Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] build_meta: prepare_metadata_for_build_wheel hook does not honor --build-option #4293

Closed
gotmax23 opened this issue Apr 7, 2024 · 2 comments
Labels
bug Needs Triage Issues that need to be evaluated for severity and status.

Comments

@gotmax23
Copy link

gotmax23 commented Apr 7, 2024

setuptools version

setuptools==69.2.0 and wheel==0.43.0

Python version

Python 3.12

OS

Fedora Linux

Additional environment information

No response

Description

I am trying to run the prepare_metadata_for_build_wheel hook for the https://github.com/Rogdham/pyzstd project as part of the Fedora Linux build process. The project requires passing --dynamic-link-zstd when building without the in-tree zstd copy or else it fails with FileNotFoundError: [Errno 2] No such file or directory: 'zstd/lib/common/'.

I ran

python -c 'from setuptools.build_meta import *; prepare_metadata_for_build_wheel("dist", {"--build-option": "--dynamic-link-zstd"})'

and expected the build backend to pass --dynamic-link-zstd through to the internal setup.py dist_info subcommand that it calls to generate the metadata. Instead, it only passes ['dist_info', '--output-dir', 'dist', '--keep-egg-info'].

Should pyzstd be changed to allow setting this option through a different mechanism (e.g., an environment variable) or can setuptools start honoring --build-option for the prepare_metadata_for_build_wheel hook?

Relates: #3896

CC: @Rogdham

Expected behavior

See above

How to Reproduce

Checkout https://github.com/Rogdham/pyzstd without the zstd submodule and run the command mentioned above.

Output

n/a

@gotmax23 gotmax23 added bug Needs Triage Issues that need to be evaluated for severity and status. labels Apr 7, 2024
@abravalheri
Copy link
Contributor

abravalheri commented Apr 7, 2024

Hi @gotmax23 , setuptools.build_meta was intentionally changed to not pass --build-option to the metadata methods.

This was a decision taken to improve compatibility with pip, see information in the thread starting in #2491 (comment) (key comment: #2491 (comment)) for context. I don't think we are going to revert this.

Please also notice that passing parameters via --global-option and --build-option is provided as it is: an experimental attempt to emulate pip's old behaviour, but it is not guaranteed to do exactly what you want (specially because pip's old behaviour is not 100% equivalent/compatible with the build process initially introduced in PEP 517/660).

If you want to pass parameters to commands, the only guaranteed way that works right now is to use configuration files like setup.cfg. See https://setuptools.pypa.io/en/latest/deprecated/distutils/configfile.html for reference.

@abravalheri
Copy link
Contributor

I will go ahead and close this issue now, since this is not a planed feature in setuptools.

If the solution mentioned in #4293 (comment) does not suit the use case, please consider contributing towards #4083.

@abravalheri abravalheri closed this as not planned Won't fix, can't repro, duplicate, stale Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Needs Triage Issues that need to be evaluated for severity and status.
Projects
None yet
Development

No branches or pull requests

2 participants