Skip to content

Commit

Permalink
Merge pull request #139 from DWesl/patch-2
Browse files Browse the repository at this point in the history
Test that find_library_file works with Cygwin libraries
  • Loading branch information
jaraco authored May 9, 2022
2 parents a7cfb56 + c6f28fc commit 27638e3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
6 changes: 4 additions & 2 deletions distutils/cygwinccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
11 changes: 11 additions & 0 deletions distutils/tests/test_cygwinccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ def tearDown(self):
def _get_config_h_filename(self):
return self.python_h

@unittest.skipIf(sys.platform != "cygwin", "Not running on Cygwin")
@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))
self.assertEquals(linkable_file, "/usr/lib/lib{:s}.dll.a".format(link_name))

def test_check_config_h(self):

# check_config_h looks for "GCC" in sys.version first
Expand Down

0 comments on commit 27638e3

Please sign in to comment.