[Numpy-svn] r4197 - in branches/numpy.scons: . numpy/core

numpy-svn@scip... numpy-svn@scip...
Mon Oct 15 01:48:28 CDT 2007


Author: cdavid
Date: 2007-10-15 01:48:05 -0500 (Mon, 15 Oct 2007)
New Revision: 4197

Modified:
   branches/numpy.scons/
   branches/numpy.scons/numpy/core/SConstruct
   branches/numpy.scons/numpy/core/setupscons.py
   branches/numpy.scons/test.sh
Log:
Start working on the problem of adding scons generated files to the distutils disttribution


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

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

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

   + 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


Modified: branches/numpy.scons/numpy/core/SConstruct
===================================================================
--- branches/numpy.scons/numpy/core/SConstruct	2007-10-15 06:47:36 UTC (rev 4196)
+++ branches/numpy.scons/numpy/core/SConstruct	2007-10-15 06:48:05 UTC (rev 4197)
@@ -1,4 +1,4 @@
-# Last Change: Mon Oct 15 02:00 PM 2007 J
+# Last Change: Mon Oct 15 03:00 PM 2007 J
 # vim:syntax=python
 import os
 from os.path import join as pjoin, basename as pbasename, dirname as pdirname
@@ -154,25 +154,21 @@
 
 config.Finish()
 
-#--------------------------
-# Generating multiarray API
-#--------------------------
+#---------------------------
+# Builder for generated code
+#---------------------------
 from scons_support import do_generate_api, generate_api_emitter, do_generate_ufunc_api
 
 # XXX: put the builder in scons support lib.
 bld = Builder(action = do_generate_api, emitter = generate_api_emitter)
 env.Append(BUILDERS = {'GenerateApi' : bld})
 from os.path import join as pjoin
-multiarray_api = env.GenerateApi(pjoin(env['build_dir'], '__multiarray_api'), 
-    [pjoin(env['src_dir'], 'code_generators', 'array_api_order.txt'),
-    pjoin(env['src_dir'], 'code_generators', 'multiarray_api_order.txt')])
 
 # Take into account the change in config_sym (using emitter, see SubstDic
 # example in scons wiki) ?
 env['config_h_gen'] = config_sym
 bld = Builder(action = generate_config_header)
 env.Append(BUILDERS = {'GenerateConfigHeader' : bld})
-config_header = env.GenerateConfigHeader(pjoin(env['build_dir'], 'config.h'), [])
 
 # Builder to generate .inc from .inc.src
 from numpy.distutils.conv_template import process_str
@@ -195,29 +191,6 @@
     t = pjoin(pdirname(str(target[0])), base)
     return ([t], source)
     
-bld = Builder(action = generate_from_template, emitter = generate_from_template_emitter)
-env.Append(BUILDERS = {'FromTemplate' : bld})
-
-scalartypes_src = env.FromTemplate(pjoin(env['build_dir'], 'src', 'scalartypes'), 
-                                   pjoin(env['src_dir'], 'src', 'scalartypes.inc.src'))
-arraytypes_src = env.FromTemplate(pjoin(env['build_dir'], 'src', 'arraytypes'), 
-                                   pjoin(env['src_dir'], 'src', 'arraytypes.inc.src'))
-
-# XXX
-#env.Append(CCFLAGS = "-W -Wall")
-# Build multiarray
-env.Append(CPPPATH = [pjoin(env['src_dir'], 'include'), env['build_dir']])
-multiarray_src = [
-    pjoin('src', 'multiarraymodule.c'),
-]
-multiarray = env.NumpyPythonExtension('multiarray', source = multiarray_src)
-
-# Build sort module
-sortmodule_src = env.FromTemplate(pjoin(env['build_dir'], 'src', '_sortmodule'), 
-                                   pjoin(env['src_dir'], 'src', '_sortmodule.c.src'))
-sort = env.NumpyPythonExtension('_sort', source = sortmodule_src)
-
-# Build umath module
 def do_generate_umath(targetfile, sourcefile, env):
     t = open(targetfile, 'w')
     from code_generators import generate_umath
@@ -239,11 +212,66 @@
 bld = Builder(action = do_generate_ufunc_api, emitter = generate_api_emitter)
 env.Append(BUILDERS = {'GenerateUfuncApi' : bld})
 
