[Numpy-svn] r4180 - in branches/numpy.scons: . numpy numpy/core numpy/distutils numpy/f2py numpy/fft numpy/lib numpy/linalg numpy/numarray numpy/oldnumeric numpy/random numpy/scons_fake numpy/testing

numpy-svn@scip... numpy-svn@scip...
Fri Oct 12 05:42:09 CDT 2007


Author: cdavid
Date: 2007-10-12 05:41:08 -0500 (Fri, 12 Oct 2007)
New Revision: 4180

Added:
   branches/numpy.scons/numpy/core/setupscons.py
   branches/numpy.scons/numpy/distutils/setupscons.py
   branches/numpy.scons/numpy/f2py/setupscons.py
   branches/numpy.scons/numpy/fft/setupscons.py
   branches/numpy.scons/numpy/lib/setupscons.py
   branches/numpy.scons/numpy/linalg/setupscons.py
   branches/numpy.scons/numpy/numarray/setupscons.py
   branches/numpy.scons/numpy/oldnumeric/setupscons.py
   branches/numpy.scons/numpy/random/setupscons.py
   branches/numpy.scons/numpy/scons_fake/setupscons.py
   branches/numpy.scons/numpy/setupscons.py
   branches/numpy.scons/numpy/testing/setupscons.py
   branches/numpy.scons/setupscons.py
Modified:
   branches/numpy.scons/
Log:
Set up setupscons.py files where it matters for future sconsification of numpy


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

   + timestamp: 2007-10-12 16:34:26.244999886 +0900
committer: David Cournapeau <david@ar.media.kyoto-u.ac.jp>
properties: 
	branch-nick: numpy.sconsified

Name: bzr:file-ids
   - 
   + setupscons.py	setupscons.py-20071012073152-5cjw0f21wjrronpp-1
numpy/setupscons.py	setupscons.py-20071012073156-2q41hv4160unzvgu-1
numpy/distutils/setupscons.py	setupscons.py-20071012073225-2siuy69nudxygxhf-1
numpy/random/setupscons.py	setupscons.py-20071012073345-rdz48sxmx4l5z104-1
numpy/scons_fake/setupscons.py	setupscons.py-20071012073348-qsdmbjgvmo8v4vfa-1
numpy/lib/setupscons.py	setupscons.py-20071012073400-jj4s0c8bf3tdyk8u-1
numpy/numarray/setupscons.py	setupscons.py-20071012073332-ozzndtqjcck51weo-1
numpy/f2py/setupscons.py	setupscons.py-20071012073214-nfy7furt0j408jxj-1
numpy/core/setupscons.py	setupscons.py-20071012073209-yf3ikofbaleurqt0-1
numpy/fft/setupscons.py	setupscons.py-20071012073214-nfy7furt0j408jxj-2
numpy/linalg/setupscons.py	setupscons.py-20071012073400-jj4s0c8bf3tdyk8u-2
numpy/oldnumeric/setupscons.py	setupscons.py-20071012073341-cyophs8ex8ot7u1c-1
numpy/testing/setupscons.py	setupscons.py-20071012073353-ti1uodrc1u4hzipy-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
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

   + 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


