[Python-checkins] CVS: distutils/distutils bcppcompiler.py,1.2,1.3

Greg Ward python-dev@python.org
Thu, 3 Aug 2000 18:30:06 -0700


Update of /cvsroot/python/distutils/distutils
In directory slayer.i.sourceforge.net:/tmp/cvs-serv1235

Modified Files:
	bcppcompiler.py 
Log Message:
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).

Index: bcppcompiler.py
===================================================================
RCS file: /cvsroot/python/distutils/distutils/bcppcompiler.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** bcppcompiler.py	2000/08/02 01:03:23	1.2
--- bcppcompiler.py	2000/08/04 01:30:03	1.3
***************
*** 358,383 ****
  
      def find_library_file (self, dirs, lib, debug=0):
!         # find library file
          # bcpp_xxx.lib is better than xxx.lib
          # and xxx_d.lib is better than xxx.lib if debug is set
          for dir in dirs:
!             if debug:
!                 libfile = os.path.join (
!                     dir, self.library_filename ("bcpp_" + lib + "_d"))
!                 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'
--- 358,381 ----
  
      def find_library_file (self, dirs, lib, debug=0):
!         # 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:
!             for name in try_names:
!                 libfile = os.path.join(dir, self.library_filename(name))
!                 if os.path.exists(libfile):
                      return libfile
          else:
              # Oops, didn't find it in *any* of 'dirs'