[Numpy-svn] r4198 - in branches/numpy.scons: . numpy/distutils numpy/distutils/command numpy/distutils/scons numpy/scons_fake numpy/scons_fake/hook

numpy-svn@scip... numpy-svn@scip...
Mon Oct 15 04:39:55 CDT 2007


Author: cdavid
Date: 2007-10-15 04:39:33 -0500 (Mon, 15 Oct 2007)
New Revision: 4198

Added:
   branches/numpy.scons/numpy/scons_fake/hook/
   branches/numpy.scons/numpy/scons_fake/hook/setup.py
Modified:
   branches/numpy.scons/
   branches/numpy.scons/numpy/distutils/command/scons.py
   branches/numpy.scons/numpy/distutils/misc_util.py
   branches/numpy.scons/numpy/distutils/scons/numpyenv.py
   branches/numpy.scons/numpy/scons_fake/setup.py
   branches/numpy.scons/numpy/scons_fake/setupscons.py
Log:
Merging work on scons hook


Property changes on: branches/numpy.scons
___________________________________________________________________
Name: bzr:revision-info
   - timestamp: 2007-10-15 15:35:42.381000042 +0900
committer: David Cournapeau <david@ar.media.kyoto-u.ac.jp>
properties: 
	branch-nick: numpy.scons

   + timestamp: 2007-10-15 17:03:15.628000021 +0900
committer: David Cournapeau <david@ar.media.kyoto-u.ac.jp>
properties: 
	branch-nick: numpy.scons

Name: bzr:ancestry:v3-trunk0
   - svn-v3-trunk0:94b884b6-d6fd-0310-90d3-974f1d3f35e1:branches%2Fnumpy.scons:4112
david@ar.media.kyoto-u.ac.jp-20071012063527-x9tlkbs04vw0iyxg

   + svn-v3-trunk0:94b884b6-d6fd-0310-90d3-974f1d3f35e1:branches%2Fnumpy.scons:4112
david@ar.media.kyoto-u.ac.jp-20071012063527-x9tlkbs04vw0iyxg
david@ar.media.kyoto-u.ac.jp-20071015075441-i7mszxi11r9w0rlg

Name: bzr:file-ids
   - 
   + numpy/scons_fake/hook	hook-20071015073443-rtv8bjyd3wprxf89-1
numpy/scons_fake/hook/SConstruct	sconstruct-20071015073443-rtv8bjyd3wprxf89-2
numpy/scons_fake/hook/setup.py	setup.py-20071015073443-rtv8bjyd3wprxf89-3

Name: bzr:revision-id:v3-trunk0
   - 3737 david@david-laptop-20070920080908-n8pj8vmszdir3zoa
