Skip to content

Commit

Permalink
Split CC to make sure we get the correct basename of the compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
isuruf committed Sep 16, 2021
1 parent 887749a commit f182b5e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions distutils/tests/test_unixccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@ def gcv(v):
sysconfig.get_config_var = gcv
self.assertEqual(self.cc.rpath_foo(), '-Wl,--enable-new-dtags,-R/foo')

def gcv(v):
if v == 'CC':
return 'gcc -pthread -B /bar'
elif v == 'GNULD':
return 'yes'
sysconfig.get_config_var = gcv
self.assertEqual(self.cc.rpath_foo(), '-Wl,--enable-new-dtags,-R/foo')

# GCC non-GNULD
sys.platform = 'bar'
def gcv(v):
Expand Down
2 changes: 1 addition & 1 deletion distutils/unixccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def runtime_library_dir_option(self, dir):
# this time, there's no way to determine this information from
# the configuration data stored in the Python installation, so
# we use this hack.
compiler = os.path.basename(sysconfig.get_config_var("CC"))
compiler = os.path.basename(sysconfig.get_config_var("CC").split(" ")[0])
if sys.platform[:6] == "darwin":
from distutils.util import get_macosx_target_ver, split_version
macosx_target_ver = get_macosx_target_ver()
Expand Down

0 comments on commit f182b5e

Please sign in to comment.