From patchwork Sun Jan 22 03:30:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vagrant Cascadian X-Patchwork-Id: 46334 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 61EB727BBE9; Sun, 22 Jan 2023 03:32:32 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 1B21127BBEB for ; Sun, 22 Jan 2023 03:32:31 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJR5P-0006J5-Mx; Sat, 21 Jan 2023 22:32:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pJR5O-0006Is-4Q for guix-patches@gnu.org; Sat, 21 Jan 2023 22:32:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pJR5N-00051g-Sa for guix-patches@gnu.org; Sat, 21 Jan 2023 22:32:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pJR5N-0004bz-OK for guix-patches@gnu.org; Sat, 21 Jan 2023 22:32:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#60941] [PATCH v2 1/2] gnu: Add python-pypdf. Resent-From: Vagrant Cascadian Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 22 Jan 2023 03:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60941 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 60941@debbugs.gnu.org Cc: Maxim Cournoyer Received: via spool by 60941-submit@debbugs.gnu.org id=B60941.167435826417657 (code B ref 60941); Sun, 22 Jan 2023 03:32:01 +0000 Received: (at 60941) by debbugs.gnu.org; 22 Jan 2023 03:31:04 +0000 Received: from localhost ([127.0.0.1]:50214 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJR4S-0004ai-43 for submit@debbugs.gnu.org; Sat, 21 Jan 2023 22:31:04 -0500 Received: from cascadia.aikidev.net ([173.255.214.101]:45666) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJR4Q-0004aF-CI for 60941@debbugs.gnu.org; Sat, 21 Jan 2023 22:31:03 -0500 Received: from localhost (unknown [IPv6:2600:3c01:e000:21:7:77:0:20]) (Authenticated sender: vagrant@aikidev.net) by cascadia.aikidev.net (Postfix) with ESMTPSA id 93E001AB81; Sat, 21 Jan 2023 19:30:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=reproducible-builds.org; s=1.vagrant; t=1674358256; bh=Z5W3Z78FY9K8IoUhKvmvF5mCSFLCie6bFVQHIfZFIAg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=HMFpRqRxXlfR3+pnCiA4dgvffJ8PjjN914sUdR4tTx0Q8Io1rJBL35UY+Kdb0VD4W zSuM5j7L609FzJBXaUxd4vV0GOYMr8AJ1iq6vYJDd8dFLWy/WnQEAgzurJWojfMnqW wXROkZheWAB2GGii0u2lQ2fdJtgkWmiKuCDDkpBqA3kgq3sa0cqZe0DBn3mkXu8vr5 G2OEx+lRjdgEd2RwxA1Eh+f9GUPjcT18wD2AU/PcJvl0QJxAGqRupxf4xGyFgs3c+b 29wE/eE/tzV/HffE7iGdsSQ54KJMYFGMJU6jsTpBZDEpGSdEWiKv2AXhEJPe8lxY2d bzuBhPT/c5v+Q== From: Vagrant Cascadian In-Reply-To: <87edrrz4nd.fsf@contorta> References: <87ilh3z4vo.fsf@contorta> <87edrrz4nd.fsf@contorta> Date: Sat, 21 Jan 2023 19:30:50 -0800 Message-ID: <87bkmr6yad.fsf@contorta> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches This series switches to pyproject-build-system, git-fetch, and has tests! Some tests are disabled due to network access requirements and non-free assets. From a7286537cf92b07798d6b537003675555c5f84ba Mon Sep 17 00:00:00 2001 From: Vagrant Cascadian 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 +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