-ufunc_api = env.GenerateUfuncApi(pjoin(env['build_dir'], '__ufunc_api'), 
-    pjoin(env['src_dir'], 'code_generators', 'ufunc_api_order.txt'))
+bld = Builder(action = generate_from_template, emitter = generate_from_template_emitter)
+env.Append(BUILDERS = {'FromTemplate' : bld})
 
+#------------------------
+# Generate generated code
+#------------------------
+config_header = env.GenerateConfigHeader(pjoin(env['build_dir'], 'config.h'), [])
+
+scalartypes_src = env.FromTemplate(pjoin(env['build_dir'], 'src', 'scalartypes'), 
+                                   pjoin(env['src_dir'], 'src', 'scalartypes.inc.src'))
+arraytypes_src = env.FromTemplate(pjoin(env['build_dir'], 'src', 'arraytypes'), 
+                                   pjoin(env['src_dir'], 'src', 'arraytypes.inc.src'))
+sortmodule_src = env.FromTemplate(pjoin(env['build_dir'], 'src', '_sortmodule'), 
+                                   pjoin(env['src_dir'], 'src', '_sortmodule.c.src'))
 umathmodule_src = env.FromTemplate(pjoin(env['build_dir'], 'src', 'umathmodule'), 
                                    pjoin(env['src_dir'], 'src', 'umathmodule.c.src'))
+scalarmathmodule_src = env.FromTemplate(pjoin(env['build_dir'], 'src', 
+                                              'scalarmathmodule'), 
+                                        pjoin(env['src_dir'], 'src', 
+                                              'scalarmathmodule.c.src'))
+
 umath = env.GenerateUmath(pjoin(env['build_dir'], '__umath_generated'), 
         pjoin(env['src_dir'], 'code_generators', 'generate_umath.py'))
+
+multiarray_api = env.GenerateApi(pjoin(env['build_dir'], '__multiarray_api'), 
+    [pjoin(env['src_dir'], 'code_generators', 'array_api_order.txt'),
+    pjoin(env['src_dir'], 'code_generators', 'multiarray_api_order.txt')])
+ufunc_api = env.GenerateUfuncApi(pjoin(env['build_dir'], '__ufunc_api'), 
+    pjoin(env['src_dir'], 'code_generators', 'ufunc_api_order.txt'))
+
+# XXX
+#env.Append(CCFLAGS = "-W -Wall")
+
+#-----------------
+# Build multiarray
+#-----------------
+env.Append(CPPPATH = [pjoin(env['src_dir'], 'include'), env['build_dir']])
+multiarray_src = [
+    pjoin('src', 'multiarraymodule.c'),
+]
+multiarray = env.NumpyPythonExtension('multiarray', source = multiarray_src)
+
+#------------------
+# Build sort module
+#------------------
+sort = env.NumpyPythonExtension('_sort', source = sortmodule_src)
+
+#-------------------
+# Build umath module
+#-------------------
 umathmodule = env.NumpyPythonExtension('umathmodule', source = umathmodule_src)
+
+#------------------------
+# Build scalarmath module
+#------------------------
+scalarmathmodule = env.NumpyPythonExtension('scalarmathmodule', 
+                                            source = scalarmathmodule_src)
+
+#----------------------
+# Build _dotblas module
+#----------------------
+dotblas_src = [pjoin('blasdot', i) for i in ['_dotblas.c']]
+dotblas = env.NumpyPythonExtension('_dotblas', source = dotblas_src)

Modified: branches/numpy.scons/numpy/core/setupscons.py
===================================================================
--- branches/numpy.scons/numpy/core/setupscons.py	2007-10-15 06:47:36 UTC (rev 4196)
+++ branches/numpy.scons/numpy/core/setupscons.py	2007-10-15 06:48:05 UTC (rev 4197)
@@ -24,206 +24,180 @@
 
     config = Configuration('core',parent_package,top_path)
     local_dir = config.local_path
-    codegen_dir = join(local_dir,'code_generators')
+    #codegen_dir = join(local_dir,'code_generators')
 
