Commit dce75aea authored by PJ Eby's avatar PJ Eby

Tweak Mac OS platform string based on Mac SIG feedback: remove "micro"

version number, and map "PowerPC" and "Power_Macintosh" to "ppc".

--HG--
branch : setuptools
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041142
parent 92cd79e4
...@@ -256,7 +256,7 @@ Mac OS X will soon have two platforms to contend with: Intel and PowerPC. ...@@ -256,7 +256,7 @@ Mac OS X will soon have two platforms to contend with: Intel and PowerPC.
Basic equality works as on other platforms:: Basic equality works as on other platforms::
>>> from pkg_resources import compatible_platforms as cp >>> from pkg_resources import compatible_platforms as cp
>>> reqd = 'macosx-10.4.2-Power_Macintosh' >>> reqd = 'macosx-10.4-ppc'
>>> cp(reqd, reqd) >>> cp(reqd, reqd)
True True
>>> cp("win32", reqd) >>> cp("win32", reqd)
...@@ -264,19 +264,19 @@ Basic equality works as on other platforms:: ...@@ -264,19 +264,19 @@ Basic equality works as on other platforms::
Distributions made on other machine types are not compatible:: Distributions made on other machine types are not compatible::
>>> cp("macosx-10.4.2-Intel", reqd) >>> cp("macosx-10.4-i386", reqd)
False False
Distributions made on earlier versions of the OS are compatible, as Distributions made on earlier versions of the OS are compatible, as
long as they are from the same top-level version. The patchlevel version long as they are from the same top-level version. The patchlevel version
number does not matter:: number does not matter::
>>> cp("macosx-10.4.5-Power_Macintosh", reqd) >>> cp("macosx-10.4-ppc", reqd)
True True
>>> cp("macosx-10.3.5-Power_Macintosh", reqd) >>> cp("macosx-10.3-ppc", reqd)
True True
>>> cp("macosx-10.5.5-Power_Macintosh", reqd) >>> cp("macosx-10.5-ppc", reqd)
False False
>>> cp("macosx-9.5.5-Power_Macintosh", reqd) >>> cp("macosx-9.5-ppc", reqd)
False False
...@@ -103,8 +103,11 @@ def get_platform(): ...@@ -103,8 +103,11 @@ def get_platform():
try: try:
version = _macosx_vers() version = _macosx_vers()
machine = os.uname()[4].replace(" ", "_") machine = os.uname()[4].replace(" ", "_")
return "macosx-%d.%d.%d-%s" % (int(version[0]), int(version[1]), machine = {
int(version[2]), machine) 'PowerPC':'ppc', 'Power_Macintosh':'ppc'
}.get(machine,machine)
return "macosx-%d.%d-%s" % (int(version[0]), int(version[1]),
machine)
except ValueError: except ValueError:
# if someone is running a non-Mac darwin system, this will fall # if someone is running a non-Mac darwin system, this will fall
# through to the default implementation # through to the default implementation
...@@ -113,14 +116,11 @@ def get_platform(): ...@@ -113,14 +116,11 @@ def get_platform():
from distutils.util import get_platform from distutils.util import get_platform
return get_platform() return get_platform()
macosVersionString = re.compile(r"macosx-(\d+)\.(\d+)\.(\d+)-(.*)") macosVersionString = re.compile(r"macosx-(\d+)\.(\d+)-(.*)")
# XXX darwinVersionString = re.compile(r"darwin-(\d+)\.(\d+)\.(\d+)-(.*)") # XXX darwinVersionString = re.compile(r"darwin-(\d+)\.(\d+)\.(\d+)-(.*)")
def compatible_platforms(provided,required): def compatible_platforms(provided,required):
"""Can code for the `provided` platform run on the `required` platform? """Can code for the `provided` platform run on the `required` platform?
...@@ -143,7 +143,7 @@ def compatible_platforms(provided,required): ...@@ -143,7 +143,7 @@ def compatible_platforms(provided,required):
# are they the same major version and machine type? # are they the same major version and machine type?
if provMac.group(1) != reqMac.group(1) or \ if provMac.group(1) != reqMac.group(1) or \
provMac.group(4) != reqMac.group(4): provMac.group(3) != reqMac.group(3):
return False return False
# is the required OS major update >= the provided one? # is the required OS major update >= the provided one?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment