summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2009-12-12 09:15:23 +0000
committerDavid Cournapeau <cournape@gmail.com>2009-12-12 09:15:23 +0000
commit9a32a8d6821bec385cb572fec8f71beab136d3d5 (patch)
tree52c23bfa3a4190ee18ad8dd9b06d1f5e511727b2
parent5053c6fa4e6b6d4ebba30905690ca6e9940db54f (diff)
downloadnumpy-9a32a8d6821bec385cb572fec8f71beab136d3d5.tar.gz
ENH: automatically translate pkgdir in .ini file.
-rw-r--r--numpy/distutils/npy_pkg_config.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/numpy/distutils/npy_pkg_config.py b/numpy/distutils/npy_pkg_config.py
index 23fbefbef..70eac884d 100644
--- a/numpy/distutils/npy_pkg_config.py
+++ b/numpy/distutils/npy_pkg_config.py
@@ -319,6 +319,18 @@ def _read_config_imp(filenames, dirs=None):
meta, vars, sections, reqs = _read_config(filenames)
+ # FIXME: document this. If pkgname is defined in the variables section, and
+ # there is no pkgdir variable defined, pkgdir is automatically defined to
+ # the path of pkgname. This requires the package to be imported to work
+ if not vars.has_key("pkgdir") and vars.has_key("pkgname"):
+ pkgname = vars["pkgname"]
+ if not pkgname in sys.modules:
+ raise ValueError("You should import %s to get information on %s" %
+ (pkgname, meta["name"]))
+
+ mod = sys.modules[pkgname]
+ vars["pkgdir"] = os.path.dirname(mod.__file__)
+
return LibraryInfo(name=meta["name"], description=meta["description"],
version=meta["version"], sections=sections, vars=VariableSet(vars))