aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortarek <none@none>2009-12-10 13:30:30 +0100
committertarek <none@none>2009-12-10 13:30:30 +0100
commitb74e204f60de97245539398db20bc1ab8e2152de (patch)
treeebae17321469132872390ee4d54f4a6d40998379
parentf7279ede282b895e789b05ababb65ba4f6436160 (diff)
downloadexternal_python_setuptools-b74e204f60de97245539398db20bc1ab8e2152de.tar.gz
external_python_setuptools-b74e204f60de97245539398db20bc1ab8e2152de.tar.bz2
external_python_setuptools-b74e204f60de97245539398db20bc1ab8e2152de.zip
fixed the MacPorts failure when platform.mac_ver() fails - fixes #92
--HG-- branch : distribute extra : rebase_source : b8bf9830479ce1433cf6c0b0c97c628a2876675c
-rw-r--r--CHANGES.txt2
-rw-r--r--pkg_resources.py10
2 files changed, 12 insertions, 0 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 422685a9..34fb5d48 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -20,6 +20,8 @@ CHANGES
only if triggered by ``install_requires`` from a setup.py call
(install, develop, etc).
* Issue 101: Allowing ``os.devnull`` in Sandbox
+* Issue 92: Fixed the "no eggs" found error with MacPort
+ (platform.mac_ver() fails)
-----
0.6.8
diff --git a/pkg_resources.py b/pkg_resources.py
index 70a32710..46841631 100644
--- a/pkg_resources.py
+++ b/pkg_resources.py
@@ -186,6 +186,16 @@ def _macosx_vers(_cache=[]):
if not _cache:
import platform
version = platform.mac_ver()[0]
+ # fallback for MacPorts
+ if version == '':
+ import re
+ version_file = '/System/Library/CoreServices/SystemVersion.plist'
+ version_regexp = r'<key>ProductVersion</key>\n\t<string>(.*?)</string>'
+ if os.path.exists(version_file):
+ osx_version = open(version_file).read()
+ osx_version = re.findall(version_regexp, osx_version, re.M)
+ if len(osx_version) > 0:
+ version = osx_version[0]
_cache.append(version.split('.'))
return _cache[0]