Ronald Oussoren <ronaldousso...@mac.com> added the comment:

This test seems to trigger an issue in site.py, adding '-v' to the code that 
starts the interpreter in test_platform.py gives the following output (amongst 
a lot more text that doesn't seem to be relevant):

'import site' failed; traceback:
Traceback (most recent call last):
  File "/Users/ronald/Projects/python/python-trunk/build/../Lib/site.py", line 
530, in <module>
    main()
  File "/Users/ronald/Projects/python/python-trunk/build/../Lib/site.py", line 
509, in main
    addbuilddir()
  File "/Users/ronald/Projects/python/python-trunk/build/../Lib/site.py", line 
118, in addbuilddir
    s = "build/lib.%s-%.3s" % (get_platform(), sys.version)
  File "/Users/ronald/Projects/python/python-trunk/Lib/sysconfig.py", line 577, 
in get_platform
    cfgvars = get_config_vars()
  File "/Users/ronald/Projects/python/python-trunk/Lib/sysconfig.py", line 402, 
in get_config_vars
    _init_posix(_CONFIG_VARS)
  File "/Users/ronald/Projects/python/python-trunk/Lib/sysconfig.py", line 255, 
in _init_posix
    raise IOError(msg)
IOError: invalid Python installation: unable to open 
/usr/local/lib/python2.7/config/Makefile (No such file or directory)


The root cause is that test_architecture_via_symlink starts python through a 
symlink, and that confuses the sysconfig module because that tries to detect if 
it is running in the build tree by looking for a file relative to 
sys.executable, without resolving symlinks.

A simple patch to sysconfig seems to fix the issue:

-_PROJECT_BASE = abspath(os.path.dirname(sys.executable))
+_PROJECT_BASE = abspath(os.path.dirname(os.path.realpath(sys.executable)))

(also attached as a proper patch).

I'm adding tarek because he added Lib/sysconfig.py.

Tarek: could you please review the patch?

----------
keywords: +patch
nosy: +tarek
Added file: http://bugs.python.org/file16252/sysconfig.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7958>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to