-    generate_umath_py = join(codegen_dir,'generate_umath.py')
-    n = dot_join(config.name,'generate_umath')
-    generate_umath = imp.load_module('_'.join(n.split('.')),
-                                     open(generate_umath_py,'U'),generate_umath_py,
-                                     ('.py','U',1))
+    #generate_umath_py = join(codegen_dir,'generate_umath.py')
+    #n = dot_join(config.name,'generate_umath')
+    #generate_umath = imp.load_module('_'.join(n.split('.')),
+    #                                 open(generate_umath_py,'U'),generate_umath_py,
+    #                                 ('.py','U',1))
 
     header_dir = 'include/numpy' # this is relative to config.path_in_package
     config.add_sconscript('SConstruct')
 
-    def generate_config_h(ext, build_dir):
-        target = join(build_dir,'config.h')
-        if newer(__file__,target):
-            config_cmd = config.get_config_cmd()
-            log.info('Generating %s',target)
-            tc = generate_testcode(target)
-            from distutils import sysconfig
-            python_include = sysconfig.get_python_inc()
-            python_h = join(python_include, 'Python.h')
-            if not os.path.isfile(python_h):
-                raise SystemError,\
-                      "Non-existing %s. Perhaps you need to install"\
-                      " python-dev|python-devel." % (python_h)
-            result = config_cmd.try_run(tc,include_dirs=[python_include],
-                                        library_dirs = default_lib_dirs)
-            if not result:
-                raise SystemError,"Failed to test configuration. "\
-                      "See previous error messages for more information."
+    #def generate_config_h(ext, build_dir):
+    #    target = join(build_dir,'config.h')
+    #    if newer(__file__,target):
+    #        config_cmd = config.get_config_cmd()
+    #        log.info('Generating %s',target)
+    #        tc = generate_testcode(target)
+    #        from distutils import sysconfig
+    #        python_include = sysconfig.get_python_inc()
+    #        python_h = join(python_include, 'Python.h')
+    #        if not os.path.isfile(python_h):
+    #            raise SystemError,\
+    #                  "Non-existing %s. Perhaps you need to install"\
+    #                  " python-dev|python-devel." % (python_h)
+    #        result = config_cmd.try_run(tc,include_dirs=[python_include],
+    #                                    library_dirs = default_lib_dirs)
+    #        if not result:
+    #            raise SystemError,"Failed to test configuration. "\
+    #                  "See previous error messages for more information."
 
-                # Python 2.3 causes a segfault when
-                #  trying to re-acquire the thread-state
-                #  which is done in error-handling
-                #  ufunc code.  NPY_ALLOW_C_API and friends
-                #  cause the segfault. So, we disable threading
-                #  for now.
-            if sys.version[:5] < '2.4.2':
-                nosmp = 1
-            else:
-                # Perhaps a fancier check is in order here.
-                #  so that threads are only enabled if there
-                #  are actually multiple CPUS? -- but
-                #  threaded code can be nice even on a single
-                #  CPU so that long-calculating code doesn't
-                #  block.
-                try:
-                    nosmp = os.environ['NPY_NOSMP']
-                    nosmp = 1
-                except KeyError:
-                    nosmp = 0
-            if nosmp: moredefs = [('NPY_ALLOW_THREADS', '0')]
-            else: moredefs = []
-            #
-            mathlibs = []
-            tc = testcode_mathlib()
-            mathlibs_choices = [[],['m'],['cpml']]
-            mathlib = os.environ.get('MATHLIB')
-            if mathlib:
-                mathlibs_choices.insert(0,mathlib.split(','))
-            for libs in mathlibs_choices:
-                if config_cmd.try_run(tc,libraries=libs):
-                    mathlibs = libs
-                    break
-            else:
-                raise EnvironmentError("math library missing; rerun "
-                                       "setup.py after setting the "
-                                       "MATHLIB env variable")
-            ext.libraries.extend(mathlibs)
-            moredefs.append(('MATHLIB',','.join(mathlibs)))
+    #            # Python 2.3 causes a segfault when
+    #            #  trying to re-acquire the thread-state
+    #            #  which is done in error-handling
+    #            #  ufunc code.  NPY_ALLOW_C_API and friends
+    #            #  cause the segfault. So, we disable threading
+    #            #  for now.
+    #        if sys.version[:5] < '2.4.2':
+    #            nosmp = 1
+    #        else:
+    #            # Perhaps a fancier check is in order here.
+    #            #  so that threads are only enabled if there
+    #            #  are actually multiple CPUS? -- but
+    #            #  threaded code can be nice even on a single
+    #            #  CPU so that long-calculating code doesn't
+    #            #  block.
+    #            try:
+    #                nosmp = os.environ['NPY_NOSMP']
+    #                nosmp = 1
+    #            except KeyError:
+    #                nosmp = 0
+    #        if nosmp: moredefs = [('NPY_ALLOW_THREADS', '0')]
+    #        else: moredefs = []
+    #        #
+    #        mathlibs = []
+    #        tc = testcode_mathlib()
+    #        mathlibs_choices = [[],['m'],['cpml']]
+    #        mathlib = os.environ.get('MATHLIB')
+    #        if mathlib:
+    #            mathlibs_choices.insert(0,mathlib.split(','))
+    #        for libs in mathlibs_choices:
+    #            if config_cmd.try_run(tc,libraries=libs):
+    #                mathlibs = libs
+    #                break
+    #        else:
+    #            raise EnvironmentError("math library missing; rerun "
+    #                                   "setup.py after setting the "
+    #                                   "MATHLIB env variable")
+    #        ext.libraries.extend(mathlibs)
+    #        moredefs.append(('MATHLIB',','.join(mathlibs)))
 
