Packaging for Linux distributions#
Requirements#
Python
MuPDF checkout (including submodules).
PyMuPDF checkout.
System packages listed in
scripts/sysinstall.py:g_sys_packages.Python packages listed in
pyproject.toml.
Extra requirements for running tests:
Python packages listed in
scripts/gh_release.py:test_packages.
General steps#
Build and install MuPDF:
Install required system packages.
Run
make install-shared-pythonon MuPDF’sMakefilewith at least these make variables:DESTDIRset to the install directory, e.g./.prefixset to location relative to DESTDIR, such as/usr/localor/usr. Must start with/.USE_SYSTEM_LIBS=yes.HAVE_LEPTONICA=yes.HAVE_TESSERACT=yes.
Build and install PyMuPDF:
Run
pip install ./PyMuPDForpip wheel ./PyMuPDFwith at least these environment variables:PYMUPDF_SETUP_MUPDF_BUILD=(empty string) to prevent download and build of hard-coded MuPDF release.CFLAGS,CXXFLAGSandLDFLAGSset to allow visibility of the installed MuPDF headers and shared libraries.
Run PyMuPDF tests:
Ensure required Python packages are available.
Run
pytest -k "not test_color_count and not test_3050" PyMuPDFTest
test_color_countis known fail if MuPDF is not built with PyMuPDF’s custom config.h.Test
test_3050is known to fail if MuPDF is built without its own third-party libraries.
Use of scripts/sysinstall.py#
scripts/sysinstall.py provides a useful example of build, install and test
commands that are known to to work, because it is run regularly by Github
action .github/workflows/test_sysinstall.yml.
Run with
-hor look at the doc-string to see detailed usage information.It uses Debian-style
aptcommands to install system packages.By default it assumes local git checkouts
mupdf/andPyMuPDF/.
To run a full build, install and test for both a local fake root and the system root:
./PyMuPDF/scripts/sysinstall.py
./PyMuPDF/scripts/sysinstall.py --root /
To see what commands would be run without actually running them:
./PyMuPDF/scripts/sysinstall.py -m 0 -p 0 -t 0
See also#
setup.py’s initial doc-comment has detailed information about the environment variables used when building PyMuPDF.