Merged revisions 71560 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r71560 | tarek.ziade | 2009-04-13 14:34:01 +0200 (Mon, 13 Apr 2009) | 1 line

  Fixed #5607: Distutils test_get_platform was failing fo Mac OS X fat binaries.
........
This commit is contained in:
Tarek Ziadé 2009-04-13 12:37:57 +00:00
parent f64e6514d7
commit 822e1d48bc
2 changed files with 33 additions and 1 deletions

View File

@ -5,6 +5,7 @@
import os import os
import sys import sys
import unittest import unittest
from copy import copy
from distutils.errors import DistutilsPlatformError from distutils.errors import DistutilsPlatformError
@ -17,6 +18,7 @@ from distutils.util import strtobool
from distutils.util import rfc822_escape from distutils.util import rfc822_escape
from distutils import util # used to patch _environ_checked from distutils import util # used to patch _environ_checked
from distutils.sysconfig import get_config_vars, _config_vars
class utilTestCase(unittest.TestCase): class utilTestCase(unittest.TestCase):
@ -30,6 +32,7 @@ class utilTestCase(unittest.TestCase):
self.join = os.path.join self.join = os.path.join
self.isabs = os.path.isabs self.isabs = os.path.isabs
self.splitdrive = os.path.splitdrive self.splitdrive = os.path.splitdrive
self._config_vars = copy(_config_vars)
# patching os.uname # patching os.uname
if hasattr(os, 'uname'): if hasattr(os, 'uname'):
@ -42,7 +45,7 @@ class utilTestCase(unittest.TestCase):
os.uname = self._get_uname os.uname = self._get_uname
def tearDown(self): def tearDown(self):
# getting back tne environment # getting back the environment
os.name = self.name os.name = self.name
sys.platform = self.platform sys.platform = self.platform
sys.version = self.version sys.version = self.version
@ -55,6 +58,7 @@ class utilTestCase(unittest.TestCase):
os.uname = self.uname os.uname = self.uname
else: else:
del os.uname del os.uname
_config_vars = copy(self._config_vars)
def _set_uname(self, uname): def _set_uname(self, uname):
self._uname = uname self._uname = uname
@ -96,8 +100,34 @@ class utilTestCase(unittest.TestCase):
'root:xnu-792.25.20~1/RELEASE_I386'), 'i386')) 'root:xnu-792.25.20~1/RELEASE_I386'), 'i386'))
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.3' os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.3'
get_config_vars()['CFLAGS'] = ('-fno-strict-aliasing -DNDEBUG -g '
'-fwrapv -O3 -Wall -Wstrict-prototypes')
self.assertEquals(get_platform(), 'macosx-10.3-i386') self.assertEquals(get_platform(), 'macosx-10.3-i386')
# macbook with fat binaries (fat, universal or fat64)
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.4'
get_config_vars()['CFLAGS'] = ('-arch ppc -arch i386 -isysroot '
'/Developer/SDKs/MacOSX10.4u.sdk '
'-fno-strict-aliasing -fno-common '
'-dynamic -DNDEBUG -g -O3')
self.assertEquals(get_platform(), 'macosx-10.4-fat')
get_config_vars()['CFLAGS'] = ('-arch x86_64 -arch i386 -isysroot '
'/Developer/SDKs/MacOSX10.4u.sdk '
'-fno-strict-aliasing -fno-common '
'-dynamic -DNDEBUG -g -O3')
self.assertEquals(get_platform(), 'macosx-10.4-universal')
get_config_vars()['CFLAGS'] = ('-arch x86_64 -isysroot '
'/Developer/SDKs/MacOSX10.4u.sdk '
'-fno-strict-aliasing -fno-common '
'-dynamic -DNDEBUG -g -O3')
self.assertEquals(get_platform(), 'macosx-10.4-fat64')
# linux debian sarge # linux debian sarge
os.name = 'posix' os.name = 'posix'
sys.version = ('2.3.5 (#1, Jul 4 2007, 17:28:59) ' sys.version = ('2.3.5 (#1, Jul 4 2007, 17:28:59) '

View File

@ -348,6 +348,8 @@ Core and Builtins
Library Library
------- -------
- Issue #5607: fixed Distutils test_get_platform for Mac OS X fat binaries.
- Issue #5732: added a new command in Distutils: check. - Issue #5732: added a new command in Distutils: check.
- Issue #5731: Distutils bdist_wininst no longer worked on non-Windows - Issue #5731: Distutils bdist_wininst no longer worked on non-Windows