def get_distutils_install_prefix(pkg, inplace): """Returns the installation path for the current package.""" from numscons.core.utils import pkg_to_path if inplace == 1: return pkg_to_path(pkg) else: install_cmd = get_cmd('install').get_finalized_command('install') return pjoin(install_cmd.install_libbase, pkg_to_path(pkg))
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 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_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_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 __init__(self, *args, **kw): if kw.has_key('tools'): raise NumsconsError("NumpyEnvironment has received a tools "\ "argument.") else: kw['tools'] = [] Environment.__init__(self, *args, **kw) # Setting dirs according to command line options self['build_dir'] = pjoin(self['build_prefix'], pkg_to_path(self['pkg_name'])) # Set directory where to "install" built C extensions if self["inplace"]: self['distutils_installdir'] = pjoin(str(self.fs.Top), self["pkg_path"]) else: if not self.has_key('distutils_installdir'): # XXX: compatibility with upstream numpy trunk - this can be # removed once install_clib is merged self["distutils_installdir"] = '' self['distutils_installdir'] = pjoin(self['distutils_libdir'], pkg_to_path(self['pkg_name'])) if not self.has_key('distutils_install_prefix'): # XXX: compatibility with upstream numpy trunk - this can be # removed once install_clib is merged self["distutils_install_prefix"] = '' else: self["distutils_install_prefix"] = os.path.abspath(pjoin(str(self.fs.Top), self["distutils_install_prefix"])) # This will keep our compiler dependent customization (optimization, # warning, etc...) self['NUMPY_CUSTOMIZATION'] = {} self._set_sconsign_location() self._customize_scons_env() set_logging(self)
def test1(self): assert pkg_to_path(self.pkg1) == self.path1_expected assert pkg_to_path(self.pkg2) == self.path2_expected