Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve handling if runtime_library_dirs is set with cygwin/mingw #150

Merged
merged 1 commit into from
Jul 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions distutils/cygwinccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
from distutils.file_util import write_file
from distutils.errors import (
DistutilsExecError,
DistutilsPlatformError,
CCompilerError,
CompileError,
UnknownFileError,
Expand Down Expand Up @@ -197,6 +198,12 @@ def link(
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)

Expand Down Expand Up @@ -265,6 +272,13 @@ def link(
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=''):
Expand Down Expand Up @@ -325,6 +339,11 @@ def __init__(self, verbose=0, dry_run=0, force=0):
# 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
Expand Down
6 changes: 6 additions & 0 deletions distutils/tests/test_cygwinccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ def test_find_library_file(self):
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
Expand Down