[Numpy-svn] r3792 - in trunk/numpy/distutils: . command
numpy-svn at scipy.org
numpy-svn at scipy.org
Sat May 19 15:44:49 EDT 2007
Author: pearu
Date: 2007-05-19 14:44:42 -0500 (Sat, 19 May 2007)
New Revision: 3792
Modified:
trunk/numpy/distutils/ccompiler.py
trunk/numpy/distutils/command/build_ext.py
trunk/numpy/distutils/command/config.py
Log:
Clean up and completed (hopefully) MSVC support.
Modified: trunk/numpy/distutils/ccompiler.py
===================================================================
--- trunk/numpy/distutils/ccompiler.py 2007-05-19 17:01:39 UTC (rev 3791)
+++ trunk/numpy/distutils/ccompiler.py 2007-05-19 19:44:42 UTC (rev 3792)
@@ -288,6 +288,7 @@
replace_method(CCompiler, 'get_version', CCompiler_get_version)
def CCompiler_cxx_compiler(self):
+ if self.compiler_type=='msvc': return self
cxx = copy(self)
cxx.compiler_so = [cxx.compiler_cxx[0]] + cxx.compiler_so[1:]
if sys.platform.startswith('aix') and 'ld_so_aix' in cxx.linker_so[0]:
Modified: trunk/numpy/distutils/command/build_ext.py
===================================================================
--- trunk/numpy/distutils/command/build_ext.py 2007-05-19 17:01:39 UTC (rev 3791)
+++ trunk/numpy/distutils/command/build_ext.py 2007-05-19 19:44:42 UTC (rev 3792)
@@ -391,6 +391,33 @@
def _libs_with_msvc_and_fortran(self, fcompiler, c_libraries, c_library_dirs):
if fcompiler is None: return
+
+ for libname in c_libraries:
+ if libname.startswith('msvc'): continue
+ fileexists = False
+ for libdir in c_library_dirs or []:
+ libfile = os.path.join(libdir,'%s.lib' % (libname))
+ if os.path.isfile(libfile):
+ fileexists = True
+ break
+ if fileexists: continue
+ # make g77-compiled static libs available to MSVC
+ fileexists = False
+ for libdir in c_library_dirs:
+ libfile = os.path.join(libdir,'lib%s.a' % (libname))
+ if os.path.isfile(libfile):
+ # copy libname.a file to name.lib so that MSVC linker
+ # can find it
+ libfile2 = os.path.join(self.build_temp, libname + '.lib')
+ copy_file(libfile, libfile2)
+ if self.build_temp not in c_library_dirs:
+ c_library_dirs.append(self.build_temp)
+ fileexists = True
+ break
+ if fileexists: continue
+ log.warn('could not find library %r in directories %s' \
+ % (libname, c_library_dirs))
+
# Always use system linker when using MSVC compiler.
f_lib_dirs = []
for dir in fcompiler.library_dirs:
@@ -404,17 +431,16 @@
c_library_dirs.extend(f_lib_dirs)
# make g77-compiled static libs available to MSVC
- lib_added = False
for lib in fcompiler.libraries:
- if not lib.startswith('msvcr'):
+ if not lib.startswith('msvc'):
c_libraries.append(lib)
p = combine_paths(f_lib_dirs, 'lib' + lib + '.a')
if p:
dst_name = os.path.join(self.build_temp, lib + '.lib')
- copy_file(p[0], dst_name)
- if not lib_added:
+ if not os.path.isfile(dst_name):
+ copy_file(p[0], dst_name)
+ if self.build_temp not in c_library_dirs:
c_library_dirs.append(self.build_temp)
- lib_added = True
return
def get_source_files (self):
Modified: trunk/numpy/distutils/command/config.py
===================================================================
--- trunk/numpy/distutils/command/config.py 2007-05-19 17:01:39 UTC (rev 3791)
+++ trunk/numpy/distutils/command/config.py 2007-05-19 19:44:42 UTC (rev 3792)
@@ -72,23 +72,29 @@
if libname not in libraries:
libraries.append(libname)
for libname in libraries:
- if libname.startswith('msvcr'): continue
+ if libname.startswith('msvc'): continue
fileexists = False
for libdir in library_dirs or []:
libfile = os.path.join(libdir,'%s.lib' % (libname))
if os.path.isfile(libfile):
fileexists = True
break
- if fileexists:
- continue
+ if fileexists: continue
# make g77-compiled static libs available to MSVC
+ fileexists = False
for libdir in library_dirs:
libfile = os.path.join(libdir,'lib%s.a' % (libname))
if os.path.isfile(libfile):
# copy libname.a file to name.lib so that MSVC linker
# can find it
- copy_file(libfile, os.path.join(libdir,'%s.lib' % (libname)))
+ libfile2 = os.path.join(libdir,'%s.lib' % (libname))
+ copy_file(libfile, libfile2)
+ self.temp_files.append(libfile2)
+ fileexists = True
break
+ if fileexists: continue
+ log.warn('could not find library %r in directories %s' \
+ % (libname, library_dirs))
return self._wrap_method(old_config._link,lang,
(body, headers, include_dirs,
libraries, library_dirs, lang))
More information about the Numpy-svn
mailing list