Added: branches/numpy.scons/numpy/core/setupscons.py
===================================================================
--- branches/numpy.scons/numpy/core/setupscons.py	2007-10-12 10:40:32 UTC (rev 4179)
+++ branches/numpy.scons/numpy/core/setupscons.py	2007-10-12 10:41:08 UTC (rev 4180)
@@ -0,0 +1,348 @@
+import imp
+import os
+import sys
+from os.path import join
+from numpy.distutils import log
+from distutils.dep_util import newer
+
+FUNCTIONS_TO_CHECK = [
+    ('expl', 'HAVE_LONGDOUBLE_FUNCS'),
+    ('expf', 'HAVE_FLOAT_FUNCS'),
+    ('log1p', 'HAVE_LOG1P'),
+    ('expm1', 'HAVE_EXPM1'),
+    ('asinh', 'HAVE_INVERSE_HYPERBOLIC'),
+    ('atanhf', 'HAVE_INVERSE_HYPERBOLIC_FLOAT'),
+    ('atanhl', 'HAVE_INVERSE_HYPERBOLIC_LONGDOUBLE'),
+    ('isnan', 'HAVE_ISNAN'),
+    ('isinf', 'HAVE_ISINF'),
+    ('rint', 'HAVE_RINT'),
+    ]
+
+def configuration(parent_package='',top_path=None):
+    from numpy.distutils.misc_util import Configuration,dot_join
+    from numpy.distutils.system_info import get_info, default_lib_dirs
+
+    config = Configuration('core',parent_package,top_path)
+    local_dir = config.local_path
+    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))
+
+    header_dir = 'include/numpy' # this is relative to config.path_in_package
+
+    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)))
+
+            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)
+
+            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.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()
+
+        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)
+
+        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
+
+    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 []
+
+    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('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'),
+                                    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('_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,
+                                  generate_array_api,
+                                  generate_ufunc_api],
+                         )
+
+    # Configure blasdot
+    blas_info = get_info('blas_opt',0)
+    #blas_info = {}
+    def get_dotblas_sources(ext, build_dir):
+        if blas_info:
+            if ('NO_ATLAS_INFO',1) in blas_info.get('define_macros',[]):
+                return None # dotblas needs ATLAS, Fortran compiled blas will not be sufficient.
+            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()
+
+    return config
+
+def testcode_mathlib():
+    return """\
+/* check whether libm is broken */
+#include <math.h>
+int main(int argc, char *argv[])
+{
+  return exp(-720.) > 1.0;  /* typically an IEEE denormal */
+}
+"""
+
+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
+
+if __name__=='__main__':
+    from numpy.distutils.core import setup
+    setup(configuration=configuration)
+

Added: branches/numpy.scons/numpy/distutils/setupscons.py
===================================================================
--- branches/numpy.scons/numpy/distutils/setupscons.py	2007-10-12 10:40:32 UTC (rev 4179)
+++ branches/numpy.scons/numpy/distutils/setupscons.py	2007-10-12 10:41:08 UTC (rev 4180)
@@ -0,0 +1,16 @@
+#!/usr/bin/env python
+
+def configuration(parent_package='',top_path=None):
+    from numpy.distutils.misc_util import Configuration
+    config = Configuration('distutils',parent_package,top_path)
+    config.add_subpackage('command')
+    config.add_subpackage('scons')
+    config.add_subpackage('fcompiler')
+    config.add_data_dir('tests')
+    config.add_data_files('site.cfg')
+    config.make_config_py()
+    return config
+
+if __name__ == '__main__':
+    from numpy.distutils.core      import setup
+    setup(configuration=configuration)

