8000 Use python3 instead of python by keith · Pull Request #2118 · ninja-build/ninja · GitHub
[go: up one dir, main page]

Skip to content

Use python3 instead of python #2118

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

Closed

Conversation

keith
Copy link
@keith keith commented Apr 20, 2022

This is a new version of #2063
for discussion. macOS 12.3 has removed /usr/bin/python entirely, so
there is no longer an executable if you request /usr/bin/env python.
So even if you override --with-python=python3, you cannot call
./configure.py directly, you'd have to run python3 configure.py
instead.

@keith
Copy link
Author
keith commented Apr 20, 2022

As stated on the previous PR, python3 isn't on this CI job that failed. I could either continue letting that CI run python2, or we could try to update that CI infra to contain python3. What would be preferred (for now I'm going with option 1 to get green CI).

https://ci.appveyor.com/project/nico/ninja/builds/43291919/job/yby9glo98np8tfrf

@jhasse
Copy link
Collaborator
jhasse commented Apr 21, 2022

macOS 12.3 has removed /usr/bin/python entirely, so there is no longer an executable if you request /usr/bin/env python.

IMHO this is a bug and should be reported to Apple, no workaround in Ninja or any other software.

@jonesmz

This comment was marked as abuse.

@keith
Copy link
Author
keith commented Apr 21, 2022

I don't think this should be considered a bug. It was definitely intentional on the Apple side, as it was included in the release notes for macOS 12.3:

image

My assumption is that they didn't want to maintain a python symlink, while also changing the version, since that would be even more confusing to users than removing it (maybe in the future they will add it back pointing at python3, but who knows).

Regardless of Apple's decisions here, the related pep https://peps.python.org/pep-0394/ (which isn't accepted, but seems to have general consensus python/peps#989) states that distributions should have python2 if they support it, python3 if they support it, but python is optional and up to the distro owner:

image

So my assumption is that over time we will see fewer and fewer users who have a python by default, for the same reasons I assume Apple removed it, to reduce version confusion.

In general I think if we believe that python3 will be more widely installed than python2, even if folks did still have this symlink, it makes sense to default to the more widely used version, and folks can continue to manually run python2 ./configure.py or python ./configure.py if they so choose.

@jhasse
Copy link
Collaborator
jhasse commented Apr 21, 2022

I disagree with the PEP, too :D

@keith keith force-pushed the ks/use-python3-instead-of-python branch from 6c3e941 to aad84b3 Compare April 22, 2022 04:53
@ComputerDruid
Copy link

Note: it's not just Mac OS that's removing /usr/bin/python by default, debian 11 does that too: https://wiki.debian.org/Python

@tristan957
Copy link

I don't think /usr/bin/python is shipped in Fedora either unless you also install python-unversioned-command.

This is a new version of ninja-build#2063
for discussion. macOS 12.3 has removed /usr/bin/python entirely, so
there is no longer an executable if you request `/usr/bin/env python`.
So even if you override `--with-python=python3`, you cannot call
`./configure.py` directly, you'd have to run `python3 configure.py`
instead.
@keith keith force-pushed the ks/use-python3-instead-of-python branch from aad84b3 to 6bfe5c4 Compare January 6, 2023 19:51
@keith
Copy link
Author
keith commented Jan 6, 2023

It looks like debian has officially removed the python 2 packages https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1027108

@jhasse
Copy link
Collaborator
jhasse commented Jan 18, 2023

fixed by 6a17e84

@jhasse jhasse closed this Jan 18, 2023
@keith keith deleted the ks/use-python3-instead-of-python branch January 18, 2023 16:49
@keith
Copy link
Author
keith commented Jan 18, 2023

It looks like there were a few in this PR that aren't in that commit, I submitted #2241

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.

6 participants
0