-            def check_func(func_name):
-                return config_cmd.check_func(func_name,
-                                             libraries=mathlibs, decl=False,
-                                             headers=['math.h'])
+    #        def check_func(func_name):
+    #            return config_cmd.check_func(func_name,
+    #                                         libraries=mathlibs, decl=False,
+    #                                         headers=['math.h'])
 
-            for func_name, defsymbol in FUNCTIONS_TO_CHECK:
-                if check_func(func_name):
-                    moredefs.append(defsymbol)
+    #        for func_name, defsymbol in FUNCTIONS_TO_CHECK:
+    #            if check_func(func_name):
+    #                moredefs.append(defsymbol)
 
-            if sys.platform == 'win32':
-                moredefs.append('NPY_NO_SIGNAL')
+    #        if sys.platform == 'win32':
+    #            moredefs.append('NPY_NO_SIGNAL')
 
-            if sys.platform=='win32' or os.name=='nt':
-                from distutils.msvccompiler import get_build_architecture
-                a = get_build_architecture()
-                print 'BUILD_ARCHITECTURE: %r, os.name=%r, sys.platform=%r' % (a, os.name, sys.platform)
-                if a == 'AMD64':
-                    moredefs.append('DISTUTILS_USE_SDK')
+    #        if sys.platform=='win32' or os.name=='nt':
+    #            from distutils.msvccompiler import get_build_architecture
+    #            a = get_build_architecture()
+    #            print 'BUILD_ARCHITECTURE: %r, os.name=%r, sys.platform=%r' % (a, os.name, sys.platform)
+    #            if a == 'AMD64':
+    #                moredefs.append('DISTUTILS_USE_SDK')
 
-            if sys.version[:3] < '2.4':
-                if config_cmd.check_func('strtod', decl=False,
-                                         headers=['stdlib.h']):
-                    moredefs.append(('PyOS_ascii_strtod', 'strtod'))
+    #        if sys.version[:3] < '2.4':
+    #            if config_cmd.check_func('strtod', decl=False,
+    #                                     headers=['stdlib.h']):
+    #                moredefs.append(('PyOS_ascii_strtod', 'strtod'))
 