3738 david@david-laptop-20070920081509-58kkojgmml3t7jxs
3739 david@david-laptop-20070920081910-phlk1ujthksgpm0z
3740 david@david-laptop-20070920082641-bdhrt6eafeoli50i
3741 david@ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p
3743 david@ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m
3744 david@david-laptop-20070922101656-61kfi2faucemr2rl
3745 david@david-laptop-20070922113708-ror18thshang1cpu
3747 david@david-laptop-20070922140534-n9xsl096tjrzmct1
3749 david@david-laptop-20070922154007-usit009fr6vp377j
3750 david@david-laptop-20070923070011-leu2ozc2fy1q5cht
3751 david@david-laptop-20070924015925-dhsiao40jp7zsfp9
3752 david@ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli
3753 david@ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4
3754 david@ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q
3755 david@ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1
3756 david@david-laptop-20070924153247-yftud00bynilxv69
3757 david@david-laptop-20070924163545-pish34x9fq2h66aj
3758 david@david-laptop-20070924164633-iiyygcaw81ji3n34
3759 david@david-laptop-20070924170201-y14v2yzikdpvamfp
3760 david@david-laptop-20070924171208-5bmitorzf49d1aa2
3761 david@david-laptop-20070925014444-ns9v90gotnxt39mq
3769 david@david-laptop-20070925145952-4osi81tvch7v6luj
3773 david@ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0
3774 david@ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo
3775 david@ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0
3776 david@ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x
3777 david@ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6
3778 david@david-laptop-20071009152108-xh5cltii0h6zjk9b
3779 david@david-laptop-20071009154954-v5se05gbq60opo1z
3780 david@david-laptop-20071009223102-vz2sgf5i6pncxsd8
3781 david@david-laptop-20071009225259-13m6enwqk4w9uihe
3782 david@ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi
3783 david@ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056
3784 david@ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0
3792 david@ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h
3793 david@ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf
3794 david@ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d
3795 david@ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl
3796 david@ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7
3797 david@ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf
3798 david@ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4
3799 david@ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n
3800 david@ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y
3801 david@ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m
3802 david@david-laptop-20071013043839-hc3yfsbn0t7gsuhe
3803 david@david-laptop-20071013123319-vf4b7yhadz9nxasc
3804 david@david-laptop-20071014063148-0bsktlh609c3rpv7
3805 david@david-laptop-20071014064841-liamaqiv3af71r3g
3806 david@david-laptop-20071014064900-j4yzxzuveukuyj2l
3807 david@david-laptop-20071014124401-n3a37y67u5imyo83
3808 david@david-laptop-20071014161201-hdljwkhh4ep0f9k2
3809 david@david-laptop-20071014164521-c6i415hcz6hfrxxp
3810 david@david-laptop-20071015032315-g9fsm9zqk6fanyjz
3811 david@ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80
3812 david@ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx
3813 david@ar.media.kyoto-u.ac.jp-20071015054650-q6t9itvdz8b36wmi
3814 david@ar.media.kyoto-u.ac.jp-20071015055114-4grsf3r93py358pq
3815 david@ar.media.kyoto-u.ac.jp-20071015063542-mharc6rxpnads86x

   + 3737 david@david-laptop-20070920080908-n8pj8vmszdir3zoa
3738 david@david-laptop-20070920081509-58kkojgmml3t7jxs
3739 david@david-laptop-20070920081910-phlk1ujthksgpm0z
3740 david@david-laptop-20070920082641-bdhrt6eafeoli50i
3741 david@ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p
3743 david@ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m
3744 david@david-laptop-20070922101656-61kfi2faucemr2rl
3745 david@david-laptop-20070922113708-ror18thshang1cpu
3747 david@david-laptop-20070922140534-n9xsl096tjrzmct1
3749 david@david-laptop-20070922154007-usit009fr6vp377j
3750 david@david-laptop-20070923070011-leu2ozc2fy1q5cht
3751 david@david-laptop-20070924015925-dhsiao40jp7zsfp9
3752 david@ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli
3753 david@ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4
3754 david@ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q
3755 david@ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1
3756 david@david-laptop-20070924153247-yftud00bynilxv69
3757 david@david-laptop-20070924163545-pish34x9fq2h66aj
3758 david@david-laptop-20070924164633-iiyygcaw81ji3n34
3759 david@david-laptop-20070924170201-y14v2yzikdpvamfp
3760 david@david-laptop-20070924171208-5bmitorzf49d1aa2
3761 david@david-laptop-20070925014444-ns9v90gotnxt39mq
3769 david@david-laptop-20070925145952-4osi81tvch7v6luj
3773 david@ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0
3774 david@ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo
3775 david@ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0
3776 david@ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x
3777 david@ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6
3778 david@david-laptop-20071009152108-xh5cltii0h6zjk9b
3779 david@david-laptop-20071009154954-v5se05gbq60opo1z
3780 david@david-laptop-20071009223102-vz2sgf5i6pncxsd8
3781 david@david-laptop-20071009225259-13m6enwqk4w9uihe
3782 david@ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi
3783 david@ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056
3784 david@ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0
3792 david@ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h
3793 david@ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf
3794 david@ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d
3795 david@ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl
3796 david@ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7
3797 david@ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf
3798 david@ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4
3799 david@ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n
3800 david@ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y
3801 david@ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m
3802 david@david-laptop-20071013043839-hc3yfsbn0t7gsuhe
3803 david@david-laptop-20071013123319-vf4b7yhadz9nxasc
3804 david@david-laptop-20071014063148-0bsktlh609c3rpv7
3805 david@david-laptop-20071014064841-liamaqiv3af71r3g
3806 david@david-laptop-20071014064900-j4yzxzuveukuyj2l
3807 david@david-laptop-20071014124401-n3a37y67u5imyo83
3808 david@david-laptop-20071014161201-hdljwkhh4ep0f9k2
3809 david@david-laptop-20071014164521-c6i415hcz6hfrxxp
3810 david@david-laptop-20071015032315-g9fsm9zqk6fanyjz
3811 david@ar.media.kyoto-u.ac.jp-20071015043352-a24r1whpwiwiso80
3812 david@ar.media.kyoto-u.ac.jp-20071015054624-f8ecd3xiq5t64bjx
3813 david@ar.media.kyoto-u.ac.jp-20071015054650-q6t9itvdz8b36wmi
3814 david@ar.media.kyoto-u.ac.jp-20071015055114-4grsf3r93py358pq
3815 david@ar.media.kyoto-u.ac.jp-20071015063542-mharc6rxpnads86x
3816 david@ar.media.kyoto-u.ac.jp-20071015080315-u087sw2qmfa6a237


