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

fix: Fix incorrectly generated Required-Dist when specifying requirements with markers in extra_requires in py_wheel rule #2200

Conversation

sfc-gh-wzhao
Copy link
Contributor

Currently, if extra requirements are provided via a file, it is allowed to contain markers, but if it is passed via extra_requires field, it will run into error since the extra in this case is blindly added in the following line in py_wheel.bzl

metadata_contents.append(
    "Requires-Dist: %s; extra == '%s'" % (requirement, option),
)

Thus, this PR adds a post-process for this case, to make it possible to pass something like

    extra_requires = {"example": [
        "pyyaml>=6.0.0,!=6.0.1",
        'toml; (python_version == "3.11" or python_version == "3.12") and python_version != "3.8"',
        'wheel; python_version == "3.11" or python_version == "3.12" ',
    ]},

to py_wheel

Copy link
Collaborator

@aignas aignas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@aignas aignas added this pull request to the merge queue Sep 7, 2024
Merged via the queue into bazelbuild:main with commit a18ae49 Sep 7, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants