def get_scons_build_dir(): """Return the top path where everything produced by scons will be put. The path is relative to the top setup.py""" from numscons import get_scons_build_dir return get_scons_build_dir()
def get_distutils_libdir(cmd, sconscript_path): """Returns the path where distutils install libraries, relatively to the scons build directory.""" from numscons import get_scons_build_dir scdir = pjoin(get_scons_build_dir(), pdirname(sconscript_path)) n = scdir.count(os.sep) return pjoin(os.sep.join([os.pardir for i in range(n + 1)]), cmd.build_lib)
def get_scons_pkg_build_dir(pkg): """Return the build directory for the given package (foo.bar). The path is relative to the top setup.py""" from numscons.core.utils import pkg_to_path return pjoin(get_scons_build_dir(), pkg_to_path(pkg))
def add_ufunc_api(): scons_build_dir = get_scons_build_dir() # XXX: I really have to think about how to communicate path info # between scons and distutils, and set the options at one single # location. h_file = join(scons_build_dir, local_dir, '__ufunc_api.h') t_file = join(scons_build_dir, local_dir, 'ufunc_api.txt') config.add_data_files((header_dir, h_file), (header_dir, t_file))
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 add_config_header(): scons_build_dir = get_scons_build_dir() # XXX: I really have to think about how to communicate path info # between scons and distutils, and set the options at one single # location. target = join(scons_build_dir, local_dir, 'config.h') incl_dir = os.path.dirname(target) if incl_dir not in config.numpy_include_dirs: config.numpy_include_dirs.append(incl_dir)
def add_config_header(): scons_build_dir = get_scons_build_dir() # XXX: I really have to think about how to communicate path info # between scons and distutils, and set the options at one single # location. target = join(get_scons_pkg_build_dir(config.name), 'config.h') incl_dir = os.path.dirname(target) if incl_dir not in config.numpy_include_dirs: config.numpy_include_dirs.append(incl_dir)
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 # unnecessary. 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 os.sep.join([os.pardir for i in range(n+1)])
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 # unnecessary. 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 os.sep.join([os.pardir for i in range(n + 1)])
def add_array_api(): scons_build_dir = get_scons_build_dir() # XXX: I really have to think about how to communicate path info # between scons and distutils, and set the options at one single # location. h_file = join(get_scons_pkg_build_dir(config.name), 'include/numpy/__multiarray_api.h') t_file = join(get_scons_pkg_build_dir(config.name), 'include/numpy/multiarray_api.txt') config.add_data_files((header_dir, h_file), (header_dir, t_file))
def add_numpyconfig_header(): scons_build_dir = get_scons_build_dir() # XXX: I really have to think about how to communicate path info # between scons and distutils, and set the options at one single # location. target = join(scons_build_dir, local_dir, 'include/numpy/numpyconfig.h') incl_dir = os.path.dirname(target) if incl_dir not in config.numpy_include_dirs: config.numpy_include_dirs.append(incl_dir) config.add_data_files((header_dir, target))
def add_numpyconfig_header(): scons_build_dir = get_scons_build_dir() # XXX: I really have to think about how to communicate path info # between scons and distutils, and set the options at one single # location. target = join(get_scons_pkg_build_dir(config.name), 'include/numpy/numpyconfig.h') incl_dir = os.path.dirname(target) if incl_dir not in config.numpy_include_dirs: config.numpy_include_dirs.append(incl_dir) config.add_data_files((header_dir, target))
def get_numpy_include_dirs(sconscript_path): """Return include dirs for numpy. The paths are relatively to the setup.py script path.""" from numscons import get_scons_build_dir scdir = pjoin(get_scons_build_dir(), pdirname(sconscript_path)) n = scdir.count(os.sep) dirs = _incdir() rdirs = [] for d in dirs: rdirs.append(pjoin(os.sep.join([os.pardir for i in range(n + 1)]), d)) return rdirs
def get_numpy_include_dirs(sconscript_path): """Return include dirs for numpy. The paths are relatively to the setup.py script path.""" from numscons import get_scons_build_dir scdir = pjoin(get_scons_build_dir(), pdirname(sconscript_path)) n = scdir.count(os.sep) dirs = _incdir() rdirs = [] for d in dirs: rdirs.append(pjoin(os.sep.join([os.pardir for i in range(n+1)]), d)) return rdirs
def add_ufunc_api(): scons_build_dir = get_scons_build_dir()