Added: branches/numpy.scons/numpy/f2py/setupscons.py
===================================================================
--- branches/numpy.scons/numpy/f2py/setupscons.py	2007-10-12 10:40:32 UTC (rev 4179)
+++ branches/numpy.scons/numpy/f2py/setupscons.py	2007-10-12 10:41:08 UTC (rev 4180)
@@ -0,0 +1,130 @@
+#!/usr/bin/env python
+"""
+setup.py for installing F2PY
+
+Usage:
+   python setup.py install
+
+Copyright 2001-2005 Pearu Peterson all rights reserved,
+Pearu Peterson <pearu@cens.ioc.ee>
+Permission to use, modify, and distribute this software is given under the
+terms of the NumPy License.
+
+NO WARRANTY IS EXPRESSED OR IMPLIED.  USE AT YOUR OWN RISK.
+$Revision: 1.32 $
+$Date: 2005/01/30 17:22:14 $
+Pearu Peterson
+"""
+
+__version__ = "$Id: setup.py,v 1.32 2005/01/30 17:22:14 pearu Exp $"
+
+import os
+import sys
+from distutils.dep_util import newer
+from numpy.distutils import log
+from numpy.distutils.core import setup
+from numpy.distutils.misc_util import Configuration
+
+from __version__ import version
+
+def configuration(parent_package='',top_path=None):
+    config = Configuration('f2py', parent_package, top_path)
+
+    config.add_subpackage('lib')
+
+    config.add_data_dir('docs')
+
+    config.add_data_files('src/fortranobject.c',
+                          'src/fortranobject.h',
+                          'f2py.1'
+                          )
+
+    config.make_svn_version_py()
+
+    def generate_f2py_py(build_dir):
+        f2py_exe = 'f2py'+os.path.basename(sys.executable)[6:]
+        if f2py_exe[-4:]=='.exe':
+            f2py_exe = f2py_exe[:-4] + '.py'
+        if 'bdist_wininst' in sys.argv and f2py_exe[-3:] != '.py':
+            f2py_exe = f2py_exe + '.py'
+        target = os.path.join(build_dir,f2py_exe)
+        if newer(__file__,target):
+            log.info('Creating %s', target)
+            f = open(target,'w')
+            f.write('''\
+#!/usr/bin/env %s
+# See http://cens.ioc.ee/projects/f2py2e/
+import os, sys
+for mode in ["g3-numpy", "2e-numeric", "2e-numarray", "2e-numpy"]:
+    try:
+        i=sys.argv.index("--"+mode)
+        del sys.argv[i]
+        break
+    except ValueError: pass
+os.environ["NO_SCIPY_IMPORT"]="f2py"
+if mode=="g3-numpy":
+    try:
+        from main import main
+    except ImportError:
+        from numpy.f2py.lib.api import main
+elif mode=="2e-numeric":
+    from f2py2e import main
+elif mode=="2e-numarray":
+    sys.argv.append("-DNUMARRAY")
+    from f2py2e import main
+elif mode=="2e-numpy":
+    from numpy.f2py import main
+else:
+    print >> sys.stderr, "Unknown mode:",`mode`
+    sys.exit(1)
+main()
+'''%(os.path.basename(sys.executable)))
+            f.close()
+        return target
+
+    config.add_scripts(generate_f2py_py)
+
+    log.info('F2PY Version %s', config.get_version())
+
+    return config
+
+if __name__ == "__main__":
+
+    config = configuration(top_path='')
+    version = config.get_version()
+    print 'F2PY Version',version
+    config = config.todict()
+
+    if sys.version[:3]>='2.3':
+        config['download_url'] = "http://cens.ioc.ee/projects/f2py2e/2.x"\
+                                 "/F2PY-2-latest.tar.gz"
+        config['classifiers'] = [
+            'Development Status :: 5 - Production/Stable',
+            'Intended Audience :: Developers',
+            'Intended Audience :: Science/Research',
+            'License :: OSI Approved :: NumPy License',
+            'Natural Language :: English',
+            'Operating System :: OS Independent',
+            'Programming Language :: C',
+            'Programming Language :: Fortran',
+            'Programming Language :: Python',
+            'Topic :: Scientific/Engineering',
+            'Topic :: Software Development :: Code Generators',
+            ]
+    setup(version=version,
+          description       = "F2PY - Fortran to Python Interface Generaton",
+          author            = "Pearu Peterson",
+          author_email      = "pearu@cens.ioc.ee",
+          maintainer        = "Pearu Peterson",
+          maintainer_email  = "pearu@cens.ioc.ee",
+          license           = "BSD",
+          platforms         = "Unix, Windows (mingw|cygwin), Mac OSX",
+          long_description  = """\
+The Fortran to Python Interface Generator, or F2PY for short, is a
+command line tool (f2py) for generating Python C/API modules for
+wrapping Fortran 77/90/95 subroutines, accessing common blocks from
+Python, and calling Python functions from Fortran (call-backs).
+Interfacing subroutines/data from Fortran 90/95 modules is supported.""",
+          url               = "http://cens.ioc.ee/projects/f2py2e/",
+          keywords          = ['Fortran','f2py'],
+          **config)


Property changes on: branches/numpy.scons/numpy/f2py/setupscons.py
___________________________________________________________________
Name: svn:executable
   + *

Added: branches/numpy.scons/numpy/fft/setupscons.py
===================================================================
--- branches/numpy.scons/numpy/fft/setupscons.py	2007-10-12 10:40:32 UTC (rev 4179)
+++ branches/numpy.scons/numpy/fft/setupscons.py	2007-10-12 10:41:08 UTC (rev 4180)
@@ -0,0 +1,19 @@
+
+
+def configuration(parent_package='',top_path=None):
+    from numpy.distutils.misc_util import Configuration
+    config = Configuration('fft',parent_package,top_path)
+
+    config.add_data_dir('tests')
+
+    # Configure fftpack_lite
+    config.add_extension('fftpack_lite',
+                         sources=['fftpack_litemodule.c', 'fftpack.c']
+                         )
+
+
+    return config
+
+if __name__ == '__main__':
+    from numpy.distutils.core import setup
+    setup(configuration=configuration)

