[Numpy-svn] r4679 - branches/build_with_scons/numpy/distutils

numpy-svn@scip... numpy-svn@scip...
Sun Jan 6 04:31:12 CST 2008


Author: cdavid
Date: 2008-01-06 04:31:05 -0600 (Sun, 06 Jan 2008)
New Revision: 4679

Added:
   branches/build_with_scons/numpy/distutils/numpy_distribution.py
Modified:
   branches/build_with_scons/numpy/distutils/core.py
Log:

Use a custom NumpyDistribution instead of distutils Distribution, to handle
scons scripts.



Modified: branches/build_with_scons/numpy/distutils/core.py
===================================================================
--- branches/build_with_scons/numpy/distutils/core.py	2008-01-06 10:09:33 UTC (rev 4678)
+++ branches/build_with_scons/numpy/distutils/core.py	2008-01-06 10:31:05 UTC (rev 4679)
@@ -21,6 +21,7 @@
 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 @@
     # 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 @@
        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):

Added: branches/build_with_scons/numpy/distutils/numpy_distribution.py
===================================================================
--- branches/build_with_scons/numpy/distutils/numpy_distribution.py	2008-01-06 10:09:33 UTC (rev 4678)
+++ branches/build_with_scons/numpy/distutils/numpy_distribution.py	2008-01-06 10:31:05 UTC (rev 4679)
@@ -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]



More information about the Numpy-svn mailing list