-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
dev-cmd/update-python-resources: use user PATH #16774
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we preserve the original value of PATH
after the command completes?
@@ -37,6 +37,10 @@ def update_python_resources_args | |||
def update_python_resources | |||
args = update_python_resources_args.parse | |||
|
|||
# Python packages may need access to additional commands while generating pip report. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which commands, for example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Off the top of my head, I recall seeing pkg-config
and msgfmt
(from gettext). It is usually for Python packages still using setup.py
that may end up running these commands.
EDIT: Alternatively, we could go with explicit list and do something like Superenv to only add those opt_bin
dirs. I went with simpler option as we already are using this PATH
in brew bump
/ brew bump-formula-pr
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get setup.py
is a script, but why are things invoking tools on a basic metadata parse? Is it just bad scripts calling things outside of build steps?
Are the failures obvious?
Having at least a couple documented examples here might be good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EDIT: Alternatively, we could go with explicit list and do something like Superenv to only add those
opt_bin
dirs. I went with simpler option as we already are using thisPATH
inbrew bump
/brew bump-formula-pr
.
Yeh, I think this might be nicer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get
setup.py
is a script, but why are things invoking tools on a basic metadata parse? Is it just bad scripts calling things outside of build steps?
Pretty much. One of the issues of having metadata and build commands in the same file as it can bleed over.
Are the failures obvious?
Usually. Though via brew
the errors are hidden without --verbose
.
❯ brew update-python-resources borgbackup
==> Retrieving PyPI dependencies for "borgbackup==1.2.7"...
Error: Unable to determine dependencies for "borgbackup==1.2.7" because of a failure when running
`/opt/homebrew/opt/[email protected]/libexec/bin/python -m pip install -q --disable-pip-version-check --dry-run --ignore-installed --report=/dev/stdout borgbackup==1.2.7`.
Please update the resources manually.
After verbose, the error at end is:
OSError: pkg-config probably not installed: FileNotFoundError(2, 'No such file or directory')
Having at least a couple documented examples here might be good.
Sure, if I keep going down this route.
EDIT: Alternatively, we could go with explicit list and do something like Superenv to only add those
opt_bin
dirs. I went with simpler option as we already are using thisPATH
inbrew bump
/brew bump-formula-pr
.Yeh, I think this might be nicer.
When I have a chance, I'll explore this option further. Logic will most likely reside in utils/pypi.rb
.
This should also help run brew bump
which may allow us to autobump these (so any extra commands are done in CI environment rather than on user system).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, thanks for the example! borgbackup
looks like it might improve with 1.4.0b1 but I recognise the need for a broader solution here.
Signed-off-by: Michael Cho <[email protected]>
3e4df98
to
1005a07
Compare
Not entirely related to this PR, but if This was not the case when the tweak was added in |
Closing this. I will work on a different approach that is more restrictive with opt-in flag to reduce unwanted/unexpected commands run on user systems. |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?This is mainly to make sure any extra commands are accessible when running
brew update-python-resources
. Currentlybrew bump-formula-pr
sets the same PATH:brew/Library/Homebrew/dev-cmd/bump-formula-pr.rb
Lines 99 to 101 in 977ac20
Particularly useful in combination with #16772 in order to make
brew
installed formulae accessible.Can be reviewed independently from other PR.
One example is
borgbackup
which runspkg-config
to findlibcrypto
.