Added: branches/numpy.scons/numpy/lib/setupscons.py
===================================================================
--- branches/numpy.scons/numpy/lib/setupscons.py	2007-10-12 10:40:32 UTC (rev 4179)
+++ branches/numpy.scons/numpy/lib/setupscons.py	2007-10-12 10:41:08 UTC (rev 4180)
@@ -0,0 +1,21 @@
+from os.path import join
+
+def configuration(parent_package='',top_path=None):
+    from numpy.distutils.misc_util import Configuration
+
+    config = Configuration('lib',parent_package,top_path)
+
+    config.add_include_dirs(join('..','core','include'))
+
+
+    config.add_extension('_compiled_base',
+                         sources=[join('src','_compiled_base.c')]
+                         )
+
+    config.add_data_dir('tests')
+
+    return config
+
+if __name__=='__main__':
+    from numpy.distutils.core import setup
+    setup(configuration=configuration)

Added: branches/numpy.scons/numpy/linalg/setupscons.py
===================================================================
--- branches/numpy.scons/numpy/linalg/setupscons.py	2007-10-12 10:40:32 UTC (rev 4179)
+++ branches/numpy.scons/numpy/linalg/setupscons.py	2007-10-12 10:41:08 UTC (rev 4180)
@@ -0,0 +1,31 @@
+
+def configuration(parent_package='',top_path=None):
+    from numpy.distutils.misc_util import Configuration
+    from numpy.distutils.system_info import get_info
+    config = Configuration('linalg',parent_package,top_path)
+
+    config.add_data_dir('tests')
+
+    # Configure lapack_lite
+    lapack_info = get_info('lapack_opt',0)
+    def get_lapack_lite_sources(ext, build_dir):
+        if not lapack_info:
+            print "### Warning:  Using unoptimized lapack ###"
+            return ext.depends[:-1]
+        else:
+            return ext.depends[:1]
+
+    config.add_extension('lapack_lite',
+                         sources = [get_lapack_lite_sources],
+                         depends=  ['lapack_litemodule.c',
+                                   'zlapack_lite.c', 'dlapack_lite.c',
+                                   'blas_lite.c', 'dlamch.c',
+                                   'f2c_lite.c','f2c.h'],
+                         extra_info = lapack_info
+                         )
+
+    return config
+
+if __name__ == '__main__':
+    from numpy.distutils.core import setup
+    setup(configuration=configuration)

Added: branches/numpy.scons/numpy/numarray/setupscons.py
===================================================================
--- branches/numpy.scons/numpy/numarray/setupscons.py	2007-10-12 10:40:32 UTC (rev 4179)
+++ branches/numpy.scons/numpy/numarray/setupscons.py	2007-10-12 10:41:08 UTC (rev 4180)
@@ -0,0 +1,17 @@
+from os.path import join
+
+def configuration(parent_package='',top_path=None):
+    from numpy.distutils.misc_util import Configuration
+    config = Configuration('numarray',parent_package,top_path)
+
+    config.add_data_files('numpy/')
+
+    config.add_extension('_capi',
+                         sources=['_capi.c'],
+                         )
+
+    return config
+
+if __name__ == '__main__':
+    from numpy.distutils.core import setup
+    setup(configuration=configuration)

Added: branches/numpy.scons/numpy/oldnumeric/setupscons.py
===================================================================
--- branches/numpy.scons/numpy/oldnumeric/setupscons.py	2007-10-12 10:40:32 UTC (rev 4179)
+++ branches/numpy.scons/numpy/oldnumeric/setupscons.py	2007-10-12 10:41:08 UTC (rev 4180)
@@ -0,0 +1,8 @@
+
+def configuration(parent_package='',top_path=None):
+    from numpy.distutils.misc_util import Configuration
+    return Configuration('oldnumeric',parent_package,top_path)
+
+if __name__ == '__main__':
+    from numpy.distutils.core import setup
+    setup(configuration=configuration)

