diff --git a/.gitignore b/.gitignore index 40b953b..8fe3b07 100644 --- a/.gitignore +++ b/.gitignore @@ -78,3 +78,4 @@ /PyMuPDF-1.23.6.tar.gz /PyMuPDF-1.23.7.tar.gz /PyMuPDF-1.23.8.tar.gz +/PyMuPDF-1.23.21.tar.gz diff --git a/0001-adjust-tesseract-tessdata-path-to-Fedora-default.patch b/0001-adjust-tesseract-tessdata-path-to-Fedora-default.patch index e5278e8..fa68782 100644 --- a/0001-adjust-tesseract-tessdata-path-to-Fedora-default.patch +++ b/0001-adjust-tesseract-tessdata-path-to-Fedora-default.patch @@ -1,19 +1,19 @@ -From 3c82c4cc53c9364a36acdc15dc61cf8e51b686e9 Mon Sep 17 00:00:00 2001 -Message-ID: <3c82c4cc53c9364a36acdc15dc61cf8e51b686e9.1695667003.git.mjg@fedoraproject.org> +From f4ad394a522c8f217334e79c049e2daa21d25b46 Mon Sep 17 00:00:00 2001 +Message-ID: From: Michael J Gruber Date: Mon, 25 Sep 2023 20:36:37 +0200 Subject: [PATCH] adjust tesseract tessdata path to Fedora default --- - fitz/helper-python.i | 2 +- - src/__init__.py | 2 +- + src/__init__.py | 2 +- + src_classic/helper-python.i | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -diff --git a/fitz/helper-python.i b/fitz/helper-python.i -index c48a1ee..ae723dd 100644 ---- a/fitz/helper-python.i -+++ b/fitz/helper-python.i -@@ -2081,7 +2081,7 @@ def get_tessdata() -> str: +diff --git a/src/__init__.py b/src/__init__.py +index 321b2059..e1e47939 100644 +--- a/src/__init__.py ++++ b/src/__init__.py +@@ -18146,7 +18146,7 @@ def get_tessdata() -> str: if sys.platform == "win32": tessdata = "C:\\Program Files\\Tesseract-OCR\\tessdata" else: @@ -22,11 +22,11 @@ index c48a1ee..ae723dd 100644 if os.path.exists(tessdata): return tessdata -diff --git a/src/__init__.py b/src/__init__.py -index ef536d4..0f255b0 100644 ---- a/src/__init__.py -+++ b/src/__init__.py -@@ -17454,7 +17454,7 @@ def get_tessdata() -> str: +diff --git a/src_classic/helper-python.i b/src_classic/helper-python.i +index 6ca431e1..01663cf7 100644 +--- a/src_classic/helper-python.i ++++ b/src_classic/helper-python.i +@@ -2098,7 +2098,7 @@ def get_tessdata() -> str: if sys.platform == "win32": tessdata = "C:\\Program Files\\Tesseract-OCR\\tessdata" else: @@ -36,5 +36,5 @@ index ef536d4..0f255b0 100644 if os.path.exists(tessdata): return tessdata -- -2.42.0.589.g6937364c1b +2.43.0.710.g31023adb55 diff --git a/0001-fix-test_-font.patch b/0001-fix-test_-font.patch index 807d2c3..1a9f0b9 100644 --- a/0001-fix-test_-font.patch +++ b/0001-fix-test_-font.patch @@ -1,5 +1,5 @@ -From 35b5f8489385ea84a5dc0300cd216feee9772415 Mon Sep 17 00:00:00 2001 -Message-ID: <35b5f8489385ea84a5dc0300cd216feee9772415.1681574102.git.mjg@fedoraproject.org> +From 17289c8e8a8e41edd2111c462b0f51ec0ac0ef24 Mon Sep 17 00:00:00 2001 +Message-ID: <17289c8e8a8e41edd2111c462b0f51ec0ac0ef24.1707427913.git.mjg@fedoraproject.org> From: Michael J Gruber Date: Sat, 15 Apr 2023 17:53:27 +0200 Subject: [PATCH] fix test_*font @@ -13,11 +13,11 @@ Adjust the tests to use the fallback font instead. 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_general.py b/tests/test_general.py -index 68da7fd..c5d45d3 100644 +index 44c4cbcd..2d66ccc8 100644 --- a/tests/test_general.py +++ b/tests/test_general.py -@@ -121,9 +121,9 @@ def test_bug1971(): - doc.close() +@@ -156,9 +156,9 @@ def test_bug1971(): + assert doc.is_closed def test_default_font(): - f = fitz.Font() @@ -29,7 +29,7 @@ index 68da7fd..c5d45d3 100644 def test_add_ink_annot(): import math -@@ -186,7 +186,7 @@ def test_get_text_dict(): +@@ -221,7 +221,7 @@ def test_get_text_dict(): json.dumps( blocks, indent=4) def test_font(): @@ -39,5 +39,5 @@ index 68da7fd..c5d45d3 100644 bbox = font.glyph_bbox( 65) print( f'bbox={bbox!r}') -- -2.40.0.414.g17ff5447bb +2.43.0.710.g31023adb55 diff --git a/0001-fix-type-error-with-GCC-14.patch b/0001-fix-type-error-with-GCC-14.patch index 971a445..e1e562b 100644 --- a/0001-fix-type-error-with-GCC-14.patch +++ b/0001-fix-type-error-with-GCC-14.patch @@ -1,26 +1,26 @@ -From a24172d8aea49b4d63f134ba2857e45bb353f2b7 Mon Sep 17 00:00:00 2001 -Message-ID: +From 4c897cdfa1ade8d1fc61a9c812f48a63a30b3e85 Mon Sep 17 00:00:00 2001 +Message-ID: <4c897cdfa1ade8d1fc61a9c812f48a63a30b3e85.1707428203.git.mjg@fedoraproject.org> From: Michael J Gruber Date: Fri, 2 Feb 2024 22:20:42 +0100 Subject: [PATCH] fix type error with GCC 14 --- - fitz/fitz.i | 2 +- + src_classic/fitz_old.i | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/fitz/fitz.i b/fitz/fitz.i -index 15104bab..21c824bc 100644 ---- a/fitz/fitz.i -+++ b/fitz/fitz.i -@@ -155,7 +155,7 @@ static void show(const char* prefix, PyObject* obj); - // additional headers ---------------------------------------------- +diff --git a/src_classic/fitz_old.i b/src_classic/fitz_old.i +index 8c67d2a3..dbd80358 100644 +--- a/src_classic/fitz_old.i ++++ b/src_classic/fitz_old.i +@@ -156,7 +156,7 @@ static void show(const char* prefix, PyObject* obj); + #if FZ_VERSION_MAJOR == 1 && FZ_VERSION_MINOR == 23 && FZ_VERSION_PATCH < 8 pdf_obj *pdf_lookup_page_loc(fz_context *ctx, pdf_document *doc, int needle, pdf_obj **parentp, int *indexp); fz_pixmap *fz_scale_pixmap(fz_context *ctx, fz_pixmap *src, float x, float y, float w, float h, const fz_irect *clip); -int fz_pixmap_size(fz_context *ctx, fz_pixmap *src); +size_t fz_pixmap_size(fz_context *ctx, fz_pixmap *src); void fz_subsample_pixmap(fz_context *ctx, fz_pixmap *tile, int factor); void fz_copy_pixmap_rect(fz_context *ctx, fz_pixmap *dest, fz_pixmap *src, fz_irect b, const fz_default_colorspaces *default_cs); - static const float JM_font_ascender(fz_context *ctx, fz_font *font); + void fz_write_pixmap_as_jpeg(fz_context *ctx, fz_output *out, fz_pixmap *pix, int jpg_quality); -- -2.43.0.692.g719022bfa2 +2.43.0.710.g31023adb55 diff --git a/0001-src-__init__.py-JM_image_reporter-work-with-change-t.patch b/0001-src-__init__.py-JM_image_reporter-work-with-change-t.patch new file mode 100644 index 0000000..6cb84b7 --- /dev/null +++ b/0001-src-__init__.py-JM_image_reporter-work-with-change-t.patch @@ -0,0 +1,35 @@ +From c07c8683d18c52ecd80dc6d85d9b90f28453f1d6 Mon Sep 17 00:00:00 2001 +Message-ID: +From: Julian Smith +Date: Thu, 1 Feb 2024 15:30:57 +0000 +Subject: [PATCH] src/__init__.py: JM_image_reporter(): work with change to + mupdf master. + +New mupdf has extra `fz_rect scissor` arg in +pdf_sanitize_filter_options::image_filter(). +--- + src/__init__.py | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/src/__init__.py b/src/__init__.py +index ef6b1d9c..321b2059 100644 +--- a/src/__init__.py ++++ b/src/__init__.py +@@ -16042,8 +16042,12 @@ def JM_image_reporter(page): + def __init__(self): + super().__init__() + self.use_virtual_image_filter() +- def image_filter(self, ctx, ctm, name, image): +- JM_image_filter(None, mupdf.FzMatrix(ctm), name, image) ++ if mupdf_version_tuple >= (1, 24): ++ def image_filter(self, ctx, ctm, name, image, scissor): ++ JM_image_filter(None, mupdf.FzMatrix(ctm), name, image) ++ else: ++ def image_filter(self, ctx, ctm, name, image): ++ JM_image_filter(None, mupdf.FzMatrix(ctm), name, image) + + sanitize_filter_options = SanitizeFilterOptions() + +-- +2.43.0.710.g31023adb55 + diff --git a/0001-test_pixmap-adjust-to-turbojpeg.patch b/0001-test_pixmap-adjust-to-turbojpeg.patch index 1c653de..94ea6bd 100644 --- a/0001-test_pixmap-adjust-to-turbojpeg.patch +++ b/0001-test_pixmap-adjust-to-turbojpeg.patch @@ -1,5 +1,5 @@ -From 735ce0fb7bf1938ead530b7138499464c6127f96 Mon Sep 17 00:00:00 2001 -Message-ID: <735ce0fb7bf1938ead530b7138499464c6127f96.1683816092.git.mjg@fedoraproject.org> +From d755e35a74fe6a32bd8cca465f2b05184d39207a Mon Sep 17 00:00:00 2001 +Message-ID: From: Michael J Gruber Date: Thu, 11 May 2023 16:40:03 +0200 Subject: [PATCH] test_pixmap: adjust to turbojpeg @@ -12,12 +12,12 @@ format. 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_pixmap.py b/tests/test_pixmap.py -index 889858b..420245e 100644 +index 3c4a1be5..49a897e3 100644 --- a/tests/test_pixmap.py +++ b/tests/test_pixmap.py -@@ -91,7 +91,7 @@ def test_setalpha(): - - def test_color_count(): +@@ -99,7 +99,7 @@ def test_color_count(): + e.g. in Linux system installs. + ''' pm = fitz.Pixmap(imgfile) - assert pm.color_count() == 40624 + assert pm.color_count() == 39912 @@ -25,5 +25,5 @@ index 889858b..420245e 100644 def test_memoryview(): pm = fitz.Pixmap(imgfile) -- -2.40.1.683.g916cfae490 +2.43.0.710.g31023adb55 diff --git a/python-PyMuPDF.spec b/python-PyMuPDF.spec index fd525ac..eb86f5f 100644 --- a/python-PyMuPDF.spec +++ b/python-PyMuPDF.spec @@ -2,7 +2,7 @@ %global module_name fitz Name: python-%{pypi_name} -Version: 1.23.8 +Version: 1.23.21 Release: %autorelease Summary: Python binding for MuPDF - a lightweight PDF and XPS viewer @@ -13,6 +13,7 @@ Patch0: 0001-fix-test_-font.patch Patch1: 0001-test_pixmap-adjust-to-turbojpeg.patch Patch2: 0001-adjust-tesseract-tessdata-path-to-Fedora-default.patch Patch3: 0001-fix-type-error-with-GCC-14.patch +Patch4: 0001-src-__init__.py-JM_image_reporter-work-with-change-t.patch BuildRequires: python3-devel BuildRequires: python3-fonttools @@ -21,13 +22,16 @@ BuildRequires: python3-pip BuildRequires: python3-psutil BuildRequires: python3-pytest BuildRequires: python3-sphinx +BuildRequires: python3-sphinx-copybutton +BuildRequires: python3-sphinx-notfound-page BuildRequires: python3-furo BuildRequires: rst2pdf BuildRequires: gcc gcc-c++ BuildRequires: swig BuildRequires: zlib-devel -BuildRequires: mupdf-devel +BuildRequires: mupdf-devel mupdf-cpp-devel BuildRequires: freetype-devel +BuildRequires: python3-mupdf %global _description %{expand: This is PyMuPDF, a Python binding for MuPDF - a lightweight PDF and XPS @@ -60,8 +64,8 @@ python-%{pypi_name}-doc contains documentation and examples for PyMuPDF export PYMUPDF_SETUP_MUPDF_BUILD_TYPE='debug' # build against system mupdf: export PYMUPDF_SETUP_MUPDF_BUILD='' -# build original implementation only: -export PYMUPDF_SETUP_IMPLEMENTATIONS='a' +# build rebased implementation only: +export PYMUPDF_SETUP_IMPLEMENTATIONS='b' CFLAGS="$CFLAGS -I/usr/include -I/usr/include/freetype2 -I/usr/include/mupdf" LDFLAGS="$LDFLAGS -lfreetype -lmupdf" %pyproject_wheel @@ -71,13 +75,25 @@ sphinx-build docs docs_built %pyproject_install %check -# FIXME: Crashes with Aborted, corrupted double-linked list -%ifarch s390 s390x -%pytest || : -%else # test_fontarchives tries to download special module via pip -%pytest -k 'not test_fontarchive' +SKIP="not test_fontarchive" +# flake8 has no place in downstream packaging +SKIP="$SKIP and not test_flake8" +# test_3050 is known to fail for distribution builds +SKIP="$SKIP and not test_3050" +# test_subset_fonts needs pymupdf_fonts +SKIP="$SKIP and not test_subset_fonts" +# test_fit_springer depends on font library version (harfbuzz etc) +SKIP="$SKIP and not test_fit_springer" +%ifarch s390 s390x +# test_3087 crashes on s390 s390x (bigendian mask problem?) +SKIP="$SKIP and not test_3087" +# test_htmlbox1 fails on s390 s390x (bigendian unicode problem?) +SKIP="$SKIP and not test_htmlbox1" %endif +# spuriously failing tests (several archs) +SKIP="$SKIP and not test_insert and not test_3087" +%pytest -k "$SKIP" %files -n python3-%{pypi_name} %license COPYING diff --git a/sources b/sources index 0b6d356..2204d51 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (PyMuPDF-1.23.8.tar.gz) = 6266ce8711dc62a467c07ef22b6e22acb81c7a3ba224749af385a23c7ac3435504c9cf0a7d8e2459eba50e11f86bb3f79857fa3b722ab66eff10b554d3e4c7b5 +SHA512 (PyMuPDF-1.23.21.tar.gz) = eaae1adc10bc1ad31d4137b390fdb0b8d94d6d420feeb63ab544a740178031e04c71bc0d63f2d4b3bc2b016a2f57286961d28a2b7c0d0f74fd343b7cadd276a9