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

numpy-svn@scip... numpy-svn@scip...
Fri Sep 21 02:46:26 CDT 2007


Author: cdavid
Date: 2007-09-21 02:46:01 -0500 (Fri, 21 Sep 2007)
New Revision: 4070

Added:
   branches/numpy.scons/numpy/distutils/scons/
Modified:
   branches/numpy.scons/
   branches/numpy.scons/numpy/distutils/command/scons.py
   branches/numpy.scons/numpy/scons_fake/SConstruct
Log:
Almost getting build dir and install dir right


Property changes on: branches/numpy.scons
___________________________________________________________________
Name: bzr:revision-info
   - timestamp: 2007-09-20 22:07:30.914000034 +0900
committer: David Cournapeau <david@ar.media.kyoto-u.ac.jp>
properties: 
	branch-nick: numpy.scons

   + timestamp: 2007-09-21 16:37:42.802000046 +0900
committer: David Cournapeau <david@ar.media.kyoto-u.ac.jp>
properties: 
	branch-nick: numpy.scons

Name: bzr:file-ids
   - numpy/scons_fake/SConstruct	sconstruct-20070920125938-jw3np1dk1gtr5a4s-1
numpy/scons_fake/foo.f	foo.f-20070920125945-d65hghrwpt9bnt0m-1
numpy/scons_fake/foo.c	foo.c-20070920125943-f6sf0rnbhik75mtj-1

   + numpy/distutils/scons	scons-20070921045716-02vll2lwyv36uchw-1

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

   + 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


Modified: branches/numpy.scons/numpy/distutils/command/scons.py
===================================================================
--- branches/numpy.scons/numpy/distutils/command/scons.py	2007-09-21 05:23:46 UTC (rev 4069)
+++ branches/numpy.scons/numpy/distutils/command/scons.py	2007-09-21 07:46:01 UTC (rev 4070)
@@ -42,6 +42,7 @@
             cmd += ' src_prefix=%s ' % os.path.dirname(i)
             cmd += ' obj_prefix=%s ' % os.path.join(self.build_temp, os.path.dirname(i))
             cmd += ' lib_prefix=%s ' % os.path.join(self.build_lib, os.path.dirname(i))
+            print cmd
             st = os.system(cmd)
             if st:
                 print "status is %d" % st

Modified: branches/numpy.scons/numpy/scons_fake/SConstruct
===================================================================
--- branches/numpy.scons/numpy/scons_fake/SConstruct	2007-09-21 05:23:46 UTC (rev 4069)
+++ branches/numpy.scons/numpy/scons_fake/SConstruct	2007-09-21 07:46:01 UTC (rev 4070)
@@ -1,19 +1,37 @@
 # vim:syntax=python
+from os.path import join as pjoin
 import os.path
 
-env = Environment()
-src_prefix = ARGUMENTS.get('src_prefix', '')
-obj_prefix = ARGUMENTS.get('obj_prefix', '')
-lib_prefix = ARGUMENTS.get('lib_prefix', '')
+opts = Options()
+opts.Add('pkg_name', 'name of the package (including parent package if any)', '')
+opts.Add('build_prefix', 'build prefix (NOT including the package name)', pjoin('build', 'scons'))
+opts.Add('distutils_libdir', 'build dir for libraries of distutils (NOT including the package name)', pjoin('build', 'lib'))
 
+#pkg_name = 'scons_fake'
+#build_prefix = pjoin('build', 'scons')
+#build_dir = pjoin(build_prefix, pkg_name)
+env = Environment(options = opts)
+env.AppendUnique(build_dir = pjoin(env['build_prefix'], env['pkg_name'].replace('.', os.path.sep)))
+env.AppendUnique(distutils_installdir = pjoin(env['distutils_libdir'], env['pkg_name'].replace('.', os.path.sep)))
+
+def NumpySharedLibrary(env, target, source, *args, **kw):
+    source = [pjoin(env['build_dir'], i) for i in source]
+    # XXX: why target is a list ? It is always true ?
+    lib = env.SharedLibrary("$build_dir/%s" % target[0], source, *args, **kw)
+
+    inst_lib = env.Install("$distutils_installdir", lib)
+    return lib, inst_lib
+
+env['BUILDERS']['NumpySharedLibrary'] = NumpySharedLibrary
+BuildDir(env['build_dir'], '.')
+
 source = ['foo.c']
-object = ['foo']
-if len(src_prefix):
-    source = [os.path.join(src_prefix, i) for i in source]
-if len(src_prefix):
-    object = [os.path.join(obj_prefix, i) for i in object]
-
-onodes = []
-for i in range(len(source)):
-    onodes.append(env.SharedObject(object[i], source = [source[i]]))
-env.SharedLibrary(os.path.join(lib_prefix, 'foo'), onodes)
+#if len(build_dir) > 0:
+#    source = [pjoin(build_dir, i) for i in source]
+#if len(src_prefix):
+#    object = [pjoin(obj_prefix, i) for i in object]
+#
+#onodes = []
+#for i in range(len(source)):
+#    onodes.append(env.SharedObject(object[i], source = [source[i]]))
+env.NumpySharedLibrary('foo', source)



More information about the Numpy-svn mailing list