about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWeijia Wang <9713184+wegank@users.noreply.github.com>2024-05-18 15:59:59 +0200
committerGitHub <noreply@github.com>2024-05-18 15:59:59 +0200
commitcb7884d6de31c46736adb561533527238fe7d3c9 (patch)
treeaa955e710c62db730bdeae963386b7c86e2714f9
parentc21d10ba30f90d5554f0e16fb73af52600f1f8f4 (diff)
parent34273406beb9f4d7b26c12aaaf72bbfed5538d2c (diff)
Merge pull request #312485 from RaghavSood/pypng/fix-darwin-build
python311Packages.pypng,python312Packages.pypng: fix test scripts
-rw-r--r--pkgs/development/python-modules/pypng/default.nix13
-rw-r--r--pkgs/development/python-modules/pypng/setup-cfg-pngsuite.patch12
2 files changed, 24 insertions, 1 deletions
diff --git a/pkgs/development/python-modules/pypng/default.nix b/pkgs/development/python-modules/pypng/default.nix
index ca47266e9dfc5..71882ee1f2eb0 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 0000000000000..085aa47f7f46d
--- /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