summaryrefslogtreecommitdiff
path: root/Lib/distutils/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/distutils/util.py')
-rw-r--r--Lib/distutils/util.py29
1 files changed, 10 insertions, 19 deletions
diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py
index e92bef1b5f..6c49f0b1cb 100644
--- a/Lib/distutils/util.py
+++ b/Lib/distutils/util.py
@@ -97,9 +97,7 @@ def get_platform ():
from distutils.sysconfig import get_config_vars
cfgvars = get_config_vars()
- macver = os.environ.get('MACOSX_DEPLOYMENT_TARGET')
- if not macver:
- macver = cfgvars.get('MACOSX_DEPLOYMENT_TARGET')
+ macver = cfgvars.get('MACOSX_DEPLOYMENT_TARGET')
if 1:
# Always calculate the release of the running machine,
@@ -116,13 +114,15 @@ def get_platform ():
# behaviour.
pass
else:
- m = re.search(
- r'<key>ProductUserVisibleVersion</key>\s*' +
- r'<string>(.*?)</string>', f.read())
- f.close()
- if m is not None:
- macrelease = '.'.join(m.group(1).split('.')[:2])
- # else: fall back to the default behaviour
+ try:
+ m = re.search(
+ r'<key>ProductUserVisibleVersion</key>\s*' +
+ r'<string>(.*?)</string>', f.read())
+ if m is not None:
+ macrelease = '.'.join(m.group(1).split('.')[:2])
+ # else: fall back to the default behaviour
+ finally:
+ f.close()
if not macver:
macver = macrelease
@@ -234,15 +234,6 @@ def change_root (new_root, pathname):
path = path[1:]
return os.path.join(new_root, path)
- elif os.name == 'mac':
- if not os.path.isabs(pathname):
- return os.path.join(new_root, pathname)
- else:
- # Chop off volume name from start of path
- elements = string.split(pathname, ":", 1)
- pathname = ":" + elements[1]
- return os.path.join(new_root, pathname)
-
else:
raise DistutilsPlatformError, \
"nothing known about platform '%s'" % os.name