Modified: branches/numpy.scons/numpy/distutils/command/scons.py
===================================================================
--- branches/numpy.scons/numpy/distutils/command/scons.py	2007-10-15 06:48:05 UTC (rev 4197)
+++ branches/numpy.scons/numpy/distutils/command/scons.py	2007-10-15 09:39:33 UTC (rev 4198)
@@ -8,6 +8,12 @@
 from numpy.distutils.ccompiler import CCompiler
 from numpy.distutils.exec_command import find_executable
 
+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"""
+    return pjoin('build', 'scons')
+
 def get_scons_local_path():
     """This returns the full path where scons.py for scons-local is located."""
     import numpy.distutils
@@ -124,12 +130,14 @@
 
         scons_exec = get_python_exec_invoc()
         scons_exec += ' ' + protect_path(pjoin(get_scons_local_path(), 'scons.py'))
-        for i in self.scons_scripts:
+        for sconscript, pre_hook, post_hook in self.scons_scripts:
+            if post_hook:
+                post_hook()
             # XXX: This is inefficient... (use join instead)
-            cmd = scons_exec + " -f " + i + ' -I. '
-            cmd += ' src_dir="%s" ' % pdirname(i)
+            cmd = scons_exec + " -f " + sconscript + ' -I. '
+            cmd += ' src_dir="%s" ' % pdirname(sconscript)
             cmd += ' distutils_libdir=%s ' % protect_path(pjoin(self.build_lib,
-                                                                pdirname(i)))
+                                                                pdirname(sconscript)))
             cmd += ' cc_opt=%s ' % dist2sconscc(self.compiler)
             cmd += ' cc_opt_path=%s ' % protect_path(get_tool_path(self.compiler))
             st = os.system(cmd)

Modified: branches/numpy.scons/numpy/distutils/misc_util.py
===================================================================
--- branches/numpy.scons/numpy/distutils/misc_util.py	2007-10-15 06:48:05 UTC (rev 4197)
+++ branches/numpy.scons/numpy/distutils/misc_util.py	2007-10-15 09:39:33 UTC (rev 4198)
@@ -1171,9 +1171,13 @@
 
     def add_sconscript(self, sconscript,
                        subpackage_path=None,
-                       standalone = False):
-        """Add a list of sconscript to configuration.
-        """
+                       standalone = False,
+                       pre_hook = None,
+                       post_hook = None):
+        """Add a sconscript to configuration.
+
+        pre_hook and post hook should be sequences of callable, which will be
+        use before and after executing scons. """
         #print "%s: adding %s" % (__file__, sconscript)
         if standalone:
             parent_name = None
@@ -1183,14 +1187,14 @@
         dist = self.get_distribution()
         # Convert the sconscript name to a relative filename (relative from top
         # setup.py's directory)
-        fullsconsname = self.paths(sconscript)
+        fullsconsname = self.paths(sconscript)[0]
         
         if dist is not None:
-            dist.scons_scripts.extend(fullsconsname)
+            dist.scons_scripts.extend((fullsconsname, pre_hook, post_hook))
             self.warn('distutils distribution has been initialized,'\
                       ' it may be too late to add a subpackage '+ subpackage_name)
         else:
-            self.scons_scripts.extend(fullsconsname)
+            self.scons_scripts.append((fullsconsname, pre_hook, post_hook))
 
     def add_scripts(self,*files):
         """Add scripts to configuration.
