* [Buildroot] [PATCH 0/5] package/python-pymupdf: bump to version 1.23.22
@ 2024-02-16 21:13 Raphaël Mélotte via buildroot
2024-02-16 21:13 ` [Buildroot] [PATCH 1/5] package: python-pymupdf: add missing python-zlib dependency Raphaël Mélotte via buildroot
` (4 more replies)
0 siblings, 5 replies; 21+ messages in thread
From: Raphaël Mélotte via buildroot @ 2024-02-16 21:13 UTC (permalink / raw)
To: buildroot; +Cc: james.hilliard1, Raphaël Mélotte
Hello,
This series builds on the following series from James to update python-pymupdf:
https://patchwork.ozlabs.org/project/buildroot/list/?series=389751&state=*
Note that patch 1 fixes an issue that was present before the version
bumps, so it could be applied separately or backported.
Patch 3 could potentially be backported as well, but I did not test it
with any other mupdf or python-pymupdf version.
Kind regards,
Raphaël
James Hilliard (2):
package/mupdf: bump to version 1.23.9
package/python-pymupdf: bump to version 1.23.22
Raphaël Mélotte (3):
package: python-pymupdf: add missing python-zlib dependency
support/testing: add new test for python-pymupdf
package/mupdf: fix building shared libraries
DEVELOPERS | 2 +
...issing-limits.h-include-for-UINT_MAX.patch | 70 ----------
package/mupdf/Config.in | 4 +
package/mupdf/mupdf.hash | 4 +-
package/mupdf/mupdf.mk | 9 +-
...w-providing-python-config-externally.patch | 125 ++++++++++++++++++
package/python-pymupdf/Config.in | 3 +-
package/python-pymupdf/python-pymupdf.hash | 4 +-
package/python-pymupdf/python-pymupdf.mk | 31 ++---
.../tests/package/sample_python_pymupdf.py | 17 +++
.../tests/package/test_python_pymupdf.py | 26 ++++
11 files changed, 203 insertions(+), 92 deletions(-)
delete mode 100644 package/mupdf/0001-Add-missing-limits.h-include-for-UINT_MAX.patch
create mode 100644 package/python-pymupdf/0001-pipcl.py-allow-providing-python-config-externally.patch
create mode 100644 support/testing/tests/package/sample_python_pymupdf.py
create mode 100644 support/testing/tests/package/test_python_pymupdf.py
--
2.37.3
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH 1/5] package: python-pymupdf: add missing python-zlib dependency
2024-02-16 21:13 [Buildroot] [PATCH 0/5] package/python-pymupdf: bump to version 1.23.22 Raphaël Mélotte via buildroot
@ 2024-02-16 21:13 ` Raphaël Mélotte via buildroot
2024-06-07 16:32 ` [Buildroot] [PATCH v2 " Raphaël Mélotte via buildroot
2024-02-16 21:13 ` [Buildroot] [PATCH 2/5] support/testing: add new test for python-pymupdf Raphaël Mélotte via buildroot
` (3 subsequent siblings)
4 siblings, 1 reply; 21+ messages in thread
From: Raphaël Mélotte via buildroot @ 2024-02-16 21:13 UTC (permalink / raw)
To: buildroot; +Cc: james.hilliard1, Raphaël Mélotte, Asaf Kahlon
It turns out that python-pymupdf doesn't require zlib directly, but it
does require the zlib python module.
This fixes the following runtime error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.11/site-packages/fitz/__init__.py", line 22, in <module>
File "/usr/lib/python3.11/site-packages/fitz/fitz.py", line 3402, in <module>
File "/usr/lib/python3.11/gzip.py", line 9, in <module>
ModuleNotFoundError: No module named 'zlib'
Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
---
package/python-pymupdf/Config.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package/python-pymupdf/Config.in b/package/python-pymupdf/Config.in
index ecaa5496b5..3831a25451 100644
--- a/package/python-pymupdf/Config.in
+++ b/package/python-pymupdf/Config.in
@@ -7,7 +7,7 @@ config BR2_PACKAGE_PYTHON_PYMUPDF
select BR2_PACKAGE_HOST_SWIG
select BR2_PACKAGE_FREETYPE
select BR2_PACKAGE_MUPDF
- select BR2_PACKAGE_ZLIB
+ select BR2_PACKAGE_PYTHON3_ZLIB # runtime
help
Python bindings for the PDF rendering library MuPDF.
--
2.37.3
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH 2/5] support/testing: add new test for python-pymupdf
2024-02-16 21:13 [Buildroot] [PATCH 0/5] package/python-pymupdf: bump to version 1.23.22 Raphaël Mélotte via buildroot
2024-02-16 21:13 ` [Buildroot] [PATCH 1/5] package: python-pymupdf: add missing python-zlib dependency Raphaël Mélotte via buildroot
@ 2024-02-16 21:13 ` Raphaël Mélotte via buildroot
2024-02-16 21:13 ` [Buildroot] [PATCH 3/5] package/mupdf: fix building shared libraries Raphaël Mélotte via buildroot
` (2 subsequent siblings)
4 siblings, 0 replies; 21+ messages in thread
From: Raphaël Mélotte via buildroot @ 2024-02-16 21:13 UTC (permalink / raw)
To: buildroot; +Cc: james.hilliard1, Raphaël Mélotte
To give us a chance to catch runtime issues (such as missing
dependencies) more easily, add a test that writes a sample PDF file,
read it back and verify the text that was read.
Like similar packages that lead to a big
rootfs (e.g. python-botocore), this test requires a separate ext2
rootfs to avoid filling the default amount of RAM available
entirely (which would cause missing files from the root filesystem and
in turn, test failures).
Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
---
DEVELOPERS | 2 ++
.../tests/package/sample_python_pymupdf.py | 17 ++++++++++++
.../tests/package/test_python_pymupdf.py | 26 +++++++++++++++++++
3 files changed, 45 insertions(+)
create mode 100644 support/testing/tests/package/sample_python_pymupdf.py
create mode 100644 support/testing/tests/package/test_python_pymupdf.py
diff --git a/DEVELOPERS b/DEVELOPERS
index 1c6c84b05b..085f2fa234 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2599,9 +2599,11 @@ F: package/python-pymupdf/
F: package/python-rsa/
F: package/python-s3transfer/
F: support/testing/tests/package/sample_python_jmespath.py
+F: support/testing/tests/package/sample_python_pymupdf.py
F: support/testing/tests/package/sample_python_rsa.py
F: support/testing/tests/package/sample_python_s3transfer.py
F: support/testing/tests/package/test_python_jmespath.py
+F: support/testing/tests/package/test_python_pymupdf.py
F: support/testing/tests/package/test_python_rsa.py
F: support/testing/tests/package/test_python_s3transfer.py
diff --git a/support/testing/tests/package/sample_python_pymupdf.py b/support/testing/tests/package/sample_python_pymupdf.py
new file mode 100644
index 0000000000..574bd27965
--- /dev/null
+++ b/support/testing/tests/package/sample_python_pymupdf.py
@@ -0,0 +1,17 @@
+import fitz
+
+# Write a test PDF file
+outfile = "python-pymupdf.pdf"
+sample_text = "This is a test page for python-pymupdf."
+doc = fitz.open()
+page = doc.new_page()
+p = fitz.Point(50, 72)
+page.insert_text(p, sample_text)
+doc.save(outfile)
+
+# Read back the file
+with fitz.open(outfile) as d: # open document
+ read_text = chr(12).join([page.get_text() for page in d])
+
+print(read_text)
+assert(read_text == sample_text + "\n")
diff --git a/support/testing/tests/package/test_python_pymupdf.py b/support/testing/tests/package/test_python_pymupdf.py
new file mode 100644
index 0000000000..5e9d5a6912
--- /dev/null
+++ b/support/testing/tests/package/test_python_pymupdf.py
@@ -0,0 +1,26 @@
+import os
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy3PyMuPDF(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON3=y
+ BR2_PACKAGE_PYTHON_PYMUPDF=y
+ BR2_PACKAGE_XORG7=y
+ BR2_USE_WCHAR=y
+ BR2_INSTALL_LIBSTDCPP=y
+ BR2_TARGET_ROOTFS_EXT2=y
+ BR2_TARGET_ROOTFS_EXT2_SIZE="250M"
+ """
+ sample_scripts = ["tests/package/sample_python_pymupdf.py"]
+ timeout = 30
+
+ def login(self):
+ ext2_file = os.path.join(self.builddir, "images", "rootfs.ext2")
+ self.emulator.boot(arch="armv5",
+ kernel="builtin",
+ options=["-drive", "file=%s,if=scsi,format=raw" % ext2_file],
+ kernel_cmdline=["rootwait", "root=/dev/sda"])
+ self.emulator.login()
--
2.37.3
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH 3/5] package/mupdf: fix building shared libraries
2024-02-16 21:13 [Buildroot] [PATCH 0/5] package/python-pymupdf: bump to version 1.23.22 Raphaël Mélotte via buildroot
2024-02-16 21:13 ` [Buildroot] [PATCH 1/5] package: python-pymupdf: add missing python-zlib dependency Raphaël Mélotte via buildroot
2024-02-16 21:13 ` [Buildroot] [PATCH 2/5] support/testing: add new test for python-pymupdf Raphaël Mélotte via buildroot
@ 2024-02-16 21:13 ` Raphaël Mélotte via buildroot
2024-04-01 20:06 ` Arnout Vandecappelle via buildroot
2024-02-16 21:13 ` [Buildroot] [PATCH 4/5] package/mupdf: bump to version 1.23.9 Raphaël Mélotte via buildroot
2024-02-16 21:13 ` [Buildroot] [PATCH 5/5] package/python-pymupdf: bump to version 1.23.22 Raphaël Mélotte via buildroot
4 siblings, 1 reply; 21+ messages in thread
From: Raphaël Mélotte via buildroot @ 2024-02-16 21:13 UTC (permalink / raw)
To: buildroot; +Cc: james.hilliard1, Raphaël Mélotte
By default mupdf generates static libraries, shared libraries must be
enabled explicitely.
The Makefile doesn't make it possible to build both static and shared
libs, so add a 'depends on' accordingly.
Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
---
package/mupdf/Config.in | 4 ++++
package/mupdf/mupdf.mk | 5 +++++
2 files changed, 9 insertions(+)
diff --git a/package/mupdf/Config.in b/package/mupdf/Config.in
index cf97711160..092e1d8ac6 100644
--- a/package/mupdf/Config.in
+++ b/package/mupdf/Config.in
@@ -1,9 +1,13 @@
+comment "MuPDF can build static or shared libs, but not both at the same time."
+ depends on BR2_SHARED_STATIC_LIBS
+
config BR2_PACKAGE_MUPDF
bool "mupdf"
depends on BR2_INSTALL_LIBSTDCPP # harfbuzz
depends on BR2_TOOLCHAIN_HAS_SYNC_4 # harfbuzz
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # harfbuzz
depends on BR2_PACKAGE_XORG7
+ depends on !BR2_SHARED_STATIC_LIBS
select BR2_PACKAGE_FREETYPE
select BR2_PACKAGE_GUMBO_PARSER
select BR2_PACKAGE_HARFBUZZ
diff --git a/package/mupdf/mupdf.mk b/package/mupdf/mupdf.mk
index 08894d7980..d2105497be 100644
--- a/package/mupdf/mupdf.mk
+++ b/package/mupdf/mupdf.mk
@@ -50,6 +50,11 @@ MUPDF_MAKE_OPTS = \
HAVE_OBJCOPY=no \
prefix="/usr"
+# The default in MuPDF is static libs
+ifeq ($(BR2_SHARED_LIBS),y)
+MUPDF_MAKE_OPTS += shared=yes
+endif
+
ifeq ($(BR2_PACKAGE_LIBFREEGLUT),y)
MUPDF_DEPENDENCIES += libfreeglut
else
--
2.37.3
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH 4/5] package/mupdf: bump to version 1.23.9
2024-02-16 21:13 [Buildroot] [PATCH 0/5] package/python-pymupdf: bump to version 1.23.22 Raphaël Mélotte via buildroot
` (2 preceding siblings ...)
2024-02-16 21:13 ` [Buildroot] [PATCH 3/5] package/mupdf: fix building shared libraries Raphaël Mélotte via buildroot
@ 2024-02-16 21:13 ` Raphaël Mélotte via buildroot
2024-02-16 21:13 ` [Buildroot] [PATCH 5/5] package/python-pymupdf: bump to version 1.23.22 Raphaël Mélotte via buildroot
4 siblings, 0 replies; 21+ messages in thread
From: Raphaël Mélotte via buildroot @ 2024-02-16 21:13 UTC (permalink / raw)
To: buildroot; +Cc: james.hilliard1, Raphaël Mélotte
From: James Hilliard <james.hilliard1@gmail.com>
Drop patch which is now upstream.
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
[bump to 1.23.9]
Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
---
...issing-limits.h-include-for-UINT_MAX.patch | 70 -------------------
package/mupdf/mupdf.hash | 4 +-
package/mupdf/mupdf.mk | 2 +-
3 files changed, 3 insertions(+), 73 deletions(-)
delete mode 100644 package/mupdf/0001-Add-missing-limits.h-include-for-UINT_MAX.patch
diff --git a/package/mupdf/0001-Add-missing-limits.h-include-for-UINT_MAX.patch b/package/mupdf/0001-Add-missing-limits.h-include-for-UINT_MAX.patch
deleted file mode 100644
index 95f2f86666..0000000000
--- a/package/mupdf/0001-Add-missing-limits.h-include-for-UINT_MAX.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-From ebce9f1b129ebc8f2b17afa02a4ffcb9453c11d9 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= <raphael.melotte@mind.be>
-Date: Mon, 24 Apr 2023 17:27:35 +0200
-Subject: [PATCH] Add missing limits.h include for UINT_MAX
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-encode-basic.c uses 'UINT_MAX', which is available in the 'limits.h'
-header.
-
-In some configurations that build with zlib from [1], by chance
-limits.h gets indirectly included when including 'z-imp.h' (the
-includes are: 'z-imp.h' -> 'zlib.h' -> 'zconf.h' -> 'limits.h'), so
-the build succeeds.
-
-When using other zlib implementations however (for example from [2]),
-limits.h is not necessarily included indirectly, which leads to the
-build failing in the following way:
-
-source/fitz/encode-basic.c: In function 'deflate_write':
-source/fitz/encode-basic.c:343:27: error: 'UINT_MAX' undeclared (first use in this function)
- 343 | newbufsize = n >= UINT_MAX ? UINT_MAX : deflateBound(&state->z, n);
- | ^~~~~~~~
-source/fitz/encode-basic.c:26:1: note: 'UINT_MAX' is defined in header '<limits.h>'; did you forget to '#include <limits.h>'?
-
-Add the missing include, so that the build succeeds no matter if zlib
-indirectly includes 'limit.h' or not.
-
-Similarly, also add it in output-ps.c where it's also missing.
-
-[1]: https://zlib.net/
-[2]: https://github.com/zlib-ng/zlib-ng
-
-Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
-Upstream: https://bugs.ghostscript.com/show_bug.cgi?id=706667
----
- source/fitz/encode-basic.c | 2 ++
- source/fitz/output-ps.c | 2 ++
- 2 files changed, 4 insertions(+)
-
-diff --git a/source/fitz/encode-basic.c b/source/fitz/encode-basic.c
-index 03a4ff76b..84f0c35e6 100644
---- a/source/fitz/encode-basic.c
-+++ b/source/fitz/encode-basic.c
-@@ -24,6 +24,8 @@
-
- #include "z-imp.h"
-
-+#include <limits.h>
-+
- struct ahx
- {
- fz_output *chain;
-diff --git a/source/fitz/output-ps.c b/source/fitz/output-ps.c
-index ef22c3cd6..3dc8ea17d 100644
---- a/source/fitz/output-ps.c
-+++ b/source/fitz/output-ps.c
-@@ -24,6 +24,8 @@
-
- #include "z-imp.h"
-
-+#include <limits.h>
-+
- typedef struct ps_band_writer_s
- {
- fz_band_writer super;
---
-2.39.1
-
diff --git a/package/mupdf/mupdf.hash b/package/mupdf/mupdf.hash
index 1f636097ed..580235eeca 100644
--- a/package/mupdf/mupdf.hash
+++ b/package/mupdf/mupdf.hash
@@ -1,8 +1,8 @@
# From https://mupdf.com/downloads/index.html:
-sha1 b9907729d604f0bf3846b45cd5891e10d7a66e24 mupdf-1.22.0-source.tar.lz
+sha1 d79600bccd70ab9d0e8ee19dae4e275f2af95ced mupdf-1.23.9-source.tar.lz
# Locally computed:
-sha256 bed78a0abf8496b30c523497292de979db633eca57e02f6cd0f3c7c042551c3e mupdf-1.22.0-source.tar.lz
+sha256 2c2f89deb9f425ba637dac226191d547f2b40975c4d21a340965f52c001e15c5 mupdf-1.23.9-source.tar.lz
# Hash for license files:
sha256 57c8ff33c9c0cfc3ef00e650a1cc910d7ee479a8bc509f6c9209a7c2a11399d6 COPYING
diff --git a/package/mupdf/mupdf.mk b/package/mupdf/mupdf.mk
index d2105497be..17bd4320b9 100644
--- a/package/mupdf/mupdf.mk
+++ b/package/mupdf/mupdf.mk
@@ -5,7 +5,7 @@
################################################################################
# python-pymupdf's version must match mupdf's version
-MUPDF_VERSION = 1.22.0
+MUPDF_VERSION = 1.23.9
MUPDF_SOURCE = mupdf-$(MUPDF_VERSION)-source.tar.lz
MUPDF_SITE = https://mupdf.com/downloads/archive
MUPDF_LICENSE = AGPL-3.0+
--
2.37.3
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH 5/5] package/python-pymupdf: bump to version 1.23.22
2024-02-16 21:13 [Buildroot] [PATCH 0/5] package/python-pymupdf: bump to version 1.23.22 Raphaël Mélotte via buildroot
` (3 preceding siblings ...)
2024-02-16 21:13 ` [Buildroot] [PATCH 4/5] package/mupdf: bump to version 1.23.9 Raphaël Mélotte via buildroot
@ 2024-02-16 21:13 ` Raphaël Mélotte via buildroot
4 siblings, 0 replies; 21+ messages in thread
From: Raphaël Mélotte via buildroot @ 2024-02-16 21:13 UTC (permalink / raw)
To: buildroot; +Cc: james.hilliard1, Raphaël Mélotte, Asaf Kahlon
From: James Hilliard <james.hilliard1@gmail.com>
The python-pymupdf and mupdf packages do not follow the exact same
version numbers anymore. There is no specific mention of version
compatibilities in the upstream package, so update our comment to just
say that both should be "compatible" (to try to avoid one being
updated without the other).
Migrate to in tree pep517 based build backend.
The hardcoded paths we used to remove from setup.py are no longer
present, so the post-patch hook is removed.
The new setup.py instead uses new environment variables which we now
provide.
The dependencies provided in the pyproject.toml are either not needed
for us (for example, psutil is only needed to run one of the tests
which we don't run), or are host dependencies already installed by
buildroot (e.g. swig). Since the pep517 backend will check for them
and fail, skip them all.
This new python-pymupdf version fails at runtime when mupdf builds
static libraries. This should not be possible as xorg anyway depends
on !BR2_STATIC_LIBS, but let's be explicit and forbid python-pymupdf
to be built with BR2_STATIC_LIBS as well.
Note also that python-pymupdf is gradually switching to a new
implementation that requires mupdf to be built with python
bindings. For now, both implementations are still available but we
only compile the old one. The runtime test is adapted accordingly as
the legacy implementation has to be imported with "fitz_old".
While at it, the dependencies are also split to one per line to make
them easier to diff in the future.
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
[Raphaël:
- fix cross-compilation
- remove unneeded dependencies
- update to 1.23.22
- update the commit message
]
Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
---
package/mupdf/mupdf.mk | 2 +-
...w-providing-python-config-externally.patch | 125 ++++++++++++++++++
package/python-pymupdf/Config.in | 1 +
package/python-pymupdf/python-pymupdf.hash | 4 +-
package/python-pymupdf/python-pymupdf.mk | 31 ++---
.../tests/package/sample_python_pymupdf.py | 2 +-
6 files changed, 146 insertions(+), 19 deletions(-)
create mode 100644 package/python-pymupdf/0001-pipcl.py-allow-providing-python-config-externally.patch
diff --git a/package/mupdf/mupdf.mk b/package/mupdf/mupdf.mk
index 17bd4320b9..edc5bf7d3f 100644
--- a/package/mupdf/mupdf.mk
+++ b/package/mupdf/mupdf.mk
@@ -4,7 +4,7 @@
#
################################################################################
-# python-pymupdf's version must match mupdf's version
+# python-pymupdf's version be compatible with mupdf's version
MUPDF_VERSION = 1.23.9
MUPDF_SOURCE = mupdf-$(MUPDF_VERSION)-source.tar.lz
MUPDF_SITE = https://mupdf.com/downloads/archive
diff --git a/package/python-pymupdf/0001-pipcl.py-allow-providing-python-config-externally.patch b/package/python-pymupdf/0001-pipcl.py-allow-providing-python-config-externally.patch
new file mode 100644
index 0000000000..2fd72c711e
--- /dev/null
+++ b/package/python-pymupdf/0001-pipcl.py-allow-providing-python-config-externally.patch
@@ -0,0 +1,125 @@
+From ca3417b8d605ccdb2e6c516c5e0c79180381627c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= <raphael.melotte@mind.be>
+Date: Sun, 4 Feb 2024 16:13:45 +0100
+Subject: [PATCH] pipcl.py: allow providing python-config externally
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+When cross-compiling (e.g. using Buildroot), the python-config
+executable that resides next to the host python executable provides
+incorrect includes (the ones for the host).
+
+Since the correct path to python-config cannot be guessed, add an
+additional environment variable to allow setting the path to the
+correct python-config executable externally.
+
+Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
+Upstream: https://github.com/pymupdf/PyMuPDF/pull/3173
+---
+ pipcl.py | 72 +++++++++++++++++++++++++++++---------------------------
+ setup.py | 3 +++
+ 2 files changed, 40 insertions(+), 35 deletions(-)
+
+diff --git a/pipcl.py b/pipcl.py
+index 209f660..c154774 100644
+--- a/pipcl.py
++++ b/pipcl.py
+@@ -1789,43 +1789,45 @@ class PythonFlags:
+ self.ldflags = f'-L {_lib_dir}'
+
+ else:
+- # We use python-config which appears to work better than pkg-config
+- # because it copes with multiple installed python's, e.g.
+- # manylinux_2014's /opt/python/cp*-cp*/bin/python*.
+- #
+- # But... on non-macos it seems that we should not attempt to specify
+- # libpython on the link command. The manylinux docker containers
+- # don't actually contain libpython.so, and it seems that this
+- # deliberate. And the link command runs ok.
+- #
+- python_exe = os.path.realpath( sys.executable)
+- if darwin():
+- # Basic install of dev tools with `xcode-select --install` doesn't
+- # seem to provide a `python3-config` or similar, but there is a
+- # `python-config.py` accessible via sysconfig.
++ python_config = os.environ.get("PYMUPDF_PYTHON_CONFIG")
++ if not python_config:
++ # We use python-config which appears to work better than pkg-config
++ # because it copes with multiple installed python's, e.g.
++ # manylinux_2014's /opt/python/cp*-cp*/bin/python*.
+ #
+- # We try different possibilities and use the last one that
+- # works.
++ # But... on non-macos it seems that we should not attempt to specify
++ # libpython on the link command. The manylinux docker containers
++ # don't actually contain libpython.so, and it seems that this
++ # deliberate. And the link command runs ok.
+ #
+- python_config = None
+- for pc in (
+- f'python3-config',
+- f'{sys.executable} {sysconfig.get_config_var("srcdir")}/python-config.py',
+- f'{python_exe}-config',
+- ):
+- e = subprocess.run(
+- f'{pc} --includes',
+- shell=1,
+- stdout=subprocess.DEVNULL,
+- stderr=subprocess.DEVNULL,
+- check=0,
+- ).returncode
+- log1(f'{e=} from {pc!r}.')
+- if e == 0:
+- python_config = pc
+- assert python_config, f'Cannot find python-config'
+- else:
+- python_config = f'{python_exe}-config'
++ python_exe = os.path.realpath( sys.executable)
++ if darwin():
++ # Basic install of dev tools with `xcode-select --install` doesn't
++ # seem to provide a `python3-config` or similar, but there is a
++ # `python-config.py` accessible via sysconfig.
++ #
++ # We try different possibilities and use the last one that
++ # works.
++ #
++ python_config = None
++ for pc in (
++ f'python3-config',
++ f'{sys.executable} {sysconfig.get_config_var("srcdir")}/python-config.py',
++ f'{python_exe}-config',
++ ):
++ e = subprocess.run(
++ f'{pc} --includes',
++ shell=1,
++ stdout=subprocess.DEVNULL,
++ stderr=subprocess.DEVNULL,
++ check=0,
++ ).returncode
++ log1(f'{e=} from {pc!r}.')
++ if e == 0:
++ python_config = pc
++ assert python_config, f'Cannot find python-config'
++ else:
++ python_config = f'{python_exe}-config'
+ log1(f'Using {python_config=}.')
+ try:
+ self.includes = run( f'{python_config} --includes', capture=1).strip()
+diff --git a/setup.py b/setup.py
+index 23a5c78..4b3b5c7 100755
+--- a/setup.py
++++ b/setup.py
+@@ -36,6 +36,9 @@ Environmental variables:
+ PYMUPDF_MUPDF_LIB
+ Directory containing MuPDF libraries, (libmupdf.so,
+ libmupdfcpp.so).
++
++ PYMUPDF_PYTHON_CONFIG
++ Optional path to python-config.
+
+ PYMUPDF_SETUP_IMPLEMENTATIONS
+ Must be one of 'a', 'b', 'ab'. If unset we use 'ab'.
+--
+2.41.0
+
diff --git a/package/python-pymupdf/Config.in b/package/python-pymupdf/Config.in
index 3831a25451..cfdd38ebe4 100644
--- a/package/python-pymupdf/Config.in
+++ b/package/python-pymupdf/Config.in
@@ -4,6 +4,7 @@ config BR2_PACKAGE_PYTHON_PYMUPDF
depends on BR2_TOOLCHAIN_HAS_SYNC_4 # mupdf -> harfbuzz
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # mupdf -> harfbuzz
depends on BR2_PACKAGE_XORG7
+ depends on !BR2_STATIC_LIBS
select BR2_PACKAGE_HOST_SWIG
select BR2_PACKAGE_FREETYPE
select BR2_PACKAGE_MUPDF
diff --git a/package/python-pymupdf/python-pymupdf.hash b/package/python-pymupdf/python-pymupdf.hash
index 9fd8150088..341366d46f 100644
--- a/package/python-pymupdf/python-pymupdf.hash
+++ b/package/python-pymupdf/python-pymupdf.hash
@@ -1,5 +1,5 @@
# md5, sha256 from https://pypi.org/pypi/pymupdf/json
-md5 468fe56375a1fca99e83fe0aa0b9f8bd PyMuPDF-1.22.0.tar.gz
-sha256 6e1694e5c0cd8b92d503a506ee8e4ba1bed768528de586889d3ec90e9dc4a7d3 PyMuPDF-1.22.0.tar.gz
+md5 5c219a0c4cb3d57b60e39cc901ebd220 PyMuPDF-1.23.22.tar.gz
+sha256 c41cd91d83696cea67a4b6c65cc1951c2019ac0a561c5a3f543318ede30d3cd0 PyMuPDF-1.23.22.tar.gz
# Locally computed sha256 checksums
sha256 57c8ff33c9c0cfc3ef00e650a1cc910d7ee479a8bc509f6c9209a7c2a11399d6 COPYING
diff --git a/package/python-pymupdf/python-pymupdf.mk b/package/python-pymupdf/python-pymupdf.mk
index 639ce0e00e..0b26c925ea 100644
--- a/package/python-pymupdf/python-pymupdf.mk
+++ b/package/python-pymupdf/python-pymupdf.mk
@@ -4,26 +4,27 @@
#
################################################################################
-# python-pymupdf's version must match mupdf's version
-PYTHON_PYMUPDF_VERSION = 1.22.0
+# python-pymupdf's version be compatible with mupdf's version
+PYTHON_PYMUPDF_VERSION = 1.23.22
PYTHON_PYMUPDF_SOURCE = PyMuPDF-$(PYTHON_PYMUPDF_VERSION).tar.gz
-PYTHON_PYMUPDF_SITE = https://files.pythonhosted.org/packages/28/ba/d6bb6fd678e8396d7b944870286fb25fd6f499b8cb599b5436c8f725adbf
-PYTHON_PYMUPDF_SETUP_TYPE = setuptools
+PYTHON_PYMUPDF_SITE = https://files.pythonhosted.org/packages/05/20/a0d1221d8f379afcc12b4d1687a8f4adb69eef659e835d781c3fa331ff46
+PYTHON_PYMUPDF_SETUP_TYPE = pep517
PYTHON_PYMUPDF_LICENSE = AGPL-3.0+
PYTHON_PYMUPDF_LICENSE_FILES = COPYING
# No license file included in pip, but it's present on github
-PYTHON_PYMUPDF_DEPENDENCIES = freetype host-swig mupdf zlib
+PYTHON_PYMUPDF_DEPENDENCIES = \
+ freetype \
+ host-python-setuptools \
+ host-swig \
+ mupdf
-PYTHON_PYMUPDF_ENV = CFLAGS="-I$(STAGING_DIR)/usr/include/mupdf -I$(STAGING_DIR)/usr/include/freetype2"
+PYTHON_PYMUPDF_BUILD_OPTS = --skip-dependency-check
-# We need to remove the original paths as we provide them in the CFLAGS:
-define PYTHON_PYMUPDF_REMOVE_PATHS
- sed -i "/\/usr\/include\/mupdf/d" $(@D)/setup.py
- sed -i "/\/usr\/include\/freetype2/d" $(@D)/setup.py
- sed -i "/\/usr\/local\/include\/mupdf/d" $(@D)/setup.py
- sed -i "/mupdf\/thirdparty\/freetype\/include/d" $(@D)/setup.py
-endef
-
-PYTHON_PYMUPDF_POST_PATCH_HOOKS = PYTHON_PYMUPDF_REMOVE_PATHS
+PYTHON_PYMUPDF_ENV = \
+ PYMUPDF_INCLUDES="$(STAGING_DIR)/usr/include/freetype2:$(STAGING_DIR)/usr/include" \
+ PYMUPDF_MUPDF_LIB="$(STAGING_DIR)/usr/lib" \
+ PYMUPDF_PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python3-config" \
+ PYMUPDF_SETUP_IMPLEMENTATIONS=a \
+ PYMUPDF_SETUP_MUPDF_BUILD=
$(eval $(python-package))
diff --git a/support/testing/tests/package/sample_python_pymupdf.py b/support/testing/tests/package/sample_python_pymupdf.py
index 574bd27965..ffcbfa1140 100644
--- a/support/testing/tests/package/sample_python_pymupdf.py
+++ b/support/testing/tests/package/sample_python_pymupdf.py
@@ -1,4 +1,4 @@
-import fitz
+import fitz_old as fitz
# Write a test PDF file
outfile = "python-pymupdf.pdf"
--
2.37.3
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [Buildroot] [PATCH 3/5] package/mupdf: fix building shared libraries
2024-02-16 21:13 ` [Buildroot] [PATCH 3/5] package/mupdf: fix building shared libraries Raphaël Mélotte via buildroot
@ 2024-04-01 20:06 ` Arnout Vandecappelle via buildroot
2024-06-07 16:44 ` Raphaël Mélotte via buildroot
0 siblings, 1 reply; 21+ messages in thread
From: Arnout Vandecappelle via buildroot @ 2024-04-01 20:06 UTC (permalink / raw)
To: Raphaël Mélotte, buildroot; +Cc: james.hilliard1
On 16/02/2024 22:13, Raphaël Mélotte via buildroot wrote:
> By default mupdf generates static libraries, shared libraries must be
> enabled explicitely.
>
> The Makefile doesn't make it possible to build both static and shared
> libs, so add a 'depends on' accordingly.
There are many packages for which is the case, for example (almost) all CMake
packages - unless a package does something specific, CMake supports only static
_or_ dynamic libraries.
We solve that by building only shared libraries even if BR2_SHARED_STATIC_LIBS
is set.
>
> Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
> ---
> package/mupdf/Config.in | 4 ++++
> package/mupdf/mupdf.mk | 5 +++++
> 2 files changed, 9 insertions(+)
>
> diff --git a/package/mupdf/Config.in b/package/mupdf/Config.in
> index cf97711160..092e1d8ac6 100644
> --- a/package/mupdf/Config.in
> +++ b/package/mupdf/Config.in
> @@ -1,9 +1,13 @@
> +comment "MuPDF can build static or shared libs, but not both at the same time."
> + depends on BR2_SHARED_STATIC_LIBS
> +
> config BR2_PACKAGE_MUPDF
> bool "mupdf"
> depends on BR2_INSTALL_LIBSTDCPP # harfbuzz
> depends on BR2_TOOLCHAIN_HAS_SYNC_4 # harfbuzz
> depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # harfbuzz
> depends on BR2_PACKAGE_XORG7
> + depends on !BR2_SHARED_STATIC_LIBS
So this bit should just be removed.
> select BR2_PACKAGE_FREETYPE
> select BR2_PACKAGE_GUMBO_PARSER
> select BR2_PACKAGE_HARFBUZZ
> diff --git a/package/mupdf/mupdf.mk b/package/mupdf/mupdf.mk
> index 08894d7980..d2105497be 100644
> --- a/package/mupdf/mupdf.mk
> +++ b/package/mupdf/mupdf.mk
> @@ -50,6 +50,11 @@ MUPDF_MAKE_OPTS = \
> HAVE_OBJCOPY=no \
> prefix="/usr"
>
> +# The default in MuPDF is static libs
> +ifeq ($(BR2_SHARED_LIBS),y)
And here it should check for BR2_STATIC_LIBS.
> +MUPDF_MAKE_OPTS += shared=yes
And we probably want both the yes and no explicitly. So:
ifeq ($(BR2_STATIC_LIBS),y)
MUPDF_MAKE_OPTS += shared=no
else
MUPDF_MAKE_OPTS += shared=yes
endif
Regards,
Arnout
> +endif
> +
> ifeq ($(BR2_PACKAGE_LIBFREEGLUT),y)
> MUPDF_DEPENDENCIES += libfreeglut
> else
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH v2 1/5] package: python-pymupdf: add missing python-zlib dependency
2024-02-16 21:13 ` [Buildroot] [PATCH 1/5] package: python-pymupdf: add missing python-zlib dependency Raphaël Mélotte via buildroot
@ 2024-06-07 16:32 ` Raphaël Mélotte via buildroot
2024-06-07 16:32 ` [Buildroot] [PATCH v2 2/5] support/testing: add new test for python-pymupdf Raphaël Mélotte via buildroot
` (4 more replies)
0 siblings, 5 replies; 21+ messages in thread
From: Raphaël Mélotte via buildroot @ 2024-06-07 16:32 UTC (permalink / raw)
To: buildroot; +Cc: James Hilliard, Raphaël Mélotte, Asaf Kahlon
It turns out that python-pymupdf doesn't require zlib directly, but it
does require the zlib python module.
This fixes the following runtime error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.11/site-packages/fitz/__init__.py", line 22, in <module>
File "/usr/lib/python3.11/site-packages/fitz/fitz.py", line 3402, in <module>
File "/usr/lib/python3.11/gzip.py", line 9, in <module>
ModuleNotFoundError: No module named 'zlib'
Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
---
package/python-pymupdf/Config.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package/python-pymupdf/Config.in b/package/python-pymupdf/Config.in
index ecaa5496b5..3831a25451 100644
--- a/package/python-pymupdf/Config.in
+++ b/package/python-pymupdf/Config.in
@@ -7,7 +7,7 @@ config BR2_PACKAGE_PYTHON_PYMUPDF
select BR2_PACKAGE_HOST_SWIG
select BR2_PACKAGE_FREETYPE
select BR2_PACKAGE_MUPDF
- select BR2_PACKAGE_ZLIB
+ select BR2_PACKAGE_PYTHON3_ZLIB # runtime
help
Python bindings for the PDF rendering library MuPDF.
--
2.37.3
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH v2 2/5] support/testing: add new test for python-pymupdf
2024-06-07 16:32 ` [Buildroot] [PATCH v2 " Raphaël Mélotte via buildroot
@ 2024-06-07 16:32 ` Raphaël Mélotte via buildroot
2024-07-13 20:35 ` Thomas Petazzoni via buildroot
2024-06-07 16:32 ` [Buildroot] [PATCH v2 3/5] package/mupdf: fix building shared libraries Raphaël Mélotte via buildroot
` (3 subsequent siblings)
4 siblings, 1 reply; 21+ messages in thread
From: Raphaël Mélotte via buildroot @ 2024-06-07 16:32 UTC (permalink / raw)
To: buildroot; +Cc: Raphaël Mélotte
To give us a chance to catch runtime issues (such as missing
dependencies) more easily, add a test that writes a sample PDF file,
read it back and verify the text that was read.
Like similar packages that lead to a big
rootfs (e.g. python-botocore), this test requires a separate ext2
rootfs to avoid filling the default amount of RAM available
entirely (which would cause missing files from the root filesystem and
in turn, test failures).
Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
---
DEVELOPERS | 2 ++
.../tests/package/sample_python_pymupdf.py | 17 ++++++++++++
.../tests/package/test_python_pymupdf.py | 26 +++++++++++++++++++
3 files changed, 45 insertions(+)
create mode 100644 support/testing/tests/package/sample_python_pymupdf.py
create mode 100644 support/testing/tests/package/test_python_pymupdf.py
diff --git a/DEVELOPERS b/DEVELOPERS
index 03aa7bfa74..e4c3920ce2 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2667,9 +2667,11 @@ F: package/python-pymupdf/
F: package/python-rsa/
F: package/python-s3transfer/
F: support/testing/tests/package/sample_python_jmespath.py
+F: support/testing/tests/package/sample_python_pymupdf.py
F: support/testing/tests/package/sample_python_rsa.py
F: support/testing/tests/package/sample_python_s3transfer.py
F: support/testing/tests/package/test_python_jmespath.py
+F: support/testing/tests/package/test_python_pymupdf.py
F: support/testing/tests/package/test_python_rsa.py
F: support/testing/tests/package/test_python_s3transfer.py
diff --git a/support/testing/tests/package/sample_python_pymupdf.py b/support/testing/tests/package/sample_python_pymupdf.py
new file mode 100644
index 0000000000..574bd27965
--- /dev/null
+++ b/support/testing/tests/package/sample_python_pymupdf.py
@@ -0,0 +1,17 @@
+import fitz
+
+# Write a test PDF file
+outfile = "python-pymupdf.pdf"
+sample_text = "This is a test page for python-pymupdf."
+doc = fitz.open()
+page = doc.new_page()
+p = fitz.Point(50, 72)
+page.insert_text(p, sample_text)
+doc.save(outfile)
+
+# Read back the file
+with fitz.open(outfile) as d: # open document
+ read_text = chr(12).join([page.get_text() for page in d])
+
+print(read_text)
+assert(read_text == sample_text + "\n")
diff --git a/support/testing/tests/package/test_python_pymupdf.py b/support/testing/tests/package/test_python_pymupdf.py
new file mode 100644
index 0000000000..5e9d5a6912
--- /dev/null
+++ b/support/testing/tests/package/test_python_pymupdf.py
@@ -0,0 +1,26 @@
+import os
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy3PyMuPDF(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON3=y
+ BR2_PACKAGE_PYTHON_PYMUPDF=y
+ BR2_PACKAGE_XORG7=y
+ BR2_USE_WCHAR=y
+ BR2_INSTALL_LIBSTDCPP=y
+ BR2_TARGET_ROOTFS_EXT2=y
+ BR2_TARGET_ROOTFS_EXT2_SIZE="250M"
+ """
+ sample_scripts = ["tests/package/sample_python_pymupdf.py"]
+ timeout = 30
+
+ def login(self):
+ ext2_file = os.path.join(self.builddir, "images", "rootfs.ext2")
+ self.emulator.boot(arch="armv5",
+ kernel="builtin",
+ options=["-drive", "file=%s,if=scsi,format=raw" % ext2_file],
+ kernel_cmdline=["rootwait", "root=/dev/sda"])
+ self.emulator.login()
--
2.37.3
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH v2 3/5] package/mupdf: fix building shared libraries
2024-06-07 16:32 ` [Buildroot] [PATCH v2 " Raphaël Mélotte via buildroot
2024-06-07 16:32 ` [Buildroot] [PATCH v2 2/5] support/testing: add new test for python-pymupdf Raphaël Mélotte via buildroot
@ 2024-06-07 16:32 ` Raphaël Mélotte via buildroot
2024-07-13 20:36 ` Thomas Petazzoni via buildroot
2024-08-12 9:14 ` Peter Korsgaard
2024-06-07 16:32 ` [Buildroot] [PATCH v2 4/5] package/mupdf: bump to version 1.23.9 Raphaël Mélotte via buildroot
` (2 subsequent siblings)
4 siblings, 2 replies; 21+ messages in thread
From: Raphaël Mélotte via buildroot @ 2024-06-07 16:32 UTC (permalink / raw)
To: buildroot; +Cc: Raphaël Mélotte
By default mupdf generates static libraries, shared libraries must be
enabled explicitely.
Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
---
Changes v1 -> v2:
- Remove SHARED_STATIC_LIBS depends and use explicit options.
---
package/mupdf/mupdf.mk | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/package/mupdf/mupdf.mk b/package/mupdf/mupdf.mk
index 08894d7980..4673b88291 100644
--- a/package/mupdf/mupdf.mk
+++ b/package/mupdf/mupdf.mk
@@ -50,6 +50,12 @@ MUPDF_MAKE_OPTS = \
HAVE_OBJCOPY=no \
prefix="/usr"
+ifeq ($(BR2_STATIC_LIBS),y)
+MUPDF_MAKE_OPTS += shared=no
+else
+MUPDF_MAKE_OPTS += shared=yes
+endif
+
ifeq ($(BR2_PACKAGE_LIBFREEGLUT),y)
MUPDF_DEPENDENCIES += libfreeglut
else
--
2.37.3
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH v2 4/5] package/mupdf: bump to version 1.23.9
2024-06-07 16:32 ` [Buildroot] [PATCH v2 " Raphaël Mélotte via buildroot
2024-06-07 16:32 ` [Buildroot] [PATCH v2 2/5] support/testing: add new test for python-pymupdf Raphaël Mélotte via buildroot
2024-06-07 16:32 ` [Buildroot] [PATCH v2 3/5] package/mupdf: fix building shared libraries Raphaël Mélotte via buildroot
@ 2024-06-07 16:32 ` Raphaël Mélotte via buildroot
2024-07-13 20:36 ` Thomas Petazzoni via buildroot
2024-06-07 16:32 ` [Buildroot] [PATCH v2 5/5] package/python-pymupdf: bump to version 1.23.22 Raphaël Mélotte via buildroot
2024-07-13 20:34 ` [Buildroot] [PATCH v2 1/5] package: python-pymupdf: add missing python-zlib dependency Thomas Petazzoni via buildroot
4 siblings, 1 reply; 21+ messages in thread
From: Raphaël Mélotte via buildroot @ 2024-06-07 16:32 UTC (permalink / raw)
To: buildroot; +Cc: James Hilliard, Raphaël Mélotte
From: James Hilliard <james.hilliard1@gmail.com>
Drop patch which is now upstream.
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
[bump to 1.23.9]
Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
---
...issing-limits.h-include-for-UINT_MAX.patch | 70 -------------------
package/mupdf/mupdf.hash | 4 +-
package/mupdf/mupdf.mk | 2 +-
3 files changed, 3 insertions(+), 73 deletions(-)
delete mode 100644 package/mupdf/0001-Add-missing-limits.h-include-for-UINT_MAX.patch
diff --git a/package/mupdf/0001-Add-missing-limits.h-include-for-UINT_MAX.patch b/package/mupdf/0001-Add-missing-limits.h-include-for-UINT_MAX.patch
deleted file mode 100644
index 95f2f86666..0000000000
--- a/package/mupdf/0001-Add-missing-limits.h-include-for-UINT_MAX.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-From ebce9f1b129ebc8f2b17afa02a4ffcb9453c11d9 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= <raphael.melotte@mind.be>
-Date: Mon, 24 Apr 2023 17:27:35 +0200
-Subject: [PATCH] Add missing limits.h include for UINT_MAX
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-encode-basic.c uses 'UINT_MAX', which is available in the 'limits.h'
-header.
-
-In some configurations that build with zlib from [1], by chance
-limits.h gets indirectly included when including 'z-imp.h' (the
-includes are: 'z-imp.h' -> 'zlib.h' -> 'zconf.h' -> 'limits.h'), so
-the build succeeds.
-
-When using other zlib implementations however (for example from [2]),
-limits.h is not necessarily included indirectly, which leads to the
-build failing in the following way:
-
-source/fitz/encode-basic.c: In function 'deflate_write':
-source/fitz/encode-basic.c:343:27: error: 'UINT_MAX' undeclared (first use in this function)
- 343 | newbufsize = n >= UINT_MAX ? UINT_MAX : deflateBound(&state->z, n);
- | ^~~~~~~~
-source/fitz/encode-basic.c:26:1: note: 'UINT_MAX' is defined in header '<limits.h>'; did you forget to '#include <limits.h>'?
-
-Add the missing include, so that the build succeeds no matter if zlib
-indirectly includes 'limit.h' or not.
-
-Similarly, also add it in output-ps.c where it's also missing.
-
-[1]: https://zlib.net/
-[2]: https://github.com/zlib-ng/zlib-ng
-
-Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
-Upstream: https://bugs.ghostscript.com/show_bug.cgi?id=706667
----
- source/fitz/encode-basic.c | 2 ++
- source/fitz/output-ps.c | 2 ++
- 2 files changed, 4 insertions(+)
-
-diff --git a/source/fitz/encode-basic.c b/source/fitz/encode-basic.c
-index 03a4ff76b..84f0c35e6 100644
---- a/source/fitz/encode-basic.c
-+++ b/source/fitz/encode-basic.c
-@@ -24,6 +24,8 @@
-
- #include "z-imp.h"
-
-+#include <limits.h>
-+
- struct ahx
- {
- fz_output *chain;
-diff --git a/source/fitz/output-ps.c b/source/fitz/output-ps.c
-index ef22c3cd6..3dc8ea17d 100644
---- a/source/fitz/output-ps.c
-+++ b/source/fitz/output-ps.c
-@@ -24,6 +24,8 @@
-
- #include "z-imp.h"
-
-+#include <limits.h>
-+
- typedef struct ps_band_writer_s
- {
- fz_band_writer super;
---
-2.39.1
-
diff --git a/package/mupdf/mupdf.hash b/package/mupdf/mupdf.hash
index 1f636097ed..580235eeca 100644
--- a/package/mupdf/mupdf.hash
+++ b/package/mupdf/mupdf.hash
@@ -1,8 +1,8 @@
# From https://mupdf.com/downloads/index.html:
-sha1 b9907729d604f0bf3846b45cd5891e10d7a66e24 mupdf-1.22.0-source.tar.lz
+sha1 d79600bccd70ab9d0e8ee19dae4e275f2af95ced mupdf-1.23.9-source.tar.lz
# Locally computed:
-sha256 bed78a0abf8496b30c523497292de979db633eca57e02f6cd0f3c7c042551c3e mupdf-1.22.0-source.tar.lz
+sha256 2c2f89deb9f425ba637dac226191d547f2b40975c4d21a340965f52c001e15c5 mupdf-1.23.9-source.tar.lz
# Hash for license files:
sha256 57c8ff33c9c0cfc3ef00e650a1cc910d7ee479a8bc509f6c9209a7c2a11399d6 COPYING
diff --git a/package/mupdf/mupdf.mk b/package/mupdf/mupdf.mk
index 4673b88291..409972d3b6 100644
--- a/package/mupdf/mupdf.mk
+++ b/package/mupdf/mupdf.mk
@@ -5,7 +5,7 @@
################################################################################
# python-pymupdf's version must match mupdf's version
-MUPDF_VERSION = 1.22.0
+MUPDF_VERSION = 1.23.9
MUPDF_SOURCE = mupdf-$(MUPDF_VERSION)-source.tar.lz
MUPDF_SITE = https://mupdf.com/downloads/archive
MUPDF_LICENSE = AGPL-3.0+
--
2.37.3
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [Buildroot] [PATCH v2 5/5] package/python-pymupdf: bump to version 1.23.22
2024-06-07 16:32 ` [Buildroot] [PATCH v2 " Raphaël Mélotte via buildroot
` (2 preceding siblings ...)
2024-06-07 16:32 ` [Buildroot] [PATCH v2 4/5] package/mupdf: bump to version 1.23.9 Raphaël Mélotte via buildroot
@ 2024-06-07 16:32 ` Raphaël Mélotte via buildroot
2024-07-13 20:38 ` Thomas Petazzoni via buildroot
2024-07-13 20:34 ` [Buildroot] [PATCH v2 1/5] package: python-pymupdf: add missing python-zlib dependency Thomas Petazzoni via buildroot
4 siblings, 1 reply; 21+ messages in thread
From: Raphaël Mélotte via buildroot @ 2024-06-07 16:32 UTC (permalink / raw)
To: buildroot; +Cc: James Hilliard, Raphaël Mélotte, Asaf Kahlon
From: James Hilliard <james.hilliard1@gmail.com>
The python-pymupdf and mupdf packages do not follow the exact same
version numbers anymore. There is no specific mention of version
compatibilities in the upstream package, so update our comment to just
say that both should be "compatible" (to try to avoid one being
updated without the other).
Migrate to in tree pep517 based build backend.
The hardcoded paths we used to remove from setup.py are no longer
present, so the post-patch hook is removed.
The new setup.py instead uses new environment variables which we now
provide.
This new python-pymupdf version fails at runtime when mupdf builds
static libraries. This should not be possible as xorg anyway depends
on !BR2_STATIC_LIBS, but let's be explicit and forbid python-pymupdf
to be built with BR2_STATIC_LIBS as well.
Note also that python-pymupdf is gradually switching to a new
implementation that requires mupdf to be built with python
bindings. For now, both implementations are still available but we
only compile the old one. The runtime test is adapted accordingly as
the legacy implementation has to be imported with "fitz_old".
While at it, the dependencies are also split to one per line to make
them easier to diff in the future.
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
[Raphaël:
- fix cross-compilation
- remove unneeded dependencies
- update to 1.23.22
- update the commit message
]
Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
---
package/mupdf/mupdf.mk | 2 +-
...w-providing-python-config-externally.patch | 125 ++++++++++++++++++
package/python-pymupdf/Config.in | 1 +
package/python-pymupdf/python-pymupdf.hash | 4 +-
package/python-pymupdf/python-pymupdf.mk | 31 +++--
.../tests/package/sample_python_pymupdf.py | 2 +-
6 files changed, 145 insertions(+), 20 deletions(-)
create mode 100644 package/python-pymupdf/0001-pipcl.py-allow-providing-python-config-externally.patch
diff --git a/package/mupdf/mupdf.mk b/package/mupdf/mupdf.mk
index 409972d3b6..1be55cfef3 100644
--- a/package/mupdf/mupdf.mk
+++ b/package/mupdf/mupdf.mk
@@ -4,7 +4,7 @@
#
################################################################################
-# python-pymupdf's version must match mupdf's version
+# python-pymupdf's version be compatible with mupdf's version
MUPDF_VERSION = 1.23.9
MUPDF_SOURCE = mupdf-$(MUPDF_VERSION)-source.tar.lz
MUPDF_SITE = https://mupdf.com/downloads/archive
diff --git a/package/python-pymupdf/0001-pipcl.py-allow-providing-python-config-externally.patch b/package/python-pymupdf/0001-pipcl.py-allow-providing-python-config-externally.patch
new file mode 100644
index 0000000000..2fd72c711e
--- /dev/null
+++ b/package/python-pymupdf/0001-pipcl.py-allow-providing-python-config-externally.patch
@@ -0,0 +1,125 @@
+From ca3417b8d605ccdb2e6c516c5e0c79180381627c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= <raphael.melotte@mind.be>
+Date: Sun, 4 Feb 2024 16:13:45 +0100
+Subject: [PATCH] pipcl.py: allow providing python-config externally
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+When cross-compiling (e.g. using Buildroot), the python-config
+executable that resides next to the host python executable provides
+incorrect includes (the ones for the host).
+
+Since the correct path to python-config cannot be guessed, add an
+additional environment variable to allow setting the path to the
+correct python-config executable externally.
+
+Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
+Upstream: https://github.com/pymupdf/PyMuPDF/pull/3173
+---
+ pipcl.py | 72 +++++++++++++++++++++++++++++---------------------------
+ setup.py | 3 +++
+ 2 files changed, 40 insertions(+), 35 deletions(-)
+
+diff --git a/pipcl.py b/pipcl.py
+index 209f660..c154774 100644
+--- a/pipcl.py
++++ b/pipcl.py
+@@ -1789,43 +1789,45 @@ class PythonFlags:
+ self.ldflags = f'-L {_lib_dir}'
+
+ else:
+- # We use python-config which appears to work better than pkg-config
+- # because it copes with multiple installed python's, e.g.
+- # manylinux_2014's /opt/python/cp*-cp*/bin/python*.
+- #
+- # But... on non-macos it seems that we should not attempt to specify
+- # libpython on the link command. The manylinux docker containers
+- # don't actually contain libpython.so, and it seems that this
+- # deliberate. And the link command runs ok.
+- #
+- python_exe = os.path.realpath( sys.executable)
+- if darwin():
+- # Basic install of dev tools with `xcode-select --install` doesn't
+- # seem to provide a `python3-config` or similar, but there is a
+- # `python-config.py` accessible via sysconfig.
++ python_config = os.environ.get("PYMUPDF_PYTHON_CONFIG")
++ if not python_config:
++ # We use python-config which appears to work better than pkg-config
++ # because it copes with multiple installed python's, e.g.
++ # manylinux_2014's /opt/python/cp*-cp*/bin/python*.
+ #
+- # We try different possibilities and use the last one that
+- # works.
++ # But... on non-macos it seems that we should not attempt to specify
++ # libpython on the link command. The manylinux docker containers
++ # don't actually contain libpython.so, and it seems that this
++ # deliberate. And the link command runs ok.
+ #
+- python_config = None
+- for pc in (
+- f'python3-config',
+- f'{sys.executable} {sysconfig.get_config_var("srcdir")}/python-config.py',
+- f'{python_exe}-config',
+- ):
+- e = subprocess.run(
+- f'{pc} --includes',
+- shell=1,
+- stdout=subprocess.DEVNULL,
+- stderr=subprocess.DEVNULL,
+- check=0,
+- ).returncode
+- log1(f'{e=} from {pc!r}.')
+- if e == 0:
+- python_config = pc
+- assert python_config, f'Cannot find python-config'
+- else:
+- python_config = f'{python_exe}-config'
++ python_exe = os.path.realpath( sys.executable)
++ if darwin():
++ # Basic install of dev tools with `xcode-select --install` doesn't
++ # seem to provide a `python3-config` or similar, but there is a
++ # `python-config.py` accessible via sysconfig.
++ #
++ # We try different possibilities and use the last one that
++ # works.
++ #
++ python_config = None
++ for pc in (
++ f'python3-config',
++ f'{sys.executable} {sysconfig.get_config_var("srcdir")}/python-config.py',
++ f'{python_exe}-config',
++ ):
++ e = subprocess.run(
++ f'{pc} --includes',
++ shell=1,
++ stdout=subprocess.DEVNULL,
++ stderr=subprocess.DEVNULL,
++ check=0,
++ ).returncode
++ log1(f'{e=} from {pc!r}.')
++ if e == 0:
++ python_config = pc
++ assert python_config, f'Cannot find python-config'
++ else:
++ python_config = f'{python_exe}-config'
+ log1(f'Using {python_config=}.')
+ try:
+ self.includes = run( f'{python_config} --includes', capture=1).strip()
+diff --git a/setup.py b/setup.py
+index 23a5c78..4b3b5c7 100755
+--- a/setup.py
++++ b/setup.py
+@@ -36,6 +36,9 @@ Environmental variables:
+ PYMUPDF_MUPDF_LIB
+ Directory containing MuPDF libraries, (libmupdf.so,
+ libmupdfcpp.so).
++
++ PYMUPDF_PYTHON_CONFIG
++ Optional path to python-config.
+
+ PYMUPDF_SETUP_IMPLEMENTATIONS
+ Must be one of 'a', 'b', 'ab'. If unset we use 'ab'.
+--
+2.41.0
+
diff --git a/package/python-pymupdf/Config.in b/package/python-pymupdf/Config.in
index 3831a25451..cfdd38ebe4 100644
--- a/package/python-pymupdf/Config.in
+++ b/package/python-pymupdf/Config.in
@@ -4,6 +4,7 @@ config BR2_PACKAGE_PYTHON_PYMUPDF
depends on BR2_TOOLCHAIN_HAS_SYNC_4 # mupdf -> harfbuzz
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # mupdf -> harfbuzz
depends on BR2_PACKAGE_XORG7
+ depends on !BR2_STATIC_LIBS
select BR2_PACKAGE_HOST_SWIG
select BR2_PACKAGE_FREETYPE
select BR2_PACKAGE_MUPDF
diff --git a/package/python-pymupdf/python-pymupdf.hash b/package/python-pymupdf/python-pymupdf.hash
index 9fd8150088..341366d46f 100644
--- a/package/python-pymupdf/python-pymupdf.hash
+++ b/package/python-pymupdf/python-pymupdf.hash
@@ -1,5 +1,5 @@
# md5, sha256 from https://pypi.org/pypi/pymupdf/json
-md5 468fe56375a1fca99e83fe0aa0b9f8bd PyMuPDF-1.22.0.tar.gz
-sha256 6e1694e5c0cd8b92d503a506ee8e4ba1bed768528de586889d3ec90e9dc4a7d3 PyMuPDF-1.22.0.tar.gz
+md5 5c219a0c4cb3d57b60e39cc901ebd220 PyMuPDF-1.23.22.tar.gz
+sha256 c41cd91d83696cea67a4b6c65cc1951c2019ac0a561c5a3f543318ede30d3cd0 PyMuPDF-1.23.22.tar.gz
# Locally computed sha256 checksums
sha256 57c8ff33c9c0cfc3ef00e650a1cc910d7ee479a8bc509f6c9209a7c2a11399d6 COPYING
diff --git a/package/python-pymupdf/python-pymupdf.mk b/package/python-pymupdf/python-pymupdf.mk
index 8825868fb5..1364bd12c3 100644
--- a/package/python-pymupdf/python-pymupdf.mk
+++ b/package/python-pymupdf/python-pymupdf.mk
@@ -4,27 +4,26 @@
#
################################################################################
-# python-pymupdf's version must match mupdf's version
-PYTHON_PYMUPDF_VERSION = 1.22.0
+# python-pymupdf's version be compatible with mupdf's version
+PYTHON_PYMUPDF_VERSION = 1.23.22
PYTHON_PYMUPDF_SOURCE = PyMuPDF-$(PYTHON_PYMUPDF_VERSION).tar.gz
-PYTHON_PYMUPDF_SITE = https://files.pythonhosted.org/packages/28/ba/d6bb6fd678e8396d7b944870286fb25fd6f499b8cb599b5436c8f725adbf
-PYTHON_PYMUPDF_SETUP_TYPE = setuptools
+PYTHON_PYMUPDF_SITE = https://files.pythonhosted.org/packages/05/20/a0d1221d8f379afcc12b4d1687a8f4adb69eef659e835d781c3fa331ff46
+PYTHON_PYMUPDF_SETUP_TYPE = pep517
PYTHON_PYMUPDF_LICENSE = AGPL-3.0+
PYTHON_PYMUPDF_LICENSE_FILES = COPYING
# No license file included in pip, but it's present on github
-PYTHON_PYMUPDF_DEPENDENCIES = freetype host-swig mupdf zlib
PYTHON_PYMUPDF_BUILD_OPTS = --skip-dependency-check
+PYTHON_PYMUPDF_DEPENDENCIES = \
+ freetype \
+ host-python-setuptools \
+ host-swig \
+ mupdf
-PYTHON_PYMUPDF_ENV = CFLAGS="-I$(STAGING_DIR)/usr/include/mupdf -I$(STAGING_DIR)/usr/include/freetype2"
-
-# We need to remove the original paths as we provide them in the CFLAGS:
-define PYTHON_PYMUPDF_REMOVE_PATHS
- sed -i "/\/usr\/include\/mupdf/d" $(@D)/setup.py
- sed -i "/\/usr\/include\/freetype2/d" $(@D)/setup.py
- sed -i "/\/usr\/local\/include\/mupdf/d" $(@D)/setup.py
- sed -i "/mupdf\/thirdparty\/freetype\/include/d" $(@D)/setup.py
-endef
-
-PYTHON_PYMUPDF_POST_PATCH_HOOKS = PYTHON_PYMUPDF_REMOVE_PATHS
+PYTHON_PYMUPDF_ENV = \
+ PYMUPDF_INCLUDES="$(STAGING_DIR)/usr/include/freetype2:$(STAGING_DIR)/usr/include" \
+ PYMUPDF_MUPDF_LIB="$(STAGING_DIR)/usr/lib" \
+ PYMUPDF_PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python3-config" \
+ PYMUPDF_SETUP_IMPLEMENTATIONS=a \
+ PYMUPDF_SETUP_MUPDF_BUILD=
$(eval $(python-package))
diff --git a/support/testing/tests/package/sample_python_pymupdf.py b/support/testing/tests/package/sample_python_pymupdf.py
index 574bd27965..ffcbfa1140 100644
--- a/support/testing/tests/package/sample_python_pymupdf.py
+++ b/support/testing/tests/package/sample_python_pymupdf.py
@@ -1,4 +1,4 @@
-import fitz
+import fitz_old as fitz
# Write a test PDF file
outfile = "python-pymupdf.pdf"
--
2.37.3
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [Buildroot] [PATCH 3/5] package/mupdf: fix building shared libraries
2024-04-01 20:06 ` Arnout Vandecappelle via buildroot
@ 2024-06-07 16:44 ` Raphaël Mélotte via buildroot
0 siblings, 0 replies; 21+ messages in thread
From: Raphaël Mélotte via buildroot @ 2024-06-07 16:44 UTC (permalink / raw)
To: Arnout Vandecappelle, buildroot; +Cc: james.hilliard1
On 4/1/24 22:06, Arnout Vandecappelle wrote:
>
>
>[...]
> ifeq ($(BR2_STATIC_LIBS),y)
> MUPDF_MAKE_OPTS += shared=no
> else
> MUPDF_MAKE_OPTS += shared=yes
> endif
>
>[...]
I sent a v2, sorry for the delay...
https://patchwork.ozlabs.org/project/buildroot/patch/20240607163208.1445715-1-raphael.melotte@mind.be/
Kind regards,
Raphaël
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Buildroot] [PATCH v2 1/5] package: python-pymupdf: add missing python-zlib dependency
2024-06-07 16:32 ` [Buildroot] [PATCH v2 " Raphaël Mélotte via buildroot
` (3 preceding siblings ...)
2024-06-07 16:32 ` [Buildroot] [PATCH v2 5/5] package/python-pymupdf: bump to version 1.23.22 Raphaël Mélotte via buildroot
@ 2024-07-13 20:34 ` Thomas Petazzoni via buildroot
2024-08-12 9:51 ` Peter Korsgaard
4 siblings, 1 reply; 21+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-07-13 20:34 UTC (permalink / raw)
To: Raphaël Mélotte via buildroot
Cc: James Hilliard, Raphaël Mélotte, Asaf Kahlon
On Fri, 7 Jun 2024 18:32:02 +0200
Raphaël Mélotte via buildroot <buildroot@buildroot.org> wrote:
> It turns out that python-pymupdf doesn't require zlib directly, but it
> does require the zlib python module.
>
> This fixes the following runtime error:
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/lib/python3.11/site-packages/fitz/__init__.py", line 22, in <module>
> File "/usr/lib/python3.11/site-packages/fitz/fitz.py", line 3402, in <module>
> File "/usr/lib/python3.11/gzip.py", line 9, in <module>
> ModuleNotFoundError: No module named 'zlib'
>
> Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
You had forgotten to drop the "zlib" dependency in MUPDF_DEPENDENCIES,
so I dropped it as well. And applied your patch!
And in fact this lead me to look more into mupdf, and I was curious to
see why it depended on X11. Except it does not: it is a purely optional
dependency. And I found other things that were not correct/useful
anymore in the package so I did a few preparation commits:
https://gitlab.com/buildroot.org/buildroot/-/commit/f7deaa1330baad303afb76a7711faeeb1ddfee5d
https://gitlab.com/buildroot.org/buildroot/-/commit/90f0a484671098f9a94ce66b8f8af94e106ae106
https://gitlab.com/buildroot.org/buildroot/-/commit/2c0d7b72c0993a55c8dcb7b38d85792e1bf6e8bc
and ultimately, I dropped the X.org dependency also on python-pymupdf:
https://gitlab.com/buildroot.org/buildroot/-/commit/edfa6f29785e618b75739b702fc863ee2410908d
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Buildroot] [PATCH v2 2/5] support/testing: add new test for python-pymupdf
2024-06-07 16:32 ` [Buildroot] [PATCH v2 2/5] support/testing: add new test for python-pymupdf Raphaël Mélotte via buildroot
@ 2024-07-13 20:35 ` Thomas Petazzoni via buildroot
2024-08-12 9:51 ` Peter Korsgaard
0 siblings, 1 reply; 21+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-07-13 20:35 UTC (permalink / raw)
To: Raphaël Mélotte via buildroot; +Cc: Raphaël Mélotte
Hello,
On Fri, 7 Jun 2024 18:32:03 +0200
Raphaël Mélotte via buildroot <buildroot@buildroot.org> wrote:
> To give us a chance to catch runtime issues (such as missing
> dependencies) more easily, add a test that writes a sample PDF file,
> read it back and verify the text that was read.
>
> Like similar packages that lead to a big
> rootfs (e.g. python-botocore), this test requires a separate ext2
> rootfs to avoid filling the default amount of RAM available
> entirely (which would cause missing files from the root filesystem and
> in turn, test failures).
>
> Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
Very good idea to have a test!
> +class TestPythonPy3PyMuPDF(TestPythonPackageBase):
> + __test__ = True
> + config = TestPythonPackageBase.config + \
> + """
> + BR2_PACKAGE_PYTHON3=y
> + BR2_PACKAGE_PYTHON_PYMUPDF=y
> + BR2_PACKAGE_XORG7=y
In fact was not needed.
> + BR2_USE_WCHAR=y
> + BR2_INSTALL_LIBSTDCPP=y
These two options were not relevant, our TestPythonPackageBase.config
use an external toolchain by default.
> + BR2_TARGET_ROOTFS_EXT2=y
> + BR2_TARGET_ROOTFS_EXT2_SIZE="250M"
Reduced to 120M, which was enough now that we no longer have X.org.
Applied with those changes!
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Buildroot] [PATCH v2 3/5] package/mupdf: fix building shared libraries
2024-06-07 16:32 ` [Buildroot] [PATCH v2 3/5] package/mupdf: fix building shared libraries Raphaël Mélotte via buildroot
@ 2024-07-13 20:36 ` Thomas Petazzoni via buildroot
2024-08-12 9:14 ` Peter Korsgaard
1 sibling, 0 replies; 21+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-07-13 20:36 UTC (permalink / raw)
To: Raphaël Mélotte via buildroot; +Cc: Raphaël Mélotte
On Fri, 7 Jun 2024 18:32:04 +0200
Raphaël Mélotte via buildroot <buildroot@buildroot.org> wrote:
> +ifeq ($(BR2_STATIC_LIBS),y)
> +MUPDF_MAKE_OPTS += shared=no
> +else
> +MUPDF_MAKE_OPTS += shared=yes
> +endif
This allowed to also drop the manual addition of -fPIC, because it's
done automatically by the package Makefile when shared=yes.
See https://gitlab.com/buildroot.org/buildroot/-/commit/401162d4a947184654d8202392425a625d000172
Applied with this change. Thanks!
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Buildroot] [PATCH v2 4/5] package/mupdf: bump to version 1.23.9
2024-06-07 16:32 ` [Buildroot] [PATCH v2 4/5] package/mupdf: bump to version 1.23.9 Raphaël Mélotte via buildroot
@ 2024-07-13 20:36 ` Thomas Petazzoni via buildroot
0 siblings, 0 replies; 21+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-07-13 20:36 UTC (permalink / raw)
To: Raphaël Mélotte via buildroot
Cc: James Hilliard, Raphaël Mélotte
On Fri, 7 Jun 2024 18:32:05 +0200
Raphaël Mélotte via buildroot <buildroot@buildroot.org> wrote:
> From: James Hilliard <james.hilliard1@gmail.com>
>
> Drop patch which is now upstream.
>
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> [bump to 1.23.9]
> Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
> ---
> ...issing-limits.h-include-for-UINT_MAX.patch | 70 -------------------
> package/mupdf/mupdf.hash | 4 +-
> package/mupdf/mupdf.mk | 2 +-
> 3 files changed, 3 insertions(+), 73 deletions(-)
> delete mode 100644 package/mupdf/0001-Add-missing-limits.h-include-for-UINT_MAX.patch
Applied to master, thanks.
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Buildroot] [PATCH v2 5/5] package/python-pymupdf: bump to version 1.23.22
2024-06-07 16:32 ` [Buildroot] [PATCH v2 5/5] package/python-pymupdf: bump to version 1.23.22 Raphaël Mélotte via buildroot
@ 2024-07-13 20:38 ` Thomas Petazzoni via buildroot
0 siblings, 0 replies; 21+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-07-13 20:38 UTC (permalink / raw)
To: Raphaël Mélotte via buildroot
Cc: James Hilliard, Raphaël Mélotte, Asaf Kahlon
Hello,
On Fri, 7 Jun 2024 18:32:06 +0200
Raphaël Mélotte via buildroot <buildroot@buildroot.org> wrote:
> This new python-pymupdf version fails at runtime when mupdf builds
> static libraries. This should not be possible as xorg anyway depends
> on !BR2_STATIC_LIBS, but let's be explicit and forbid python-pymupdf
> to be built with BR2_STATIC_LIBS as well.
I dropped the last sentence because X.org is no longer a dependency.
> -# python-pymupdf's version must match mupdf's version
> +# python-pymupdf's version be compatible with mupdf's version
*must be*
> diff --git a/package/python-pymupdf/0001-pipcl.py-allow-providing-python-config-externally.patch b/package/python-pymupdf/0001-pipcl.py-allow-providing-python-config-externally.patch
> new file mode 100644
> index 0000000000..2fd72c711e
> --- /dev/null
> +++ b/package/python-pymupdf/0001-pipcl.py-allow-providing-python-config-externally.patch
> @@ -0,0 +1,125 @@
> +From ca3417b8d605ccdb2e6c516c5e0c79180381627c Mon Sep 17 00:00:00 2001
> +From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= <raphael.melotte@mind.be>
> +Date: Sun, 4 Feb 2024 16:13:45 +0100
> +Subject: [PATCH] pipcl.py: allow providing python-config externally
> +MIME-Version: 1.0
> +Content-Type: text/plain; charset=UTF-8
> +Content-Transfer-Encoding: 8bit
> +
> +When cross-compiling (e.g. using Buildroot), the python-config
> +executable that resides next to the host python executable provides
> +incorrect includes (the ones for the host).
> +
> +Since the correct path to python-config cannot be guessed, add an
> +additional environment variable to allow setting the path to the
> +correct python-config executable externally.
> +
> +Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
> +Upstream: https://github.com/pymupdf/PyMuPDF/pull/3173
I changed this to the final commit, since it got merged upstream!
> diff --git a/package/python-pymupdf/Config.in b/package/python-pymupdf/Config.in
> index 3831a25451..cfdd38ebe4 100644
> --- a/package/python-pymupdf/Config.in
> +++ b/package/python-pymupdf/Config.in
> @@ -4,6 +4,7 @@ config BR2_PACKAGE_PYTHON_PYMUPDF
> depends on BR2_TOOLCHAIN_HAS_SYNC_4 # mupdf -> harfbuzz
> depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # mupdf -> harfbuzz
> depends on BR2_PACKAGE_XORG7
> + depends on !BR2_STATIC_LIBS
> select BR2_PACKAGE_HOST_SWIG
> select BR2_PACKAGE_FREETYPE
> select BR2_PACKAGE_MUPDF
Config.in comment update was missing for the !BR2_STATIC_LIBS dependency.
> -# python-pymupdf's version must match mupdf's version
> -PYTHON_PYMUPDF_VERSION = 1.22.0
> +# python-pymupdf's version be compatible with mupdf's version
> +PYTHON_PYMUPDF_VERSION = 1.23.22
> PYTHON_PYMUPDF_SOURCE = PyMuPDF-$(PYTHON_PYMUPDF_VERSION).tar.gz
> -PYTHON_PYMUPDF_SITE = https://files.pythonhosted.org/packages/28/ba/d6bb6fd678e8396d7b944870286fb25fd6f499b8cb599b5436c8f725adbf
> -PYTHON_PYMUPDF_SETUP_TYPE = setuptools
> +PYTHON_PYMUPDF_SITE = https://files.pythonhosted.org/packages/05/20/a0d1221d8f379afcc12b4d1687a8f4adb69eef659e835d781c3fa331ff46
> +PYTHON_PYMUPDF_SETUP_TYPE = pep517
This change was actually wrong. Keep "setuptools" is the same as
pep517, except that we don't have to manually add the dependency on
host-python-setuptools. Of course assuming I did not misunderstand the
Python infrastructure :-)
Applied with those changes. Thanks a lot for this series, and sorry for
the time it took to get it merged!
Best regards,
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Buildroot] [PATCH v2 3/5] package/mupdf: fix building shared libraries
2024-06-07 16:32 ` [Buildroot] [PATCH v2 3/5] package/mupdf: fix building shared libraries Raphaël Mélotte via buildroot
2024-07-13 20:36 ` Thomas Petazzoni via buildroot
@ 2024-08-12 9:14 ` Peter Korsgaard
1 sibling, 0 replies; 21+ messages in thread
From: Peter Korsgaard @ 2024-08-12 9:14 UTC (permalink / raw)
To: Raphaël Mélotte via buildroot; +Cc: Raphaël Mélotte
>>>>> "Raphaël" == Raphaël Mélotte via buildroot <buildroot@buildroot.org> writes:
> By default mupdf generates static libraries, shared libraries must be
> enabled explicitely.
> Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
> ---
> Changes v1 -> v2:
> - Remove SHARED_STATIC_LIBS depends and use explicit options.
Committed to 2024.02.x and 2024.05.x, thanks.
--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Buildroot] [PATCH v2 1/5] package: python-pymupdf: add missing python-zlib dependency
2024-07-13 20:34 ` [Buildroot] [PATCH v2 1/5] package: python-pymupdf: add missing python-zlib dependency Thomas Petazzoni via buildroot
@ 2024-08-12 9:51 ` Peter Korsgaard
0 siblings, 0 replies; 21+ messages in thread
From: Peter Korsgaard @ 2024-08-12 9:51 UTC (permalink / raw)
To: Thomas Petazzoni via buildroot
Cc: Asaf Kahlon, James Hilliard, Raphaël Mélotte,
Thomas Petazzoni
>>>>> "Thomas" == Thomas Petazzoni via buildroot <buildroot@buildroot.org> writes:
> On Fri, 7 Jun 2024 18:32:02 +0200
> Raphaël Mélotte via buildroot <buildroot@buildroot.org> wrote:
>> It turns out that python-pymupdf doesn't require zlib directly, but it
>> does require the zlib python module.
>>
>> This fixes the following runtime error:
>>
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> File "/usr/lib/python3.11/site-packages/fitz/__init__.py", line 22, in <module>
>> File "/usr/lib/python3.11/site-packages/fitz/fitz.py", line 3402, in <module>
>> File "/usr/lib/python3.11/gzip.py", line 9, in <module>
>> ModuleNotFoundError: No module named 'zlib'
>>
>> Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
> You had forgotten to drop the "zlib" dependency in MUPDF_DEPENDENCIES,
> so I dropped it as well. And applied your patch!
> And in fact this lead me to look more into mupdf, and I was curious to
> see why it depended on X11. Except it does not: it is a purely optional
> dependency. And I found other things that were not correct/useful
> anymore in the package so I did a few preparation commits:
> https://gitlab.com/buildroot.org/buildroot/-/commit/f7deaa1330baad303afb76a7711faeeb1ddfee5d
> https://gitlab.com/buildroot.org/buildroot/-/commit/90f0a484671098f9a94ce66b8f8af94e106ae106
> https://gitlab.com/buildroot.org/buildroot/-/commit/2c0d7b72c0993a55c8dcb7b38d85792e1bf6e8bc
> and ultimately, I dropped the X.org dependency also on python-pymupdf:
> https://gitlab.com/buildroot.org/buildroot/-/commit/edfa6f29785e618b75739b702fc863ee2410908d
Committed all 4 to 2024.02.x and 2024.05.x, thanks.
--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Buildroot] [PATCH v2 2/5] support/testing: add new test for python-pymupdf
2024-07-13 20:35 ` Thomas Petazzoni via buildroot
@ 2024-08-12 9:51 ` Peter Korsgaard
0 siblings, 0 replies; 21+ messages in thread
From: Peter Korsgaard @ 2024-08-12 9:51 UTC (permalink / raw)
To: Thomas Petazzoni via buildroot
Cc: Raphaël Mélotte, Thomas Petazzoni
>>>>> "Thomas" == Thomas Petazzoni via buildroot <buildroot@buildroot.org> writes:
> Hello,
> On Fri, 7 Jun 2024 18:32:03 +0200
> Raphaël Mélotte via buildroot <buildroot@buildroot.org> wrote:
>> To give us a chance to catch runtime issues (such as missing
>> dependencies) more easily, add a test that writes a sample PDF file,
>> read it back and verify the text that was read.
>>
>> Like similar packages that lead to a big
>> rootfs (e.g. python-botocore), this test requires a separate ext2
>> rootfs to avoid filling the default amount of RAM available
>> entirely (which would cause missing files from the root filesystem and
>> in turn, test failures).
>>
>> Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
> Very good idea to have a test!
>> +class TestPythonPy3PyMuPDF(TestPythonPackageBase):
>> + __test__ = True
>> + config = TestPythonPackageBase.config + \
>> + """
>> + BR2_PACKAGE_PYTHON3=y
>> + BR2_PACKAGE_PYTHON_PYMUPDF=y
>> + BR2_PACKAGE_XORG7=y
> In fact was not needed.
>> + BR2_USE_WCHAR=y
>> + BR2_INSTALL_LIBSTDCPP=y
> These two options were not relevant, our TestPythonPackageBase.config
> use an external toolchain by default.
>> + BR2_TARGET_ROOTFS_EXT2=y
>> + BR2_TARGET_ROOTFS_EXT2_SIZE="250M"
> Reduced to 120M, which was enough now that we no longer have X.org.
> Applied with those changes!
Committed to 2024.02.x and 2024.05.x, thanks.
--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2024-08-12 9:51 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-16 21:13 [Buildroot] [PATCH 0/5] package/python-pymupdf: bump to version 1.23.22 Raphaël Mélotte via buildroot
2024-02-16 21:13 ` [Buildroot] [PATCH 1/5] package: python-pymupdf: add missing python-zlib dependency Raphaël Mélotte via buildroot
2024-06-07 16:32 ` [Buildroot] [PATCH v2 " Raphaël Mélotte via buildroot
2024-06-07 16:32 ` [Buildroot] [PATCH v2 2/5] support/testing: add new test for python-pymupdf Raphaël Mélotte via buildroot
2024-07-13 20:35 ` Thomas Petazzoni via buildroot
2024-08-12 9:51 ` Peter Korsgaard
2024-06-07 16:32 ` [Buildroot] [PATCH v2 3/5] package/mupdf: fix building shared libraries Raphaël Mélotte via buildroot
2024-07-13 20:36 ` Thomas Petazzoni via buildroot
2024-08-12 9:14 ` Peter Korsgaard
2024-06-07 16:32 ` [Buildroot] [PATCH v2 4/5] package/mupdf: bump to version 1.23.9 Raphaël Mélotte via buildroot
2024-07-13 20:36 ` Thomas Petazzoni via buildroot
2024-06-07 16:32 ` [Buildroot] [PATCH v2 5/5] package/python-pymupdf: bump to version 1.23.22 Raphaël Mélotte via buildroot
2024-07-13 20:38 ` Thomas Petazzoni via buildroot
2024-07-13 20:34 ` [Buildroot] [PATCH v2 1/5] package: python-pymupdf: add missing python-zlib dependency Thomas Petazzoni via buildroot
2024-08-12 9:51 ` Peter Korsgaard
2024-02-16 21:13 ` [Buildroot] [PATCH 2/5] support/testing: add new test for python-pymupdf Raphaël Mélotte via buildroot
2024-02-16 21:13 ` [Buildroot] [PATCH 3/5] package/mupdf: fix building shared libraries Raphaël Mélotte via buildroot
2024-04-01 20:06 ` Arnout Vandecappelle via buildroot
2024-06-07 16:44 ` Raphaël Mélotte via buildroot
2024-02-16 21:13 ` [Buildroot] [PATCH 4/5] package/mupdf: bump to version 1.23.9 Raphaël Mélotte via buildroot
2024-02-16 21:13 ` [Buildroot] [PATCH 5/5] package/python-pymupdf: bump to version 1.23.22 Raphaël Mélotte via buildroot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox