summaryrefslogtreecommitdiff
path: root/numpy/distutils/misc_util.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/distutils/misc_util.py')
-rw-r--r--numpy/distutils/misc_util.py51
1 files changed, 28 insertions, 23 deletions
diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py
index 21aaece70..102af874f 100644
--- a/numpy/distutils/misc_util.py
+++ b/numpy/distutils/misc_util.py
@@ -33,11 +33,6 @@ def clean_up_temporary_directory():
atexit.register(clean_up_temporary_directory)
-try:
- set
-except NameError:
- from sets import Set as set
-
from numpy.distutils.compat import get_exception
from numpy.compat import basestring
from numpy.compat import npy_load_module
@@ -461,7 +456,7 @@ def is_sequence(seq):
return False
try:
len(seq)
- except:
+ except Exception:
return False
return True
@@ -1064,24 +1059,25 @@ class Configuration(object):
Notes
-----
- Rules for installation paths:
- foo/bar -> (foo/bar, foo/bar) -> parent/foo/bar
- (gun, foo/bar) -> parent/gun
- foo/* -> (foo/a, foo/a), (foo/b, foo/b) -> parent/foo/a, parent/foo/b
- (gun, foo/*) -> (gun, foo/a), (gun, foo/b) -> gun
- (gun/*, foo/*) -> parent/gun/a, parent/gun/b
- /foo/bar -> (bar, /foo/bar) -> parent/bar
- (gun, /foo/bar) -> parent/gun
- (fun/*/gun/*, sun/foo/bar) -> parent/fun/foo/gun/bar
+ Rules for installation paths::
+
+ foo/bar -> (foo/bar, foo/bar) -> parent/foo/bar
+ (gun, foo/bar) -> parent/gun
+ foo/* -> (foo/a, foo/a), (foo/b, foo/b) -> parent/foo/a, parent/foo/b
+ (gun, foo/*) -> (gun, foo/a), (gun, foo/b) -> gun
+ (gun/*, foo/*) -> parent/gun/a, parent/gun/b
+ /foo/bar -> (bar, /foo/bar) -> parent/bar
+ (gun, /foo/bar) -> parent/gun
+ (fun/*/gun/*, sun/foo/bar) -> parent/fun/foo/gun/bar
Examples
--------
For example suppose the source directory contains fun/foo.dat and
- fun/bar/car.dat::
+ fun/bar/car.dat:
- >>> self.add_data_dir('fun') #doctest: +SKIP
- >>> self.add_data_dir(('sun', 'fun')) #doctest: +SKIP
- >>> self.add_data_dir(('gun', '/full/path/to/fun'))#doctest: +SKIP
+ >>> self.add_data_dir('fun') #doctest: +SKIP
+ >>> self.add_data_dir(('sun', 'fun')) #doctest: +SKIP
+ >>> self.add_data_dir(('gun', '/full/path/to/fun'))#doctest: +SKIP
Will install data-files to the locations::
@@ -1097,6 +1093,7 @@ class Configuration(object):
gun/
foo.dat
car.dat
+
"""
if is_sequence(data_path):
d, data_path = data_path
@@ -1836,7 +1833,7 @@ class Configuration(object):
close_fds=True)
sout = p.stdout
m = re.match(r'(?P<revision>\d+)', sout.read())
- except:
+ except Exception:
pass
os.chdir(cwd)
if m:
@@ -1873,7 +1870,7 @@ class Configuration(object):
close_fds=True)
sout = p.stdout
m = re.match(r'(?P<revision>\d+)', sout.read())
- except:
+ except Exception:
pass
os.chdir(cwd)
if m:
@@ -2068,7 +2065,6 @@ class Configuration(object):
"""
self.py_modules.append((self.name, name, generate_config_py))
-
def get_info(self,*names):
"""Get resources information.
@@ -2282,9 +2278,18 @@ def generate_config_py(target):
from distutils.dir_util import mkpath
mkpath(os.path.dirname(target))
f = open(target, 'w')
- f.write('# This file is generated by %s\n' % (os.path.abspath(sys.argv[0])))
+ f.write('# This file is generated by numpy\'s %s\n' % (os.path.basename(sys.argv[0])))
f.write('# It contains system_info results at the time of building this package.\n')
f.write('__all__ = ["get_info","show"]\n\n')
+
+ # For gfortran+msvc combination, extra shared libraries may exist
+ f.write("""
+import os
+extra_dll_dir = os.path.join(os.path.dirname(__file__), 'extra-dll')
+if os.path.isdir(extra_dll_dir):
+ os.environ["PATH"] += os.pathsep + extra_dll_dir
+""")
+
for k, i in system_info.saved_results.items():
f.write('%s=%r\n' % (k, i))
f.write(r'''