summary refs log tree commit diff
diff options
context:
space:
mode:
authorRobert Schütz <nix@dotlambda.de>2021-09-18 13:49:10 -0700
committerRobert Schütz <nix@dotlambda.de>2021-09-18 14:15:36 -0700
commitfc1c501f4c6e5ca4a90b48ce5bd5b9d631ce5772 (patch)
treed8329ae9b7b76e6f38110ac90af7a56cac0d1fdd
parented332b0bc7440cc25de85a09fdb0491d3ad3343d (diff)
downloadnixpkgs-fc1c501f4c6e5ca4a90b48ce5bd5b9d631ce5772.tar
nixpkgs-fc1c501f4c6e5ca4a90b48ce5bd5b9d631ce5772.tar.gz
nixpkgs-fc1c501f4c6e5ca4a90b48ce5bd5b9d631ce5772.tar.bz2
nixpkgs-fc1c501f4c6e5ca4a90b48ce5bd5b9d631ce5772.tar.lz
nixpkgs-fc1c501f4c6e5ca4a90b48ce5bd5b9d631ce5772.tar.xz
nixpkgs-fc1c501f4c6e5ca4a90b48ce5bd5b9d631ce5772.tar.zst
nixpkgs-fc1c501f4c6e5ca4a90b48ce5bd5b9d631ce5772.zip
python3Packages.pikepdf: 2.16.1 -> 3.0.0
https://pikepdf.readthedocs.io/en/latest/release_notes.html#v3-0-0
-rw-r--r--pkgs/development/python-modules/pikepdf/default.nix27
-rw-r--r--pkgs/development/python-modules/pikepdf/paths.patch26
2 files changed, 40 insertions, 13 deletions
diff --git a/pkgs/development/python-modules/pikepdf/default.nix b/pkgs/development/python-modules/pikepdf/default.nix
index a7d9faf98a9..00128a26de3 100644
--- a/pkgs/development/python-modules/pikepdf/default.nix
+++ b/pkgs/development/python-modules/pikepdf/default.nix
@@ -5,13 +5,12 @@
 , fetchPypi
 , hypothesis
 , isPy3k
+, jbig2dec
 , lxml
+, mupdf
 , pillow
 , psutil
 , pybind11
-, pytest-cov
-, pytest-helpers-namespace
-, pytest-timeout
 , pytest-xdist
 , pytestCheckHook
 , python-dateutil
@@ -20,18 +19,27 @@
 , setuptools
 , setuptools-scm
 , setuptools-scm-git-archive
+, substituteAll
 }:
 
 buildPythonPackage rec {
   pname = "pikepdf";
-  version = "2.16.1";
+  version = "3.0.0";
   disabled = ! isPy3k;
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "sha256-4k3/avMfHrcy/LXbRniDXR8xJkOZb9zZ2+uKylK8Dd4=";
+    sha256 = "sha256-PBeTfiMLIq+pdeaRMOid8pEd0eLHu+IAE4aEFU5CiEM=";
   };
 
+  patches = [
+    (substituteAll {
+      src = ./paths.patch;
+      jbig2dec = "${lib.getBin jbig2dec}/bin/jbig2dec";
+      mudraw = "${lib.getBin mupdf}/bin/mudraw";
+    })
+  ];
+
   buildInputs = [
     pybind11
     qpdf
@@ -45,11 +53,8 @@ buildPythonPackage rec {
   checkInputs = [
     attrs
     hypothesis
-    pytest-helpers-namespace
-    pytest-timeout
     pytest-xdist
     psutil
-    pytest-cov
     pytestCheckHook
     python-dateutil
     python-xmp-toolkit
@@ -62,17 +67,13 @@ buildPythonPackage rec {
     setuptools
   ];
 
-  preBuild = ''
-    HOME=$TMPDIR
-  '';
-
   pythonImportsCheck = [ "pikepdf" ];
 
   meta = with lib; {
     homepage = "https://github.com/pikepdf/pikepdf";
     description = "Read and write PDFs with Python, powered by qpdf";
     license = licenses.mpl20;
-    maintainers = [ maintainers.kiwi ];
+    maintainers = with maintainers; [ kiwi dotlambda ];
     changelog = "https://github.com/pikepdf/pikepdf/blob/${version}/docs/release_notes.rst";
   };
 }
diff --git a/pkgs/development/python-modules/pikepdf/paths.patch b/pkgs/development/python-modules/pikepdf/paths.patch
new file mode 100644
index 00000000000..807041696ad
--- /dev/null
+++ b/pkgs/development/python-modules/pikepdf/paths.patch
@@ -0,0 +1,26 @@
+diff --git a/src/pikepdf/_methods.py b/src/pikepdf/_methods.py
+index 70cdc9e..c3a14d0 100644
+--- a/src/pikepdf/_methods.py
++++ b/src/pikepdf/_methods.py
+@@ -190,7 +190,7 @@ def _mudraw(buffer, fmt) -> bytes:
+         tmp_in.flush()
+ 
+         proc = run(
+-            ['mudraw', '-F', fmt, '-o', '-', tmp_in.name],
++            ['@mudraw@', '-F', fmt, '-o', '-', tmp_in.name],
+             stdout=PIPE,
+             stderr=PIPE,
+             check=True,
+diff --git a/src/pikepdf/jbig2.py b/src/pikepdf/jbig2.py
+index 80cc910..64f6d31 100644
+--- a/src/pikepdf/jbig2.py
++++ b/src/pikepdf/jbig2.py
+@@ -25,7 +25,7 @@ def extract_jbig2(
+         global_path = Path(tmpdir) / "global"
+         output_path = Path(tmpdir) / "outfile"
+ 
+-        args = ["jbig2dec", "-e", "-o", os.fspath(output_path)]
++        args = ["@jbig2dec@", "-e", "-o", os.fspath(output_path)]
+ 
+         # Get the raw stream, because we can't decode im_obj - that is why we are here
+         # (Strictly speaking we should remove any non-JBIG2 filters if double encoded)