-            target_f = open(target,'a')
-            for d in moredefs:
-                if isinstance(d,str):
-                    target_f.write('#define %s\n' % (d))
-                else:
-                    target_f.write('#define %s %s\n' % (d[0],d[1]))
-            if not nosmp:  # default is to use WITH_THREAD
-                target_f.write('#ifdef WITH_THREAD\n#define NPY_ALLOW_THREADS 1\n#else\n#define NPY_ALLOW_THREADS 0\n#endif\n')
-            target_f.close()
-            print 'File:',target
-            target_f = open(target)
-            print target_f.read()
-            target_f.close()
-            print 'EOF'
-        else:
-            mathlibs = []
-            target_f = open(target)
-            for line in target_f.readlines():
-                s = '#define MATHLIB'
-                if line.startswith(s):
-                    value = line[len(s):].strip()
-                    if value:
-                        mathlibs.extend(value.split(','))
-            target_f.close()
+    #        target_f = open(target,'a')
+    #        for d in moredefs:
+    #            if isinstance(d,str):
+    #                target_f.write('#define %s\n' % (d))
+    #            else:
+    #                target_f.write('#define %s %s\n' % (d[0],d[1]))
+    #        if not nosmp:  # default is to use WITH_THREAD
+    #            target_f.write('#ifdef WITH_THREAD\n#define NPY_ALLOW_THREADS 1\n#else\n#define NPY_ALLOW_THREADS 0\n#endif\n')
+    #        target_f.close()
+    #        print 'File:',target
+    #        target_f = open(target)
+    #        print target_f.read()
+    #        target_f.close()
+    #        print 'EOF'
+    #    else:
+    #        mathlibs = []
+    #        target_f = open(target)
+    #        for line in target_f.readlines():
+    #            s = '#define MATHLIB'
+    #            if line.startswith(s):
+    #                value = line[len(s):].strip()
+    #                if value:
+    #                    mathlibs.extend(value.split(','))
+    #        target_f.close()
 
-        ext.libraries.extend(mathlibs)
+    #    ext.libraries.extend(mathlibs)
 
-        incl_dir = os.path.dirname(target)
-        if incl_dir not in config.numpy_include_dirs:
-            config.numpy_include_dirs.append(incl_dir)
+    #    incl_dir = os.path.dirname(target)
+    #    if incl_dir not in config.numpy_include_dirs:
+    #        config.numpy_include_dirs.append(incl_dir)
 
-        config.add_data_files((header_dir,target))
-        return target
+    #    config.add_data_files((header_dir,target))
+    #    return target
 
-    def generate_api_func(module_name):
-        def generate_api(ext, build_dir):
-            script = join(codegen_dir, module_name + '.py')
-            sys.path.insert(0, codegen_dir)
-            try:
-                m = __import__(module_name)
-                log.info('executing %s', script)
-                h_file, c_file, doc_file = m.generate_api(build_dir)
-            finally:
-                del sys.path[0]
-            config.add_data_files((header_dir, h_file),
-                                  (header_dir, doc_file))
-            return (h_file,)
-        return generate_api
+    #def generate_api_func(module_name):
+    #    def generate_api(ext, build_dir):
+    #        script = join(codegen_dir, module_name + '.py')
+    #        sys.path.insert(0, codegen_dir)
+    #        try:
+    #            m = __import__(module_name)
+    #            log.info('executing %s', script)
+    #            h_file, c_file, doc_file = m.generate_api(build_dir)
+    #        finally:
+    #            del sys.path[0]
+    #        config.add_data_files((header_dir, h_file),
+    #                              (header_dir, doc_file))
+    #        return (h_file,)
+    #    return generate_api
 
-    generate_array_api = generate_api_func('generate_array_api')
-    generate_ufunc_api = generate_api_func('generate_ufunc_api')
+    #generate_array_api = generate_api_func('generate_array_api')
+    #generate_ufunc_api = generate_api_func('generate_ufunc_api')
 
-    def generate_umath_c(ext,build_dir):
-        target = join(build_dir,'__umath_generated.c')
-        script = generate_umath_py
-        if newer(script,target):
-            f = open(target,'w')
-            f.write(generate_umath.make_code(generate_umath.defdict,
-                                             generate_umath.__file__))
-            f.close()
-        return []
+    #def generate_umath_c(ext,build_dir):
+    #    target = join(build_dir,'__umath_generated.c')
+    #    script = generate_umath_py
+    #    if newer(script,target):
+    #        f = open(target,'w')
+    #        f.write(generate_umath.make_code(generate_umath.defdict,
+    #                                         generate_umath.__file__))
+    #        f.close()
+    #    return []
 
