[issue12131] python built with --prefix fails in site.py with no section 'posix_prefix'
Ned Deily
report at bugs.python.org
Sat May 21 05:14:11 CEST 2011
New submission from Ned Deily <nad at acm.org>:
[reported by Stefan Behnel]
With the "packaging" changes introducing Lib/sysconfig.cfg and corresponding changes to Lib/sysconfig.py to depend on them, builds that use --prefix= to install outside of the build directory fail during startup when site.py calls sysconfig:
Traceback (most recent call last):
File "/.../python/lib/python3.3/configparser.py", line 842, in items
d.update(self._sections[section])
KeyError: 'posix_prefix'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/.../python/lib/python3.3/site.py", line 537, in <module>
main()
File "/.../python/lib/python3.3/site.py", line 522, in main
known_paths = addusersitepackages(known_paths)
File "/.../python/lib/python3.3/site.py", line 263, in addusersitepackages
user_site = getusersitepackages()
File "/.../python/lib/python3.3/site.py", line 238, in getusersitepackages
user_base = getuserbase() # this will also set USER_BASE
File "/.../python/lib/python3.3/site.py", line 228, in getuserbase
USER_BASE = get_config_var('userbase')
File "/.../python/lib/python3.3/sysconfig.py", line 576, in get_config_var
return get_config_vars().get(name)
File "/.../python/lib/python3.3/sysconfig.py", line 472, in get_config_vars
_init_posix(_CONFIG_VARS)
File "/.../python/lib/python3.3/sysconfig.py", line 324, in _init_posix
makefile = get_makefile_filename()
File "/.../python/lib/python3.3/sysconfig.py", line 318, in
get_makefile_filename
return os.path.join(get_path('stdlib'), config_dir_name, 'Makefile')
File "/.../python/lib/python3.3/sysconfig.py", line 436, in get_path
return get_paths(scheme, vars, expand)[name]
File "/.../python/lib/python3.3/sysconfig.py", line 426, in get_paths
return _expand_vars(scheme, vars)
File "/.../python/lib/python3.3/sysconfig.py", line 142, in _expand_vars
for key, value in _SCHEMES.items(scheme):
File "/.../python/lib/python3.3/configparser.py", line 845, in items
raise NoSectionError(section)
configparser.NoSectionError: No section: 'posix_prefix'
The problem is that sysconfig.py expects sysconfig.cfg to be in the same directory as it but no changes were added to the Makefile to do so.
A simple-minded workaround is something like this:
diff --git a/Makefile.pre.in b/Makefile.pre.in
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -947,7 +947,7 @@
else true; \
fi; \
done
- @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.egg-info ; \
+ @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.egg-info $(srcdir)/Lib/*.cfg ; \
do \
if test -x $$i; then \
$(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
I am not sure if that is a proper long-term fix. For real Python installations, say, via a binary installer, is the lib/python3.x directory the proper place for a .cfg file? Is it expected that site admins will modify this file?
----------
assignee: tarek
messages: 136419
nosy: ned.deily, tarek
priority: critical
severity: normal
stage: needs patch
status: open
title: python built with --prefix fails in site.py with no section 'posix_prefix'
versions: Python 3.3
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12131>
_______________________________________
More information about the Python-bugs-list
mailing list