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

utils/pypi: use python from formula for non-pypi url metadata #16723

Merged
merged 1 commit into from
Feb 22, 2024

Conversation

cho-m
Copy link
Member

@cho-m cho-m commented Feb 22, 2024

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

This fixes the resource detection when formula has Python packages that are not compatible with current aliased python formula, e.g. awscli

Also switch to opt_libexec path to ignore Python formula patch version and revision bump differences.


Originally hit when working on Homebrew/homebrew-core#163705, e.g.

brew update-python-resources awscli
==> Retrieving PyPI dependencies for "https://github.com/aws/aws-cli/archive/refs/tags/2.15.22.tar.gz
==> Retrieving PyPI dependencies for excluded ""...
Error: Unable to determine metadata for "https://github.com/aws/aws-cli/archive/refs/tags/2.15.22.tar.gz" because of a failure when running
`/opt/homebrew/opt/python@3.12/bin/python3 -m pip install -q --no-deps --dry-run --ignore-installed --report /dev/stdout https://github.com/aws/aws-cli/archive/refs/tags/2.15.22.tar.gz`.
Please report this issue:
  https://docs.brew.sh/Troubleshooting
Warning: Removed Sorbet lines from backtrace!
Rerun with `--verbose` to see the original backtrace
/opt/homebrew/Library/Homebrew/utils/pypi.rb:147:in `basic_metadata'
/opt/homebrew/Library/Homebrew/utils/pypi.rb:26:in `name'
/opt/homebrew/Library/Homebrew/utils/pypi.rb:304:in `update_python_resources!'
/opt/homebrew/Library/Homebrew/dev-cmd/update-python-resources.rb:41:in `block in update_python_resources'
/opt/homebrew/Library/Homebrew/dev-cmd/update-python-resources.rb:40:in `each'
/opt/homebrew/Library/Homebrew/dev-cmd/update-python-resources.rb:40:in `update_python_resources'
/opt/homebrew/Library/Homebrew/brew.rb:86:in `<main>'
            _ruamel_yaml.c:27082:36: error: no member named 'curexc_traceback' in 'struct _ts'
                    PyObject* tmp_tb = tstate->curexc_traceback;
                                       ~~~~~~  ^
            _ruamel_yaml.c:27085:21: error: no member named 'curexc_traceback' in 'struct _ts'
                        tstate->curexc_traceback = tb;
                        ~~~~~~  ^
            _ruamel_yaml.c:27624:22: error: call to undeclared function '_PyUnicode_Ready'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                    if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
                                 ^

This fixes the resource detection when formula has Python packages that
are not compatible with current aliased python formula, e.g. `awscli`

Also switch to `opt_libexec` path to ignore Python formula patch version
and revision bump differences.
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Looks great, thanks @cho-m!

@MikeMcQuaid MikeMcQuaid merged commit da44787 into Homebrew:master Feb 22, 2024
24 checks passed
@cho-m cho-m deleted the non-pypi-url-use-formula-py branch February 29, 2024 13:19
@github-actions github-actions bot added the outdated PR was locked due to age label Apr 3, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants