summaryrefslogtreecommitdiff
path: root/Lib/test
diff options
context:
space:
mode:
authorJoshua Root <jmr@macports.org>2020-04-22 17:44:10 +1000
committerGitHub <noreply@github.com>2020-04-22 03:44:10 -0400
commitb310700976524b4b99ee319c947ca40468716fc9 (patch)
treeee5ffee5d510dd540b0c5748424b3afecd53bda8 /Lib/test
parent3a69f3caeeaea57048ed3bc3051e16854b9a4cd6 (diff)
downloadcpython-git-b310700976524b4b99ee319c947ca40468716fc9.tar.gz
bpo-38360: macOS: support alternate form of -isysroot flag (GH-16480)
It is possible to use either '-isysroot /some/path' (with a space) or '-isysroot/some/path' (no space in between). Support both forms in places where special handling of -isysroot is done, rather than just the first form. Co-authored-by: Ned Deily <nad@python.org>
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test__osx_support.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/Lib/test/test__osx_support.py b/Lib/test/test__osx_support.py
index 388a2b1a84..1a5d649b40 100644
--- a/Lib/test/test__osx_support.py
+++ b/Lib/test/test__osx_support.py
@@ -174,6 +174,29 @@ class Test_OSXSupport(unittest.TestCase):
_osx_support._remove_universal_flags(
config_vars))
+ def test__remove_universal_flags_alternate(self):
+ # bpo-38360: also test the alternate single-argument form of -isysroot
+ config_vars = {
+ 'CFLAGS': '-fno-strict-aliasing -g -O3 -arch ppc -arch i386 ',
+ 'LDFLAGS': '-arch ppc -arch i386 -g',
+ 'CPPFLAGS': '-I. -isysroot/Developer/SDKs/MacOSX10.4u.sdk',
+ 'BLDSHARED': 'gcc-4.0 -bundle -arch ppc -arch i386 -g',
+ 'LDSHARED': 'gcc-4.0 -bundle -arch ppc -arch i386 '
+ '-isysroot/Developer/SDKs/MacOSX10.4u.sdk -g',
+ }
+ expected_vars = {
+ 'CFLAGS': '-fno-strict-aliasing -g -O3 ',
+ 'LDFLAGS': ' -g',
+ 'CPPFLAGS': '-I. ',
+ 'BLDSHARED': 'gcc-4.0 -bundle -g',
+ 'LDSHARED': 'gcc-4.0 -bundle -g',
+ }
+ self.add_expected_saved_initial_values(config_vars, expected_vars)
+
+ self.assertEqual(expected_vars,
+ _osx_support._remove_universal_flags(
+ config_vars))
+
def test__remove_unsupported_archs(self):
config_vars = {
'CC': 'clang',
@@ -261,6 +284,34 @@ class Test_OSXSupport(unittest.TestCase):
_osx_support._check_for_unavailable_sdk(
config_vars))
+ def test__check_for_unavailable_sdk_alternate(self):
+ # bpo-38360: also test the alternate single-argument form of -isysroot
+ config_vars = {
+ 'CC': 'clang',
+ 'CFLAGS': '-fno-strict-aliasing -g -O3 -arch ppc -arch i386 '
+ '-isysroot/Developer/SDKs/MacOSX10.1.sdk',
+ 'LDFLAGS': '-arch ppc -arch i386 -g',
+ 'CPPFLAGS': '-I. -isysroot/Developer/SDKs/MacOSX10.1.sdk',
+ 'BLDSHARED': 'gcc-4.0 -bundle -arch ppc -arch i386 -g',
+ 'LDSHARED': 'gcc-4.0 -bundle -arch ppc -arch i386 '
+ '-isysroot/Developer/SDKs/MacOSX10.1.sdk -g',
+ }
+ expected_vars = {
+ 'CC': 'clang',
+ 'CFLAGS': '-fno-strict-aliasing -g -O3 -arch ppc -arch i386 '
+ ' ',
+ 'LDFLAGS': '-arch ppc -arch i386 -g',
+ 'CPPFLAGS': '-I. ',
+ 'BLDSHARED': 'gcc-4.0 -bundle -arch ppc -arch i386 -g',
+ 'LDSHARED': 'gcc-4.0 -bundle -arch ppc -arch i386 '
+ ' -g',
+ }
+ self.add_expected_saved_initial_values(config_vars, expected_vars)
+
+ self.assertEqual(expected_vars,
+ _osx_support._check_for_unavailable_sdk(
+ config_vars))
+
def test_get_platform_osx(self):
# Note, get_platform_osx is currently tested more extensively
# indirectly by test_sysconfig and test_distutils