summaryrefslogtreecommitdiff
path: root/setuptools
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2021-10-18 21:11:33 -0400
committerJason R. Coombs <jaraco@jaraco.com>2021-10-18 21:11:33 -0400
commit46591cfae8bd2d9fd7164a66b670d58578e8ff6c (patch)
treee8fc4ac164364cfc58e3019ad106216a51ecfed2 /setuptools
parent3dd1af099fc1379935a975a2a5f1561870c9dc92 (diff)
parent42f0cf2d17c82ec2fde18fa74ff2f7fc0a60d892 (diff)
downloadpython-setuptools-git-46591cfae8bd2d9fd7164a66b670d58578e8ff6c.tar.gz
Merge https://github.com/pypa/distutils
Diffstat (limited to 'setuptools')
-rw-r--r--setuptools/_distutils/tests/test_unixccompiler.py4
-rw-r--r--setuptools/_distutils/unixccompiler.py25
-rw-r--r--setuptools/_distutils/util.py4
3 files changed, 13 insertions, 20 deletions
diff --git a/setuptools/_distutils/tests/test_unixccompiler.py b/setuptools/_distutils/tests/test_unixccompiler.py
index 1008f58a..ee2fe99c 100644
--- a/setuptools/_distutils/tests/test_unixccompiler.py
+++ b/setuptools/_distutils/tests/test_unixccompiler.py
@@ -177,7 +177,7 @@ class UnixCCompilerTestCase(unittest.TestCase):
elif v == 'GNULD':
return 'yes'
sysconfig.get_config_var = gcv
- self.assertEqual(self.cc.rpath_foo(), '-R/foo')
+ self.assertEqual(self.cc.rpath_foo(), '-Wl,--enable-new-dtags,-R/foo')
# non-GCC non-GNULD
sys.platform = 'bar'
@@ -187,7 +187,7 @@ class UnixCCompilerTestCase(unittest.TestCase):
elif v == 'GNULD':
return 'no'
sysconfig.get_config_var = gcv
- self.assertEqual(self.cc.rpath_foo(), '-R/foo')
+ self.assertEqual(self.cc.rpath_foo(), '-Wl,-R/foo')
@unittest.skipIf(sys.platform == 'win32', "can't test on Windows")
def test_cc_overrides_ldshared(self):
diff --git a/setuptools/_distutils/unixccompiler.py b/setuptools/_distutils/unixccompiler.py
index 349cc164..a07e5988 100644
--- a/setuptools/_distutils/unixccompiler.py
+++ b/setuptools/_distutils/unixccompiler.py
@@ -245,23 +245,16 @@ class UnixCCompiler(CCompiler):
if self._is_gcc(compiler):
return ["-Wl,+s", "-L" + dir]
return ["+s", "-L" + dir]
+
+ # For all compilers, `-Wl` is the presumed way to
+ # pass a compiler option to the linker and `-R` is
+ # the way to pass an RPATH.
+ if sysconfig.get_config_var("GNULD") == "yes":
+ # GNU ld needs an extra option to get a RUNPATH
+ # instead of just an RPATH.
+ return "-Wl,--enable-new-dtags,-R" + dir
else:
- if self._is_gcc(compiler):
- # gcc on non-GNU systems does not need -Wl, but can
- # use it anyway. Since distutils has always passed in
- # -Wl whenever gcc was used in the past it is probably
- # safest to keep doing so.
- if sysconfig.get_config_var("GNULD") == "yes":
- # GNU ld needs an extra option to get a RUNPATH
- # instead of just an RPATH.
- return "-Wl,--enable-new-dtags,-R" + dir
- else:
- return "-Wl,-R" + dir
- else:
- # No idea how --enable-new-dtags would be passed on to
- # ld if this system was using GNU ld. Don't know if a
- # system like this even exists.
- return "-R" + dir
+ return "-Wl,-R" + dir
def library_option(self, lib):
return "-l" + lib
diff --git a/setuptools/_distutils/util.py b/setuptools/_distutils/util.py
index 64f06dd4..afc23c4e 100644
--- a/setuptools/_distutils/util.py
+++ b/setuptools/_distutils/util.py
@@ -134,14 +134,14 @@ def get_macosx_target_ver():
"""Return the version of macOS for which we are building.
The target version defaults to the version in sysconfig latched at time
- the Python interpreter was built, unless overriden by an environment
+ the Python interpreter was built, unless overridden by an environment
variable. If neither source has a value, then None is returned"""
syscfg_ver = get_macosx_target_ver_from_syscfg()
env_ver = os.environ.get(MACOSX_VERSION_VAR)
if env_ver:
- # Validate overriden version against sysconfig version, if have both.
+ # Validate overridden version against sysconfig version, if have both.
# Ensure that the deployment target of the build process is not less
# than 10.3 if the interpreter was built for 10.3 or later. This
# ensures extension modules are built with correct compatibility