-
-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
Enable linking multiple Python formulae #107517
Conversation
a56c57e
to
6598029
Compare
b19b708
to
5a5f61a
Compare
This comment was marked as resolved.
This comment was marked as resolved.
5a5f61a
to
e0a4730
Compare
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.
Doesn't this mean that if you run brew install python@3.9
(no alias so no auto upgrade to python@3.10
) and then have a script that relies on /opt/homebrew/bin/python3
it will no longer work unless you manually install python@3.10
?
Yes. But the same thing happens whenever we make |
e0a4730
to
7472b2d
Compare
If you do not need a specific version of Python, and always want Homebrew's `python3` in your PATH: | ||
brew install python3 |
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.
@Rylan12 this should help a bit with users who really just want python3
(of whatever version) but did brew install python@3.9
.
It won't make it go away, since not everyone reads the caveats
, but it should help a bit.
Co-authored-by: XuehaiPan <XuehaiPan@pku.edu.cn>
1f88fe0
to
f16e655
Compare
This is ready for review. Some dependents will still fail, but all failures should have fixes in progress. See #107517 (comment). I hope to be able to merge this once CI completes. |
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.
Makes sense to me. One small question.
link_overwrite "Frameworks/Python.framework/Headers" | ||
link_overwrite "Frameworks/Python.framework/Python" | ||
link_overwrite "Frameworks/Python.framework/Resources" | ||
link_overwrite "Frameworks/Python.framework/Versions/Current" |
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.
Does this mean whichever version is linked last will be Current
?
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 contemplated that, but found it too confusing, so decided against it.
In this PR, only the newest Python in Homebrew/core (i.e. python@3.10
) will have these symlinks.
I would like to find a way to do it so that the newest Python you have installed will have these symlinks, so that the behaviour is consistent and predictable, but im punting on that for now.
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 contemplated that, but found it too confusing, so decided against it.
Agreed, I think it's better this way.
In this PR, only the newest Python in Homebrew/core (i.e.
python@3.10
) will have these symlinks.
How do we ensure these get updated/migrated on a new Python version? Audit? Could do something like fail if the alias doesn't point to python
.
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.
How do we ensure these get updated/migrated on a new Python version? Audit? Could do something like fail if the alias doesn't point to
python
.
Yup, we should add an audit for this. Will look at one soon.
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.
@carlocab Sounds great, doesn't need to block this PR 👍🏻
This is a backport of Homebrew#107517 to `python@3.8`.
This is a backport of #107517 to `python@3.8`.
This is a backport of Homebrew#107517 to `python@3.7`.
Fixes a CI failure seen at Homebrew#107517.
This is a backport of #107517 to `python@3.7`.
altinstall
targetHOMEBREW_PREFIX
The primary change (see first commit) uses the
altinstall
target in the PythonMakefile
to make sure that Python3.9 only installs files that contain Python's major and minor version. That is,python@3.9
will now install onlypython3.9
,python3.9-config
, etc., instead ofpython3
andpython3-config
.This will allow users to have both
python@3.9
andpython@3.10
linked intoHOMEBREW_PREFIX
simultaneously. Users who wish to callpython3.9
aspython3
can addlibexec/"bin"
to theirPATH
.Going forward, I believe this will help simplify migrating to newer Python versions, since there will be no need to make the newer version keg-only while most dependent formulae still depend on the older version of Python.
I've made a lot of changes here. For ease of review, I placed substantive changes in the first two commits. The third and fourth commits are refactoring, and the
last twofifth and sixth update non-formula files.I have not tested this on Linux. This may require a few more adjustments there.
See discussion at Homebrew/discussions#2776 and documentation at https://github.com/python/cpython#installing-multiple-versions.
Closes #87075.
brew install --build-from-source <formula>
, where<formula>
is the name of the formula you're submitting?brew test <formula>
, where<formula>
is the name of the formula you're submitting?brew audit --strict <formula>
(after doingbrew install --build-from-source <formula>
)? If this is a new formula, does it passbrew audit --new <formula>
?