diff --git a/distutils/sysconfig.py b/distutils/sysconfig.py index 871f93f546..8832b3eceb 100644 --- a/distutils/sysconfig.py +++ b/distutils/sysconfig.py @@ -214,10 +214,9 @@ def customize_compiler(compiler): if 'CC' in os.environ: newcc = os.environ['CC'] - if (sys.platform == 'darwin' - and 'LDSHARED' not in os.environ + if('LDSHARED' not in os.environ and ldshared.startswith(cc)): - # On OS X, if CC is overridden, use that as the default + # If CC is overridden, use that as the default # command for LDSHARED as well ldshared = newcc + ldshared[len(cc):] cc = newcc diff --git a/distutils/tests/test_unixccompiler.py b/distutils/tests/test_unixccompiler.py index ebd7c161e0..d8ebae1cc8 100644 --- a/distutils/tests/test_unixccompiler.py +++ b/distutils/tests/test_unixccompiler.py @@ -181,8 +181,8 @@ def gcv(v): sysconfig.get_config_var = gcv self.assertEqual(self.cc.rpath_foo(), '-R/foo') - @unittest.skipUnless(sys.platform == 'darwin', 'test only relevant for OS X') - def test_osx_cc_overrides_ldshared(self): + @unittest.skipIf(sys.platform == 'win32', "can't test on Windows") + def test_cc_overrides_ldshared(self): # Issue #18080: # ensure that setting CC env variable also changes default linker def gcv(v): @@ -202,8 +202,8 @@ def gcvs(*args, _orig=sysconfig.get_config_vars): sysconfig.customize_compiler(self.cc) self.assertEqual(self.cc.linker_so[0], 'my_cc') - @unittest.skipUnless(sys.platform == 'darwin', 'test only relevant for OS X') - def test_osx_explicit_ldshared(self): + @unittest.skipIf(sys.platform == 'win32', "can't test on Windows") + def test_explicit_ldshared(self): # Issue #18080: # ensure that setting CC env variable does not change # explicit LDSHARED setting for linker