How to pass arbritary options in SPEC file for python build

I’m currently refactoring the picard spec file to conform to the new python build guidelines, everything fine there so I thought I’d add --disable-autoupdate so as to remove the new update option at runtime. Picard allows for this by using --disable-update. When I try:

It build fine, but doesn’t work. I’ve asked the good folks at the Picard forum and here is the response:

I tried getting options to pass with python -m build, but without success.

Picard is using the setuptools backend, and it looks like passing arbitrary options is currently not working there. See the discussion at Setuptools does not pass config_settings through backend · Issue #2491 · pypa/setuptools · GitHub .

I would have expected something like python -m build --wheel -C--disable-autoupdate or maybe python -m build --wheel -C--disable-autoupdate=True should work, but it doesn’t for now, as the parameters are not passed on.

One workaround seems to be to add a custom build backend that overrides the relevant parts to handle the customer build parameters as it was done for example in Add custom build backend to support build args by tobiasah · Pull Request #328 · capnproto/pycapnp · GitHub

We could also maybe check for specific environment variables or such. But ideally the issue gets solved in setuptools itself.

Am I missing some functionality in the Fedora buildtools or is this just not possible. Thanks for any insights.

I can see in dist-git that you found a solution already by patching setup.py (as I would have suggested). But do really need to call setup.py yourself?

The sources that you liked indicate that certain pip versions have a problem - dropping the old way and not properly supporting the new way of passing options. So there is not much that the Fedora buildtools can do, as they call the build backend.

1 Like

This conversation continued at How to pass arbritary options in SPEC file for python build - python-devel - Fedora mailing-lists

From Ask Fedora to Project Discussion

Added package-maintainers and removed python-packaging

Yeah, that is what I was thinking, but I thought I’d ask anyway just in case I was missing something. I’ve tried just about every imaginable combination and nothing seems to work. The setup.py patch is easy enough to do.