aboutsummaryrefslogtreecommitdiffstats
path: root/pkg_resources.py
diff options
context:
space:
mode:
authorPJ Eby <distutils-sig@python.org>2006-02-07 13:36:50 +0000
committerPJ Eby <distutils-sig@python.org>2006-02-07 13:36:50 +0000
commite6577a4177c4b21b2f840f760613ce71d9ed7733 (patch)
tree34e8d0aed429824f7d9a3941b75b23f28033d04f /pkg_resources.py
parent41e25d5f6f4da0c7b7afe13baab1ec8a16949fdb (diff)
downloadexternal_python_setuptools-e6577a4177c4b21b2f840f760613ce71d9ed7733.tar.gz
external_python_setuptools-e6577a4177c4b21b2f840f760613ce71d9ed7733.tar.bz2
external_python_setuptools-e6577a4177c4b21b2f840f760613ce71d9ed7733.zip
Implement more Mac OS X version handling stuff requested by Bob
Ippolito. --HG-- branch : setuptools extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4042256
Diffstat (limited to 'pkg_resources.py')
-rw-r--r--pkg_resources.py46
1 files changed, 23 insertions, 23 deletions
diff --git a/pkg_resources.py b/pkg_resources.py
index 50e68ecc..dc0942ae 100644
--- a/pkg_resources.py
+++ b/pkg_resources.py
@@ -18,26 +18,26 @@ from sets import ImmutableSet
from os import utime, rename, unlink # capture these to bypass sandboxing
from os import open as os_open
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+def _get_max_platform(plat):
+ """Return this platform's maximum compatible version.
+
+ distutils.util.get_platform() normally reports the minimum version
+ of Mac OS X that would be required to *use* extensions produced by
+ distutils. But what we want when checking compatibility is to know the
+ version of Mac OS X that we are *running*. To allow usage of packages that
+ explicitly require a newer version of Mac OS X, we must also know the
+ current version of the OS.
+
+ If this condition occurs for any other platform with a version in its
+ platform strings, this function should be extended accordingly.
+ """
+ m = macosVersionString.match(plat)
+ if m is not None and sys.platform == "darwin":
+ try:
+ plat = 'macosx-%s-%s' % ('.'.join(_macosx_vers()[:2]), m.group(3))
+ except ValueError:
+ pass # not Mac OS X
+ return plat
__all__ = [
# Basic resource access and distribution/entry point discovery
@@ -167,10 +167,12 @@ def compatible_platforms(provided,required):
Returns true if either platform is ``None``, or the platforms are equal.
- XXX Needs compatibility checks for Linux and Mac OS X.
+ XXX Needs compatibility checks for Linux and other unixy OSes.
"""
if provided is None or required is None or provided==required:
return True # easy case
+ provided = _get_max_platform(provided)
+ if provided==required: return True
# Mac OS X special cases
reqMac = macosVersionString.match(required)
@@ -194,7 +196,6 @@ def compatible_platforms(provided,required):
# "use the macosx designation instead of darwin.",
# category=DeprecationWarning)
return True
-
return False # egg isn't macosx or legacy darwin
# are they the same major version and machine type?
@@ -202,7 +203,6 @@ def compatible_platforms(provided,required):
provMac.group(3) != reqMac.group(3):
return False
-
# is the required OS major update >= the provided one?
if int(provMac.group(2)) > int(reqMac.group(2)):
return False