@@ -1256,6 +1260,10 @@
         cmd.ensure_finalized()
         return cmd.build_temp
 
+    def get_scons_build_dir(self):
+        from command.scons import get_scons_build_dir
+        return get_scons_build_dir()
+
     def have_f77c(self):
         """Check for availability of Fortran 77 compiler.
         Use it inside source generating function to ensure that

Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py
===================================================================
--- branches/numpy.scons/numpy/distutils/scons/numpyenv.py	2007-10-15 06:48:05 UTC (rev 4197)
+++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py	2007-10-15 09:39:33 UTC (rev 4198)
@@ -10,6 +10,8 @@
 from SCons.Tool import Tool, FindTool, FindAllTools
 from SCons.Script import BuildDir, Help
 
+from numpy.distutils.command.scons import get_scons_build_dir
+
 from default import tool_list
 from custom_builders import NumpySharedLibrary, NumpyCtypes, NumpyPythonExtension
 from libinfo import get_config
@@ -52,7 +54,7 @@
     opts.Add('pkg_name', 'name of the package (including parent package if any)', '')
     opts.Add('src_dir', 'src dir relative to top called', '.')
     opts.Add('build_prefix', 'build prefix (NOT including the package name)', 
-             pjoin('build', 'scons'))
+             get_scons_build_dir())
     opts.Add('distutils_libdir', 
              'build dir for libraries of distutils (NOT including the package name)', 
              pjoin('build', 'lib'))

Added: branches/numpy.scons/numpy/scons_fake/hook/setup.py
===================================================================
--- branches/numpy.scons/numpy/scons_fake/hook/setup.py	2007-10-15 06:48:05 UTC (rev 4197)
+++ branches/numpy.scons/numpy/scons_fake/hook/setup.py	2007-10-15 09:39:33 UTC (rev 4198)
@@ -0,0 +1,15 @@
+import os
+import os.path
+
+def configuration(parent_package='',top_path=None):
+    from numpy.distutils.misc_util import Configuration
+    config = Configuration('hook',parent_package,top_path)
+
+    def foo():
+        print "foo"
+    config.add_sconscript('SConstruct', post_hook = foo)
+    return config
+
+if __name__ == '__main__':
+    from numpy.distutils.core import setup
+    setup(configuration=configuration)

Modified: branches/numpy.scons/numpy/scons_fake/setup.py
===================================================================
--- branches/numpy.scons/numpy/scons_fake/setup.py	2007-10-15 06:48:05 UTC (rev 4197)
+++ branches/numpy.scons/numpy/scons_fake/setup.py	2007-10-15 09:39:33 UTC (rev 4198)
@@ -8,6 +8,7 @@
     config.add_subpackage('pyext')
     config.add_subpackage('ctypesext')
     config.add_subpackage('checklib')
+    config.add_subpackage('hook')
     return config
 
 if __name__ == '__main__':

Modified: branches/numpy.scons/numpy/scons_fake/setupscons.py
===================================================================
--- branches/numpy.scons/numpy/scons_fake/setupscons.py	2007-10-15 06:48:05 UTC (rev 4197)
+++ branches/numpy.scons/numpy/scons_fake/setupscons.py	2007-10-15 09:39:33 UTC (rev 4198)
@@ -8,6 +8,7 @@
     config.add_subpackage('pyext')
     config.add_subpackage('ctypesext')
     config.add_subpackage('checklib')
+    config.add_subpackage('hook')
     return config
 
 if __name__ == '__main__':



More information about the Numpy-svn mailing list