mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Catch failure to open installed Makefile, and report it as a
DistutilsPlatformError: "invalid Python installation". (This will happen on Red Hat-ish systems where the python-devel package is not installed.)
This commit is contained in:
parent
f1dc5fa2c8
commit
a570c05997
1 changed files with 11 additions and 1 deletions
|
@ -229,7 +229,17 @@ def _init_posix():
|
||||||
"""Initialize the module as appropriate for POSIX systems."""
|
"""Initialize the module as appropriate for POSIX systems."""
|
||||||
g = globals()
|
g = globals()
|
||||||
# load the installed Makefile:
|
# load the installed Makefile:
|
||||||
parse_makefile(open(get_makefile_filename()), g)
|
try:
|
||||||
|
filename = get_makefile_filename()
|
||||||
|
file = open(filename)
|
||||||
|
except IOError, msg:
|
||||||
|
my_msg = "invalid Python installation: unable to open %s" % filename
|
||||||
|
if hasattr(msg, "strerror"):
|
||||||
|
my_msg = my_msg + " (%s)" % msg.strerror
|
||||||
|
|
||||||
|
raise DistutilsPlatformError, my_msg
|
||||||
|
|
||||||
|
parse_makefile(file, g)
|
||||||
|
|
||||||
|
|
||||||
def _init_nt():
|
def _init_nt():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue