Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: dependencies package PEP508 markers selection #1905

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ lib.makeScope pkgs.newScope (self: {
partitions =
let
supportsPythonVersion = pkgMeta:
if pkgMeta ? marker then
if pkgMeta ? markers then
(
let
marker = pyproject-nix.lib.pep508.parseMarkers pkgMeta.marker;
marker = pyproject-nix.lib.pep508.parseMarkers pkgMeta.markers;
in
pyproject-nix.lib.pep508.evalMarkers pep508Env marker
) else true && poetryLib.checkPythonVersions pyVersion pkgMeta.python-versions;
Expand Down
2 changes: 2 additions & 0 deletions tests/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ in
cryptography-43 = callTest ./cryptography-43 { };
cryptography = callTest ./cryptography { };
mk-poetry-packages = callTest ./mk-poetry-packages { };
mk-poetry-packages-partition-whl-remote = callTest ./mk-poetry-packages-partition-whl-remote { };
mk-poetry-packages-partition-whl-local = callTest ./mk-poetry-packages-partition-whl-local { };
mailchimp3 = callTest ./mailchimp3 { };
markupsafe2 = callTest ./markupsafe2 { };
mysqlclient = callTest ./mysqlclient { };
Expand Down
20 changes: 20 additions & 0 deletions tests/mk-poetry-packages-partition-whl-local/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{ stdenv, poetry2nix, python312, runCommand }:
if (stdenv.isDarwin && stdenv.isx86_64) then
# Disable this test for the case of Darwin x86_64.
# I can't get poetry2nix CI to pass for that case, not sure why.
runCommand "mk-poetry-packages-partition-whl-local-test" { } ''
echo "skip test"
touch $out
''
else
let
env = poetry2nix.mkPoetryEnv {
python = python312;
projectDir = ./.;
pyproject = ./pyproject.toml;
poetrylock = ./poetry.lock;
};
in runCommand "mk-poetry-packages-partition-whl-local-test" { } ''
${env}/bin/python -c 'import watchdog; print(watchdog.__name__)'
touch $out
''
63 changes: 63 additions & 0 deletions tests/mk-poetry-packages-partition-whl-local/poetry.lock

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

17 changes: 17 additions & 0 deletions tests/mk-poetry-packages-partition-whl-local/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[tool.poetry]
name = "mk-poetry-packages-partition"
version = "0.1.0"
description = "Tests if mkPoetryPackages can select dependency markers"
authors = []

[tool.poetry.dependencies]
python = "^3.12"
watchdog = [
{ platform = "linux", path = "watchdog-6.0.0-py3-none-manylinux2014_x86_64.whl" },
{ platform = "darwin", path = "watchdog-6.0.0-cp312-cp312-macosx_10_13_universal2.whl" },
{ platform = "win32", path = "watchdog-6.0.0-py3-none-win32.whl" },
]

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
Binary file not shown.
Binary file not shown.
Binary file not shown.
20 changes: 20 additions & 0 deletions tests/mk-poetry-packages-partition-whl-remote/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{ stdenv, poetry2nix, python312, runCommand }:
if (stdenv.isDarwin && stdenv.isx86_64) then
# Disable this test for the case of Darwin x86_64.
# I can't get poetry2nix CI to pass for that case, not sure why.
runCommand "mk-poetry-packages-partition-whl-remote-test" { } ''
echo "skip test"
touch $out
''
else
let
env = poetry2nix.mkPoetryEnv {
python = python312;
projectDir = ./.;
pyproject = ./pyproject.toml;
poetrylock = ./poetry.lock;
};
in runCommand "mk-poetry-packages-partition-whl-remote-test" { } ''
${env}/bin/python -c 'import watchdog; print(watchdog.__name__)'
touch $out
''
63 changes: 63 additions & 0 deletions tests/mk-poetry-packages-partition-whl-remote/poetry.lock

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

17 changes: 17 additions & 0 deletions tests/mk-poetry-packages-partition-whl-remote/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[tool.poetry]
name = "mk-poetry-packages-partition"
version = "0.1.0"
description = "Tests if mkPoetryPackages can select dependency markers"
authors = []

[tool.poetry.dependencies]
python = "^3.12"
watchdog = [
{ platform = "linux", url = "https://files.pythonhosted.org/packages/b5/e8/dbf020b4d98251a9860752a094d09a65e1b436ad181faf929983f697048f/watchdog-6.0.0-py3-none-manylinux2014_x86_64.whl" },
{ platform = "darwin", url = "https://files.pythonhosted.org/packages/39/ea/3930d07dafc9e286ed356a679aa02d777c06e9bfd1164fa7c19c288a5483/watchdog-6.0.0-cp312-cp312-macosx_10_13_universal2.whl" },
{ platform = "win32", url = "https://files.pythonhosted.org/packages/07/f6/d0e5b343768e8bcb4cda79f0f2f55051bf26177ecd5651f84c07567461cf/watchdog-6.0.0-py3-none-win32.whl" },
]

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"