From 97648e69ab945e830ef1ea82b5e528898461031e Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Mon, 2 May 2022 18:17:31 -0400 Subject: [PATCH 1/2] BUG: Set library name patterns for Cygwin packages Closes #3302 Sets static library, DLL, and import library name patterns to those used by Cygwin packages. The DLLs will often have a numeral as part of the name (cyg${name}-0.dll or cyg${name}_2.dll or such), but I don't know how to specify that here. --- setuptools/_distutils/cygwinccompiler.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/setuptools/_distutils/cygwinccompiler.py b/setuptools/_distutils/cygwinccompiler.py index c5c86d8f07..80f5a15bca 100644 --- a/setuptools/_distutils/cygwinccompiler.py +++ b/setuptools/_distutils/cygwinccompiler.py @@ -101,9 +101,11 @@ class CygwinCCompiler(UnixCCompiler): compiler_type = 'cygwin' obj_extension = ".o" static_lib_extension = ".a" - shared_lib_extension = ".dll" + shared_lib_extension = ".dll.a" + dylib_lib_extension = ".dll" static_lib_format = "lib%s%s" - shared_lib_format = "%s%s" + shared_lib_format = "lib%s%s" + dylib_lib_format = "cyg%s%s" exe_extension = ".exe" def __init__(self, verbose=0, dry_run=0, force=0): From 911cb88a2459fb8464789e806bcdc5da93e0e1b0 Mon Sep 17 00:00:00 2001 From: DWesl <22566757+DWesl@users.noreply.github.com> Date: Mon, 2 May 2022 18:34:51 -0400 Subject: [PATCH 2/2] TST: Test that CygwinCCompiler can find installed libs libbash.dll.a seems to be installed by default, which allows a good test of the more unusual features of Cygwin linking. --- setuptools/_distutils/tests/test_cygwinccompiler.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/setuptools/_distutils/tests/test_cygwinccompiler.py b/setuptools/_distutils/tests/test_cygwinccompiler.py index 8715a53539..e8484c3016 100644 --- a/setuptools/_distutils/tests/test_cygwinccompiler.py +++ b/setuptools/_distutils/tests/test_cygwinccompiler.py @@ -53,6 +53,15 @@ def test_check_config_h(self): # and CONFIG_H_OK if __GNUC__ is found self.write_file(self.python_h, 'xxx __GNUC__ xxx') self.assertEqual(check_config_h()[0], CONFIG_H_OK) + + @unittest.skipIf(not os.path.exists("/usr/lib/libbash.dll.a"), "Don't know a linkable library") + def test_find_library_file(self): + from distutils.cygwinccompiler import CygwinCCompiler + compiler = CygwinCCompiler() + link_name = "bash" + linkable_file = compiler.find_library_file(["/usr/lib"], link_name) + self.assertIsNotNone(linkable_file) + self.assertTrue(os.path.exists(linkable_file)) def test_get_msvcr(self):