This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Use $HOSTPYTHON when determining candidate interpreter for $PYTHON_FOR_BUILD.
Type: enhancement Stage:
Components: Cross-Build Versions: Python 3.4, Python 3.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: doko, martin.panter, pmpp, rpetrov, shiz, yan12125
Priority: normal Keywords: patch

Created on 2014-07-29 15:34 by shiz, last changed 2022-04-11 14:58 by admin.

Files
File name Uploaded Description Edit
Python-hg-723e0a7c4914-fix-PYTHON_FOR_BUILD-detection.patch shiz, 2014-07-29 15:34 review
Python-hg-723e0a7c4914-fix-PYTHON_FOR_BUILD-detection-v2.patch shiz, 2014-07-31 15:53 review
Python-hg-723e0a7c4914-fix-PYTHON_FOR_BUILD-detection-v3.patch shiz, 2014-08-04 08:39 review
Messages (4)
msg224230 - (view) Author: Shiz (shiz) * Date: 2014-07-29 15:34
Currently, when cross-compiling, the configure script doesn't take $HOSTPYTHON into account when determining $PYTHON_FOR_BUILD. This can lead to a wrong Python interpreter being used for several critical cross-compilation stages, leading to compilation errors[1].

Attached is a patch which makes it take $HOSTPYTHON into account, thus solving said issues, diffed against the current hg tip, 723e0a7c4914.

[1]: https://github.com/rave-engine/python3-android/issues/1 (the last issue in the report)
msg224422 - (view) Author: Shiz (shiz) * Date: 2014-07-31 15:53
After some further investigation it seems the which-clause fails when given a relative path. Since we should expect $HOSTPYTHON to be present in the first place, I modified the patch a bit to special-case the $HOSTPYTHON check, and fall back on the other interpreters as checked before.
msg224701 - (view) Author: Shiz (shiz) * Date: 2014-08-04 08:39
And a last tiny fix: on a lot of systems (except apparently the system I was using for my main testing), a freshly-built HOSTPYTHON will be confused to look for libraries, and the invocation will fail because it can't bootstrap itself. Point it to the current Python tree for libraries.
msg255395 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015-11-26 00:41
What is $HOSTPYTHON? It does not appear to be used or mentioned anywhere. You mention it as if it is commonly known, but if you are proposing a new configuration variable, perhaps you should document it.

The Gnu version of “which” seems to work fine with relative paths, though I know it is not a standardized command. Can you explain what your problem with relative paths is? Maybe we can find a cleaner way to check if a command exists, e.g. use “command -v”.

$ which ./python && echo Success
/media/disk/home/proj/python/cpython/python
Success

Can you explain the problem with PYTHONPATH and the —S addition? If we really need it, a comment would be good. What is the difference between your $HOSTPYTHON case and the original python3 etc cases, where it is not needed?

Also, did you test your patch? Your —S argument uses a UTF-8 em dash, which would be interpreted as a script file name, rather than an ASCII dash for the -S option.
History
Date User Action Args
2022-04-11 14:58:06adminsetgithub: 66298
2021-02-28 09:47:59pmppsetnosy: + pmpp
2015-11-26 00:41:24martin.pantersetnosy: + martin.panter
messages: + msg255395
2015-11-25 15:14:41yan12125setnosy: + yan12125
2014-08-04 08:39:01shizsetfiles: + Python-hg-723e0a7c4914-fix-PYTHON_FOR_BUILD-detection-v3.patch

messages: + msg224701
2014-07-31 15:53:56shizsetfiles: + Python-hg-723e0a7c4914-fix-PYTHON_FOR_BUILD-detection-v2.patch

messages: + msg224422
2014-07-29 21:09:26rpetrovsetnosy: + rpetrov
2014-07-29 20:31:14ned.deilysetnosy: + doko

versions: - Python 3.3
2014-07-29 17:56:47shizsetversions: + Python 3.3, Python 3.4
2014-07-29 15:34:01shizcreate