summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhangenuit@gmail.com <hangenuit@gmail.com>2011-09-17 20:09:23 +0200
committerCharles Harris <charlesr.harris@gmail.com>2011-10-04 11:29:32 -0600
commit9ba2d5301afdfbba3c53a117c2cc417bf04ae037 (patch)
tree1d690ab436ba676d5a78193019b28174b7ddda2f
parent33dec5f3d364eccc9ee8d9e88a8710cea9ee94ec (diff)
downloadnumpy-9ba2d5301afdfbba3c53a117c2cc417bf04ae037.tar.gz
BUG: Fixes for Python3 and some further enhancements.
-rw-r--r--numpy/distutils/mingw32ccompiler.py36
1 files changed, 19 insertions, 17 deletions
diff --git a/numpy/distutils/mingw32ccompiler.py b/numpy/distutils/mingw32ccompiler.py
index 02fef9680..78457bbf0 100644
--- a/numpy/distutils/mingw32ccompiler.py
+++ b/numpy/distutils/mingw32ccompiler.py
@@ -274,15 +274,14 @@ def generate_def(dll, dfile):
The .def file will be overwritten"""
dump = dump_table(dll)
for i in range(len(dump)):
- if _START.match(dump[i]):
+ if _START.match(dump[i].decode()):
break
-
- if i == len(dump):
+ else:
raise ValueError("Symbol table not found")
syms = []
for j in range(i+1, len(dump)):
- m = _TABLE.match(dump[j])
+ m = _TABLE.match(dump[j].decode())
if m:
syms.append((int(m.group(1).strip()), m.group(2)))
else:
@@ -313,13 +312,15 @@ def find_dll(dll_name):
return os.path.join(root, dll_name)
return None
- # First, look in the Python directory, then scan PATH for
- # the given dll name. Lastly, look in the WinSxS directory.
- for path in [sys.prefix] + os.environ['PATH'].split(';'):
- filepath = os.path.join(path, dll_name)
- if os.path.exists(filepath):
- return os.path.abspath(filepath)
- return _find_dll_in_winsxs(dll_name)
+ def _find_dll_in_path(dll_name):
+ # First, look in the Python directory, then scan PATH for
+ # the given dll name.
+ for path in [sys.prefix] + os.environ['PATH'].split(';'):
+ filepath = os.path.join(path, dll_name)
+ if os.path.exists(filepath):
+ return os.path.abspath(filepath)
+
+ return _find_dll_in_winsxs(dll_name) or _find_dll_in_path(dll_name)
def build_msvcr_library(debug=False):
if os.name != 'nt':
@@ -335,6 +336,13 @@ def build_msvcr_library(debug=False):
if debug:
msvcr_name += 'd'
+ # Skip if custom library already exists
+ out_name = "lib%s.a" % msvcr_name
+ out_file = os.path.join(sys.prefix, 'libs', out_name)
+ if os.path.isfile(out_file):
+ log.debug('Skip building msvcr library: "%s" exists' % (out_file))
+ return True
+
# Find the msvcr dll
msvcr_dll_name = msvcr_name + '.dll'
dll_file = find_dll(msvcr_dll_name)
@@ -342,12 +350,6 @@ def build_msvcr_library(debug=False):
log.warn('Cannot build msvcr library: "%s" not found' % msvcr_dll_name)
return False
- out_name = "lib%s.a" % msvcr_name
- out_file = os.path.join(sys.prefix, 'libs', out_name)
- if os.path.isfile(out_file):
- log.debug('Skip building msvcr library: "%s" exists' % (out_file))
- return True
-
def_name = "lib%s.def" % msvcr_name
def_file = os.path.join(sys.prefix, 'libs', def_name)