Skip to content

Commit

Permalink
Merge pull request #1603 from Samuel-Martineau/patch-1
Browse files Browse the repository at this point in the history
overrides: update build system for pyzmq 26.0.0 to scikit-build
  • Loading branch information
cpcloud authored May 2, 2024
2 parents f83f0f6 + 1e848fe commit 64a3034
Show file tree
Hide file tree
Showing 6 changed files with 243 additions and 2 deletions.
14 changes: 12 additions & 2 deletions overrides/build-systems.json
Original file line number Diff line number Diff line change
Expand Up @@ -20235,8 +20235,18 @@
"pyzmq": [
"cython",
"packaging",
"setuptools",
"setuptools-scm"
{
"buildSystem": "setuptools",
"until": "26.0.0"
},
{
"buildSystem": "setuptools-scm",
"until": "26.0.0"
},
{
"buildSystem": "scikit-build-core",
"from": "26.0.0"
}
],
"pyzufall": [
"setuptools"
Expand Down
25 changes: 25 additions & 0 deletions overrides/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2939,6 +2939,18 @@ lib.composeManyExtensions [
old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkg-config ];
propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ pkgs.zeromq ];
# setting dontUseCmakeConfigure is necessary because:
#
# 1. pyzmq uses scikit-build-core as of pyzmq version 26.0.0
# 2. scikit-build-core requires the *Python* cmake package to find the cmake binary
# 3. since scikit-build-core's is in nativeBuildInputs and python
# cmake depends on pkgs.cmake that puts cmake in pyzmq's
# nativeBuildInputs
# 4. point 3 causes the pyzmq build it use vanilla cmake configure
# instead of cmake via scikit-build-core
#
# what a heaping mess
dontUseCmakeConfigure = lib.versionAtLeast old.version "26.0.0";
}
);

Expand Down Expand Up @@ -3256,6 +3268,19 @@ lib.composeManyExtensions [
} else old
);

scikit-build-core = super.scikit-build-core.overridePythonAttrs (
old: {
propagatedBuildInputs = old.propagatedBuildInputs or [ ] ++ [
self.pyproject-metadata
self.pathspec
# these are _intentionally_ the *Python* wrappers for cmake and
# ninja, both of which are used by scikit-build-core
self.cmake
self.ninja
];
}
);

scikit-image = super.scikit-image.overridePythonAttrs (
old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [
Expand Down
1 change: 1 addition & 0 deletions tests/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ in
scientific = callTest ./scientific { };
apsw = callTest ./apsw { };
no-infinite-recur-on-missing-gitignores = callTest ./no-infinite-recur-on-missing-gitignores { };
pyzmq = callTest ./pyzmq { };
} // lib.optionalAttrs (!stdenv.isDarwin) {
# pyqt5 = (callTest ./pyqt5 { });
pyqt6 = callTest ./pyqt6 { };
Expand Down
11 changes: 11 additions & 0 deletions tests/pyzmq/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{ poetry2nix, python3, runCommand }:
let
env = poetry2nix.mkPoetryEnv {
python = python3;
pyproject = ./pyproject.toml;
poetrylock = ./poetry.lock;
};
in
runCommand "pyzmq-test" { } ''
${env}/bin/python -c 'import zmq; print(zmq.__version__)' > $out
''
Loading

0 comments on commit 64a3034

Please sign in to comment.