Added: branches/numpy.scons/numpy/random/setupscons.py
===================================================================
--- branches/numpy.scons/numpy/random/setupscons.py	2007-10-12 10:40:32 UTC (rev 4179)
+++ branches/numpy.scons/numpy/random/setupscons.py	2007-10-12 10:41:08 UTC (rev 4180)
@@ -0,0 +1,53 @@
+from os.path import join, split
+
+def configuration(parent_package='',top_path=None):
+    from numpy.distutils.misc_util import Configuration, get_mathlibs
+    config = Configuration('random',parent_package,top_path)
+
+    def generate_libraries(ext, build_dir):
+        config_cmd = config.get_config_cmd()
+        if top_path is None:
+            libs = get_mathlibs()
+        else:
+            path = join(split(build_dir)[0],'core')
+            libs = get_mathlibs(path)
+        tc = testcode_wincrypt()
+        if config_cmd.try_run(tc):
+            libs.append('Advapi32')
+        ext.libraries.extend(libs)
+        return None
+
+    libs = []
+    # Configure mtrand
+    config.add_extension('mtrand',
+                         sources=[join('mtrand', x) for x in
+                                  ['mtrand.c', 'randomkit.c', 'initarray.c',
+                                   'distributions.c']]+[generate_libraries],
+                         libraries=libs,
+                         depends = [join('mtrand','*.h'),
+                                    join('mtrand','*.pyx'),
+                                    join('mtrand','*.pxi'),
+                                    ]
+                        )
+
+    config.add_data_files(('.', join('mtrand', 'randomkit.h')))
+    config.add_data_dir('tests')
+
+    return config
+
+def testcode_wincrypt():
+    return """\
+/* check to see if _WIN32 is defined */
+int main(int argc, char *argv[])
+{
+#ifdef _WIN32
+    return 0;
+#else
+    return 1;
+#endif
+}
+"""
+
+if __name__ == '__main__':
+    from numpy.distutils.core import setup
+    setup(configuration=configuration)

Added: branches/numpy.scons/numpy/scons_fake/setupscons.py
===================================================================
--- branches/numpy.scons/numpy/scons_fake/setupscons.py	2007-10-12 10:40:32 UTC (rev 4179)
+++ branches/numpy.scons/numpy/scons_fake/setupscons.py	2007-10-12 10:41:08 UTC (rev 4180)
@@ -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('scons_fake',parent_package,top_path)
+
+    config.add_subpackage('pyext')
+    config.add_subpackage('ctypesext')
+    config.add_subpackage('checklib')
+    return config
+
+if __name__ == '__main__':
+    from numpy.distutils.core import setup
+    setup(configuration=configuration)

Added: branches/numpy.scons/numpy/setupscons.py
===================================================================
--- branches/numpy.scons/numpy/setupscons.py	2007-10-12 10:40:32 UTC (rev 4179)
+++ branches/numpy.scons/numpy/setupscons.py	2007-10-12 10:41:08 UTC (rev 4180)
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+
+def configuration(parent_package='',top_path=None):
+    from numpy.distutils.misc_util import Configuration
+    config = Configuration('numpy',parent_package,top_path, setup_name = 'setupscons.py')
+    config.add_subpackage('distutils')
+    config.add_subpackage('scons_fake')
+    config.add_subpackage('testing')
+    config.add_subpackage('f2py')
+    config.add_subpackage('core')
+    config.add_subpackage('lib')
+    config.add_subpackage('oldnumeric')
+    config.add_subpackage('numarray')
+    config.add_subpackage('fft')
+    config.add_subpackage('linalg')
+    config.add_subpackage('random')
+    config.add_data_dir('doc')
+    config.add_data_dir('tests')
+    config.make_config_py() # installs __config__.py
+    return config
+
+if __name__ == '__main__':
+    print 'This is the wrong setup.py file to run'

