summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2022-07-01 15:26:06 -0400
committerGitHub <noreply@github.com>2022-07-01 15:26:06 -0400
commit1b885fafac5c9d3819f9fb29bceceb1390e3c55a (patch)
tree8add038727715fa5054651d10ac7a3eacad411b3
parent763c440818cc9ca3d4a45cfae1fa48739233e975 (diff)
parent7134521c327f522c9d378949cf32460bfbcaccb5 (diff)
downloadpython-setuptools-git-1b885fafac5c9d3819f9fb29bceceb1390e3c55a.tar.gz
Merge pull request #150 from lazka/cygwin-no-rpath
Improve handling if runtime_library_dirs is set with cygwin/mingw
-rw-r--r--distutils/cygwinccompiler.py19
-rw-r--r--distutils/tests/test_cygwinccompiler.py6
2 files changed, 25 insertions, 0 deletions
diff --git a/distutils/cygwinccompiler.py b/distutils/cygwinccompiler.py
index 931b3661..445e2e51 100644
--- a/distutils/cygwinccompiler.py
+++ b/distutils/cygwinccompiler.py
@@ -58,6 +58,7 @@ from distutils.unixccompiler import UnixCCompiler
from distutils.file_util import write_file
from distutils.errors import (
DistutilsExecError,
+ DistutilsPlatformError,
CCompilerError,
CompileError,
UnknownFileError,
@@ -197,6 +198,12 @@ class CygwinCCompiler(UnixCCompiler):
libraries = copy.copy(libraries or [])
objects = copy.copy(objects or [])
+ if runtime_library_dirs:
+ self.warn(
+ "I don't know what to do with 'runtime_library_dirs': "
+ + str(runtime_library_dirs)
+ )
+
# Additional libraries
libraries.extend(self.dll_libraries)
@@ -265,6 +272,13 @@ class CygwinCCompiler(UnixCCompiler):
target_lang,
)
+ def runtime_library_dir_option(self, dir):
+ # cygwin doesn't support rpath. While in theory we could error
+ # out like MSVC does, code might expect it to work like on Unix, so
+ # just warn and hope for the best.
+ self.warn("don't know how to set runtime library search path on Windows")
+ return []
+
# -- Miscellaneous methods -----------------------------------------
def object_filenames(self, source_filenames, strip_dir=0, output_dir=''):
@@ -325,6 +339,11 @@ class Mingw32CCompiler(CygwinCCompiler):
# with MSVC 7.0 or later.
self.dll_libraries = get_msvcr()
+ def runtime_library_dir_option(self, dir):
+ raise DistutilsPlatformError(
+ "don't know how to set runtime library search path on Windows"
+ )
+
# Because these compilers aren't configured in Python's pyconfig.h file by
# default, we should at least warn the user if he is using an unmodified
diff --git a/distutils/tests/test_cygwinccompiler.py b/distutils/tests/test_cygwinccompiler.py
index b3c164ed..7760436a 100644
--- a/distutils/tests/test_cygwinccompiler.py
+++ b/distutils/tests/test_cygwinccompiler.py
@@ -48,6 +48,12 @@ class CygwinCCompilerTestCase(support.TempdirManager, unittest.TestCase):
self.assertTrue(os.path.exists(linkable_file))
self.assertEquals(linkable_file, "/usr/lib/lib{:s}.dll.a".format(link_name))
+ @unittest.skipIf(sys.platform != "cygwin", "Not running on Cygwin")
+ def test_runtime_library_dir_option(self):
+ from distutils.cygwinccompiler import CygwinCCompiler
+ compiler = CygwinCCompiler()
+ self.assertEqual(compiler.runtime_library_dir_option('/foo'), [])
+
def test_check_config_h(self):
# check_config_h looks for "GCC" in sys.version first