Skip to content

Fix failures of CI on macOS due to requirement normalisation inconsistency.#4546

Merged
abravalheri merged 5 commits intopypa:mainfrom
abravalheri:fix-macos-error
Aug 8, 2024
Merged

Fix failures of CI on macOS due to requirement normalisation inconsistency.#4546
abravalheri merged 5 commits intopypa:mainfrom
abravalheri:fix-macos-error

Conversation

@abravalheri
Copy link
Copy Markdown
Contributor

@abravalheri abravalheri commented Aug 8, 2024

It seems that the error in macOS happens due to the normalisation of quotes in the Requirement string:

assert "Requires-Dist: tomli >=1 ; extra == 'all'" in """
    Metadata-Version: 2.1
    Name: foo
    Version: 0.1
    Summary: This is a Python package
    License: MIT
    Project-URL: Homepage, http://github.com/
    Classifier: Development Status :: 5 - Production/Stable
    Classifier: Intended Audience :: Developers
    Description-Content-Type: text/x-rst
    License-File: LICENSE.txt
    Requires-Dist: appdirs
    Provides-Extra: all
    Requires-Dist: tomli>=1; extra == "all"
    Requires-Dist: pyscaffold<5,>=4; extra == "all"
    Requires-Dist: importlib; python_version == "2.6" and extra == "all"
    This is a ``README``
    """

## Summary of changes

Closes #4547

Pull Request Checklist

Comment thread setuptools/tests/test_build_meta.py Outdated
@abravalheri abravalheri changed the title [WIP] Investigate failures of CI on macOS Fix failures of CI on macOS due to requirement normalisation inconsistency. Aug 8, 2024
@abravalheri
Copy link
Copy Markdown
Contributor Author

abravalheri commented Aug 8, 2024

Now the second error happens because of the normalisation of Requires-Dist: tomli >=1 ; extra == "all" into Requires-Dist: tomli>=1; extra == "all" (different whitespace).

The annoying part is that it only happens on macOS.

@abravalheri
Copy link
Copy Markdown
Contributor Author

abravalheri commented Aug 8, 2024

Now the second error happens because of the normalisation of Requires-Dist: tomli >=1 ; extra == "all" into Requires-Dist: tomli>=1; extra == "all".

The annoying part is that it only happens on macOS.

I see what is happening: in pypa/wheel@4ec2ae3 wheel changed to a different normalisation that uses packaging.requirements.Requirement. But the vendored version that we have right now still uses the old normalisation.

So I am assuming that somehow the latest version of wheel ends up in the testenv for macOS, but an old version is used for Linux (or not used at all, and we rely on the vendored package).

@abravalheri abravalheri marked this pull request as ready for review August 8, 2024 15:08
@abravalheri abravalheri merged commit c3e7be1 into pypa:main Aug 8, 2024
@abravalheri abravalheri deleted the fix-macos-error branch August 8, 2024 15:24
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.

[CI] Inconsistent normalisation of requirement strings on macOS causing trouble in the CI

2 participants