Skip to content

Commit

Permalink
chore: get pyzmq with scikit-build-core working in a somewhat reasona…
Browse files Browse the repository at this point in the history
…ble way
  • Loading branch information
cpcloud committed May 2, 2024
1 parent 178ccb2 commit 1e848fe
Show file tree
Hide file tree
Showing 6 changed files with 232 additions and 1 deletion.
2 changes: 1 addition & 1 deletion overrides/build-systems.json
Original file line number Diff line number Diff line change
Expand Up @@ -20244,7 +20244,7 @@
"until": "26.0.0"
},
{
"buildSystem": "scikit-build",
"buildSystem": "scikit-build-core",
"from": "26.0.0"
}
],
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 1e848fe

Please sign in to comment.