Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Change Log
* Retrospectively mark `4544 <https://github.com/pymupdf/PyMuPDF/issues/4544>`_ as fixed in 1.26.4.


**Changes in version 1.26.4**
**Changes in version 1.26.4 (2025-08-25)**

* Use MuPDF-1.26.7.

Expand Down
40 changes: 32 additions & 8 deletions scripts/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@
--cibw-release-2
Set up so that `cibw` builds only linux-aarch64 wheel.

--cibw-skip-add-defaults 0|1
If 1 (the default) we add defaults to CIBW_SKIP such as `pp*` (to
exclude pypy) and `cp3??t-*` (to exclude free-threading).

--cibw-test-project 0|1
If 1, command `cibw` will use a minimal test project instead of the
PyMuPDF directory itself.
Expand Down Expand Up @@ -406,6 +410,7 @@ def main(argv):
cibw_name = None
cibw_pyodide = None
cibw_pyodide_version = None
cibw_skip_add_defaults = True
cibw_test_project = None
commands = list()
env_extra = dict()
Expand Down Expand Up @@ -474,7 +479,7 @@ def main(argv):
env_extra['CIBW_ARCHS_LINUX'] = 'auto64'
env_extra['CIBW_ARCHS_MACOS'] = 'auto64'
env_extra['CIBW_ARCHS_WINDOWS'] = 'auto' # win32 and win64.
env_extra['CIBW_SKIP'] = 'pp* *i686 cp36* cp37* *musllinux*aarch64*'
env_extra['CIBW_SKIP'] = '*musllinux*aarch64*'

elif arg == '--cibw-release-2':
env_extra['CIBW_ARCHS_LINUX'] = 'aarch64'
Expand All @@ -493,6 +498,9 @@ def main(argv):
elif arg == '--cibw-pyodide':
cibw_pyodide = int(next(args))

elif arg == '--cibw-skip-add-defaults':
cibw_skip_add_defaults = int(next(args))

elif arg == '--cibw-test-project':
cibw_test_project = int(next(args))

Expand Down Expand Up @@ -707,6 +715,7 @@ def main(argv):
cibw_pyodide_version,
cibw_sdist,
cibw_test_project,
cibw_skip_add_defaults,
)

elif command == 'install':
Expand Down Expand Up @@ -857,6 +866,7 @@ def cibuildwheel(
cibw_pyodide_version,
cibw_sdist,
cibw_test_project,
cibw_skip_add_defaults,
):

if cibw_sdist and platform.system() == 'Linux':
Expand All @@ -871,9 +881,19 @@ def cibuildwheel(
# Some general flags.
if 'CIBW_BUILD_VERBOSITY' not in env_extra:
env_extra['CIBW_BUILD_VERBOSITY'] = '1'
if 'CIBW_SKIP' not in env_extra:
env_extra['CIBW_SKIP'] = 'pp* *i686 cp36* cp37* *musllinux* *-win32 *-aarch64'


# Add default flags to CIBW_SKIP.
# 2025-10-07: `cp3??t-*` excludes free-threading, which currently breaks
# some tests.

if cibw_skip_add_defaults:
CIBW_SKIP = env_extra.get('CIBW_SKIP', '')
CIBW_SKIP += ' pp* *i686 cp36* cp37* *musllinux* *-win32 *-aarch64 cp3??t-*'
CIBW_SKIP = CIBW_SKIP.split()
CIBW_SKIP = sorted(list(set(CIBW_SKIP)))
CIBW_SKIP = ' '.join(CIBW_SKIP)
env_extra['CIBW_SKIP'] = CIBW_SKIP

# Set what wheels to build, if not already specified.
if 'CIBW_ARCHS' not in env_extra:
if 'CIBW_ARCHS_WINDOWS' not in env_extra:
Expand Down Expand Up @@ -929,10 +949,14 @@ def cibuildwheel(
env_extra['CIBW_PYODIDE_VERSION'] = cibw_pyodide_version
env_extra['CIBW_ENABLE'] = 'pyodide-prerelease'

# Pass all the environment variables we have set, to Linux
# docker. Note that this will miss any settings in the original
# environment.
env_extra['CIBW_ENVIRONMENT_PASS_LINUX'] = ' '.join(sorted(env_extra.keys()))
# Pass all the environment variables we have set, to Linux docker. Note
# that this will miss any settings in the original environment. We have to
# add CIBW_BUILD explicitly because we haven't set it yet.
CIBW_ENVIRONMENT_PASS_LINUX = set(env_extra.keys())
CIBW_ENVIRONMENT_PASS_LINUX.add('CIBW_BUILD')
CIBW_ENVIRONMENT_PASS_LINUX = sorted(list(CIBW_ENVIRONMENT_PASS_LINUX))
CIBW_ENVIRONMENT_PASS_LINUX = ' '.join(CIBW_ENVIRONMENT_PASS_LINUX)
env_extra['CIBW_ENVIRONMENT_PASS_LINUX'] = CIBW_ENVIRONMENT_PASS_LINUX

if cibw_test_project:
cibw_do_test_project(env_extra, CIBW_BUILD, cibw_pyodide, cibw_pyodide_args)
Expand Down
Binary file added tests/resources/test_4699.pdf
Binary file not shown.
Binary file added tests/resources/test_4699.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions tests/test_pixmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,3 +631,22 @@ def test_4388():
assert rms == 0
else:
assert rms >= 10


def test_4699():
path = os.path.normpath(f'{__file__}/../../tests/resources/test_4699.pdf')
path_png_expected = os.path.normpath(f'{__file__}/../../tests/resources/test_4699.png')
path_png_actual = os.path.normpath(f'{__file__}/../../tests/test_4699.png')
with pymupdf.open(path) as document:
page = document[0]
pixmap = page.get_pixmap()
pixmap.save(path_png_actual)
print(f'Have saved to {path_png_actual=}.')
rms = gentle_compare.pixmaps_rms(path_png_expected, pixmap)
print(f'test_4699(): {rms=}')
if pymupdf.mupdf_version_tuple >= (1, 27):
assert rms == 0
else:
wt = pymupdf.TOOLS.mupdf_warnings()
assert 'syntax error: cannot find ExtGState resource' in wt
assert rms > 20
8 changes: 5 additions & 3 deletions tests/test_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@
import sys


g_root = os.path.normpath(f'{__file__}/../../')
g_root = os.path.relpath(g_root)
g_root_abs = os.path.normpath(f'{__file__}/../../')

sys.path.insert(0, g_root)
sys.path.insert(0, g_root_abs)
try:
import pipcl
import setup
finally:
del sys.path[0]

g_root = pipcl.relpath(g_root_abs)


def _file_line(path, text, re_match, offset=+2):
'''
Expand Down