Skip to content

Commit

Permalink
scripts/: default to not installing system packages such as valgrind …
Browse files Browse the repository at this point in the history
…by default.
  • Loading branch information
julian-smith-artifex-com committed Nov 18, 2024
1 parent 0545ad2 commit 44fe4c3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion scripts/gh_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def get_bool(name, default=0):
if platform.system() == 'Linux' and inputs_wheels_linux_pyodide:
# Pyodide wheels are built by running scripts/test.py, not
# cibuildwheel.
command = f'{sys.executable} scripts/test.py'
command = f'{sys.executable} scripts/test.py -P 1'
if inputs_PYMUPDF_SETUP_MUPDF_BUILD:
command += f' -m {shlex.quote(inputs_PYMUPDF_SETUP_MUPDF_BUILD)}'
command += ' pyodide_wheel'
Expand Down
17 changes: 13 additions & 4 deletions scripts/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
specified PyMuPDF will download its default mupdf .tgz.]
-p <pytest-options>
Set pytest options; default is ''.
-P 0|1
If 1, automatically install required packages such as Valgrind. Default
is 0.
-s 0 | 1
If 1 (the default), build with Python Limited API/Stable ABI.
-t <names>
Expand Down Expand Up @@ -174,6 +177,7 @@ def main(argv):
pytest_k = None
system_site_packages = False
pyodide_build_version = None
packages = False

options = os.environ.get('PYMUDF_SCRIPTS_TEST_options', '')
options = shlex.split(options)
Expand Down Expand Up @@ -210,7 +214,9 @@ def main(argv):
elif arg == '-k':
pytest_k = next(args)
elif arg == '-p':
pytest_options = next(args)
packages = int(next(args))
elif arg == '-P':
packages = int(next(args))
elif arg == '-s':
value = next(args)
assert value in ('0', '1'), f'`-s` must be followed by `0` or `1`, not {value=}.'
Expand Down Expand Up @@ -289,6 +295,7 @@ def do_test():
test_fitz=test_fitz,
pytest_k=pytest_k,
pybind=pybind,
packages=packages,
)

for command in commands:
Expand Down Expand Up @@ -630,6 +637,7 @@ def test(
test_fitz=True,
pytest_k=None,
pybind=False,
packages=False,
):
'''
Args:
Expand Down Expand Up @@ -737,9 +745,10 @@ def getmtime(path):
run_compound_args += f' -t {timeout}'
env_extra = None
if valgrind:
log('Installing valgrind.')
run(f'sudo apt update')
run(f'sudo apt install --upgrade valgrind')
if packages:
log('Installing valgrind.')
run(f'sudo apt update')
run(f'sudo apt install --upgrade valgrind')
run(f'valgrind --version')

log('Running PyMuPDF tests under valgrind.')
Expand Down

0 comments on commit 44fe4c3

Please sign in to comment.