Skip to content

Commit 02e9f65

Browse files
authored
Merge pull request #54 from isuruf/basename
Split CC to make sure we get the correct basename of the compiler
2 parents 04b8822 + c51dc8c commit 02e9f65

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

distutils/tests/test_unixccompiler.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,14 @@ def gcv(v):
140140
sysconfig.get_config_var = gcv
141141
self.assertEqual(self.cc.rpath_foo(), '-Wl,--enable-new-dtags,-R/foo')
142142

143+
def gcv(v):
144+
if v == 'CC':
145+
return 'gcc -pthread -B /bar'
146+
elif v == 'GNULD':
147+
return 'yes'
148+
sysconfig.get_config_var = gcv
149+
self.assertEqual(self.cc.rpath_foo(), '-Wl,--enable-new-dtags,-R/foo')
150+
143151
# GCC non-GNULD
144152
sys.platform = 'bar'
145153
def gcv(v):

distutils/unixccompiler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* link shared library handled by 'cc -shared'
1414
"""
1515

16-
import os, sys, re
16+
import os, sys, re, shlex
1717

1818
from distutils import sysconfig
1919
from distutils.dep_util import newer
@@ -231,7 +231,7 @@ def runtime_library_dir_option(self, dir):
231231
# this time, there's no way to determine this information from
232232
# the configuration data stored in the Python installation, so
233233
# we use this hack.
234-
compiler = os.path.basename(sysconfig.get_config_var("CC"))
234+
compiler = os.path.basename(shlex.split(sysconfig.get_config_var("CC"))[0])
235235
if sys.platform[:6] == "darwin":
236236
from distutils.util import get_macosx_target_ver, split_version
237237
macosx_target_ver = get_macosx_target_ver()

0 commit comments

Comments
 (0)