setup.py implementation #2649
julian-smith-artifex-com
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
[This discussion is branched off #2628.]
@dvzrv wrote in #2628 (comment)
PyMuPDF's setup.py and pipcl.py really don't "lack all the common use-cases", and i'm not sure it's helpful to say so.
As i've already said, they follow the Python packaging spec described in PEP-517 etc, so work with pip and other build front ends, and they also support legacy command-line usage.
Adding in support for passing in compile/include/link flags is trivial to add, and working in my tree.
From those links, it looks like Meson can only deal with sub-projects that also use Meson.
You could suggest to the MuPDF team that they switch to Meson i guess, but i don't think it's likely to be agreed.
I'm sure meson is great.
But as far as i can tell, it has no support for SWIG, so it is a complete non-starter for MuPDF's Python bindings and PyMuPDF.
I understand the concern here, and i agree that using an existing tool would be preferable. But the prime requirement is that the build has to actually work, and i couldn't find anything that could cope with the requirements for building PyMuPDF.
So we've opted for a new generic Python packaging library (pipcl.py) and a customised setup.py.
There is no need to read all of the code.
For someone who is doing a standard build of PyMuPDF, all you need to know is that setup.py and pyproject.toml works with any Python build frontend, such as pip.
If you need more control, the standard doc-comment at the start of setup.py explains in detail the various environment variables that can be used to control the build. If something is not clear, let me know and i'll clarify it.
If someone is interested in using pipcl.py in a new project, pipcl.py has detailed documentation about how to use the
Package
class (which follows the general approach of distutils/setuptools), with a complete doctest example of bulding a Python extension using SWIG, and references to the relevant pypa specifications.Recent MuPDF has a new Extract sub-library, and so may require changes to how it is built. This is a separate issue from PyMuPDF.
MuPDF builds are customised using environmental variables and/or make variables;, it does not use cmake or pkgconfig. You could suggest changes to the MuPDF team if you think they would be beneficial.
Beta Was this translation helpful? Give feedback.
All reactions