summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2009-07-26 11:21:14 +0000
committerDavid Cournapeau <cournape@gmail.com>2009-07-26 11:21:14 +0000
commit8f8927f9a8c7444974dc5605a296ab6efed59ce5 (patch)
tree6f35032a1ac49e49e24abc30b36d80b037d9b5a5
parent36456699517e7867b5e0b13f40622b319ad3f084 (diff)
downloadnumpy-8f8927f9a8c7444974dc5605a296ab6efed59ce5.tar.gz
Add a dirs argument to get_info to look for npy-pkg-config files in additional directories.
-rw-r--r--numpy/distutils/misc_util.py30
1 files changed, 24 insertions, 6 deletions
diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py
index e92ca0c46..399fc6d34 100644
--- a/numpy/distutils/misc_util.py
+++ b/numpy/distutils/misc_util.py
@@ -1616,10 +1616,28 @@ def get_numpy_include_dirs():
# else running numpy/core/setup.py
return include_dirs
-def get_info(pkgname):
+def get_npy_pkg_dir():
+ """Return the path where to find the npy-pkg-config directory."""
+ # XXX: import here for bootstrapping reasons
+ import numpy
+ d = os.path.join(os.path.dirname(numpy.__file__),
+ 'core', 'lib', 'npy-pkg-config')
+
+
+def get_info(pkgname, dirs=None):
"""Given a clib package name, returns a info dict with the necessary
options to use the clib.
+ Parameters
+ ----------
+ pkgname: str
+ name of the package (should match the name of the .ini file, without
+ the extension, e.g. foo for the file foo.ini)
+ dirs: seq {None}
+ if given, should be a sequence of additional directories where to look
+ for npy-pkg-config files. Those directories are search prior to the
+ numpy one.
+
Note
----
Raise a numpy.distutils.PkgNotFound exception if the package is not
@@ -1630,14 +1648,14 @@ def get_info(pkgname):
>>> npymath_info = get_info('npymath')
>>> config.add_extension('foo', sources=['foo.c'], extra_info=npymath_info)
"""
- # XXX: import here for bootstrapping reasons
- import numpy
from numpy.distutils.npy_pkg_config import read_config, parse_flags, \
PkgNotFound
- d = os.path.join(
- os.path.dirname(numpy.__file__), 'core', 'lib', 'npy-pkg-config')
- pkg_info = read_config(pkgname, [d])
+ if dirs:
+ dirs.append(get_npy_pkg_dir())
+ else:
+ dirs = [get_npy_pkg_dir()]
+ pkg_info = read_config(pkgname, dirs)
# Translate LibraryInfo instance into a build_info dict
info = parse_flags(pkg_info.cflags())