Package Details: python-pypdf2 1:4.2.0-3

Git Clone URL: https://aur.archlinux.org/python-pypdf2.git (read-only, click to copy)
Package Base: python-pypdf2
Description: Python library for manipulating pages of PDF files (legacy v2)
Upstream URL: https://github.com/py-pdf/PyPDF2
Licenses: BSD
Submitter: arojas
Maintainer: TurtleRuss
Last Packager: TurtleRuss
Votes: 33
Popularity: 1.96
First Submitted: 2019-07-30 05:58 (UTC)
Last Updated: 2024-05-23 16:01 (UTC)

Latest Comments

1 2 3 4 5 Next › Last »

TrialnError commented on 2024-06-04 20:16 (UTC)

That should work. But still doesn't really the answer the question, why this PKGBUILD was updated and brought alongside python-pypdf. If there is a python program, which needs pypdf >3.0.0 to work it needs to depend on python-pypdf and not this. If it is somehow really checking for pypdf2 and still requires >3.0.0 to work, this should be brought up upstream, as there may be something going wrong.

alan1world commented on 2024-05-26 00:49 (UTC)

Try this for the PKGBUILD:

# Maintainer: Turtle Russ <tttturtleruss@gmail.com>
# Contributor: mark.blakeney at bullet-systems dot net
# Contributor: Yuanji <self@gimo.me>
# Contributor: Antonio Rojas <arojas@archlinux.org>
# Contributor: Francois Boulogne <fboulogne at april dot org>

_name=PyPDF2
pkgname=python-pypdf2
pkgver=2.12.1
pkgrel=4
epoch=2
pkgdesc='Python library for manipulating pages of PDF files (legacy v2)'
arch=(any)
url="https://github.com/py-pdf/$_name"
license=(BSD)
depends=(python python-pillow python-cryptography python-pycryptodome python-typing_extensions)
makedepends=(python-setuptools python-build python-installer python-wheel python-flit-core)
source=($_name-$pkgver.tar.gz::"https://files.pythonhosted.org/packages/77/d6/afcbdb452c335bccf22ec8ac5ac27b03222f9be8b96043bcce87ba1ce32a/PyPDF2-2.12.1.tar.gz")
sha256sums=('e03ef18abcc75da741a0acc1a7749253496887be38cd9887bcce1cee393da45e')

build() {
  cd $_name-$pkgver
  python -m build --wheel --no-isolation
}

package(){
  cd $_name-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -D -m644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

bulletmark commented on 2024-05-24 22:29 (UTC) (edited on 2024-05-24 22:30 (UTC) by bulletmark)

@TurtleRuss, yes TriainError is correct. Please restore this package back to 2.12.1. You will have to bump the epoch to 2. Perhaps also change the url in the PKGBUILD to https://pypi.org/project/PyPDF2/ which is more appropriate now. The current 4.2.0 version is available in the standard packages at python-pypdf which you have inadvertently duplicated.

TrialnError commented on 2024-05-24 17:38 (UTC)

Isn't this package now broken for other programs that requires pypdf2 with the bump to the latest release? It was deliberatly left at version 2.x, because afterwards upstream unified the various pypdf project attempts and 3.x and forward weren't compatible with the old API?
https://github.com/py-pdf/pypdf/pull/1489
Of note is that 3.0.0 apparantly already broke things and therefore this was left at the latest 2.x release.
Didn't test with stapler-git yet, but for that reason also avoiding to build a new package pypdf2 package because I am still irritated why this legacy got updated to the latest version of pypdf (which is not pypdf2).

simon.wiles commented on 2024-05-24 04:35 (UTC)

Yeah this package as been completely borked with the recent change; thank you @alan1world for the fix :)

alan1world commented on 2024-05-23 18:12 (UTC) (edited on 2024-05-23 18:12 (UTC) by alan1world)

Using patch, the PKGBUILD would look something like this:

prepare() {
  mv pypdf-$pkgver $_name-$pkgver
  mv $_name-$pkgver/pypdf $_name-$pkgver/PyPDF2
  patch --directory=$_name-$pkgver --forward --strip=1 --input=../PyPDF2-4.2.0.patch
}

