Message238993
On Python 3.5.0a1+ built from source,
>>> import sysconfig
>>> sysconfig.is_python_build()
False
>>> sysconfig.is_python_build(True)
False
>>> sysconfig._PROJECT_BASE
'/opt/bin'
>>> import sys
>>> sys._home
>>>
The problem is, when sys._home is None, this function uses _is_python_source_dir(_PROJECT_BASE) . In this case the _PROJECT_BASE is clearly passed wrongly as '/opt/bin'. That is the INSTALL_PREFIX, not _PROJECT_BASE .
Let us do a small hack and set _PROJECT_BASE to the folder where I build this Python version.
# Of course this can't be reproduced but you get the idea.
>>> sysconfig._PROJECT_BASE='/home/anand/code/cpython/'
>>> sysconfig.is_python_build()
True
The documentation says,
"
sysconfig.is_python_build()
Return True if the current Python installation was built from source.
"
which is clearly in conflict with what it is doing.
From a quick look at sysconfig.py it looks like it is calculating _PROJECT_BASE wrongly.
I can give a patch for this, but first I am more interested in finding out what this function is supposed to do - why have this function if you are not able to get the details of the build environment from the built interpreter ? Clearly it is not doing that here.
The conclusions are part of the attached file in comments. |
|
Date |
User |
Action |
Args |
2015-03-23 09:13:02 | pythonhacker | set | recipients:
+ pythonhacker |
2015-03-23 09:13:02 | pythonhacker | set | messageid: <1427101982.73.0.589713060591.issue23746@psf.upfronthosting.co.za> |
2015-03-23 09:13:02 | pythonhacker | link | issue23746 messages |
2015-03-23 09:13:02 | pythonhacker | create | |
|