Skip to content

Prefer python3 command#28

Merged
dantesun merged 1 commit intogdubw:masterfrom
DanielThomas:patch-1
Aug 16, 2024
Merged

Prefer python3 command#28
dantesun merged 1 commit intogdubw:masterfrom
DanielThomas:patch-1

Conversation

@DanielThomas
Copy link
Contributor

If version-less symlinks are present on the system (required for scripts with #!/usr/bin/env python for instance) assuming that python is Python 2 will fail. This prefers python3 before falling back to python.

If version-less symlinks are present on the system (required for scripts with `#!/usr/bin/env python` for instance) assuming that `python` is Python 2 will fail. This prefers `python3` before falling back to `python`.
@DanielThomas
Copy link
Contributor Author

In fact it occurs to me that print() should be fine in any case, don't quite follow why there needs to be this distinction?

@matthewadams
Copy link

I've come to this because I can't get pyenv, installed via homebrew, to build python 2 on my M1 mac:

$ pyenv install 2.7.9
python-build: use openssl from homebrew
python-build: use readline from homebrew
Downloading Python-2.7.9.tar.xz...
-> https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tar.xz
Installing Python-2.7.9...
patching file ./Lib/site.py
patching file ./Lib/ssl.py
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

BUILD FAILED (OS X 12.3.1 using python-build 20180424)

Inspect or clean up the working tree at /var/folders/kt/g1jvgqy51tj1tpl7bbh1zd_c0000gn/T/python-build.20220503110231.54830
Results logged to /var/folders/kt/g1jvgqy51tj1tpl7bbh1zd_c0000gn/T/python-build.20220503110231.54830.log

Last 10 log lines:
checking size of _Bool... 1
checking for uintptr_t... yes
checking size of uintptr_t... 8
checking size of off_t... 8
checking whether to enable large file support... no
checking size of time_t... 8
checking for pthread_t... yes
checking size of pthread_t... 8
checking for --enable-toolbox-glue... yes
configure: error: Unexpected output of 'arch' on OSX

So, I have no python available on my path, only python3. Based on this PR, I updated line 185 of gng at /opt/homebrew/Cellar/gng/1.0.3/bin/gng to be

      python3 -c "import json,sys;obj=json.load(sys.stdin);print(obj['version']);") || die "Failed to fetch the version info!"

Everything worked fine. Please accept this MR. No reason not to, IMHO, especially since python version 2.x has been EOLed.

@dantesun dantesun merged commit 52a9aed into gdubw:master Aug 16, 2024
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.

3 participants