diff options
Diffstat (limited to 'pkg_resources.py')
-rw-r--r-- | pkg_resources.py | 10 |
1 files changed, 10 insertions, 0 deletions
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] |