Skip to content

Commit

Permalink
Merge pull request nix-community#1288 from cpcloud/contourpy
Browse files Browse the repository at this point in the history
fix(contourpy): allow wheel usage
  • Loading branch information
cpcloud authored Aug 26, 2023
2 parents d5006be + 03872e1 commit 5b3a515
Show file tree
Hide file tree
Showing 8 changed files with 270 additions and 1 deletion.
2 changes: 1 addition & 1 deletion overrides/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ lib.composeManyExtensions [
);

contourpy = super.contourpy.overridePythonAttrs (
old: {
old: lib.optionalAttrs (!(old.src.isWheel or false)) {
buildInputs = (old.buildInputs or [ ]) ++ [ self.pybind11 ];
nativeBuildInputs = (old.nativeBuildInputs or [ ])
++ lib.optionals (lib.versionAtLeast old.version "1.1.0") [ self.meson-python pkg-config ];
Expand Down
19 changes: 19 additions & 0 deletions tests/contourpy-no-wheel/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{ poetry2nix, python3, pkgs, runCommand }:
let
env = poetry2nix.mkPoetryEnv {
python = python3;
pyproject = ./pyproject.toml;
poetrylock = ./poetry.lock;
preferWheels = false;
overrides = poetry2nix.overrides.withDefaults (
_: super: {
numpy = super.numpy.override {
preferWheel = true;
};
}
);
};
in
assert !env.python.pkgs.contourpy.src.isWheel; runCommand "contourpy-no-wheel" { } ''
${env}/bin/python -c 'import contourpy; print(contourpy.__version__)' > $out
''
100 changes: 100 additions & 0 deletions tests/contourpy-no-wheel/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions tests/contourpy-no-wheel/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[tool.poetry]
name = "test-contourpy-wheel"
version = "0.1.0"
description = "Test of wheel for contourpy"
authors = ["Your Name <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.9"
contourpy = "^1.1.0"

[build-system]
requires = ["poetry-core>=1"]
build-backend = "poetry.core.masonry.api"
22 changes: 22 additions & 0 deletions tests/contourpy-wheel/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{ poetry2nix, python3, pkgs, runCommand }:
let
env = poetry2nix.mkPoetryEnv {
python = python3;
pyproject = ./pyproject.toml;
poetrylock = ./poetry.lock;
preferWheels = false;
overrides = poetry2nix.overrides.withDefaults (
_: super: {
contourpy = super.contourpy.override {
preferWheel = true;
};
numpy = super.numpy.override {
preferWheel = true;
};
}
);
};
in
assert env.python.pkgs.contourpy.src.isWheel; runCommand "contourpy-wheel" { } ''
${env}/bin/python -c 'import contourpy; print(contourpy.__version__)' > $out
''
Loading

0 comments on commit 5b3a515

Please sign in to comment.