diff options
-rw-r--r-- | numpy/distutils/npy_pkg_config.py | 12 |
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)) |