Commits

tarek  committed 7a6f295

fixed the MacPorts failure when platform.mac_ver() fails - fixes #92

  • Participants
  • Parent commits 48274ba
  • Branches 0.6-maintenance

Comments (0)

Files changed (2)

   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

File pkg_resources.py

     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]