unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Vagrant Cascadian <vagrant@reproducible-builds.org>
To: 60941@debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Subject: [bug#60941] [PATCH v3 1/2] gnu: Add python-pypdf.
Date: Sat, 21 Jan 2023 23:03:39 -0800	[thread overview]
Message-ID: <87ilgzuk38.fsf@contorta> (raw)
In-Reply-To: <87bkmr6yad.fsf@contorta>


[-- Attachment #1.1: Type: text/plain, Size: 11 bytes --]

No change.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-gnu-Add-python-pypdf.patch --]
[-- Type: text/x-diff, Size: 6385 bytes --]

From 421c017a26ffa77120a2e8792779296a141ecbb5 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@reproducible-builds.org>
Date: Sat, 21 Jan 2023 19:17:23 -0800
Subject: [PATCH 1/2] gnu: Add python-pypdf.

* gnu/packages/pdf.scm (python-pypdf): New variable.
* gnu/packages/patches/python-pypdf-annotate-tests-appropriately.patch: New
file.
* gnu/local.mk (dist_patch_DATA): Add patch.
---
 gnu/local.mk                                  |  1 +
 ...n-pypdf-annotate-tests-appropriately.patch | 96 +++++++++++++++++++
 gnu/packages/pdf.scm                          | 29 ++++++
 3 files changed, 126 insertions(+)
 create mode 100644 gnu/packages/patches/python-pypdf-annotate-tests-appropriately.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 3da47858ff..310c9f1f90 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1639,6 +1639,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/python-louvain-fix-test.patch		\
   %D%/packages/patches/python-random2-getrandbits-test.patch		\
   %D%/packages/patches/python-poppler-qt5-fix-build.patch	\
+  %D%/packages/patches/python-pypdf-annotate-tests-appropriately.patch	\
   %D%/packages/patches/python-telingo-fix-comparison.patch	\
   %D%/packages/patches/python-w3lib-fix-test-failure.patch	\
   %D%/packages/patches/sdcc-disable-non-free-code.patch		\
diff --git a/gnu/packages/patches/python-pypdf-annotate-tests-appropriately.patch b/gnu/packages/patches/python-pypdf-annotate-tests-appropriately.patch
new file mode 100644
index 0000000000..14f1f73924
--- /dev/null
+++ b/gnu/packages/patches/python-pypdf-annotate-tests-appropriately.patch
@@ -0,0 +1,96 @@
+Origin: https://github.com/py-pdf/pypdf/commit/767047b98ee3ea7aca331cfbd63502a284bfed93
+From 767047b98ee3ea7aca331cfbd63502a284bfed93 Mon Sep 17 00:00:00 2001
+From: dkg <dkg@fifthhorseman.net>
+Date: Sat, 14 Jan 2023 03:32:45 -0500
+Subject: [PATCH 03/14] Annotate tests appropriately (#1551)
+
+By annotating these tests, we can use pytest markers to skip external
+tests and tests that depend on sample-files.
+---
+ tests/test_reader.py | 5 +++++
+ tests/test_writer.py | 4 ++++
+ 2 files changed, 9 insertions(+)
+
+diff --git a/tests/test_reader.py b/tests/test_reader.py
+index 710e6c5..62eb7b7 100644
+--- a/tests/test_reader.py
++++ b/tests/test_reader.py
+@@ -176,6 +176,7 @@ def test_get_outline(src, outline_elements):
+     assert len(outline) == outline_elements
+ 
+ 
++@pytest.mark.samples
+ @pytest.mark.parametrize(
+     ("src", "expected_images"),
+     [
+@@ -866,6 +867,7 @@ def test_get_fields():
+     assert dict(fields["c1-1"]) == ({"/FT": "/Btn", "/T": "c1-1"})
+ 
+ 
++@pytest.mark.external
+ def test_get_full_qualified_fields():
+     url = "https://github.com/py-pdf/PyPDF2/files/10142389/fields_with_dots.pdf"
+     name = "fields_with_dots.pdf"
+@@ -1214,6 +1216,7 @@ def test_zeroing_xref():
+     len(reader.pages)
+ 
+ 
++@pytest.mark.external
+ def test_thread():
+     url = "https://github.com/py-pdf/pypdf/files/9066120/UTA_OSHA_3115_Fall_Protection_Training_09162021_.pdf"
+     name = "UTA_OSHA.pdf"
+@@ -1226,6 +1229,7 @@ def test_thread():
+     assert len(reader.threads) >= 1
+ 
+ 
++@pytest.mark.external
+ def test_build_outline_item(caplog):
+     url = "https://github.com/py-pdf/pypdf/files/9464742/shiv_resume.pdf"
+     name = "shiv_resume.pdf"
+@@ -1253,6 +1257,7 @@ def test_build_outline_item(caplog):
+     assert "Unexpected destination 2" in exc.value.args[0]
+ 
+ 
++@pytest.mark.samples
+ @pytest.mark.parametrize(
+     ("src", "page_labels"),
+     [
+diff --git a/tests/test_writer.py b/tests/test_writer.py
+index 60b4a17..20c4de0 100644
+--- a/tests/test_writer.py
++++ b/tests/test_writer.py
+@@ -930,6 +930,7 @@ def test_startup_dest():
+     pdf_file_writer.open_destination = None
+ 
+ 
++@pytest.mark.external
+ def test_iss471():
+     url = "https://github.com/py-pdf/pypdf/files/9139245/book.pdf"
+     name = "book_471.pdf"
+@@ -942,6 +943,7 @@ def test_iss471():
+     )
+ 
+ 
++@pytest.mark.external
+ def test_reset_translation():
+     url = "https://corpora.tika.apache.org/base/docs/govdocs1/924/924666.pdf"
+     name = "tika-924666.pdf"
+@@ -977,6 +979,7 @@ def test_threads_empty():
+     assert thr == thr2
+ 
+ 
++@pytest.mark.external
+ def test_append_without_annots_and_articles():
+     url = "https://corpora.tika.apache.org/base/docs/govdocs1/924/924666.pdf"
+     name = "tika-924666.pdf"
+@@ -993,6 +996,7 @@ def test_append_without_annots_and_articles():
+     assert len(writer.threads) >= 1
+ 
+ 
++@pytest.mark.external
+ def test_append_multiple():
+     url = "https://corpora.tika.apache.org/base/docs/govdocs1/924/924666.pdf"
+     name = "tika-924666.pdf"
+-- 
+2.39.1
+
diff --git a/gnu/packages/pdf.scm b/gnu/packages/pdf.scm
index 4b9d0623fe..446d833e51 100644
--- a/gnu/packages/pdf.scm
+++ b/gnu/packages/pdf.scm
@@ -1260,6 +1260,35 @@ (define-public pdf2svg
 converter using the Poppler and Cairo libraries.")
     (license license:gpl2+)))
 
+(define-public python-pypdf
+  (package
+    (name "python-pypdf")
+    (version "3.2.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/py-pdf/pypdf")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1qwvjr694sabfblx22zd54b9ny40f2gbv3bv6q43myrlxwvvisk6"))
+              (patches (search-patches
+                        "python-pypdf-annotate-tests-appropriately.patch"))))
+    (build-system pyproject-build-system)
+    (native-inputs (list python-pytest python-flit))
+    (propagated-inputs (list python-typing-extensions))
+    (home-page "https://github.com/py-pdf/pypdf")
+    (arguments
+     (list
+           ;; Disable tests that use the network and non-free assets.
+           #:test-flags #~(list "-m" "not external and not samples")))
+    (synopsis "Python PDF library")
+    (description
+     "This package provides a PDF library capable of splitting, merging,
+cropping, and transforming PDF files.")
+    (license license:bsd-3)))
+
 (define-public python-pypdf2
   (package
     (name "python-pypdf2")
-- 
2.39.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

  reply	other threads:[~2023-01-22  7:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-19  1:31 [bug#60941] Update diffoscope to 232 Vagrant Cascadian
     [not found] ` <handler.60941.B.16740919305557.ack@debbugs.gnu.org>
2023-01-19  1:36   ` [bug#60941] [PATCH 1/2] gnu: Add python-pypdf Vagrant Cascadian
2023-01-19  1:38     ` [bug#60941] [PATCH 2/2] gnu: diffoscope: Update to 232 Vagrant Cascadian
2023-01-19  1:48       ` [bug#60941] Update diffoscope " Maxim Cournoyer
2023-01-22  3:26         ` Vagrant Cascadian
2023-01-23  1:04           ` Maxim Cournoyer
2023-01-22  3:32       ` [bug#60941] [PATCH v2 2/2] gnu: diffoscope: Update to 233 Vagrant Cascadian
2023-01-19  1:42     ` [bug#60941] [PATCH 1/2] gnu: Add python-pypdf Maxim Cournoyer
2023-01-22  3:30     ` [bug#60941] [PATCH v2 " Vagrant Cascadian
2023-01-22  7:03       ` Vagrant Cascadian [this message]
2023-01-22  7:06         ` [bug#60941] [PATCH v3 2/2] gnu: diffoscope: Update to 233 Vagrant Cascadian
2023-01-23  1:07           ` bug#60941: " Maxim Cournoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ilgzuk38.fsf@contorta \
    --to=vagrant@reproducible-builds.org \
    --cc=60941@debbugs.gnu.org \
    --cc=maxim.cournoyer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).