Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@NattyNarwhal
Copy link
Contributor

The "python" interpreter is specified by PEP-394. In it, an OS
can decide not to ship a "python" executable, and instead only
ship python2/3, providing some ambiguity for scripts that are
version-neutral, like the one Mono uses.

This uses an automake macro to locate a suitable Python, and
changes the makefile to use the located Python, whatever it may be.

The "python" interpreter is specified by PEP-394. In it, an OS
can decide not to ship a "python" executable, and instead only
ship python2/3, providing some ambiguity for scripts that are
version-neutral, like the one Mono uses.

This uses an automake macro to locate a suitable Python, and
changes the makefile to use the located Python, whatever it may be.
@jaykrell
Copy link
Contributor

Python2 or 3?
Does env work?

@NattyNarwhal
Copy link
Contributor Author

It will look for any Python it can, which is fine for the one script that needs it. (You could specify a minimum version as an argument, AFAIK.)

@jaykrell
Copy link
Contributor

Another choice is usr/bin/env.
I suppose an advantage of automake is it can find any of python, python2, or python3.
Though python3 will be correct long term.
Also your approach saves a fork/exec, like on slow Cygwin.

@NattyNarwhal
Copy link
Contributor Author

env won't save you when the system lacks python and just has python2/python3. (IIRC, CentOS 6/7 lack Python3, and some distros stopped including Python2.)

@lewurm
Copy link
Contributor

lewurm commented Dec 16, 2019

@monojenkins squash

@monojenkins monojenkins merged commit 84221f0 into mono:master Dec 16, 2019
ManickaP pushed a commit to ManickaP/runtime that referenced this pull request Jan 20, 2020
Fix locating Python interpreter when it isn't "python"

The "python" interpreter is specified by PEP-394. In it, an OS
can decide not to ship a "python" executable, and instead only
ship python2/3, providing some ambiguity for scripts that are
version-neutral, like the one Mono uses.

This uses an automake macro to locate a suitable Python, and
changes the makefile to use the located Python, whatever it may be.


Commit migrated from mono/mono@84221f0
akoeplinger pushed a commit to monojenkins/mono that referenced this pull request Apr 2, 2020
Fix locating Python interpreter when it isn't "python"

The "python" interpreter is specified by PEP-394. In it, an OS
can decide not to ship a "python" executable, and instead only
ship python2/3, providing some ambiguity for scripts that are
version-neutral, like the one Mono uses.

This uses an automake macro to locate a suitable Python, and
changes the makefile to use the located Python, whatever it may be.

(cherry picked from commit 84221f0)
akoeplinger pushed a commit that referenced this pull request Apr 3, 2020
* Force Python 3.x from env in shebang lines

* Fix byte/string incompatiblity in Python 3

* Fix locating Python interpreter when it isn't "python" (#18197)

Fix locating Python interpreter when it isn't "python"

The "python" interpreter is specified by PEP-394. In it, an OS
can decide not to ship a "python" executable, and instead only
ship python2/3, providing some ambiguity for scripts that are
version-neutral, like the one Mono uses.

This uses an automake macro to locate a suitable Python, and
changes the makefile to use the located Python, whatever it may be.

(cherry picked from commit 84221f0)

* More disambiguation of Python in makefiles (#18284)

(cherry picked from commit b3ce5bf)

* [build] Check for Python 3 in configure.ac (#18625)

I fear this causing packaging problems, but as-is we require Python 3 for most of our Python files but don't actually check for that in configure. We should be consistent about this. Some projects (notably wasm) also use the Python version detected here, so bumping this will also bump the version used in those cases (a good thing, since there are some known bugs when using the scripts with Python 2).

(cherry picked from commit 0f47ea5)

Co-authored-by: Calvin Buckley <[email protected]>
Co-authored-by: Ryan Lucia <[email protected]>
UnityAlex pushed a commit to Unity-Technologies/mono that referenced this pull request Jun 2, 2022
Fix locating Python interpreter when it isn't "python"

The "python" interpreter is specified by PEP-394. In it, an OS
can decide not to ship a "python" executable, and instead only
ship python2/3, providing some ambiguity for scripts that are
version-neutral, like the one Mono uses.

This uses an automake macro to locate a suitable Python, and
changes the makefile to use the located Python, whatever it may be.
UnityAlex pushed a commit to Unity-Technologies/mono that referenced this pull request Dec 13, 2022
Fix locating Python interpreter when it isn't "python"

The "python" interpreter is specified by PEP-394. In it, an OS
can decide not to ship a "python" executable, and instead only
ship python2/3, providing some ambiguity for scripts that are
version-neutral, like the one Mono uses.

This uses an automake macro to locate a suitable Python, and
changes the makefile to use the located Python, whatever it may be.
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.

5 participants