From 34273406beb9f4d7b26c12aaaf72bbfed5538d2c Mon Sep 17 00:00:00 2001 From: Raghav Sood Date: Sat, 18 May 2024 01:08:05 +0800 Subject: [PATCH] python311Packages.pypng,python312Packages.pypng: fix test imports and PATH --- pkgs/development/python-modules/pypng/default.nix | 13 ++++++++++++- .../python-modules/pypng/setup-cfg-pngsuite.patch | 12 ++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/python-modules/pypng/setup-cfg-pngsuite.patch diff --git a/pkgs/development/python-modules/pypng/default.nix b/pkgs/development/python-modules/pypng/default.nix index ca47266e9dfc..71882ee1f2eb 100644 --- a/pkgs/development/python-modules/pypng/default.nix +++ b/pkgs/development/python-modules/pypng/default.nix @@ -21,7 +21,18 @@ buildPythonPackage rec { setuptools ]; - pythonImportsCheck = [ "png" ]; + patches = [ + # pngsuite is imported by code/test_png.py but is not defined in + # setup.cfg, so it isn't built - this adds it to py_modules + ./setup-cfg-pngsuite.patch + ]; + + # allow tests to use the binaries produced by this package + preCheck = '' + export PATH="$out/bin:$PATH" + ''; + + pythonImportsCheck = [ "png" "pngsuite" ]; nativeCheckInputs = [ pytestCheckHook ]; diff --git a/pkgs/development/python-modules/pypng/setup-cfg-pngsuite.patch b/pkgs/development/python-modules/pypng/setup-cfg-pngsuite.patch new file mode 100644 index 000000000000..085aa47f7f46 --- /dev/null +++ b/pkgs/development/python-modules/pypng/setup-cfg-pngsuite.patch @@ -0,0 +1,12 @@ +diff --git a/setup.cfg b/setup.cfg +index 04bba8a..db159d2 100644 +--- a/setup.cfg ++++ b/setup.cfg +@@ -28,6 +28,7 @@ package_dir = + = code + py_modules = + png ++ pngsuite + scripts = + code/prichunkpng + code/pricolpng