[Buildroot] [PATCH 2/3] package/mupdf, python-pymupdf: bump to version 1.24.9, 1.24.10
Raphaël Mélotte
raphael.melotte at mind.be
Mon Apr 7 10:39:57 UTC 2025
With this new python-pymupdf (and mupdf) version, we can no longer
build the old implementation (the 'a' implementation). We now need to
build mupdf's python binding, which require host-clang (and its python
bindings) to be built.
Note that python-mupdf's version still needs to stay close to mupdf's
version, they can only be updated together.
A number of mupdf patches were needed:
- To allow changing the build-time log level from an environment
variable.
- To be able to provide the libclang include directories. This is
needed because our default libclang include directories are not
properly set.
- To be able to link against mupdf with no versioning number.
In mupdf, we need to set a number of environment variables:
- VENV_FLAG: to tell mupdf that it should not create a venv at build
time.
- MUPDF_LIBCLANG_ARGS: to provide the right include directories to
clang's python bindings.
- PIPCL_PYTHON_CONFIG: so that pipcl uses our python3-config and not
the host one.
- JLIB_log_levels: to get libclang's diagnostics when building.
Setting JLIB_log_levels is not strictly necessary, but it
greatly helps debugging build issues. It also only has an impact at
build time anyway. To make it easier to debug potential future CI
build failures, we enable it unconditionally.
In python-pymupdf, !BR2_STATIC_LIBS is now required by mupdf anyway,
so update the comment accordingly.
The patch that is now upstream is also removed, and the test is
updated to use the new implementation.
These new versions no longer fit in a 120M rootfs, so double its size.
Signed-off-by: Raphaël Mélotte <raphael.melotte at mind.be>
---
...-jlib-fix-setting-filename-log-level.patch | 48 +++++++
...y-to-provide-libclang-include-dirs-e.patch | 53 ++++++++
...e-non-versioned-symlink-to-the-build.patch | 35 +++++
...-log-level-through-environement-vari.patch | 53 ++++++++
...rted-operand-type-when-setting-log-l.patch | 44 ++++++
package/mupdf/Config.in | 8 ++
package/mupdf/mupdf.hash | 4 +-
package/mupdf/mupdf.mk | 37 +++++-
...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 | 7 +-
.../tests/package/sample_python_pymupdf.py | 2 +-
.../tests/package/test_python_pymupdf.py | 2 +-
14 files changed, 288 insertions(+), 137 deletions(-)
create mode 100644 package/mupdf/0001-jlib-fix-setting-filename-log-level.patch
create mode 100644 package/mupdf/0001-scripts-add-a-way-to-provide-libclang-include-dirs-e.patch
create mode 100644 package/mupdf/0001-setup.py-add-the-non-versioned-symlink-to-the-build.patch
create mode 100644 package/mupdf/0002-jlib-fix-setting-log-level-through-environement-vari.patch
create mode 100644 package/mupdf/0003-jlib-fix-unsupported-operand-type-when-setting-log-l.patch
delete mode 100644 package/python-pymupdf/0001-pipcl.py-allow-providing-python-config-externally.patch
diff --git a/package/mupdf/0001-jlib-fix-setting-filename-log-level.patch b/package/mupdf/0001-jlib-fix-setting-filename-log-level.patch
new file mode 100644
index 0000000000..2a0e62b870
--- /dev/null
+++ b/package/mupdf/0001-jlib-fix-setting-filename-log-level.patch
@@ -0,0 +1,48 @@
+From 553bb924e032646739362c586adbcd5e931f02b9 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= <raphael.melotte at mind.be>
+Date: Mon, 24 Feb 2025 13:06:00 +0100
+Subject: [PATCH] jlib: fix setting filename log level
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Building using JLIB_log_levels for filenames only currently fails.
+
+For example, building with the following command:
+make JLIB_log_levels=cpp.py=-5 python
+
+... leads to the following trace:
+
+ File "/home/rme/Documents/mupdf/scripts/jlib.py", line 427, in log
+ level += log_levels_find( caller)
+ ^^^^^^^^^^^^^^^^^^^^^^^^
+ File "/home/rme/Documents/mupdf/scripts/jlib.py", line 350, in log_levels_find
+ if item_filename and not filename.startswith( item_filename):
+
+This is because ffl is always a list (unpacked in case len==2), and
+the filename is the first element of this list.
+To fix it, only keep the first element of ffl when there is exactly
+one.
+
+Upstream: https://github.com/ArtifexSoftware/mupdf/pull/58
+Signed-off-by: Raphaël Mélotte <raphael.melotte at mind.be>
+---
+ scripts/jlib.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/scripts/jlib.py b/scripts/jlib.py
+index 8d7ecc6cd..4c7e2a0f0 100644
+--- a/scripts/jlib.py
++++ b/scripts/jlib.py
+@@ -509,7 +509,7 @@ def log_levels_add_env( name='JLIB_log_levels'):
+ if 0: # lgtm [py/unreachable-statement]
+ pass
+ elif len( ffl) == 1:
+- filename = ffl
++ filename = ffl[0]
+ function = None
+ elif len( ffl) == 2:
+ filename, function = ffl
+--
+2.48.1
+
diff --git a/package/mupdf/0001-scripts-add-a-way-to-provide-libclang-include-dirs-e.patch b/package/mupdf/0001-scripts-add-a-way-to-provide-libclang-include-dirs-e.patch
new file mode 100644
index 0000000000..588f2f004b
--- /dev/null
+++ b/package/mupdf/0001-scripts-add-a-way-to-provide-libclang-include-dirs-e.patch
@@ -0,0 +1,53 @@
+From b2483d9d47c10895e94e54918ff6f2144f3ef5f9 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= <raphael.melotte at mind.be>
+Date: Thu, 20 Feb 2025 12:50:01 +0100
+Subject: [PATCH] scripts: add a way to provide libclang include dirs
+ externally
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+When cross-compiling, libclang doesn't necessarily have the right
+include directories configured by default.
+See for example: https://bugs.ghostscript.com/show_bug.cgi?id=708041
+
+Since we also have no way to figure out the right include directories
+from our scripts, add a new environment variable that can be used to
+provide them externally.
+
+Upstream: https://github.com/ArtifexSoftware/mupdf/pull/63
+Signed-off-by: Raphaël Mélotte <raphael.melotte at mind.be>
+---
+ scripts/wrap/cpp.py | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/scripts/wrap/cpp.py b/scripts/wrap/cpp.py
+index 80ab2dfbe..cb0bbd220 100644
+--- a/scripts/wrap/cpp.py
++++ b/scripts/wrap/cpp.py
+@@ -6,6 +6,7 @@ import io
+ import os
+ import pickle
+ import re
++import shlex
+ import textwrap
+
+ import jlib
+@@ -5311,6 +5312,14 @@ def cpp_source(
+ '-D', 'MUPDF_WRAP_LIBCLANG',
+ '-D', 'FZ_FUNCTION=',
+ ]
++
++ # In some circumstances (e.g. when cross-compiling when
++ # libclang doesn't have the right include directories by
++ # default) the includes are provided externally:
++ libclang_args = os.environ.get('MUPDF_LIBCLANG_ARGS', '')
++ if libclang_args:
++ args += shlex.split(libclang_args)
++
+ tu = index.parse(
+ temp_h,
+ args = args,
+--
+2.48.1
+
diff --git a/package/mupdf/0001-setup.py-add-the-non-versioned-symlink-to-the-build.patch b/package/mupdf/0001-setup.py-add-the-non-versioned-symlink-to-the-build.patch
new file mode 100644
index 0000000000..e99ced9cdc
--- /dev/null
+++ b/package/mupdf/0001-setup.py-add-the-non-versioned-symlink-to-the-build.patch
@@ -0,0 +1,35 @@
+From 0cb92558aeac286c058eae35a6bad0e2c8f0725e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= <raphael.melotte at mind.be>
+Date: Tue, 3 Sep 2024 15:35:33 +0200
+Subject: [PATCH] setup.py: add the non-versioned symlink to the build
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Starting from bf1c28cc4f2dd4bd17e35783fa3c1f98ded22296, the generated
+mupdf libraries are versioned. This means that if we want to link
+against them without knowing their version number (i.e. using
+'-lmupdf'), we also need to install the symlink to the wheel.
+
+Upstream: https://github.com/ArtifexSoftware/mupdf/pull/59
+Signed-off-by: Raphaël Mélotte <raphael.melotte at mind.be>
+---
+ setup.py | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/setup.py b/setup.py
+index 5411bd34b..0709e2ef6 100755
+--- a/setup.py
++++ b/setup.py
+@@ -354,6 +354,8 @@ def build():
+ names = [
+ pipcl.get_soname(f'{build_dir()}/libmupdf.so'), # C.
+ pipcl.get_soname(f'{build_dir()}/libmupdfcpp.so'), # C++.
++ f'{build_dir()}/libmupdf.so', # C symlink.
++ f'{build_dir()}/libmupdfcpp.so', # C++ symlink.
+ f'{build_dir()}/_mupdf.so', # Python internals.
+ f'{build_dir()}/mupdf.py', # Python.
+ ]
+--
+2.45.2
+
diff --git a/package/mupdf/0002-jlib-fix-setting-log-level-through-environement-vari.patch b/package/mupdf/0002-jlib-fix-setting-log-level-through-environement-vari.patch
new file mode 100644
index 0000000000..386dd2050e
--- /dev/null
+++ b/package/mupdf/0002-jlib-fix-setting-log-level-through-environement-vari.patch
@@ -0,0 +1,53 @@
+From e033e1a8b8a1674e1e7ee6638008bd005b511920 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= <raphael.melotte at mind.be>
+Date: Mon, 24 Feb 2025 22:29:13 +0100
+Subject: [PATCH] jlib: fix setting log level through environement variable
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Currently, setting a log level through the JLIB_log_levels environment
+fails in this way:
+ File "/home/rme/Documents/mupdf/scripts/jlib.py", line 185, in __call__
+ ret += ' (+%s)' % time_duration( time.time() - self.t0, s_format='%.1f')
+ ^^^^^^^^^^^^^
+This is because at the time log_levels_add_env() is invoked,
+time_duration is not defined yet.
+
+To fix it, just move the invocation further down, after time_duration
+is defined.
+
+Upstream: https://github.com/ArtifexSoftware/mupdf/pull/58
+Signed-off-by: Raphaël Mélotte <raphael.melotte at mind.be>
+---
+ scripts/jlib.py | 7 +++----
+ 1 file changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/scripts/jlib.py b/scripts/jlib.py
+index 4c7e2a0f0..788a4bec8 100644
+--- a/scripts/jlib.py
++++ b/scripts/jlib.py
+@@ -743,10 +743,6 @@ def text_split_last_of( text, substrings):
+ return text[ :pos], text[ pos:]
+
+
+-
+-log_levels_add_env()
+-
+-
+ def force_line_buffering():
+ '''
+ Ensure `sys.stdout` and `sys.stderr` are line-buffered. E.g. makes things
+@@ -1246,6 +1242,9 @@ def time_duration( seconds, verbose=False, s_format='%i'):
+ return ret
+
+
++log_levels_add_env()
++
++
+ def date_time( t=None):
+ if t is None:
+ t = time.time()
+--
+2.48.1
+
diff --git a/package/mupdf/0003-jlib-fix-unsupported-operand-type-when-setting-log-l.patch b/package/mupdf/0003-jlib-fix-unsupported-operand-type-when-setting-log-l.patch
new file mode 100644
index 0000000000..819f2d0a55
--- /dev/null
+++ b/package/mupdf/0003-jlib-fix-unsupported-operand-type-when-setting-log-l.patch
@@ -0,0 +1,44 @@
+From a568ae50e32e8b209edc9720360d873b10769f60 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= <raphael.melotte at mind.be>
+Date: Mon, 24 Feb 2025 22:48:36 +0100
+Subject: [PATCH] jlib: fix unsupported operand type when setting log level
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This fixes the following issue when log_levels_find() is used (for
+example when setting a log level delta using JLIB_log_levels):
+[...]
+ scripts/jlib.py:424:log(): level += log_levels_find( caller)
+ scripts/jlib.py:334:log_levels_find(): tb = traceback.extract_stack( None, 1+caller)
+TypeError: unsupported operand type(s) for +: 'int' and 'FrameInfo'
+
+Note that this fix get JLIB_log_levels working, but it might be
+incorrect.
+
+Upstream: https://github.com/ArtifexSoftware/mupdf/pull/58
+Signed-off-by: Raphaël Mélotte <raphael.melotte at mind.be>
+---
+ scripts/jlib.py | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/scripts/jlib.py b/scripts/jlib.py
+index 788a4bec8..452b3ae00 100644
+--- a/scripts/jlib.py
++++ b/scripts/jlib.py
+@@ -331,7 +331,11 @@ def log_levels_find( caller):
+ if not s_log_levels_items:
+ return 0
+
+- tb = traceback.extract_stack( None, 1+caller)
++ if isinstance(caller, inspect.FrameInfo):
++ tb = traceback.extract_stack( None, 1)
++ else:
++ tb = traceback.extract_stack( None, 1+caller)
++
+ if len(tb) == 0:
+ return 0
+ filename, line, function, text = tb[0]
+--
+2.48.1
+
diff --git a/package/mupdf/Config.in b/package/mupdf/Config.in
index 34c5e7d538..77c656dede 100644
--- a/package/mupdf/Config.in
+++ b/package/mupdf/Config.in
@@ -20,3 +20,11 @@ comment "mupdf needs a toolchain w/ C++, gcc >= 4.9"
depends on BR2_TOOLCHAIN_HAS_SYNC_4
depends on !BR2_INSTALL_LIBSTDCPP || \
!BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
+
+config BR2_PACKAGE_MUPDF_PYTHON_BINDINGS
+ bool "python bindings for mupdf"
+ depends on !BR2_STATIC_LIBS
+ depends on BR2_PACKAGE_PYTHON3
+ select BR2_PACKAGE_HOST_CLANG
+ select BR2_PACKAGE_HOST_CLANG_PYTHON_BINDINGS
+ select BR2_PACKAGE_HOST_SWIG
diff --git a/package/mupdf/mupdf.hash b/package/mupdf/mupdf.hash
index 580235eeca..ea739d2e33 100644
--- a/package/mupdf/mupdf.hash
+++ b/package/mupdf/mupdf.hash
@@ -1,8 +1,8 @@
# From https://mupdf.com/downloads/index.html:
-sha1 d79600bccd70ab9d0e8ee19dae4e275f2af95ced mupdf-1.23.9-source.tar.lz
+sha1 b7a876b7a9a7fff555f8fcc18184f767d120b03c mupdf-1.24.9-source.tar.lz
# Locally computed:
-sha256 2c2f89deb9f425ba637dac226191d547f2b40975c4d21a340965f52c001e15c5 mupdf-1.23.9-source.tar.lz
+sha256 d87da097ae943ad0113003190ed370d39bde817383c59dc753dce23c7ba2b710 mupdf-1.24.9-source.tar.lz
# Hash for license files:
sha256 57c8ff33c9c0cfc3ef00e650a1cc910d7ee479a8bc509f6c9209a7c2a11399d6 COPYING
diff --git a/package/mupdf/mupdf.mk b/package/mupdf/mupdf.mk
index 9eecb84232..493d46f77a 100644
--- a/package/mupdf/mupdf.mk
+++ b/package/mupdf/mupdf.mk
@@ -5,7 +5,7 @@
################################################################################
# python-pymupdf's version be compatible with mupdf's version
-MUPDF_VERSION = 1.23.9
+MUPDF_VERSION = 1.24.9
MUPDF_SOURCE = mupdf-$(MUPDF_VERSION)-source.tar.lz
MUPDF_SITE = https://mupdf.com/downloads/archive
MUPDF_LICENSE = AGPL-3.0+
@@ -36,6 +36,41 @@ ifeq ($(BR2_STATIC_LIBS),y)
MUPDF_MAKE_OPTS += shared=no
else
MUPDF_MAKE_OPTS += shared=yes
+
+ifeq ($(BR2_PACKAGE_MUPDF_PYTHON_BINDINGS),y)
+MUPDF_DEPENDENCIES += \
+ host-clang \
+ host-swig \
+ python3
+
+MUPDF_MAKE_ENV += \
+ VENV_FLAG="" \
+ MUPDF_LIBCLANG_ARGS="-I$(STAGING_DIR)/usr/include -I$(HOST_DIR)/lib/clang/$(HOST_CLANG_VERSION)/include" \
+ PIPCL_PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python3-config"
+
+# mupdf generates C++ code for its python bindings. As things can
+# easily go wrong, increase the log level as much as we can so that we
+# at least always see libclang's diagnostics:
+MUPDF_MAKE_ENV += JLIB_log_levels="/:=-5"
+
+define MUPDF_BUILD_PYTHON_BINDINGS
+ $(MUPDF_MAKE_ENV) $(MAKE) -C $(@D) $(MUPDF_MAKE_OPTS) python
+endef
+
+define MUPDF_INSTALL_PYTHON_BINDINGS_TO_STAGING
+ $(MUPDF_MAKE_ENV) $(MAKE) -C $(@D) $(MUPDF_MAKE_OPTS) \
+ DESTDIR="$(STAGING_DIR)" pydir=/usr/lib/python$(PYTHON3_VERSION_MAJOR) install-shared-python \
+ -o python -o c++ # skip rebuilding bindings
+endef
+define MUPDF_INSTALL_PYTHON_BINDINGS_TO_TARGET
+ $(MUPDF_MAKE_ENV) $(MAKE) -C $(@D) $(MUPDF_MAKE_OPTS) \
+ DESTDIR="$(TARGET_DIR)" pydir=/usr/lib/python$(PYTHON3_VERSION_MAJOR) install-shared-python \
+ -o python -o c++ # skip rebuilding bindings
+endef
+MUPDF_POST_BUILD_HOOKS += MUPDF_BUILD_PYTHON_BINDINGS
+MUPDF_POST_INSTALL_STAGING_HOOKS += MUPDF_INSTALL_PYTHON_BINDINGS_TO_STAGING
+MUPDF_POST_INSTALL_TARGET_HOOKS += MUPDF_INSTALL_PYTHON_BINDINGS_TO_TARGET
+endif
endif
ifeq ($(BR2_PACKAGE_XLIB_LIBX11)$(BR2_PACKAGE_XLIB_LIBXEXT),yy)
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
deleted file mode 100644
index 95aa3f7a21..0000000000
--- a/package/python-pymupdf/0001-pipcl.py-allow-providing-python-config-externally.patch
+++ /dev/null
@@ -1,125 +0,0 @@
-From ca3417b8d605ccdb2e6c516c5e0c79180381627c Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= <raphael.melotte at 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 at mind.be>
-Upstream: https://github.com/pymupdf/PyMuPDF/commit/3a214b0c144d86fd1329b26030f6b9f2a6b27020
----
- 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 e6e7c38c9e..810d642602 100644
--- a/package/python-pymupdf/Config.in
+++ b/package/python-pymupdf/Config.in
@@ -3,10 +3,11 @@ config BR2_PACKAGE_PYTHON_PYMUPDF
depends on BR2_INSTALL_LIBSTDCPP # mupdf -> harfbuzz
depends on BR2_TOOLCHAIN_HAS_SYNC_4 # mupdf -> harfbuzz
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # mupdf -> harfbuzz
- depends on !BR2_STATIC_LIBS # runtime failure
+ depends on !BR2_STATIC_LIBS # mupdf python bindings
select BR2_PACKAGE_HOST_SWIG
select BR2_PACKAGE_FREETYPE
select BR2_PACKAGE_MUPDF
+ select BR2_PACKAGE_MUPDF_PYTHON_BINDINGS
select BR2_PACKAGE_PYTHON3_ZLIB # runtime
help
Python bindings for the PDF rendering library MuPDF.
diff --git a/package/python-pymupdf/python-pymupdf.hash b/package/python-pymupdf/python-pymupdf.hash
index 341366d46f..407491442c 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 5c219a0c4cb3d57b60e39cc901ebd220 PyMuPDF-1.23.22.tar.gz
-sha256 c41cd91d83696cea67a4b6c65cc1951c2019ac0a561c5a3f543318ede30d3cd0 PyMuPDF-1.23.22.tar.gz
+md5 44b7f3d1a0bd0c203d058a3580043128 PyMuPDF-1.24.10.tar.gz
+sha256 bd3ebd6d3fb8a845582098362f885bfb0a31ae4272587efc2c55c5e29fe7327a PyMuPDF-1.24.10.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 1d6ad78bce..ae0fd9ed00 100644
--- a/package/python-pymupdf/python-pymupdf.mk
+++ b/package/python-pymupdf/python-pymupdf.mk
@@ -5,9 +5,9 @@
################################################################################
# python-pymupdf's version must be compatible with mupdf's version
-PYTHON_PYMUPDF_VERSION = 1.23.22
+PYTHON_PYMUPDF_VERSION = 1.24.10
PYTHON_PYMUPDF_SOURCE = PyMuPDF-$(PYTHON_PYMUPDF_VERSION).tar.gz
-PYTHON_PYMUPDF_SITE = https://files.pythonhosted.org/packages/05/20/a0d1221d8f379afcc12b4d1687a8f4adb69eef659e835d781c3fa331ff46
+PYTHON_PYMUPDF_SITE = https://files.pythonhosted.org/packages/83/57/da06ca4886afc71a624e4b463d05f45c8a822596ede939957295e229eb4e
PYTHON_PYMUPDF_SETUP_TYPE = setuptools
PYTHON_PYMUPDF_LICENSE = AGPL-3.0+
PYTHON_PYMUPDF_LICENSE_FILES = COPYING
@@ -18,8 +18,7 @@ PYTHON_PYMUPDF_BUILD_OPTS = --skip-dependency-check
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 \
+ PIPCL_PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python3-config" \
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 ffcbfa1140..574bd27965 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_old as fitz
+import fitz
# Write a test PDF file
outfile = "python-pymupdf.pdf"
diff --git a/support/testing/tests/package/test_python_pymupdf.py b/support/testing/tests/package/test_python_pymupdf.py
index 1af3efc8af..ac826f74ab 100644
--- a/support/testing/tests/package/test_python_pymupdf.py
+++ b/support/testing/tests/package/test_python_pymupdf.py
@@ -9,7 +9,7 @@ class TestPythonPy3PyMuPDF(TestPythonPackageBase):
BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_PYTHON_PYMUPDF=y
BR2_TARGET_ROOTFS_EXT2=y
- BR2_TARGET_ROOTFS_EXT2_SIZE="120M"
+ BR2_TARGET_ROOTFS_EXT2_SIZE="240M"
"""
sample_scripts = ["tests/package/sample_python_pymupdf.py"]
timeout = 30
--
2.34.1
More information about the buildroot
mailing list