summaryrefslogtreecommitdiffstats
path: root/Lib/distutils
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2000-08-04 01:30:03 (GMT)
committerGreg Ward <gward@python.net>2000-08-04 01:30:03 (GMT)
commit5db2c3ae24cb740575b527656785c85b58a272fe (patch)
tree23372aa2f73977ec1eae09012279e00392d374e2 /Lib/distutils
parentd142564821b8427e8839742ef0813f776fb7ba78 (diff)
downloadcpython-5db2c3ae24cb740575b527656785c85b58a272fe.zip
cpython-5db2c3ae24cb740575b527656785c85b58a272fe.tar.gz
cpython-5db2c3ae24cb740575b527656785c85b58a272fe.tar.bz2
Rewrote 'find_library_file()' much more cleanly (and consistently with
MSVCCompiler's version, to aid in factoring common code out of the two classes when the time comes).
Diffstat (limited to 'Lib/distutils')
-rw-r--r--Lib/distutils/bcppcompiler.py34
1 files changed, 16 insertions, 18 deletions
diff --git a/Lib/distutils/bcppcompiler.py b/Lib/distutils/bcppcompiler.py
index 7daa597..1d897de 100644
--- a/Lib/distutils/bcppcompiler.py
+++ b/Lib/distutils/bcppcompiler.py
@@ -357,28 +357,26 @@ class BCPPCompiler(CCompiler) :
def find_library_file (self, dirs, lib, debug=0):
- # find library file
+ # List of effective library names to try, in order of preference:
# bcpp_xxx.lib is better than xxx.lib
# and xxx_d.lib is better than xxx.lib if debug is set
+ #
+ # The "bcpp_" prefix is to handle a Python installation for people
+ # with multiple compilers (primarily Distutils hackers, I suspect
+ # ;-). The idea is they'd have one static library for each
+ # compiler they care about, since (almost?) every Windows compiler
+ # seems to have a different format for static libraries.
+ if debug:
+ dlib = (lib + "_d")
+ try_names = ("bcpp_" + dlib, "bcpp_" + lib, dlib, lib)
+ else:
+ try_names = ("bcpp_" + lib, lib)
+
for dir in dirs:
- if debug:
- libfile = os.path.join (
- dir, self.library_filename ("bcpp_" + lib + "_d"))
- if os.path.exists (libfile):
+ for name in try_names:
+ libfile = os.path.join(dir, self.library_filename(name))
+ if os.path.exists(libfile):
return libfile
- libfile = os.path.join (
- dir, self.library_filename ("bcpp_" + lib))
- if os.path.exists (libfile):
- return libfile
- if debug:
- libfile = os.path.join (
- dir, self.library_filename(lib + '_d'))
- if os.path.exists (libfile):
- return libfile
- libfile = os.path.join (dir, self.library_filename (lib))
- if os.path.exists (libfile):
- return libfile
-
else:
# Oops, didn't find it in *any* of 'dirs'
return None