and the patch (PyPDF2-4.2.0.patch) would look like:

Only in PyPDF2-4.2.0.orig: pypdf
Only in PyPDF2-4.2.0.new: PyPDF2
diff --unified --recursive --text PyPDF2-4.2.0.orig/pyproject.toml PyPDF2-4.2.0.new/pyproject.toml
--- PyPDF2-4.2.0.orig/pyproject.toml    2024-04-07 13:37:08.000000000 +0100
+++ PyPDF2-4.2.0.new/pyproject.toml 2024-05-23 18:47:12.802062253 +0100
@@ -3,7 +3,7 @@
 build-backend = "flit_core.buildapi"

 [project]
-name = "pypdf"
+name = "PyPDF2"
 authors = [{ name = "Mathieu Fenniak", email = "biziqe@mathieu.fenniak.net" }]
 maintainers = [{ name = "Martin Thoma", email = "info@martin-thoma.de" }]
 description = "A pure-python PDF library capable of splitting, merging, cropping, and transforming PDF files"
@@ -59,7 +59,7 @@
 tests_dir = "tests/"

 [tool.check-wheel-contents]
-package = "./pypdf"
+package = "./PyPDF2"

 [tool.flit.sdist]
 exclude = [".github/*", "docs/*", "resources/*", "sample-files/*", "sample-files/.github/*", "sample-files/.gitignore", "sample-files/.pre-commit-config.yaml",  "requirements/*", "tests/*", ".flake8", ".gitignore", ".gitmodules", ".pylintrc", "tox.ini", "make_release.py", "mutmut-test.sh", ".pre-commit-config.yaml", ".gitblame-ignore-revs", "Makefile", "mutmut_config.py"]
@@ -83,7 +83,7 @@
 known_third_party = ["pytest", "setuptools"]

 [tool.coverage.run]
-source = ["pypdf"]
+source = ["PyPDF2"]
 branch = true

 [tool.coverage.report]
@@ -203,7 +203,7 @@
 "docs/conf.py" = ["PTH", "INP001"]
 "json_consistency.py" = ["T201"]
 "make_release.py" = ["T201", "S603", "S607"]
-"pypdf/*" = ["N802", "N803"]  # We first need to deprecate old stuff:
+"PyPDF2/*" = ["N802", "N803"]  # We first need to deprecate old stuff:
 "sample-files/*" = ["D100", "INP001"]
 "tests/*" = ["S101", "ANN001", "ANN201","D104", "S105", "S106", "D103", "B018", "B017"]
 "tests/test_workflows.py" =  ["T201"]

alan1world commented on 2024-05-23 17:52 (UTC) (edited on 2024-05-23 17:52 (UTC) by alan1world)

The repo now builds to a site library folder of pypdf rather than PyPDF2, causing a conflict with the pypdf package.

This package could be marked with a conflict against the python-pypdf package. However, since this is the legacy package with a lot of applications expecting to import from PyPDF2, it would be preferable to amend the package to build to PyPDF2.

No changes are needed to the package build, I made the changes manually (because I can't remember how to build a patch file) and re-ran with makepkg -e.

Changes:

  • source folder pypdf -> PyPDF2
  • pyproject.toml project name pypdf -> PyPDF2
  • pyproject.toml tool.check-wheel-contents pypdf -> PyPDF2
  • pyproject.toml tool.coverage.run pypdf -> PyPDF2
  • pyproject.toml tool.ruff.per-file-ignores pypdf/ -> PyPDF2/

Those changes build to a site-library folder of PyPDF2.

Using bookletimposer as a test, this now runs.

bulletmark commented on 2023-01-20 07:15 (UTC)

Actually, I just pushed 1:2.12.1-3 which changes the name of the download file and thus forces it to be re-downloaded to avoid this issue for any future users who may still have the old file cached.

bulletmark commented on 2023-01-20 06:53 (UTC)

@DrMartinus, read my previous comment here.