summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2000-05-23 23:14:00 (GMT)
committerGreg Ward <gward@python.net>2000-05-23 23:14:00 (GMT)
commita570c059976b4ed402f2edc7c44b378475ae50a6 (patch)
treec3f296ea61d97118429e0c1e247f1d331ea4cc82
parentf1dc5fa2c8d97e3618a0a260e9f831e5e2fae554 (diff)
downloadcpython-a570c059976b4ed402f2edc7c44b378475ae50a6.zip
cpython-a570c059976b4ed402f2edc7c44b378475ae50a6.tar.gz
cpython-a570c059976b4ed402f2edc7c44b378475ae50a6.tar.bz2
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.)
-rw-r--r--Lib/distutils/sysconfig.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
index 5cc71dc..a5f3816 100644
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -229,7 +229,17 @@ def _init_posix():
"""Initialize the module as appropriate for POSIX systems."""
g = globals()
# 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():