[Numpy-svn] r4192 - in branches/numpy.scons: . numpy/core
numpy-svn at scipy.org
numpy-svn at scipy.org
Sun Oct 14 23:24:20 EDT 2007
Author: cdavid
Date: 2007-10-14 22:24:03 -0500 (Sun, 14 Oct 2007)
New Revision: 4192
Modified:
branches/numpy.scons/
branches/numpy.scons/numpy/core/SConstruct
branches/numpy.scons/numpy/core/scons_support.py
branches/numpy.scons/numpy/core/setupscons.py
branches/numpy.scons/test.sh
Log:
_sort module compiled, but problems with umath
Property changes on: branches/numpy.scons
___________________________________________________________________
Name: bzr:revision-info
- timestamp: 2007-10-15 01:45:21.803999901 +0900
committer: david <david at david-laptop>
properties:
branch-nick: numpy.scons
+ timestamp: 2007-10-15 12:23:15.546999931 +0900
committer: david <david at david-laptop>
properties:
branch-nick: numpy.scons
Name: bzr:revision-id:v3-trunk0
- 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa
3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs
3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z
3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i
3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p
3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m
3744 david at david-laptop-20070922101656-61kfi2faucemr2rl
3745 david at david-laptop-20070922113708-ror18thshang1cpu
3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1
3749 david at david-laptop-20070922154007-usit009fr6vp377j
3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht
3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9
3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli
3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4
3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q
3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1
3756 david at david-laptop-20070924153247-yftud00bynilxv69
3757 david at david-laptop-20070924163545-pish34x9fq2h66aj
3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34
3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp
3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2
3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq
3769 david at david-laptop-20070925145952-4osi81tvch7v6luj
3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0
3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo
3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0
3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x
3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6
3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b
3779 david at david-laptop-20071009154954-v5se05gbq60opo1z
3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8
3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe
3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi
3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056
3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0
3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h
3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf
3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d
3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl
3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7
3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf
3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4
3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n
3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y
3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m
3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe
3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc
3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7
3805 david at david-laptop-20071014064841-liamaqiv3af71r3g
3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l
3807 david at david-laptop-20071014124401-n3a37y67u5imyo83
3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2
3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp
+ 3737 david at david-laptop-20070920080908-n8pj8vmszdir3zoa
3738 david at david-laptop-20070920081509-58kkojgmml3t7jxs
3739 david at david-laptop-20070920081910-phlk1ujthksgpm0z
3740 david at david-laptop-20070920082641-bdhrt6eafeoli50i
3741 david at ar.media.kyoto-u.ac.jp-20070920130730-satdeppbh1k0bq2p
3743 david at ar.media.kyoto-u.ac.jp-20070921073742-vpv8pwv0j8fbd93m
3744 david at david-laptop-20070922101656-61kfi2faucemr2rl
3745 david at david-laptop-20070922113708-ror18thshang1cpu
3747 david at david-laptop-20070922140534-n9xsl096tjrzmct1
3749 david at david-laptop-20070922154007-usit009fr6vp377j
3750 david at david-laptop-20070923070011-leu2ozc2fy1q5cht
3751 david at david-laptop-20070924015925-dhsiao40jp7zsfp9
3752 david at ar.media.kyoto-u.ac.jp-20070924070657-nbw23j0ayan30cli
3753 david at ar.media.kyoto-u.ac.jp-20070924082918-i1lc1zikywi8czj4
3754 david at ar.media.kyoto-u.ac.jp-20070924083008-c0edtt8zs31yeh1q
3755 david at ar.media.kyoto-u.ac.jp-20070924112351-pnnho638cohz6lj1
3756 david at david-laptop-20070924153247-yftud00bynilxv69
3757 david at david-laptop-20070924163545-pish34x9fq2h66aj
3758 david at david-laptop-20070924164633-iiyygcaw81ji3n34
3759 david at david-laptop-20070924170201-y14v2yzikdpvamfp
3760 david at david-laptop-20070924171208-5bmitorzf49d1aa2
3761 david at david-laptop-20070925014444-ns9v90gotnxt39mq
3769 david at david-laptop-20070925145952-4osi81tvch7v6luj
3773 david at ar.media.kyoto-u.ac.jp-20070926073429-2kdc6yf1o210aer0
3774 david at ar.media.kyoto-u.ac.jp-20070926084356-938djoytjap90rmo
3775 david at ar.media.kyoto-u.ac.jp-20070926085329-3gquq3gu2k8rgzb0
3776 david at ar.media.kyoto-u.ac.jp-20071009084906-9kradhwpu7su633x
3777 david at ar.media.kyoto-u.ac.jp-20071009093339-q5nf5me6ikdi48k6
3778 david at david-laptop-20071009152108-xh5cltii0h6zjk9b
3779 david at david-laptop-20071009154954-v5se05gbq60opo1z
3780 david at david-laptop-20071009223102-vz2sgf5i6pncxsd8
3781 david at david-laptop-20071009225259-13m6enwqk4w9uihe
3782 david at ar.media.kyoto-u.ac.jp-20071010021710-liz2jvw0ggbxrtgi
3783 david at ar.media.kyoto-u.ac.jp-20071010032218-8qzxvdmith85a056
3784 david at ar.media.kyoto-u.ac.jp-20071010032323-lgbxfd788h402kn0
3792 david at ar.media.kyoto-u.ac.jp-20071011033223-s14976refgeaw00h
3793 david at ar.media.kyoto-u.ac.jp-20071011033241-rrzlo2vu6w0tkdwf
3794 david at ar.media.kyoto-u.ac.jp-20071011071251-c5pxigyynpck262d
3795 david at ar.media.kyoto-u.ac.jp-20071012040323-8ka0mgkx1t8r9fcl
3796 david at ar.media.kyoto-u.ac.jp-20071012042801-44pmvc5o1u6p6wi7
3797 david at ar.media.kyoto-u.ac.jp-20071012071207-nfpsuyfoq0ooy7xf
3798 david at ar.media.kyoto-u.ac.jp-20071012073426-8o9tejzovgk7qzi4
3799 david at ar.media.kyoto-u.ac.jp-20071012074103-1fzviuk1sunv0b9n
3800 david at ar.media.kyoto-u.ac.jp-20071012074129-t5nu6f96wie8fd1y
3801 david at ar.media.kyoto-u.ac.jp-20071012100715-sq8hhctu5tynlx4m
3802 david at david-laptop-20071013043839-hc3yfsbn0t7gsuhe
3803 david at david-laptop-20071013123319-vf4b7yhadz9nxasc
3804 david at david-laptop-20071014063148-0bsktlh609c3rpv7
3805 david at david-laptop-20071014064841-liamaqiv3af71r3g
3806 david at david-laptop-20071014064900-j4yzxzuveukuyj2l
3807 david at david-laptop-20071014124401-n3a37y67u5imyo83
3808 david at david-laptop-20071014161201-hdljwkhh4ep0f9k2
3809 david at david-laptop-20071014164521-c6i415hcz6hfrxxp
3810 david at david-laptop-20071015032315-g9fsm9zqk6fanyjz
Modified: branches/numpy.scons/numpy/core/SConstruct
===================================================================
--- branches/numpy.scons/numpy/core/SConstruct 2007-10-14 16:46:06 UTC (rev 4191)
+++ branches/numpy.scons/numpy/core/SConstruct 2007-10-15 03:24:03 UTC (rev 4192)
@@ -138,7 +138,7 @@
#--------------------------
# Generating multiarray API
#--------------------------
-from scons_support import do_generate_api, generate_api_emitter
+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)
@@ -185,21 +185,46 @@
pjoin(env['src_dir'], 'src', 'arraytypes.inc.src'))
# XXX
-env.Append(CCFLAGS = "-W -Wall -Wextra -O2")
+#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)
+#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)
+#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
+ code = generate_umath.make_code(generate_umath.defdict, generate_umath.__file__)
+ t.write(code)
+ t.close()
+
+def generate_umath(target, source, env):
+ for t, s in zip(target, source):
+ do_generate_umath(str(t), str(s), env)
+
+def generate_umath_emitter(target, source, env):
+ t = str(target[0]) + '.c'
+ return ([t], source)
+
+bld = Builder(action = generate_umath, emitter = generate_umath_emitter)
+env.Append(BUILDERS = {'GenerateUmath' : bld})
+
+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'))
+
umathmodule_src = env.FromTemplate(pjoin(env['build_dir'], 'src', 'umathmodule'),
pjoin(env['src_dir'], 'src', 'umathmodule.c.src'))
-#sort = env.NumpyPythonExtension('_sort', source = sortmodule_src)
-
+umath = env.GenerateUmath(pjoin(env['build_dir'], '__umath_generated'),
+ pjoin(env['src_dir'], 'code_generators', 'generate_umath.py'))
+umathmodule = env.NumpyPythonExtension('umathmodule', source = umathmodule_src)
Modified: branches/numpy.scons/numpy/core/scons_support.py
===================================================================
--- branches/numpy.scons/numpy/core/scons_support.py 2007-10-14 16:46:06 UTC (rev 4191)
+++ branches/numpy.scons/numpy/core/scons_support.py 2007-10-15 03:24:03 UTC (rev 4192)
@@ -1,8 +1,11 @@
from code_generators.generate_array_api import types, h_template, c_template
+from code_generators.generate_ufunc_api import h_template, c_template
import code_generators.genapi as genapi
import SCons.Errors
+# XXX: better refactor code_generators.generate* functions, and use them
+# directly
def do_generate_api(target, source, env):
"""source has to be a sequence of OBJECT, MULTIARRAY txt files."""
h_file = str(target[0])
@@ -95,3 +98,54 @@
txt = base + '.txt'
t = [h, c, txt]
return (t, source)
+
+def do_generate_ufunc_api(target, source, env):
+ """source has to be a txt file."""
+ h_file = str(target[0])
+ c_file = str(target[1])
+ d_file = str(target[2])
+
+ targets = (h_file, c_file, d_file)
+
+ UFUNC_API_ORDER = str(source[0])
+ ufunc_api_list = genapi.get_api_functions('UFUNC_API', UFUNC_API_ORDER)
+
+ # API fixes for __arrayobject_api.h
+
+ fixed = 1
+ nummulti = len(ufunc_api_list)
+ numtotal = fixed + nummulti
+
+ module_list = []
+ extension_list = []
+ init_list = []
+
+ # set up object API
+ genapi.add_api_list(fixed, 'PyUFunc_API', ufunc_api_list,
+ module_list, extension_list, init_list)
+
+ # Write to header
+ fid = open(h_file, 'w')
+ s = h_template % ('\n'.join(module_list), '\n'.join(extension_list))
+ fid.write(s)
+ fid.close()
+
+ # Write to c-code
+ fid = open(c_file, 'w')
+ s = c_template % '\n'.join(init_list)
+ fid.write(s)
+ fid.close()
+
+ # Write to documentation
+ fid = open(d_file, 'w')
+ fid.write('''
+=================
+Numpy Ufunc C-API
+=================
+''')
+ for func in ufunc_api_list:
+ fid.write(func.to_ReST())
+ fid.write('\n\n')
+ fid.close()
+
+ return 0
Modified: branches/numpy.scons/numpy/core/setupscons.py
===================================================================
--- branches/numpy.scons/numpy/core/setupscons.py 2007-10-14 16:46:06 UTC (rev 4191)
+++ branches/numpy.scons/numpy/core/setupscons.py 2007-10-15 03:24:03 UTC (rev 4192)
@@ -203,18 +203,6 @@
if sys.platform == 'cygwin':
config.add_data_dir('include/numpy/fenv')
- #config.add_extension('multiarray',
- # sources = [join('src','multiarraymodule.c'),
- # generate_config_h,
- # generate_array_api,
- # join('src','scalartypes.inc.src'),
- # join('src','arraytypes.inc.src'),
- # join(codegen_dir,'generate_array_api.py'),
- # join('*.py')
- # ],
- # depends = deps,
- # )
-
config.add_extension('umath',
sources = [generate_config_h,
join('src','umathmodule.c.src'),
@@ -229,13 +217,6 @@
]+deps,
)
- #config.add_extension('_sort',
- # sources=[join('src','_sortmodule.c.src'),
- # generate_config_h,
- # generate_array_api,
- # ],
- # )
-
config.add_extension('scalarmath',
sources=[join('src','scalarmathmodule.c.src'),
generate_config_h,
Modified: branches/numpy.scons/test.sh
===================================================================
--- branches/numpy.scons/test.sh 2007-10-14 16:46:06 UTC (rev 4191)
+++ branches/numpy.scons/test.sh 2007-10-15 03:24:03 UTC (rev 4192)
@@ -1,5 +1,6 @@
PREFIX=/usr/src/dsp/bzrversion/numpy.scons/tmp
-#rm -rf build
+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)")
More information about the Numpy-svn
mailing list