Added: branches/numpy.scons/numpy/testing/setupscons.py
===================================================================
--- branches/numpy.scons/numpy/testing/setupscons.py	2007-10-12 10:40:32 UTC (rev 4179)
+++ branches/numpy.scons/numpy/testing/setupscons.py	2007-10-12 10:41:08 UTC (rev 4180)
@@ -0,0 +1,16 @@
+#!/usr/bin/env python
+
+def configuration(parent_package='',top_path=None):
+    from numpy.distutils.misc_util import Configuration
+    config = Configuration('testing',parent_package,top_path)
+    return config
+
+if __name__ == '__main__':
+    from numpy.distutils.core import setup
+    setup(maintainer = "NumPy Developers",
+          maintainer_email = "numpy-dev@numpy.org",
+          description = "NumPy test module",
+          url = "http://www.numpy.org",
+          license = "NumPy License (BSD Style)",
+          configuration = configuration,
+          )


Property changes on: branches/numpy.scons/numpy/testing/setupscons.py
___________________________________________________________________
Name: svn:executable
   + *

Added: branches/numpy.scons/setupscons.py
===================================================================
--- branches/numpy.scons/setupscons.py	2007-10-12 10:40:32 UTC (rev 4179)
+++ branches/numpy.scons/setupscons.py	2007-10-12 10:41:08 UTC (rev 4180)
@@ -0,0 +1,90 @@
+#!/usr/bin/env python
+"""NumPy: array processing for numbers, strings, records, and objects.
+
+NumPy is a general-purpose array-processing package designed to
+efficiently manipulate large multi-dimensional arrays of arbitrary
+records without sacrificing too much speed for small multi-dimensional
+arrays.  NumPy is built on the Numeric code base and adds features
+introduced by numarray as well as an extended C-API and the ability to
+create arrays of arbitrary type which also makes NumPy suitable for
+interfacing with general-purpose data-base applications.
+
+There are also basic facilities for discrete fourier transform,
+basic linear algebra and random number generation.
+"""
+
+DOCLINES = __doc__.split("\n")
+
+import os
+import sys
+
+CLASSIFIERS = """\
+Development Status :: 4 - Beta
+Intended Audience :: Science/Research
+Intended Audience :: Developers
+License :: OSI Approved
+Programming Language :: C
+Programming Language :: Python
+Topic :: Software Development
+Topic :: Scientific/Engineering
+Operating System :: Microsoft :: Windows
+Operating System :: POSIX
+Operating System :: Unix
+Operating System :: MacOS
+"""
+
+# BEFORE importing distutils, remove MANIFEST. distutils doesn't properly
+# update it when the contents of directories change.
+if os.path.exists('MANIFEST'): os.remove('MANIFEST')
+
+def configuration(parent_package='',top_path=None):
+    from numpy.distutils.misc_util import Configuration
+
+    config = Configuration(None, parent_package, top_path, setup_name = 'setupscons.py')
+    config.set_options(ignore_setup_xxx_py=True,
+                       assume_default_configuration=True,
+                       delegate_options_to_subpackages=True,
+                       quiet=True)
+    
+    config.add_subpackage('numpy')
+        
+    config.add_data_files(('numpy','*.txt'),
+                          ('numpy','COMPATIBILITY'),
+                          ('numpy','scipy_compatibility'), 
+                          ('numpy','site.cfg.example'))
+
+    config.get_version('numpy/version.py') # sets config.version
+
+    return config
+
+def setup_package():
+
+    from numpy.distutils.core import setup
+
+    old_path = os.getcwd()
+    local_path = os.path.dirname(os.path.abspath(sys.argv[0]))
+    os.chdir(local_path)
+    sys.path.insert(0,local_path)
+
+    try:
+        setup(
+            name = 'numpy',
+            maintainer = "NumPy Developers",
+            maintainer_email = "numpy-discussion@lists.sourceforge.net",
+            description = DOCLINES[0],
+            long_description = "\n".join(DOCLINES[2:]),
+            url = "http://numeric.scipy.org",
+            download_url = "http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103",
+            license = 'BSD',
+            classifiers=filter(None, CLASSIFIERS.split('\n')),
+            author = "Travis E. Oliphant, et.al.",
+            author_email = "oliphant@ee.byu.edu",
+            platforms = ["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"],            
+            configuration=configuration )
+    finally:
+        del sys.path[0]
+        os.chdir(old_path)
+    return
+
+if __name__ == '__main__':
+    setup_package()


Property changes on: branches/numpy.scons/setupscons.py
___________________________________________________________________
Name: svn:executable
   + *



More information about the Numpy-svn mailing list