Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d142564

Browse files
committed
Added 'debug' flag to 'find_library_file()', and changed code to handle it.
1 parent e5e6015 commit d142564

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

Lib/distutils/msvccompiler.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -474,13 +474,18 @@ def library_option (self, lib):
474474
return self.library_filename (lib)
475475

476476

477-
def find_library_file (self, dirs, lib):
478-
477+
def find_library_file (self, dirs, lib, debug=0):
478+
# Prefer a debugging library if found (and requested), but deal
479+
# with it if we don't have one.
480+
if debug:
481+
try_names = [lib + "_d", lib]
482+
else:
483+
try_names = [lib]
479484
for dir in dirs:
480-
libfile = os.path.join (dir, self.library_filename (lib))
481-
if os.path.exists (libfile):
482-
return libfile
483-
485+
for name in try_names:
486+
libfile = os.path.join(dir, self.library_filename (name))
487+
if os.path.exists(libfile):
488+
return libfile
484489
else:
485490
# Oops, didn't find it in *any* of 'dirs'
486491
return None

0 commit comments

Comments
 (0)