diff options
author | David Cournapeau <cournape@gmail.com> | 2008-01-06 10:31:05 +0000 |
---|---|---|
committer | David Cournapeau <cournape@gmail.com> | 2008-01-06 10:31:05 +0000 |
commit | dfc2efb779561ace735ec52b0c1f31638b0f4669 (patch) | |
tree | e9a75900869c360ff0247f78fdfc6e86d328ba8e | |
parent | 9cb2d68f550e6277187117cab1f7fb9b08f3146c (diff) | |
download | numpy-dfc2efb779561ace735ec52b0c1f31638b0f4669.tar.gz |
Use a custom NumpyDistribution instead of distutils Distribution, to handle
scons scripts.
-rw-r--r-- | numpy/distutils/core.py | 7 | ||||
-rw-r--r-- | numpy/distutils/numpy_distribution.py | 28 |
2 files changed, 34 insertions, 1 deletions
diff --git a/numpy/distutils/core.py b/numpy/distutils/core.py index 19e1b33a3..14dc924da 100644 --- a/numpy/distutils/core.py +++ b/numpy/distutils/core.py @@ -21,6 +21,7 @@ import distutils.core import distutils.dist from numpy.distutils.extension import Extension +from numpy.distutils.numpy_distribution import NumpyDistribution from numpy.distutils.command import config, config_compiler, \ build, build_py, build_ext, build_clib, build_src, build_scripts, \ sdist, install_data, install_headers, install, bdist_rpm @@ -95,9 +96,10 @@ def get_distribution(always=False): # class is local to a function in setuptools.command.easy_install if dist is not None and \ 'DistributionWithoutHelpCommands' in repr(dist): + raise NotImplementedError("setuptools not supported yet for numpy.scons branch") dist = None if always and dist is None: - dist = distutils.dist.Distribution() + dist = NumpyDistribution() return dist def _exit_interactive_session(_cache=[]): @@ -175,6 +177,9 @@ def setup(**attr): and 'headers' not in new_attr: new_attr['headers'] = [] + # Use our custom NumpyDistribution class instead of distutils' one + new_attr['distclass'] = NumpyDistribution + return old_setup(**new_attr) def _check_append_library(libraries, item): diff --git a/numpy/distutils/numpy_distribution.py b/numpy/distutils/numpy_distribution.py new file mode 100644 index 000000000..681b8b316 --- /dev/null +++ b/numpy/distutils/numpy_distribution.py @@ -0,0 +1,28 @@ +# XXX: Handle setuptools ? +from distutils.core import Distribution + +# This class is used because we add new files (sconscripts, and so on) with the +# scons command +class NumpyDistribution(Distribution): + def __init__(self, attrs = None): + # A list of (sconscripts, pre_hook, post_hook, src, parent_names) + self.scons_data = [] + Distribution.__init__(self, attrs) + + def has_scons_scripts(self): + return bool(self.scons_data) + + def get_scons_scripts(self): + return [i[0] for i in self.scons_data] + + def get_scons_pre_hooks(self): + return [i[1] for i in self.scons_data] + + def get_scons_post_hooks(self): + return [i[2] for i in self.scons_data] + + def get_scons_sources(self): + return [i[3] for i in self.scons_data] + + def get_scons_parent_names(self): + return [i[4] for i in self.scons_data] |