+    # Add generated files to distutils...
+    #print dir(config)
+    #print config.get_build_temp_dir()
+    #config_header = os.path.dirname(
+    #    incl_dir = os.path.dirname(target)
+    #    if incl_dir not in config.numpy_include_dirs:
+    #        config.numpy_include_dirs.append(incl_dir)
+
+    #    config.add_data_files((header_dir,target))
     config.add_data_files('include/numpy/*.h')
     config.add_include_dirs('src')
 
     config.numpy_include_dirs.extend(config.paths('include'))
 
-    deps = [join('src','arrayobject.c'),
-            join('src','arraymethods.c'),
-            join('src','scalartypes.inc.src'),
-            join('src','arraytypes.inc.src'),
-            join('src','_signbit.c'),
-            join('src','_isnan.c'),
-            join('src','ucsnarrow.c'),
-            join('include','numpy','*object.h'),
-            'include/numpy/fenv/fenv.c',
-            'include/numpy/fenv/fenv.h',
-            join(codegen_dir,'genapi.py'),
-            join(codegen_dir,'*.txt')
-            ]
-
     # Don't install fenv unless we need them.
     if sys.platform == 'cygwin':
         config.add_data_dir('include/numpy/fenv')
 
-    config.add_extension('umath',
-                         sources = [generate_config_h,
-                                    join('src','umathmodule.c.src'),
-                                    generate_umath_c,
-                                    generate_ufunc_api,
-                                    join('src','scalartypes.inc.src'),
-                                    join('src','arraytypes.inc.src'),
-                                    ],
-                         depends = [join('src','ufuncobject.c'),
-                                    generate_umath_py,
-                                    join(codegen_dir,'generate_ufunc_api.py'),
-                                    ]+deps,
-                         )
-
-    config.add_extension('scalarmath',
-                         sources=[join('src','scalarmathmodule.c.src'),
-                                  generate_config_h,
-                                  generate_array_api,
-                                  generate_ufunc_api],
-                         )
-
     # Configure blasdot
     blas_info = get_info('blas_opt',0)
     #blas_info = {}
@@ -234,16 +208,6 @@
             return ext.depends[:1]
         return None # no extension module will be built
 
-    config.add_extension('_dotblas',
-                         sources = [get_dotblas_sources],
-                         depends=[join('blasdot','_dotblas.c'),
-                                  join('blasdot','cblas.h'),
-                                  ],
-                         include_dirs = ['blasdot'],
-                         extra_info = blas_info
-                         )
-
-
     config.add_data_dir('tests')
     config.make_svn_version_py()
 
