Skip to content

Commit 27638e3

Browse files
authored
Merge pull request #139 from DWesl/patch-2
Test that find_library_file works with Cygwin libraries
2 parents a7cfb56 + c6f28fc commit 27638e3

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

distutils/cygwinccompiler.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,11 @@ class CygwinCCompiler(UnixCCompiler):
101101
compiler_type = 'cygwin'
102102
obj_extension = ".o"
103103
static_lib_extension = ".a"
104-
shared_lib_extension = ".dll"
104+
shared_lib_extension = ".dll.a"
105+
dylib_lib_extension = ".dll"
105106
static_lib_format = "lib%s%s"
106-
shared_lib_format = "%s%s"
107+
shared_lib_format = "lib%s%s"
108+
dylib_lib_format = "cyg%s%s"
107109
exe_extension = ".exe"
108110

109111
def __init__(self, verbose=0, dry_run=0, force=0):

distutils/tests/test_cygwinccompiler.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,17 @@ def tearDown(self):
3131
def _get_config_h_filename(self):
3232
return self.python_h
3333

34+
@unittest.skipIf(sys.platform != "cygwin", "Not running on Cygwin")
35+
@unittest.skipIf(not os.path.exists("/usr/lib/libbash.dll.a"), "Don't know a linkable library")
36+
def test_find_library_file(self):
37+
from distutils.cygwinccompiler import CygwinCCompiler
38+
compiler = CygwinCCompiler()
39+
link_name = "bash"
40+
linkable_file = compiler.find_library_file(["/usr/lib"], link_name)
41+
self.assertIsNotNone(linkable_file)
42+
self.assertTrue(os.path.exists(linkable_file))
43+
self.assertEquals(linkable_file, "/usr/lib/lib{:s}.dll.a".format(link_name))
44+
3445
def test_check_config_h(self):
3546

3647
# check_config_h looks for "GCC" in sys.version first

0 commit comments

Comments
 (0)