summaryrefslogtreecommitdiff
path: root/numpy/distutils/command/scons.py
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2009-07-26 11:06:27 +0000
committerDavid Cournapeau <cournape@gmail.com>2009-07-26 11:06:27 +0000
commit8f76e68c6e492cab74a60aa27426536dfb8b224c (patch)
tree0240e5b83d4dbdbdef73163e40d07d2044f92a05 /numpy/distutils/command/scons.py
parent3131612bc4e067dc254dbff80d9b5afa80b91f4b (diff)
downloadnumpy-8f76e68c6e492cab74a60aa27426536dfb8b224c.tar.gz
Refactor the code to get top dir relatively to scons build dir.
Diffstat (limited to 'numpy/distutils/command/scons.py')
-rw-r--r--numpy/distutils/command/scons.py23
1 files changed, 11 insertions, 12 deletions
diff --git a/numpy/distutils/command/scons.py b/numpy/distutils/command/scons.py
index a8707c106..6003762ec 100644
--- a/numpy/distutils/command/scons.py
+++ b/numpy/distutils/command/scons.py
@@ -45,17 +45,7 @@ def get_scons_local_path():
from numscons import get_scons_path
return get_scons_path()
-def get_distutils_libdir(cmd, pkg):
- """Returns the path where distutils install libraries, relatively to the
- scons build directory."""
- from numscons import get_scons_build_dir
- from numscons.core.utils import pkg_to_path
- scdir = pjoin(get_scons_build_dir(), pkg_to_path(pkg))
- n = scdir.count(os.sep)
- return pjoin(os.sep.join([os.pardir for i in range(n+1)]), cmd.build_lib)
-
-def get_distutils_clibdir(cmd, pkg):
- """Returns the path where distutils put pure C libraries."""
+def _get_top_dir(pkg):
# XXX: this mess is necessary because scons is launched per package, and
# has no knowledge outside its build dir, which is package dependent. If
# one day numscons does not launch one process/package, this will be
@@ -64,7 +54,16 @@ def get_distutils_clibdir(cmd, pkg):
from numscons.core.utils import pkg_to_path
scdir = pjoin(get_scons_build_dir(), pkg_to_path(pkg))
n = scdir.count(os.sep)
- return pjoin(os.sep.join([os.pardir for i in range(n+1)]), cmd.build_temp)
+ return os.sep.join([os.pardir for i in range(n+1)])
+
+def get_distutils_libdir(cmd, pkg):
+ """Returns the path where distutils install libraries, relatively to the
+ scons build directory."""
+ return pjoin(_get_top_dir(pkg), cmd.build_lib)
+
+def get_distutils_clibdir(cmd, pkg):
+ """Returns the path where distutils put pure C libraries."""
+ return pjoin(_get_top_dir(pkg), cmd.build_temp)
def get_python_exec_invoc():
"""This returns the python executable from which this file is invocated."""