@@ -259,71 +223,71 @@
 }
 """
 
-import sys
-def generate_testcode(target):
-    if sys.platform == 'win32':
-        target = target.replace('\\','\\\\')
-    testcode = [r'''
-#include <Python.h>
-#include <limits.h>
-#include <stdio.h>
+# import sys
+# def generate_testcode(target):
+#     if sys.platform == 'win32':
+#         target = target.replace('\\','\\\\')
+#     testcode = [r'''
+# #include <Python.h>
+# #include <limits.h>
+# #include <stdio.h>
+# 
+# int main(int argc, char **argv)
+# {
+# 
+#         FILE *fp;
+# 
+#         fp = fopen("'''+target+'''","w");
+#         ''']
+# 
+#     c_size_test = r'''
+# #ifndef %(sz)s
+#           fprintf(fp,"#define %(sz)s %%d\n", sizeof(%(type)s));
+# #else
+#           fprintf(fp,"/* #define %(sz)s %%d */\n", %(sz)s);
+# #endif
+# '''
+#     for sz, t in [('SIZEOF_SHORT', 'short'),
+#                   ('SIZEOF_INT', 'int'),
+#                   ('SIZEOF_LONG', 'long'),
+#                   ('SIZEOF_FLOAT', 'float'),
+#                   ('SIZEOF_DOUBLE', 'double'),
+#                   ('SIZEOF_LONG_DOUBLE', 'long double'),
+#                   ('SIZEOF_PY_INTPTR_T', 'Py_intptr_t'),
+#                   ]:
+#         testcode.append(c_size_test % {'sz' : sz, 'type' : t})
+# 
+#     testcode.append('#ifdef PY_LONG_LONG')
+#     testcode.append(c_size_test % {'sz' : 'SIZEOF_LONG_LONG',
+#                                    'type' : 'PY_LONG_LONG'})
+#     testcode.append(c_size_test % {'sz' : 'SIZEOF_PY_LONG_LONG',
+#                                    'type' : 'PY_LONG_LONG'})
+# 
+# 
+#     testcode.append(r'''
+# #else
+#         fprintf(fp, "/* PY_LONG_LONG not defined */\n");
+# #endif
+# #ifndef CHAR_BIT
+#           {
+#              unsigned char var = 2;
+#              int i=0;
+#              while (var >= 2) {
+#                      var = var << 1;
+#                      i++;
+#              }
+#              fprintf(fp,"#define CHAR_BIT %d\n", i+1);
+#           }
+# #else
+#           fprintf(fp, "/* #define CHAR_BIT %d */\n", CHAR_BIT);
+# #endif
+#           fclose(fp);
+#           return 0;
+# }
+# ''')
+#     testcode = '\n'.join(testcode)
+#     return testcode
 
-int main(int argc, char **argv)
-{
-
-        FILE *fp;
-
-        fp = fopen("'''+target+'''","w");
-        ''']
-
-    c_size_test = r'''
-#ifndef %(sz)s
-          fprintf(fp,"#define %(sz)s %%d\n", sizeof(%(type)s));
-#else
-          fprintf(fp,"/* #define %(sz)s %%d */\n", %(sz)s);
-#endif
-'''
-    for sz, t in [('SIZEOF_SHORT', 'short'),
-                  ('SIZEOF_INT', 'int'),
-                  ('SIZEOF_LONG', 'long'),
-                  ('SIZEOF_FLOAT', 'float'),
-                  ('SIZEOF_DOUBLE', 'double'),
-                  ('SIZEOF_LONG_DOUBLE', 'long double'),
-                  ('SIZEOF_PY_INTPTR_T', 'Py_intptr_t'),
-                  ]:
-        testcode.append(c_size_test % {'sz' : sz, 'type' : t})
-
-    testcode.append('#ifdef PY_LONG_LONG')
-    testcode.append(c_size_test % {'sz' : 'SIZEOF_LONG_LONG',
-                                   'type' : 'PY_LONG_LONG'})
-    testcode.append(c_size_test % {'sz' : 'SIZEOF_PY_LONG_LONG',
-                                   'type' : 'PY_LONG_LONG'})
-
-
-    testcode.append(r'''
-#else
-        fprintf(fp, "/* PY_LONG_LONG not defined */\n");
-#endif
-#ifndef CHAR_BIT
-          {
-             unsigned char var = 2;
-             int i=0;
-             while (var >= 2) {
-                     var = var << 1;
-                     i++;
-             }
-             fprintf(fp,"#define CHAR_BIT %d\n", i+1);
-          }
-#else
-          fprintf(fp, "/* #define CHAR_BIT %d */\n", CHAR_BIT);
-#endif
-          fclose(fp);
-          return 0;
-}
-''')
-    testcode = '\n'.join(testcode)
-    return testcode
-
 if __name__=='__main__':
     from numpy.distutils.core import setup
     setup(configuration=configuration)

Modified: branches/numpy.scons/test.sh
===================================================================
--- branches/numpy.scons/test.sh	2007-10-15 06:47:36 UTC (rev 4196)
+++ branches/numpy.scons/test.sh	2007-10-15 06:48:05 UTC (rev 4197)
@@ -1,6 +1,8 @@
-PREFIX=/usr/src/dsp/bzrversion/numpy.scons/tmp
+PREFIX=/usr/media/src/src/dsp/bzrversion/numpy.scons/tmp
 rm -rf build
 rm -rf $PREFIX
-python setupscons.py install --prefix=$PREFIX
-#python setup.py install --prefix=$PREFIX
-(cd $PREFIX && PYTHONPATH=$PREFIX/lib/python2.5/site-packages python -c "import numpy; print numpy; numpy.test(level = 9999)")
+python setupscons.py scons
+python setupscons.py build
+#--prefix=$PREFIX
+##python setup.py install --prefix=$PREFIX
+#(cd $PREFIX && PYTHONPATH=$PREFIX/lib/python2.5/site-packages python -c "import numpy; print numpy; numpy.test(level = 9999)")



More information about the Numpy-svn mailing list