From numpy-svn at scipy.org Thu Nov 1 05:53:15 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 1 Nov 2007 04:53:15 -0500 (CDT) Subject: [Numpy-svn] r4368 - in branches/numpy.scons/numpy: distutils distutils/scons/checkers distutils/scons/doc linalg Message-ID: <20071101095315.8282D39C31E@new.scipy.org> Author: cdavid Date: 2007-11-01 04:52:50 -0500 (Thu, 01 Nov 2007) New Revision: 4368 Modified: branches/numpy.scons/numpy/distutils/misc_util.py branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py branches/numpy.scons/numpy/distutils/scons/checkers/support.py branches/numpy.scons/numpy/distutils/scons/doc/TODO branches/numpy.scons/numpy/distutils/system_info.py branches/numpy.scons/numpy/linalg/SConstruct branches/numpy.scons/numpy/linalg/setupscons.py Log: basic show_config implementation Modified: branches/numpy.scons/numpy/distutils/misc_util.py =================================================================== --- branches/numpy.scons/numpy/distutils/misc_util.py 2007-10-31 23:21:39 UTC (rev 4367) +++ branches/numpy.scons/numpy/distutils/misc_util.py 2007-11-01 09:52:50 UTC (rev 4368) @@ -1517,7 +1517,7 @@ f = open(target, 'w') f.write('# this file is generated by %s\n' % (os.path.abspath(sys.argv[0]))) f.write('# it contains system_info results at the time of building this package.\n') - f.write('__all__ = ["get_info","show"]\n\n') + f.write('__all__ = ["show"]\n\n') confdir = get_scons_configres_dir() confilename = get_scons_configres_filename() for root, dirs, files in os.walk(confdir): @@ -1532,27 +1532,19 @@ d[pkg_name] = config_mod.config finally: fid.close() - for k, i in d.items(): - f.write('%s=%r\n' % (k, i)) + # d is a dictionary whose keys are package names, and values the + # corresponding configuration. Each configuration is itself a dictionary + # (lib : libinfo) + f.write('_config = %s\n' % d) f.write(r''' -def get_info(name): - g = globals() - return g.get(name, g.get(name + "_info", {})) - def show(): - for name,info_dict in globals().items(): - if name[0] == "_" or type(info_dict) is not type({}): continue - print name + ":" - if not info_dict: - print " not available" - for k,v in info_dict.items(): - v = str(v) - if k == "sources" and len(v) > 200: - v = v[:60] + " ...\n... " + v[-60:] - print " %s = %s" % (k,v) - print + for pkg, config in _config.items(): + print "package %s configuration:" % pkg + for lib, libc in config.items(): + print ' %s' % lib + for line in libc.split('\n'): + print '\t%s' % line ''') - f.close() return target Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-10-31 23:21:39 UTC (rev 4367) +++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-01 09:52:50 UTC (rev 4368) @@ -114,7 +114,8 @@ fdict['LIBPATH'].extend(context.env['LIBPATH']) st = check_include_and_run(context, 'LAPACK (MKL)', [], [], test_src, fdict['LIBS'], fdict['LIBPATH'], [], [], autoadd = 1) - add_info(env, 'lapack', opts) + if st: + add_info(env, 'lapack', opts) return st # Check ATLAS @@ -128,8 +129,10 @@ fdict['LIBPATH'].extend(context.env['LIBPATH']) st = check_include_and_run(context, 'LAPACK (ATLAS)', [], [], test_src, fdict['LIBS'], fdict['LIBPATH'], [], [], autoadd = 1) - add_info(env, 'lapack', opts) - # XXX: Check complete LAPACK or not + if st: + add_info(env, 'lapack', opts) + # XXX: Check complete LAPACK or not. (Checking for not + # implemented lapack symbols ?) return st return 0 Modified: branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-10-31 23:21:39 UTC (rev 4367) +++ branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-11-01 09:52:50 UTC (rev 4368) @@ -8,7 +8,9 @@ # Generally, you don't use those directly: they are used in 'meta' checkers, # such as BLAS, CBLAS, LAPACK checkers. import re +from os.path import join as pjoin +from numpy.distutils.system_info import default_lib_dirs from numpy.distutils.scons.libinfo import get_config_from_section, get_config from numpy.distutils.scons.testcode_snippets import cblas_sgemm as cblas_src, \ c_sgemm as sunperf_src, lapack_sgesv @@ -51,7 +53,7 @@ if not st: context.Result('Failed (could not check header(s) : check config.log '\ 'in %s for more details)' % env['build_dir']) - return st, ConfigRes(opts, found) + return st, ConfigRes(name, opts, found) # Check whether the library is available (CheckLib-like checker) saved = save_and_set(env, opts) @@ -68,7 +70,7 @@ if not st: context.Result('Failed (could not check symbol %s : check config.log '\ 'in %s for more details))' % (sym, env['build_dir'])) - return st, ConfigRes(opts, found) + return st, ConfigRes(name, opts, found) context.Result(st) @@ -82,9 +84,9 @@ version = 'Unknown (checking version failed)' else: version = 'Unkown (not implemented)' - cfgres = ConfigRes(opts, found, version) + cfgres = ConfigRes(name, opts, found, version) else: - cfgres = ConfigRes(opts, found, version = 'Not checked') + cfgres = ConfigRes(name, opts, found, version = 'Not checked') return st, cfgres @@ -160,7 +162,9 @@ """Check whether ATLAS is usable in C.""" name = 'ATLAS' section = 'atlas' - defopts = ConfigOpts(libs = ['atlas']) + defopts = ConfigOpts(libs = ['atlas'], + libpath = [pjoin(i, 'atlas') for i in + default_lib_dirs]) headers = ['atlas_enum.h'] funcs = ['ATL_sgemm'] Modified: branches/numpy.scons/numpy/distutils/scons/checkers/support.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/support.py 2007-10-31 23:21:39 UTC (rev 4367) +++ branches/numpy.scons/numpy/distutils/scons/checkers/support.py 2007-11-01 09:52:50 UTC (rev 4368) @@ -109,7 +109,8 @@ return '\n'.join(msg) class ConfigRes(): - def __init__(self, cfgopts, origin, version = None): + def __init__(self, name, cfgopts, origin, version = None): + self.name = name self.data = cfgopts.data self.origin = origin self.version = version @@ -124,13 +125,14 @@ return bool(self.origin) def __repr__(self): + msg = ['Using %s' % self.name] if self.is_customized(): - msg = ['Customized items site.cfg:'] + msg += [ 'Customized items site.cfg:'] else: - msg = ['Using default configuration:'] + msg += [' Using default configuration:'] - msg += ['\t%s : %s' % (k, i) for k, i in self.data.items() if len(i) > 0] - msg += ['Version is : %s' % self.version] + msg += [' %s : %s' % (k, i) for k, i in self.data.items() if len(i) > 0] + msg += [' Version is : %s' % self.version] return '\n'.join(msg) def __str__(self): Modified: branches/numpy.scons/numpy/distutils/scons/doc/TODO =================================================================== --- branches/numpy.scons/numpy/distutils/scons/doc/TODO 2007-10-31 23:21:39 UTC (rev 4367) +++ branches/numpy.scons/numpy/distutils/scons/doc/TODO 2007-11-01 09:52:50 UTC (rev 4368) @@ -1,8 +1,4 @@ Before second alpha (in order of priority): - - show_config implementation : show libs, libpath and cpppath for each - configuration (~ 2-3 hours) - - BLAS, CBLAS and LAPACK meta checkers: overridable, support at least - ATLAS, Accelerate, and MKL (~ 2-3 hours) - Basic warn, debug and optim flags : at least gcc+linux, mingw, VS, gcc+mac os x, and posix ? (~ 2 hours). @@ -12,9 +8,6 @@ Design questions: - improve BrokenMathlib and Mathlib in core, and make them available to everyone - - How to build meta-checkers from simple checkers (for example, BLAS with - MKL, ATLAS, Sunperf, etc...) ? - - How to gather informations from checkers for config info ? - How to provide a usable framework for checks (+ doc) - overriding compilation flags: env variables, site.cfg ? (autotools convention ?) Modified: branches/numpy.scons/numpy/distutils/system_info.py =================================================================== --- branches/numpy.scons/numpy/distutils/system_info.py 2007-10-31 23:21:39 UTC (rev 4367) +++ branches/numpy.scons/numpy/distutils/system_info.py 2007-11-01 09:52:50 UTC (rev 4368) @@ -853,6 +853,7 @@ def get_paths(self, section, key): pre_dirs = system_info.get_paths(self, section, key) + print "pre dirs is %s" % pre_dirs dirs = [] for d in pre_dirs: dirs.extend(self.combine_paths(d,['atlas*','ATLAS*', Modified: branches/numpy.scons/numpy/linalg/SConstruct =================================================================== --- branches/numpy.scons/numpy/linalg/SConstruct 2007-10-31 23:21:39 UTC (rev 4367) +++ branches/numpy.scons/numpy/linalg/SConstruct 2007-11-01 09:52:50 UTC (rev 4368) @@ -3,6 +3,7 @@ from numpy.distutils.misc_util import get_numpy_include_dirs, get_mathlibs from numpy.distutils.scons import GetNumpyEnvironment, scons_get_paths from numpy.distutils.scons import CheckLAPACK +from numpy.distutils.scons.configuration import write_info env = GetNumpyEnvironment(ARGUMENTS) env.Append(CPPPATH = scons_get_paths(env['include_bootstrap'])) @@ -22,6 +23,7 @@ env.AppendUnique(LIBS = mlib) config.Finish() +write_info(env) sources = ['lapack_litemodule.c'] if not use_lapack: Modified: branches/numpy.scons/numpy/linalg/setupscons.py =================================================================== --- branches/numpy.scons/numpy/linalg/setupscons.py 2007-10-31 23:21:39 UTC (rev 4367) +++ branches/numpy.scons/numpy/linalg/setupscons.py 2007-11-01 09:52:50 UTC (rev 4368) @@ -10,7 +10,8 @@ source_files = ['lapack_litemodule.c', 'zlapack_lite.c', 'dlapack_lite.c', 'blas_lite.c', 'dlamch.c', - 'f2c_lite.c','f2c.h']) + 'f2c_lite.c','f2c.h'], + post_hook = config.add_configres) return config From numpy-svn at scipy.org Thu Nov 1 06:06:38 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 1 Nov 2007 05:06:38 -0500 (CDT) Subject: [Numpy-svn] r4369 - in branches/numpy.scons/numpy: distutils/scons scons_fake/hook Message-ID: <20071101100638.93DC839C2EB@new.scipy.org> Author: cdavid Date: 2007-11-01 05:06:31 -0500 (Thu, 01 Nov 2007) New Revision: 4369 Modified: branches/numpy.scons/numpy/distutils/scons/configuration.py branches/numpy.scons/numpy/scons_fake/hook/setup.py Log: Remove some debug prints Modified: branches/numpy.scons/numpy/distutils/scons/configuration.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/configuration.py 2007-11-01 09:52:50 UTC (rev 4368) +++ branches/numpy.scons/numpy/distutils/scons/configuration.py 2007-11-01 10:06:31 UTC (rev 4369) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Mon Oct 29 06:00 PM 2007 J +# Last Change: Thu Nov 01 06:00 PM 2007 J import os def add_info(env, name, opt): @@ -7,8 +7,6 @@ cfg[name] = str(opt) def write_info(env): - print "File is %s" % env['NUMPY_PKG_CONFIG_FILE'] - print "Info is %s" % env['NUMPY_PKG_CONFIG'] dir = os.path.dirname(env['NUMPY_PKG_CONFIG_FILE']) if not os.path.exists(dir): os.makedirs(dir) Modified: branches/numpy.scons/numpy/scons_fake/hook/setup.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/hook/setup.py 2007-11-01 09:52:50 UTC (rev 4368) +++ branches/numpy.scons/numpy/scons_fake/hook/setup.py 2007-11-01 10:06:31 UTC (rev 4369) @@ -6,7 +6,7 @@ config = Configuration('hook',parent_package,top_path) def foo(): - print "foo" + print "scons hook test: foo" config.add_sconscript('SConstruct', post_hook = foo) return config From numpy-svn at scipy.org Thu Nov 1 06:37:18 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 1 Nov 2007 05:37:18 -0500 (CDT) Subject: [Numpy-svn] r4370 - branches/numpy.scons/numpy/distutils/command Message-ID: <20071101103718.270A539C011@new.scipy.org> Author: cdavid Date: 2007-11-01 05:37:14 -0500 (Thu, 01 Nov 2007) New Revision: 4370 Modified: branches/numpy.scons/numpy/distutils/command/scons.py Log: Clean up a bit the code for distutils scons command Modified: branches/numpy.scons/numpy/distutils/command/scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/scons.py 2007-11-01 10:06:31 UTC (rev 4369) +++ branches/numpy.scons/numpy/distutils/command/scons.py 2007-11-01 10:37:14 UTC (rev 4370) @@ -10,6 +10,7 @@ from numpy.distutils.exec_command import find_executable from numpy.distutils.misc_util import get_scons_build_dir from numpy.distutils import log +from numpy.distutils.misc_util import get_numpy_include_dirs def get_scons_local_path(): """This returns the full path where scons.py for scons-local is located.""" @@ -123,22 +124,27 @@ # release. # XXX: add an option to the scons command for configuration (auto/force/cache). description = "Scons builder" - user_options = old_build_ext.user_options + [ - ('jobs=', None, - "specify number of worker threads when executing scons"),] + user_options = old_build_ext.user_options + \ + [('jobs=', None, + "specify number of worker threads when executing scons"), + ('silent=', None, 'specify whether scons output should be silent '\ + '(1), super silent (2) or not (0, default)')] def initialize_options(self): old_build_ext.initialize_options(self) self.jobs = None + self.silent = 0 def finalize_options(self): old_build_ext.finalize_options(self) if self.distribution.has_scons_scripts(): #print "Got it: scons scripts are %s" % self.distribution.scons_scripts self.sconscripts = self.distribution.get_scons_scripts() + self.pre_hooks = self.distribution.get_scons_pre_hooks() self.post_hooks = self.distribution.get_scons_post_hooks() else: self.sconscripts = [] + self.pre_hooks = [] self.post_hooks = [] # Try to get the same compiler than the ones used by distutils: this is @@ -181,28 +187,35 @@ scons_exec = get_python_exec_invoc() scons_exec += ' ' + protect_path(pjoin(get_scons_local_path(), 'scons.py')) - # XXX handle pre hoook - for sconscript, post_hook in zip(self.sconscripts, self.post_hooks): - # XXX: This is inefficient... (use join instead) - from numpy.distutils.misc_util import get_numpy_include_dirs - cmd = scons_exec + " -f " + sconscript + ' -I. ' + for sconscript, pre_hook, post_hook in zip(self.sconscripts, + self.pre_hooks, self.post_hooks): + if pre_hook: + pre_hook() + + cmd = [scons_exec, "-f", sconscript, '-I.'] if self.jobs: - cmd += " --jobs=%d " % int(self.jobs) - cmd += ' src_dir="%s" ' % pdirname(sconscript) - cmd += ' distutils_libdir=%s ' % protect_path(pjoin(self.build_lib, - pdirname(sconscript))) - cmd += ' cc_opt=%s ' % dist2sconscc(self.compiler) - cmd += ' cc_opt_path=%s ' % protect_path(get_tool_path(self.compiler)) + cmd.append(" --jobs=%d" % int(self.jobs)) + cmd.append('src_dir="%s"' % pdirname(sconscript)) + cmd.append('distutils_libdir=%s' % protect_path(pjoin(self.build_lib, + pdirname(sconscript)))) + cmd.append('cc_opt=%s' % dist2sconscc(self.compiler)) + cmd.append('cc_opt_path=%s' % protect_path(get_tool_path(self.compiler))) - cmd += ' f77_opt=%s ' % dist2sconsfc(self.fcompiler) - cmd += ' f77_opt_path=%s ' % protect_path(get_f77_tool_path(self.fcompiler)) + cmd.append('f77_opt=%s' % dist2sconsfc(self.fcompiler)) + cmd.append('f77_opt_path=%s' % protect_path(get_f77_tool_path(self.fcompiler))) - cmd += ' include_bootstrap=%s ' % dirl_to_str(get_numpy_include_dirs()) - log.info("Executing scons command: %s ", cmd) - st = os.system(cmd) + cmd.append('include_bootstrap=%s' % dirl_to_str(get_numpy_include_dirs())) + if self.silent: + if int(self.silent) == 1: + cmd.append('-Q') + elif int(self.silent) == 2: + cmd.append('-s') + cmdstr = ' '.join(cmd) + log.info("Executing scons command: %s ", cmdstr) + st = os.system(cmdstr) if st: print "status is %d" % st raise DistutilsExecError("Error while executing scons command "\ - "%s (see above)" % cmd) + "%s (see above)" % cmdstr) if post_hook: post_hook() From numpy-svn at scipy.org Thu Nov 1 06:38:26 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 1 Nov 2007 05:38:26 -0500 (CDT) Subject: [Numpy-svn] r4371 - branches/numpy.scons/numpy/scons_fake/checkers Message-ID: <20071101103826.E011E39C011@new.scipy.org> Author: cdavid Date: 2007-11-01 05:38:22 -0500 (Thu, 01 Nov 2007) New Revision: 4371 Modified: branches/numpy.scons/numpy/scons_fake/checkers/SConstruct Log: Always run all the checkers for buildbot test Modified: branches/numpy.scons/numpy/scons_fake/checkers/SConstruct =================================================================== --- branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-11-01 10:37:14 UTC (rev 4370) +++ branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-11-01 10:38:22 UTC (rev 4371) @@ -18,6 +18,7 @@ 'CheckAccelerate' : CheckAccelerate, 'CheckSunperf' : CheckSunperf}) +do_check = 1 if do_check: st, opts = config.CheckATLAS(autoadd = 0) if st: From numpy-svn at scipy.org Thu Nov 1 06:45:21 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 1 Nov 2007 05:45:21 -0500 (CDT) Subject: [Numpy-svn] r4372 - branches/numpy.scons/numpy/distutils/scons/doc Message-ID: <20071101104521.AEE5139C32D@new.scipy.org> Author: cdavid Date: 2007-11-01 05:45:17 -0500 (Thu, 01 Nov 2007) New Revision: 4372 Added: branches/numpy.scons/numpy/distutils/scons/doc/FORTRAN Log: Add fortran doc (macro to define for f2py) Added: branches/numpy.scons/numpy/distutils/scons/doc/FORTRAN =================================================================== --- branches/numpy.scons/numpy/distutils/scons/doc/FORTRAN 2007-11-01 10:38:22 UTC (rev 4371) +++ branches/numpy.scons/numpy/distutils/scons/doc/FORTRAN 2007-11-01 10:45:17 UTC (rev 4372) @@ -0,0 +1,34 @@ +#if defined(PREPEND_FORTRAN) + #if defined(NO_APPEND_FORTRAN) + #if defined(UPPERCASE_FORTRAN) + #define F_FUNC(f,F) _##F + #else + #define F_FUNC(f,F) _##f + #endif + #else + #if defined(UPPERCASE_FORTRAN) + #define F_FUNC(f,F) _##F##_ + #else + #define F_FUNC(f,F) _##f##_ + #endif + #endif +#else + #if defined(NO_APPEND_FORTRAN) + #if defined(UPPERCASE_FORTRAN) + #define F_FUNC(f,F) F + #else + #define F_FUNC(f,F) f + #endif + #else + #if defined(UPPERCASE_FORTRAN) + #define F_FUNC(f,F) F##_ + #else + #define F_FUNC(f,F) f##_ + #endif + #endif +#endif +#if defined(UNDERSCORE_G77) + #define F_FUNC_US(f,F) F_FUNC(f##_,F##_) +#else + #define F_FUNC_US(f,F) F_FUNC(f,F) +#endif From numpy-svn at scipy.org Fri Nov 2 03:56:12 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 2 Nov 2007 02:56:12 -0500 (CDT) Subject: [Numpy-svn] r4373 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071102075612.7D61139C054@new.scipy.org> Author: cdavid Date: 2007-11-02 02:56:03 -0500 (Fri, 02 Nov 2007) New Revision: 4373 Modified: branches/numpy.scons/numpy/distutils/scons/default.py branches/numpy.scons/numpy/distutils/scons/numpyenv.py Log: Start working on compiler flags customization Modified: branches/numpy.scons/numpy/distutils/scons/default.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/default.py 2007-11-01 10:45:17 UTC (rev 4372) +++ branches/numpy.scons/numpy/distutils/scons/default.py 2007-11-02 07:56:03 UTC (rev 4373) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Thu Oct 18 05:00 PM 2007 J +# Last Change: Fri Nov 02 04:00 PM 2007 J # This is a copy of scons/Tools/__init__.py, because scons does not offer any # public api for this @@ -81,3 +81,39 @@ 'tar', 'tex', 'yacc', 'zip'] return linkers, c_compilers, cxx_compilers, assemblers, fortran_compilers, \ ars, other_tools + +# Handling compiler configuration: only flags which change how to build object +# files. Nothing related to linking, search path, etc... should be given here. +# Basically, limit yourself to optimization/debug/warning flags. +class CompilerConfig: + def __init__(self, optim = None, warn = None, debug = None, debug_symbol = None): + # XXX: several level of optimizations ? + self.optim = optim + # XXX: several level of warnings ? + self.warn = warn + # To enable putting debugging info in binaries + self.debug_symbol = debug_symbol + # To enable friendly debugging + self.debug = debug + + def get_optims(self, level): + pass + + def get_warn(self, level): + pass + + def get_flags_dict(self): + return {'NUMPY_OPTIM_CFLAGS' : self.optim, + 'NUMPY_WARN_CFLAGS' : self.warn, + 'NUMPY_DEBUG_CFLAGS' : self.debug, + 'NUMPY_DEBUG_SYMBOL_CFLAGS' : self.debug_symbol} + +def get_cc_config(name): + if name == 'gcc': + cfg = CompilerConfig(optim = ['-O2', '-fno-strict-aliasing', '-DNDEBUG'], + warn = ['-Wall', '-Wstrict-prototypes'], + debug_symbol = ['-g']) + else: + cfg = CompilerConfig() + + return cfg Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-11-01 10:45:17 UTC (rev 4372) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-11-02 07:56:03 UTC (rev 4373) @@ -8,7 +8,7 @@ from numpy.distutils.misc_util import get_scons_build_dir, get_scons_configres_dir,\ get_scons_configres_filename -from default import tool_list +from default import tool_list, get_cc_config from custom_builders import NumpySharedLibrary, NumpyCtypes, NumpyPythonExtension from libinfo import get_config from extension_scons import PythonExtension @@ -72,7 +72,18 @@ return opts +def customize_cc(name, env): + """Customize env options related to the given tool.""" + cfg = get_cc_config(name) + env.AppendUnique(**cfg.get_flags_dict()) + def GetNumpyEnvironment(args): + env = _GetNumpyEnvironment(args) + env.AppendUnique(CFLAGS = env['NUMPY_WARN_CFLAGS'] + env['NUMPY_OPTIM_CFLAGS'] +\ + env['NUMPY_DEBUG_SYMBOL_CFLAGS']) + return env + +def _GetNumpyEnvironment(args): """Call this with args = ARGUMENTS.""" from SCons.Environment import Environment from SCons.Tool import Tool, FindTool, FindAllTools @@ -116,6 +127,7 @@ t = Tool(env['cc_opt'], topdir = os.path.split(env['cc_opt_path'])[0]) t(env) + customize_cc(t.name, env) else: if is_cc_suncc(pjoin(env['cc_opt_path'], env['cc_opt'])): env['cc_opt'] = 'suncc' @@ -123,6 +135,7 @@ # PATH ? (may not work on windows). t = Tool(env['cc_opt']) t(env) + customize_cc(t.name, env) if sys.platform == 'win32': env['ENV']['PATH'] += ';%s' % env['cc_opt_path'] else: @@ -134,6 +147,7 @@ else: t = Tool(FindTool(DEF_C_COMPILERS)) t(env) + customize_cc(t.name, env) # F77 compiler if len(env['f77_opt']) > 0: @@ -197,10 +211,6 @@ except KeyError: pass - # XXX: think about how to handle optimizations per compiler - if env['CC'] == 'gcc': - env.Append(CCFLAGS = "-Wall -Wstrict-prototypes -fno-strict-aliasing -O3 -g") - # Adding custom builder env['BUILDERS']['NumpySharedLibrary'] = NumpySharedLibrary env['BUILDERS']['NumpyCtypes'] = NumpyCtypes From numpy-svn at scipy.org Fri Nov 2 04:31:58 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 2 Nov 2007 03:31:58 -0500 (CDT) Subject: [Numpy-svn] r4374 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071102083158.D21C439C092@new.scipy.org> Author: cdavid Date: 2007-11-02 03:31:54 -0500 (Fri, 02 Nov 2007) New Revision: 4374 Modified: branches/numpy.scons/numpy/distutils/scons/default.py branches/numpy.scons/numpy/distutils/scons/numpyenv.py Log: Add basic support for MS compiler (untested) + thread option Modified: branches/numpy.scons/numpy/distutils/scons/default.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/default.py 2007-11-02 07:56:03 UTC (rev 4373) +++ branches/numpy.scons/numpy/distutils/scons/default.py 2007-11-02 08:31:54 UTC (rev 4374) @@ -1,5 +1,6 @@ #! /usr/bin/env python -# Last Change: Fri Nov 02 04:00 PM 2007 J +# Last Change: Fri Nov 02 05:00 PM 2007 J +import sys # This is a copy of scons/Tools/__init__.py, because scons does not offer any # public api for this @@ -85,8 +86,11 @@ # Handling compiler configuration: only flags which change how to build object # files. Nothing related to linking, search path, etc... should be given here. # Basically, limit yourself to optimization/debug/warning flags. + +# XXX: customization from site.cfg or other ? class CompilerConfig: - def __init__(self, optim = None, warn = None, debug = None, debug_symbol = None): + def __init__(self, optim = None, warn = None, debug = None, debug_symbol = + None, thread = None): # XXX: several level of optimizations ? self.optim = optim # XXX: several level of warnings ? @@ -95,24 +99,37 @@ self.debug_symbol = debug_symbol # To enable friendly debugging self.debug = debug + # XXX + self.thread = thread - def get_optims(self, level): - pass - - def get_warn(self, level): - pass - def get_flags_dict(self): return {'NUMPY_OPTIM_CFLAGS' : self.optim, 'NUMPY_WARN_CFLAGS' : self.warn, + 'NUMPY_THREAD_CFLAGS' : self.thread, 'NUMPY_DEBUG_CFLAGS' : self.debug, 'NUMPY_DEBUG_SYMBOL_CFLAGS' : self.debug_symbol} +# It seems that scons consider any option with space in it as a multi option, +# which breaks command line options. So just don't put space. def get_cc_config(name): if name == 'gcc': cfg = CompilerConfig(optim = ['-O2', '-fno-strict-aliasing', '-DNDEBUG'], warn = ['-Wall', '-Wstrict-prototypes'], - debug_symbol = ['-g']) + debug_symbol = ['-g'], + thread = ['-pthread']) + elif name == 'intelc': + if sys.platform[:5] == 'win32': + raise NotImplementedError('FIXME: intel compiler on windows not '\ + ' supported yet') + + cfg = CompilerConfig(optim = ['-O2', '-fno-strict-aliasing', '-DNDEBUG'], + warn = ['-Wall', '-Wstrict-prototypes'], + debug_symbol = ['-g'], + thread = ['-pthread']) + elif name == 'msvc': + cfg = CompilerConfig(optim = ['/Ox', '/DNDEBUG'], + warn = ['/W3', '/Wall'], + thread = ['/MD', '/GX']) else: cfg = CompilerConfig() Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-11-02 07:56:03 UTC (rev 4373) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-11-02 08:31:54 UTC (rev 4374) @@ -80,7 +80,8 @@ def GetNumpyEnvironment(args): env = _GetNumpyEnvironment(args) env.AppendUnique(CFLAGS = env['NUMPY_WARN_CFLAGS'] + env['NUMPY_OPTIM_CFLAGS'] +\ - env['NUMPY_DEBUG_SYMBOL_CFLAGS']) + env['NUMPY_DEBUG_SYMBOL_CFLAGS'] +\ + env['NUMPY_THREAD_CFLAGS']) return env def _GetNumpyEnvironment(args): From numpy-svn at scipy.org Fri Nov 2 04:34:44 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 2 Nov 2007 03:34:44 -0500 (CDT) Subject: [Numpy-svn] r4375 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071102083444.AB1C139C0C7@new.scipy.org> Author: cdavid Date: 2007-11-02 03:34:41 -0500 (Fri, 02 Nov 2007) New Revision: 4375 Modified: branches/numpy.scons/numpy/distutils/scons/fortran_scons.py Log: Return failure for F77 mangler check when dummy main check fails. Modified: branches/numpy.scons/numpy/distutils/scons/fortran_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-11-02 08:31:54 UTC (rev 4374) +++ branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-11-02 08:34:41 UTC (rev 4375) @@ -1,4 +1,4 @@ -# Last Change: Mon Oct 29 03:00 PM 2007 J +# Last Change: Fri Nov 02 05:00 PM 2007 J import os import sys import string @@ -227,7 +227,9 @@ name, returns the F77 name as seen by the linker.""" env = context.env if not env.has_key('F77_DUMMY_MAIN'): - CheckF77DummyMain(context) + st = CheckF77DummyMain(context) + if st == 0: + return st context.Message('Checking %s name mangling - ' % env['F77']) res, mangler, u, du, c = _CheckFMangling(context, 'F77', env['F77_DUMMY_MAIN'], '.f') if res: From numpy-svn at scipy.org Fri Nov 2 06:49:57 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 2 Nov 2007 05:49:57 -0500 (CDT) Subject: [Numpy-svn] r4376 - in branches/numpy.scons/numpy: core distutils/scons Message-ID: <20071102104957.40C2E39C27A@new.scipy.org> Author: cdavid Date: 2007-11-02 05:49:49 -0500 (Fri, 02 Nov 2007) New Revision: 4376 Modified: branches/numpy.scons/numpy/core/SConstruct branches/numpy.scons/numpy/distutils/scons/default.py branches/numpy.scons/numpy/distutils/scons/numpyenv.py Log: More info for VS support in scons Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-11-02 08:34:41 UTC (rev 4375) +++ branches/numpy.scons/numpy/core/SConstruct 2007-11-02 10:49:49 UTC (rev 4376) @@ -1,4 +1,4 @@ -# Last Change: Tue Oct 30 07:00 PM 2007 J +# Last Change: Fri Nov 02 06:00 PM 2007 J # vim:syntax=python import os import sys @@ -55,8 +55,8 @@ check_type('float') check_type('double') check_type('long double') -check_type('Py_intptr_t', include = r"#include \n") -check_type('PY_LONG_LONG', include = r"#include \n") +check_type('Py_intptr_t', include = "#include \n") +check_type('PY_LONG_LONG', include = "#include \n") # TODO: check python extension can be built (in root or here ?) Modified: branches/numpy.scons/numpy/distutils/scons/default.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/default.py 2007-11-02 08:34:41 UTC (rev 4375) +++ branches/numpy.scons/numpy/distutils/scons/default.py 2007-11-02 10:49:49 UTC (rev 4376) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Fri Nov 02 05:00 PM 2007 J +# Last Change: Fri Nov 02 06:00 PM 2007 J import sys # This is a copy of scons/Tools/__init__.py, because scons does not offer any @@ -90,7 +90,7 @@ # XXX: customization from site.cfg or other ? class CompilerConfig: def __init__(self, optim = None, warn = None, debug = None, debug_symbol = - None, thread = None): + None, thread = None, extra = None): # XXX: several level of optimizations ? self.optim = optim # XXX: several level of warnings ? @@ -101,13 +101,20 @@ self.debug = debug # XXX self.thread = thread + # XXX + self.extra = extra def get_flags_dict(self): - return {'NUMPY_OPTIM_CFLAGS' : self.optim, + d = {'NUMPY_OPTIM_CFLAGS' : self.optim, 'NUMPY_WARN_CFLAGS' : self.warn, 'NUMPY_THREAD_CFLAGS' : self.thread, + 'NUMPY_EXTRA_CFLAGS' : self.debug, 'NUMPY_DEBUG_CFLAGS' : self.debug, 'NUMPY_DEBUG_SYMBOL_CFLAGS' : self.debug_symbol} + for k, v in d.items(): + if v is None: + d[k] = [] + return d # It seems that scons consider any option with space in it as a multi option, # which breaks command line options. So just don't put space. @@ -116,7 +123,7 @@ cfg = CompilerConfig(optim = ['-O2', '-fno-strict-aliasing', '-DNDEBUG'], warn = ['-Wall', '-Wstrict-prototypes'], debug_symbol = ['-g'], - thread = ['-pthread']) + thread = []) elif name == 'intelc': if sys.platform[:5] == 'win32': raise NotImplementedError('FIXME: intel compiler on windows not '\ @@ -127,9 +134,32 @@ debug_symbol = ['-g'], thread = ['-pthread']) elif name == 'msvc': + # XXX: distutils part of customization: + # if self.__arch == "Intel": + # self.compile_options = [ '/nologo', '/Ox', '/MD', '/W3', '/GX' , '/DNDEBUG'] + # self.compile_options_debug = ['/nologo', '/Od', '/MDd', '/W3', '/GX', '/Z7', '/D_DEBUG'] + # else: + # # Win64 + # self.compile_options = [ '/nologo', '/Ox', '/MD', '/W3', '/GS-' , + # '/DNDEBUG'] + # self.compile_options_debug = ['/nologo', '/Od', '/MDd', '/W3', '/GS-', + # '/Z7', '/D_DEBUG'] + # + # self.ldflags_shared = ['/DLL', '/nologo', '/INCREMENTAL:NO'] + # if self.__version >= 7: + # self.ldflags_shared_debug = [ + # '/DLL', '/nologo', '/INCREMENTAL:no', '/DEBUG' + # ] + # else: + # self.ldflags_shared_debug = [ + # '/DLL', '/nologo', '/INCREMENTAL:no', '/pdb:None', '/DEBUG' + # ] + # self.ldflags_static = [ '/nologo'] + cfg = CompilerConfig(optim = ['/Ox', '/DNDEBUG'], warn = ['/W3', '/Wall'], - thread = ['/MD', '/GX']) + thread = ['/MD', '/GX'], + extra = ['/nologo']) else: cfg = CompilerConfig() Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-11-02 08:34:41 UTC (rev 4375) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-11-02 10:49:49 UTC (rev 4376) @@ -81,6 +81,7 @@ env = _GetNumpyEnvironment(args) env.AppendUnique(CFLAGS = env['NUMPY_WARN_CFLAGS'] + env['NUMPY_OPTIM_CFLAGS'] +\ env['NUMPY_DEBUG_SYMBOL_CFLAGS'] +\ + env['NUMPY_EXTRA_CFLAGS'] +\ env['NUMPY_THREAD_CFLAGS']) return env @@ -224,6 +225,7 @@ else: BuildDir(env['build_dir'], '.') + env['CC'] = 'tcc' # Generate help (if calling scons directly during debugging, this could be useful) Help(opts.GenerateHelpText(env)) From numpy-svn at scipy.org Sat Nov 3 02:02:57 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 3 Nov 2007 01:02:57 -0500 (CDT) Subject: [Numpy-svn] r4377 - trunk/numpy/lib Message-ID: <20071103060257.5F41539C124@new.scipy.org> Author: cookedm Date: 2007-11-03 01:02:55 -0500 (Sat, 03 Nov 2007) New Revision: 4377 Modified: trunk/numpy/lib/function_base.py Log: Expand linspace docstring. Modified: trunk/numpy/lib/function_base.py =================================================================== --- trunk/numpy/lib/function_base.py 2007-11-02 10:49:49 UTC (rev 4376) +++ trunk/numpy/lib/function_base.py 2007-11-03 06:02:55 UTC (rev 4377) @@ -35,7 +35,35 @@ Return num evenly spaced samples from start to stop. If endpoint is True, the last sample is stop. If retstep is - True then return the step value used. + True then return (seq, step_value), where step_value used. + + :Parameters: + start : {float} + The value the sequence starts at. + stop : {float} + The value the sequence stops at. If ``endpoint`` is false, then + this is not included in the sequence. Otherwise it is + guaranteed to be the last value. + num : {integer} + Number of samples to generate. Default is 50. + endpoint : {boolean} + If true, ``stop`` is the last sample. Otherwise, it is not + included. Default is true. + retstep : {boolean} + If true, return ``(samples, step)``, where ``step`` is the + spacing used in generating the samples. + + :Returns: + samples : {array} + ``num`` equally spaced samples from the range [start, stop] + or [start, stop). + step : {float} (Only if ``retstep`` is true) + Size of spacing between samples. + + :See Also: + `arange` : Similiar to linspace, however, when used with + a float endpoint, that endpoint may or may not be included. + `logspace` """ num = int(num) if num <= 0: From numpy-svn at scipy.org Sat Nov 3 02:28:15 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 3 Nov 2007 01:28:15 -0500 (CDT) Subject: [Numpy-svn] r4378 - trunk/numpy/distutils/command Message-ID: <20071103062815.E4F7A39C03E@new.scipy.org> Author: cookedm Date: 2007-11-03 01:28:14 -0500 (Sat, 03 Nov 2007) New Revision: 4378 Modified: trunk/numpy/distutils/command/build_src.py Log: Refactor Pyrex source building into a separate method in build_src.py Modified: trunk/numpy/distutils/command/build_src.py =================================================================== --- trunk/numpy/distutils/command/build_src.py 2007-11-03 06:02:55 UTC (rev 4377) +++ trunk/numpy/distutils/command/build_src.py 2007-11-03 06:28:14 UTC (rev 4378) @@ -1,4 +1,4 @@ -""" Build swig, f2py, weave, sources. +""" Build swig, f2py, pyrex sources. """ import os @@ -376,35 +376,43 @@ for source in sources: (base, ext) = os.path.splitext(source) if ext == '.pyx': - if self.inplace or not have_pyrex: - target_dir = os.path.dirname(base) - else: - target_dir = appendpath(self.build_src, os.path.dirname(base)) - target_file = os.path.join(target_dir, ext_name + '.c') - depends = [source] + extension.depends - if (self.force or newer_group(depends, target_file, 'newer')): - if have_pyrex: - log.info("pyrexc:> %s" % (target_file)) - self.mkpath(target_dir) - options = Pyrex.Compiler.Main.CompilationOptions( - defaults=Pyrex.Compiler.Main.default_options, - output_file=target_file) - pyrex_result = Pyrex.Compiler.Main.compile(source, - options=options) - if pyrex_result.num_errors != 0: - raise DistutilsError,"%d errors while compiling %r with Pyrex" \ - % (pyrex_result.num_errors, source) - elif os.path.isfile(target_file): - log.warn("Pyrex required for compiling %r but not available,"\ - " using old target %r"\ - % (source, target_file)) - else: - raise DistutilsError,"Pyrex required for compiling %r but not available" % (source) + target_file = self.generate_a_pyrex_source(base, ext_name, + source, + extension) new_sources.append(target_file) else: new_sources.append(source) return new_sources + def generate_a_pyrex_source(self, base, ext_name, source, extension): + if self.inplace or not have_pyrex: + target_dir = os.path.dirname(base) + else: + target_dir = appendpath(self.build_src, os.path.dirname(base)) + target_file = os.path.join(target_dir, ext_name + '.c') + depends = [source] + extension.depends + if self.force or newer_group(depends, target_file, 'newer'): + if have_pyrex: + log.info("pyrexc:> %s" % (target_file)) + self.mkpath(target_dir) + options = Pyrex.Compiler.Main.CompilationOptions( + defaults=Pyrex.Compiler.Main.default_options, + include_path=extension.include_dirs, + output_file=target_file) + pyrex_result = Pyrex.Compiler.Main.compile(source, + options=options) + if pyrex_result.num_errors != 0: + raise DistutilsError,"%d errors while compiling %r with Pyrex" \ + % (pyrex_result.num_errors, source) + elif os.path.isfile(target_file): + log.warn("Pyrex required for compiling %r but not available,"\ + " using old target %r"\ + % (source, target_file)) + else: + raise DistutilsError("Pyrex required for compiling %r"\ + " but notavailable" % (source,)) + return target_file + def f2py_sources(self, sources, extension): new_sources = [] f2py_sources = [] From numpy-svn at scipy.org Sat Nov 3 04:24:01 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 3 Nov 2007 03:24:01 -0500 (CDT) Subject: [Numpy-svn] r4379 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071103082401.6083C39C02E@new.scipy.org> Author: cdavid Date: 2007-11-03 03:23:56 -0500 (Sat, 03 Nov 2007) New Revision: 4379 Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py Log: Remove tcc debug override. Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-11-03 06:28:14 UTC (rev 4378) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-11-03 08:23:56 UTC (rev 4379) @@ -225,7 +225,6 @@ else: BuildDir(env['build_dir'], '.') - env['CC'] = 'tcc' # Generate help (if calling scons directly during debugging, this could be useful) Help(opts.GenerateHelpText(env)) From numpy-svn at scipy.org Sat Nov 3 12:09:08 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 3 Nov 2007 11:09:08 -0500 (CDT) Subject: [Numpy-svn] r4380 - trunk/numpy/distutils/command Message-ID: <20071103160908.3DBB439C0AD@new.scipy.org> Author: cookedm Date: 2007-11-03 11:09:06 -0500 (Sat, 03 Nov 2007) New Revision: 4380 Modified: trunk/numpy/distutils/command/build_ext.py Log: numpy.distutils.command.build_ext: append build C libraries as dependencies of the extension, to force recompiling if they change. (It should really only force relinking, but adding that is tougher.) Modified: trunk/numpy/distutils/command/build_ext.py =================================================================== --- trunk/numpy/distutils/command/build_ext.py 2007-11-03 08:23:56 UTC (rev 4379) +++ trunk/numpy/distutils/command/build_ext.py 2007-11-03 16:09:06 UTC (rev 4380) @@ -89,6 +89,7 @@ ' overwriting build_info\n%s... \nwith\n%s...' \ % (libname, `clibs[libname]`[:300], `build_info`[:300])) clibs[libname] = build_info + local_clibs = clibs.copy() # .. and distribution libraries: for libname,build_info in self.distribution.libraries or []: if clibs.has_key(libname): @@ -105,13 +106,18 @@ c_lib_dirs = [] macros = [] for libname in ext.libraries: - if clibs.has_key(libname): + if libname in clibs: binfo = clibs[libname] c_libs += binfo.get('libraries',[]) c_lib_dirs += binfo.get('library_dirs',[]) for m in binfo.get('macros',[]): if m not in macros: macros.append(m) + if libname in local_clibs: + c = self.compiler + outname = c.library_filename(libname, + output_dir=self.build_temp) + ext.depends.append(outname) for l in clibs.get(libname,{}).get('source_languages',[]): ext_languages.add(l) if c_libs: From numpy-svn at scipy.org Mon Nov 5 02:12:34 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 5 Nov 2007 01:12:34 -0600 (CST) Subject: [Numpy-svn] r4381 - branches/numpy.scons/numpy/distutils/scons/tools Message-ID: <20071105071234.3265C39C019@new.scipy.org> Author: cdavid Date: 2007-11-05 01:12:26 -0600 (Mon, 05 Nov 2007) New Revision: 4381 Added: branches/numpy.scons/numpy/distutils/scons/tools/f77.py branches/numpy.scons/numpy/distutils/scons/tools/f90.py branches/numpy.scons/numpy/distutils/scons/tools/f95.py branches/numpy.scons/numpy/distutils/scons/tools/fortran.py branches/numpy.scons/numpy/distutils/scons/tools/gfortran.py Log: Add fortran related toolchain in scons tools Added: branches/numpy.scons/numpy/distutils/scons/tools/f77.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/tools/f77.py 2007-11-03 16:09:06 UTC (rev 4380) +++ branches/numpy.scons/numpy/distutils/scons/tools/f77.py 2007-11-05 07:12:26 UTC (rev 4381) @@ -0,0 +1,135 @@ +"""engine.SCons.Tool.f77 + +Tool-specific initialization for the generic Posix f77 Fortran compiler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +import SCons.Defaults +import SCons.Scanner.Fortran +import SCons.Tool +import SCons.Util +import fortran + +compilers = ['f77'] + +# +F77Suffixes = ['.f77'] +F77PPSuffixes = [] +if SCons.Util.case_sensitive_suffixes('.f77', '.F77'): + F77PPSuffixes.append('.F77') +else: + F77Suffixes.append('.F77') + +# +F77Scan = SCons.Scanner.Fortran.FortranScan("F77PATH") + +for suffix in F77Suffixes + F77PPSuffixes: + SCons.Tool.SourceFileScanner.add_scanner(suffix, F77Scan) +del suffix + +# +fVLG = fortran.VariableListGenerator + +F77Generator = fVLG('F77', 'FORTRAN', '_FORTRAND') +F77FlagsGenerator = fVLG('F77FLAGS', 'FORTRANFLAGS') +F77CommandGenerator = fVLG('F77COM', 'FORTRANCOM', '_F77COMD') +F77CommandStrGenerator = fVLG('F77COMSTR', 'FORTRANCOMSTR', '_F77COMSTRD') +F77PPCommandGenerator = fVLG('F77PPCOM', 'FORTRANPPCOM', '_F77PPCOMD') +F77PPCommandStrGenerator = fVLG('F77PPCOMSTR', 'FORTRANPPCOMSTR', '_F77PPCOMSTRD') +ShF77Generator = fVLG('SHF77', 'SHFORTRAN', 'F77', 'FORTRAN', '_FORTRAND') +ShF77FlagsGenerator = fVLG('SHF77FLAGS', 'SHFORTRANFLAGS') +ShF77CommandGenerator = fVLG('SHF77COM', 'SHFORTRANCOM', '_SHF77COMD') +ShF77CommandStrGenerator = fVLG('SHF77COMSTR', 'SHFORTRANCOMSTR', '_SHF77COMSTRD') +ShF77PPCommandGenerator = fVLG('SHF77PPCOM', 'SHFORTRANPPCOM', '_SHF77PPCOMD') +ShF77PPCommandStrGenerator = fVLG('SHF77PPCOMSTR', 'SHFORTRANPPCOMSTR', '_SHF77PPCOMSTRD') + +del fVLG + +# +F77Action = SCons.Action.Action('$_F77COMG ', '$_F77COMSTRG') +F77PPAction = SCons.Action.Action('$_F77PPCOMG ', '$_F77PPCOMSTRG') +ShF77Action = SCons.Action.Action('$_SHF77COMG ', '$_SHF77COMSTRG') +ShF77PPAction = SCons.Action.Action('$_SHF77PPCOMG ', '$_SHF77PPCOMSTRG') + +def add_to_env(env): + """Add Builders and construction variables for f77 to an Environment.""" + env.AppendUnique(FORTRANSUFFIXES = F77Suffixes + F77PPSuffixes) + + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + + for suffix in F77Suffixes: + static_obj.add_action(suffix, F77Action) + shared_obj.add_action(suffix, ShF77Action) + static_obj.add_emitter(suffix, fortran.FortranEmitter) + shared_obj.add_emitter(suffix, fortran.ShFortranEmitter) + + for suffix in F77PPSuffixes: + static_obj.add_action(suffix, F77PPAction) + shared_obj.add_action(suffix, ShF77PPAction) + static_obj.add_emitter(suffix, fortran.FortranEmitter) + shared_obj.add_emitter(suffix, fortran.ShFortranEmitter) + + env['_F77G'] = F77Generator + env['_F77FLAGSG'] = F77FlagsGenerator + env['_F77COMG'] = F77CommandGenerator + env['_F77PPCOMG'] = F77PPCommandGenerator + env['_F77COMSTRG'] = F77CommandStrGenerator + env['_F77PPCOMSTRG'] = F77PPCommandStrGenerator + + env['_SHF77G'] = ShF77Generator + env['_SHF77FLAGSG'] = ShF77FlagsGenerator + env['_SHF77COMG'] = ShF77CommandGenerator + env['_SHF77PPCOMG'] = ShF77PPCommandGenerator + env['_SHF77COMSTRG'] = ShF77CommandStrGenerator + env['_SHF77PPCOMSTRG'] = ShF77PPCommandStrGenerator + + env['_F77INCFLAGS'] = '$( ${_concat(INCPREFIX, F77PATH, INCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' + + env['_F77COMD'] = '$_F77G -o $TARGET -c $_F77FLAGSG $_F77INCFLAGS $SOURCES' + env['_F77PPCOMD'] = '$_F77G -o $TARGET -c $_F77FLAGSG $CPPFLAGS $_CPPDEFFLAGS $_F77INCFLAGS $SOURCES' + env['_SHF77COMD'] = '$_SHF77G -o $TARGET -c $_SHF77FLAGSG $_F77INCFLAGS $SOURCES' + env['_SHF77PPCOMD'] = '$_SHF77G -o $TARGET -c $_SHF77FLAGSG $CPPFLAGS $_CPPDEFFLAGS $_F77INCFLAGS $SOURCES' + +def generate(env): + fortran.add_to_env(env) + + import f90 + import f95 + f90.add_to_env(env) + f95.add_to_env(env) + + add_to_env(env) + + env['_FORTRAND'] = env.Detect(compilers) or 'f77' + +def exists(env): + return env.Detect(compilers) Added: branches/numpy.scons/numpy/distutils/scons/tools/f90.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/tools/f90.py 2007-11-03 16:09:06 UTC (rev 4380) +++ branches/numpy.scons/numpy/distutils/scons/tools/f90.py 2007-11-05 07:12:26 UTC (rev 4381) @@ -0,0 +1,132 @@ +"""engine.SCons.Tool.f90 + +Tool-specific initialization for the generic Posix f90 Fortran compiler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +import SCons.Defaults +import SCons.Scanner.Fortran +import SCons.Tool +import SCons.Util +import fortran + +compilers = ['f90'] + +# +F90Suffixes = ['.f90'] +F90PPSuffixes = [] +if SCons.Util.case_sensitive_suffixes('.f90', '.F90'): + F90PPSuffixes.append('.F90') +else: + F90Suffixes.append('.F90') + +# +F90Scan = SCons.Scanner.Fortran.FortranScan("F90PATH") + +for suffix in F90Suffixes + F90PPSuffixes: + SCons.Tool.SourceFileScanner.add_scanner(suffix, F90Scan) +del suffix + +# +fVLG = fortran.VariableListGenerator + +F90Generator = fVLG('F90', 'FORTRAN', '_FORTRAND') +F90FlagsGenerator = fVLG('F90FLAGS', 'FORTRANFLAGS') +F90CommandGenerator = fVLG('F90COM', 'FORTRANCOM', '_F90COMD') +F90CommandStrGenerator = fVLG('F90COMSTR', 'FORTRANCOMSTR', '_F90COMSTRD') +F90PPCommandGenerator = fVLG('F90PPCOM', 'FORTRANPPCOM', '_F90PPCOMD') +F90PPCommandStrGenerator = fVLG('F90PPCOMSTR', 'FORTRANPPCOMSTR', '_F90PPCOMSTRD') +ShF90Generator = fVLG('SHF90', 'SHFORTRAN', 'F90', 'FORTRAN', '_FORTRAND') +ShF90FlagsGenerator = fVLG('SHF90FLAGS', 'SHFORTRANFLAGS') +ShF90CommandGenerator = fVLG('SHF90COM', 'SHFORTRANCOM', '_SHF90COMD') +ShF90CommandStrGenerator = fVLG('SHF90COMSTR', 'SHFORTRANCOMSTR', '_SHF90COMSTRD') +ShF90PPCommandGenerator = fVLG('SHF90PPCOM', 'SHFORTRANPPCOM', '_SHF90PPCOMD') +ShF90PPCommandStrGenerator = fVLG('SHF90PPCOMSTR', 'SHFORTRANPPCOMSTR', '_SHF90PPCOMSTRD') + +del fVLG + +# +F90Action = SCons.Action.Action('$_F90COMG ', '$_F90COMSTRG') +F90PPAction = SCons.Action.Action('$_F90PPCOMG ', '$_F90PPCOMSTRG') +ShF90Action = SCons.Action.Action('$_SHF90COMG ', '$_SHF90COMSTRG') +ShF90PPAction = SCons.Action.Action('$_SHF90PPCOMG ', '$_SHF90PPCOMSTRG') + +def add_to_env(env): + """Add Builders and construction variables for f90 to an Environment.""" + env.AppendUnique(FORTRANSUFFIXES = F90Suffixes + F90PPSuffixes) + + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + + for suffix in F90Suffixes: + static_obj.add_action(suffix, F90Action) + shared_obj.add_action(suffix, ShF90Action) + static_obj.add_emitter(suffix, fortran.FortranEmitter) + shared_obj.add_emitter(suffix, fortran.ShFortranEmitter) + + for suffix in F90PPSuffixes: + static_obj.add_action(suffix, F90PPAction) + shared_obj.add_action(suffix, ShF90PPAction) + static_obj.add_emitter(suffix, fortran.FortranEmitter) + shared_obj.add_emitter(suffix, fortran.ShFortranEmitter) + + env['_F90G'] = F90Generator + env['_F90FLAGSG'] = F90FlagsGenerator + env['_F90COMG'] = F90CommandGenerator + env['_F90COMSTRG'] = F90CommandStrGenerator + env['_F90PPCOMG'] = F90PPCommandGenerator + env['_F90PPCOMSTRG'] = F90PPCommandStrGenerator + + env['_SHF90G'] = ShF90Generator + env['_SHF90FLAGSG'] = ShF90FlagsGenerator + env['_SHF90COMG'] = ShF90CommandGenerator + env['_SHF90COMSTRG'] = ShF90CommandStrGenerator + env['_SHF90PPCOMG'] = ShF90PPCommandGenerator + env['_SHF90PPCOMSTRG'] = ShF90PPCommandStrGenerator + + env['_F90INCFLAGS'] = '$( ${_concat(INCPREFIX, F90PATH, INCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' + env['_F90COMD'] = '$_F90G -o $TARGET -c $_F90FLAGSG $_F90INCFLAGS $_FORTRANMODFLAG $SOURCES' + env['_F90PPCOMD'] = '$_F90G -o $TARGET -c $_F90FLAGSG $CPPFLAGS $_CPPDEFFLAGS $_F90INCFLAGS $_FORTRANMODFLAG $SOURCES' + env['_SHF90COMD'] = '$_SHF90G -o $TARGET -c $_SHF90FLAGSG $_F90INCFLAGS $_FORTRANMODFLAG $SOURCES' + env['_SHF90PPCOMD'] = '$_SHF90G -o $TARGET -c $_SHF90FLAGSG $CPPFLAGS $_CPPDEFFLAGS $_F90INCFLAGS $_FORTRANMODFLAG $SOURCES' + +def generate(env): + fortran.add_to_env(env) + + import f77 + f77.add_to_env(env) + + add_to_env(env) + + env['_FORTRAND'] = env.Detect(compilers) or 'f90' + +def exists(env): + return env.Detect(compilers) Added: branches/numpy.scons/numpy/distutils/scons/tools/f95.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/tools/f95.py 2007-11-03 16:09:06 UTC (rev 4380) +++ branches/numpy.scons/numpy/distutils/scons/tools/f95.py 2007-11-05 07:12:26 UTC (rev 4381) @@ -0,0 +1,135 @@ +"""engine.SCons.Tool.f95 + +Tool-specific initialization for the generic Posix f95 Fortran compiler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +import SCons.Defaults +import SCons.Tool +import SCons.Util +import fortran + +compilers = ['f95'] + +# +F95Suffixes = ['.f95'] +F95PPSuffixes = [] +if SCons.Util.case_sensitive_suffixes('.f95', '.F95'): + F95PPSuffixes.append('.F95') +else: + F95Suffixes.append('.F95') + +# +F95Scan = SCons.Scanner.Fortran.FortranScan("F95PATH") + +for suffix in F95Suffixes + F95PPSuffixes: + SCons.Tool.SourceFileScanner.add_scanner(suffix, F95Scan) +del suffix + +# +fVLG = fortran.VariableListGenerator + +F95Generator = fVLG('F95', 'FORTRAN', '_FORTRAND') +F95FlagsGenerator = fVLG('F95FLAGS', 'FORTRANFLAGS') +F95CommandGenerator = fVLG('F95COM', 'FORTRANCOM', '_F95COMD') +F95CommandStrGenerator = fVLG('F95COMSTR', 'FORTRANCOMSTR', '_F95COMSTRD') +F95PPCommandGenerator = fVLG('F95PPCOM', 'FORTRANPPCOM', '_F95PPCOMD') +F95PPCommandStrGenerator = fVLG('F95PPCOMSTR', 'FORTRANPPCOMSTR', '_F95PPCOMSTRD') +ShF95Generator = fVLG('SHF95', 'SHFORTRAN', 'F95', 'FORTRAN', '_FORTRAND') +ShF95FlagsGenerator = fVLG('SHF95FLAGS', 'SHFORTRANFLAGS') +ShF95CommandGenerator = fVLG('SHF95COM', 'SHFORTRANCOM', '_SHF95COMD') +ShF95CommandStrGenerator = fVLG('SHF95COMSTR', 'SHFORTRANCOMSTR', '_SHF95COMSTRD') +ShF95PPCommandGenerator = fVLG('SHF95PPCOM', 'SHFORTRANPPCOM', '_SHF95PPCOMD') +ShF95PPCommandStrGenerator = fVLG('SHF95PPCOMSTR', 'SHFORTRANPPCOMSTR', '_SHF95PPCOMSTRD') + +del fVLG + +# +F95Action = SCons.Action.Action('$_F95COMG ', '$_F95COMSTRG') +F95PPAction = SCons.Action.Action('$_F95PPCOMG ', '$_F95PPCOMSTRG') +ShF95Action = SCons.Action.Action('$_SHF95COMG ', '$_SHF95COMSTRG') +ShF95PPAction = SCons.Action.Action('$_SHF95PPCOMG ', '$_SHF95PPCOMSTRG') + +def add_to_env(env): + """Add Builders and construction variables for f95 to an Environment.""" + env.AppendUnique(FORTRANSUFFIXES = F95Suffixes + F95PPSuffixes) + + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + + for suffix in F95Suffixes: + static_obj.add_action(suffix, F95Action) + shared_obj.add_action(suffix, ShF95Action) + static_obj.add_emitter(suffix, fortran.FortranEmitter) + shared_obj.add_emitter(suffix, fortran.ShFortranEmitter) + + for suffix in F95PPSuffixes: + static_obj.add_action(suffix, F95PPAction) + shared_obj.add_action(suffix, ShF95PPAction) + static_obj.add_emitter(suffix, fortran.FortranEmitter) + shared_obj.add_emitter(suffix, fortran.ShFortranEmitter) + + env['_F95G'] = F95Generator + env['_F95FLAGSG'] = F95FlagsGenerator + env['_F95COMG'] = F95CommandGenerator + env['_F95COMSTRG'] = F95CommandStrGenerator + env['_F95PPCOMG'] = F95PPCommandGenerator + env['_F95PPCOMSTRG'] = F95PPCommandStrGenerator + + env['_SHF95G'] = ShF95Generator + env['_SHF95FLAGSG'] = ShF95FlagsGenerator + env['_SHF95COMG'] = ShF95CommandGenerator + env['_SHF95COMSTRG'] = ShF95CommandStrGenerator + env['_SHF95PPCOMG'] = ShF95PPCommandGenerator + env['_SHF95PPCOMSTRG'] = ShF95PPCommandStrGenerator + + env['_F95INCFLAGS'] = '$( ${_concat(INCPREFIX, F95PATH, INCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' + + env['_F95COMD'] = '$_F95G -o $TARGET -c $_F95FLAGSG $_F95INCFLAGS $_FORTRANMODFLAG $SOURCES' + env['_F95PPCOMD'] = '$_F95G -o $TARGET -c $_F95FLAGSG $CPPFLAGS $_CPPDEFFLAGS $_F95INCFLAGS $_FORTRANMODFLAG $SOURCES' + env['_SHF95COMD'] = '$_SHF95G -o $TARGET -c $_SHF95FLAGSG $_F95INCFLAGS $_FORTRANMODFLAG $SOURCES' + env['_SHF95PPCOMD'] = '$_SHF95G -o $TARGET -c $_SHF95FLAGSG $CPPFLAGS $_CPPDEFFLAGS $_F95INCFLAGS $_FORTRANMODFLAG $SOURCES' + +def generate(env): + fortran.add_to_env(env) + + import f77 + f77.add_to_env(env) + + import f90 + f90.add_to_env(env) + + add_to_env(env) + + env['_FORTRAND'] = env.Detect(compilers) or 'f95' + +def exists(env): + return env.Detect(compilers) Added: branches/numpy.scons/numpy/distutils/scons/tools/fortran.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/tools/fortran.py 2007-11-03 16:09:06 UTC (rev 4380) +++ branches/numpy.scons/numpy/distutils/scons/tools/fortran.py 2007-11-05 07:12:26 UTC (rev 4381) @@ -0,0 +1,187 @@ +"""SCons.Tool.fortran + +Tool-specific initialization for a generic Posix f77/f90 Fortran compiler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +import re +import string + +import SCons.Action +import SCons.Defaults +import SCons.Scanner.Fortran +import SCons.Tool +import SCons.Util + +compilers = ['f95', 'f90', 'f77'] + +# +# Not yet sure how to deal with fortran pre-processor functions. +# Different compilers do this differently in modern fortran. Some still +# rely on the c pre-processor, some (like cvf, ivf) have their own +# pre-processor technology and use intermediary suffixes (.i90) +# +FortranSuffixes = [".f", ".for", ".ftn", ] +FortranPPSuffixes = ['.fpp', '.FPP'] +upper_case = [".F", ".FOR", ".FTN"] +if SCons.Util.case_sensitive_suffixes('.f', '.F'): + FortranPPSuffixes.extend(upper_case) +else: + FortranSuffixes.extend(upper_case) + +# +FortranScan = SCons.Scanner.Fortran.FortranScan("FORTRANPATH") + +for suffix in FortranSuffixes + FortranPPSuffixes: + SCons.Tool.SourceFileScanner.add_scanner(suffix, FortranScan) +del suffix + +# +def _fortranEmitter(target, source, env): + node = source[0].rfile() + if not node.exists() and not node.is_derived(): + print "Could not locate " + str(node.name) + return ([], []) + mod_regex = """(?i)^\s*MODULE\s+(?!PROCEDURE)(\w+)""" + cre = re.compile(mod_regex,re.M) + # Retrieve all USE'd module names + modules = cre.findall(node.get_contents()) + # Remove unique items from the list + modules = SCons.Util.unique(modules) + # Convert module name to a .mod filename + suffix = env.subst('$FORTRANMODSUFFIX', target=target, source=source) + moddir = env.subst('$FORTRANMODDIR', target=target, source=source) + modules = map(lambda x, s=suffix: string.lower(x) + s, modules) + for m in modules: + target.append(env.fs.File(m, moddir)) + return (target, source) + +def FortranEmitter(target, source, env): + target, source = _fortranEmitter(target, source, env) + return SCons.Defaults.StaticObjectEmitter(target, source, env) + +def ShFortranEmitter(target, source, env): + target, source = _fortranEmitter(target, source, env) + return SCons.Defaults.SharedObjectEmitter(target, source, env) + +class VariableListGenerator: + def __init__(self, *variablelist): + self.variablelist = variablelist + def __call__(self, env, target, source, for_signature=0): + for v in self.variablelist: + try: return env[v] + except KeyError: pass + return '' + +# +FortranGenerator = VariableListGenerator('FORTRAN', 'F77', '_FORTRAND') +FortranFlagsGenerator = VariableListGenerator('FORTRANFLAGS', 'F77FLAGS') +FortranCommandGenerator = VariableListGenerator('FORTRANCOM', 'F77COM', '_FORTRANCOMD') +FortranCommandStrGenerator = VariableListGenerator('FORTRANCOMSTR', 'F77COMSTR', '_FORTRANCOMSTRD') +FortranPPCommandGenerator = VariableListGenerator('FORTRANPPCOM', 'F77PPCOM', '_FORTRANPPCOMD') +FortranPPCommandStrGenerator = VariableListGenerator('FORTRANPPCOMSTR', 'F77PPCOMSTR', '_FORTRANPPCOMSTRD') +ShFortranGenerator = VariableListGenerator('SHFORTRAN', 'SHF77', 'FORTRAN', 'F77', '_FORTRAND') +ShFortranFlagsGenerator = VariableListGenerator('SHFORTRANFLAGS', 'SHF77FLAGS') +ShFortranCommandGenerator = VariableListGenerator('SHFORTRANCOM', 'SHF77COM', '_SHFORTRANCOMD') +ShFortranCommandStrGenerator = VariableListGenerator('SHFORTRANCOMSTR', 'SHF77COMSTR', '_SHFORTRANCOMSTRD') +ShFortranPPCommandGenerator = VariableListGenerator('SHFORTRANPPCOM', 'SHF77PPCOM', '_SHFORTRANPPCOMD') +ShFortranPPCommandStrGenerator = VariableListGenerator('SHFORTRANPPCOMSTR', 'SHF77PPCOMSTR', '_SHFORTRANPPCOMSTRD') + +# +FortranAction = SCons.Action.Action('$_FORTRANCOMG ', '$_FORTRANCOMSTRG') +FortranPPAction = SCons.Action.Action('$_FORTRANPPCOMG ', '$_FORTRANPPCOMSTRG') +ShFortranAction = SCons.Action.Action('$_SHFORTRANCOMG ', '$_SHFORTRANCOMSTRG') +ShFortranPPAction = SCons.Action.Action('$_SHFORTRANPPCOMG ', '$_SHFORTRANPPCOMSTRG') + +def add_to_env(env): + """Add Builders and construction variables for Fortran to an Environment.""" + + env['_FORTRANG'] = FortranGenerator + env['_FORTRANFLAGSG'] = FortranFlagsGenerator + env['_FORTRANCOMG'] = FortranCommandGenerator + env['_FORTRANCOMSTRG'] = FortranCommandStrGenerator + env['_FORTRANPPCOMG'] = FortranPPCommandGenerator + env['_FORTRANPPCOMSTRG'] = FortranPPCommandStrGenerator + + env['_SHFORTRANG'] = ShFortranGenerator + env['_SHFORTRANFLAGSG'] = ShFortranFlagsGenerator + env['_SHFORTRANCOMG'] = ShFortranCommandGenerator + env['_SHFORTRANCOMSTRG'] = ShFortranCommandStrGenerator + env['_SHFORTRANPPCOMG'] = ShFortranPPCommandGenerator + env['_SHFORTRANPPCOMSTRG'] = ShFortranPPCommandStrGenerator + + env['_FORTRANINCFLAGS'] = '$( ${_concat(INCPREFIX, FORTRANPATH, INCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' + + env['FORTRANMODPREFIX'] = '' # like $LIBPREFIX + env['FORTRANMODSUFFIX'] = '.mod' # like $LIBSUFFIX + + env['FORTRANMODDIR'] = '' # where the compiler should place .mod files + env['FORTRANMODDIRPREFIX'] = '' # some prefix to $FORTRANMODDIR - similar to $INCPREFIX + env['FORTRANMODDIRSUFFIX'] = '' # some suffix to $FORTRANMODDIR - similar to $INCSUFFIX + env['_FORTRANMODFLAG'] = '$( ${_concat(FORTRANMODDIRPREFIX, FORTRANMODDIR, FORTRANMODDIRSUFFIX, __env__, RDirs)} $)' + + env.AppendUnique(FORTRANSUFFIXES = FortranSuffixes + FortranPPSuffixes) + + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + + for suffix in FortranSuffixes: + static_obj.add_action(suffix, FortranAction) + shared_obj.add_action(suffix, ShFortranAction) + static_obj.add_emitter(suffix, FortranEmitter) + shared_obj.add_emitter(suffix, ShFortranEmitter) + + for suffix in FortranPPSuffixes: + static_obj.add_action(suffix, FortranPPAction) + shared_obj.add_action(suffix, ShFortranPPAction) + static_obj.add_emitter(suffix, FortranEmitter) + shared_obj.add_emitter(suffix, ShFortranEmitter) + + env['_FORTRANCOMD'] = '$_FORTRANG -o $TARGET -c $_FORTRANFLAGSG $_FORTRANINCFLAGS $_FORTRANMODFLAG $SOURCES' + env['_FORTRANPPCOMD'] = '$_FORTRANG -o $TARGET -c $_FORTRANFLAGSG $CPPFLAGS $_CPPDEFFLAGS $_FORTRANINCFLAGS $_FORTRANMODFLAG $SOURCES' + env['_SHFORTRANCOMD'] = '$_SHFORTRANG -o $TARGET -c $_SHFORTRANFLAGSG $_FORTRANINCFLAGS $_FORTRANMODFLAG $SOURCES' + env['_SHFORTRANPPCOMD'] = '$_SHFORTRANG -o $TARGET -c $_SHFORTRANFLAGSG $CPPFLAGS $_CPPDEFFLAGS $_FORTRANINCFLAGS $_FORTRANMODFLAG $SOURCES' + +import f77 +import f90 +import f95 + +def generate(env): + f77.add_to_env(env) + f90.add_to_env(env) + f95.add_to_env(env) + + add_to_env(env) + + env['_FORTRAND'] = env.Detect(compilers) or 'f77' + +def exists(env): + return env.Detect(compilers) Added: branches/numpy.scons/numpy/distutils/scons/tools/gfortran.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/tools/gfortran.py 2007-11-03 16:09:06 UTC (rev 4380) +++ branches/numpy.scons/numpy/distutils/scons/tools/gfortran.py 2007-11-05 07:12:26 UTC (rev 4381) @@ -0,0 +1,49 @@ +"""SCons.Tool.gfirtran + +Tool-specific initialization for gfortran, the GNU Fortran 95/Fortran 2003 compiler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +import string + +import SCons.Defaults + +import fortran + +def generate(env): + """Add Builders and construction variables for gfortran to an Environment.""" + fortran.generate(env) + + env['_FORTRAND'] = 'gfortran' + +def exists(env): + return env.Detect('ifort') From numpy-svn at scipy.org Mon Nov 5 02:23:21 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 5 Nov 2007 01:23:21 -0600 (CST) Subject: [Numpy-svn] r4382 - in branches/numpy.scons/numpy/distutils: command scons Message-ID: <20071105072321.18AB839C019@new.scipy.org> Author: cdavid Date: 2007-11-05 01:23:15 -0600 (Mon, 05 Nov 2007) New Revision: 4382 Modified: branches/numpy.scons/numpy/distutils/command/scons.py branches/numpy.scons/numpy/distutils/scons/numpyenv.py Log: gfortran directly supported through scons tool Modified: branches/numpy.scons/numpy/distutils/command/scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/scons.py 2007-11-05 07:12:26 UTC (rev 4381) +++ branches/numpy.scons/numpy/distutils/command/scons.py 2007-11-05 07:23:15 UTC (rev 4382) @@ -63,7 +63,7 @@ return 'g77' elif compiler.compiler_type == 'gnu95': # XXX ? - return 'f95' + return 'gfortran' else: return compiler.compiler_type Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-11-05 07:12:26 UTC (rev 4381) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-11-05 07:23:15 UTC (rev 4382) @@ -157,7 +157,7 @@ if len(env['f77_opt_path']) > 0: # XXX: what is the right way to add one directory in the # PATH ? (may not work on windows). - t = Tool(env['f77_opt']) + t = Tool(env['f77_opt'], toolpath = ['numpy/distutils/scons/tools']) t(env) if sys.platform == 'win32': env['ENV']['PATH'] += ';%s' % env['f77_opt_path'] From numpy-svn at scipy.org Mon Nov 5 03:24:16 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 5 Nov 2007 02:24:16 -0600 (CST) Subject: [Numpy-svn] r4383 - in branches/numpy.scons/numpy/distutils: command scons/checkers Message-ID: <20071105082416.045F039C10F@new.scipy.org> Author: cdavid Date: 2007-11-05 02:24:11 -0600 (Mon, 05 Nov 2007) New Revision: 4383 Modified: branches/numpy.scons/numpy/distutils/command/scons.py branches/numpy.scons/numpy/distutils/scons/checkers/support.py Log: - Fix trivial typo which prevents scons working on python 2.4 - For fortran compiler not supported yet, just returns 'fortran' as a type instead of compiler_type Modified: branches/numpy.scons/numpy/distutils/command/scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/scons.py 2007-11-05 07:23:15 UTC (rev 4382) +++ branches/numpy.scons/numpy/distutils/command/scons.py 2007-11-05 08:24:11 UTC (rev 4383) @@ -62,10 +62,10 @@ elif compiler.compiler_type == 'gnu': return 'g77' elif compiler.compiler_type == 'gnu95': - # XXX ? return 'gfortran' else: - return compiler.compiler_type + # XXX: Just give up for now, and use generic fortran compiler + return 'fortran' def get_compiler_executable(compiler): """For any give CCompiler instance, this gives us the name of C compiler Modified: branches/numpy.scons/numpy/distutils/scons/checkers/support.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/support.py 2007-11-05 07:23:15 UTC (rev 4382) +++ branches/numpy.scons/numpy/distutils/scons/checkers/support.py 2007-11-05 08:24:11 UTC (rev 4383) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Wed Oct 31 08:00 PM 2007 J +# Last Change: Mon Nov 05 05:00 PM 2007 J # This module defines some helper functions, to be used by high level checkers @@ -108,7 +108,7 @@ msg = [r'%s : %s' % (k, i) for k, i in self.data.items()] return '\n'.join(msg) -class ConfigRes(): +class ConfigRes: def __init__(self, name, cfgopts, origin, version = None): self.name = name self.data = cfgopts.data From numpy-svn at scipy.org Mon Nov 5 04:32:44 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 5 Nov 2007 03:32:44 -0600 (CST) Subject: [Numpy-svn] r4384 - trunk Message-ID: <20071105093244.9975939C261@new.scipy.org> Author: cookedm Date: 2007-11-05 03:32:43 -0600 (Mon, 05 Nov 2007) New Revision: 4384 Removed: trunk/scipy_compatibility Log: Remove old file scipy_compatibility Deleted: trunk/scipy_compatibility =================================================================== --- trunk/scipy_compatibility 2007-11-05 08:24:11 UTC (rev 4383) +++ trunk/scipy_compatibility 2007-11-05 09:32:43 UTC (rev 4384) @@ -1,4 +0,0 @@ -Changed names and behaviors in limits -Changed usage of types -Moved around some names -Moved scimath functions to numpy.math From numpy-svn at scipy.org Mon Nov 5 05:03:02 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 5 Nov 2007 04:03:02 -0600 (CST) Subject: [Numpy-svn] r4385 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071105100302.7A5D939C269@new.scipy.org> Author: cdavid Date: 2007-11-05 04:02:57 -0600 (Mon, 05 Nov 2007) New Revision: 4385 Modified: branches/numpy.scons/numpy/distutils/scons/default.py Log: Handle -pthread option with gcc if necessary. Modified: branches/numpy.scons/numpy/distutils/scons/default.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/default.py 2007-11-05 09:32:43 UTC (rev 4384) +++ branches/numpy.scons/numpy/distutils/scons/default.py 2007-11-05 10:02:57 UTC (rev 4385) @@ -1,6 +1,7 @@ #! /usr/bin/env python -# Last Change: Fri Nov 02 06:00 PM 2007 J +# Last Change: Mon Nov 05 06:00 PM 2007 J import sys +import distutils.sysconfig # This is a copy of scons/Tools/__init__.py, because scons does not offer any # public api for this @@ -120,10 +121,14 @@ # which breaks command line options. So just don't put space. def get_cc_config(name): if name == 'gcc': + if distutils.sysconfig.get_config_vars('LDFLAGS')[0].find('-pthread'): + thread = ['-pthread'] + else: + thread = [] cfg = CompilerConfig(optim = ['-O2', '-fno-strict-aliasing', '-DNDEBUG'], warn = ['-Wall', '-Wstrict-prototypes'], debug_symbol = ['-g'], - thread = []) + thread = thread) elif name == 'intelc': if sys.platform[:5] == 'win32': raise NotImplementedError('FIXME: intel compiler on windows not '\ From numpy-svn at scipy.org Mon Nov 5 05:09:47 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 5 Nov 2007 04:09:47 -0600 (CST) Subject: [Numpy-svn] r4386 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071105100947.CB44139C269@new.scipy.org> Author: cdavid Date: 2007-11-05 04:09:44 -0600 (Mon, 05 Nov 2007) New Revision: 4386 Modified: branches/numpy.scons/numpy/distutils/scons/default.py Log: Sensible default for compilation on not supported compilers Modified: branches/numpy.scons/numpy/distutils/scons/default.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/default.py 2007-11-05 10:02:57 UTC (rev 4385) +++ branches/numpy.scons/numpy/distutils/scons/default.py 2007-11-05 10:09:44 UTC (rev 4386) @@ -166,6 +166,9 @@ thread = ['/MD', '/GX'], extra = ['/nologo']) else: - cfg = CompilerConfig() + # For not yet supported compiler, just put everything in optims from + # distutils + cfg = CompilerConfig(optims = + distutils.sysconfig.get_config_vars('CFLAGS')) return cfg From numpy-svn at scipy.org Mon Nov 5 05:11:31 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 5 Nov 2007 04:11:31 -0600 (CST) Subject: [Numpy-svn] r4387 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071105101131.3F1D239C269@new.scipy.org> Author: cdavid Date: 2007-11-05 04:11:27 -0600 (Mon, 05 Nov 2007) New Revision: 4387 Added: branches/numpy.scons/numpy/distutils/scons/parser.py Log: Add a small module to parse typical compiler options for scons Added: branches/numpy.scons/numpy/distutils/scons/parser.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/parser.py 2007-11-05 10:09:44 UTC (rev 4386) +++ branches/numpy.scons/numpy/distutils/scons/parser.py 2007-11-05 10:11:27 UTC (rev 4387) @@ -0,0 +1,117 @@ +#! /usr/bin/env python +# Last Change: Mon Nov 05 07:00 PM 2007 J +import re +import shlex + +# Those are obtained from distutils.sysconfig.get_config_vars('CFLAGS') +tiger_x86_cflags = r'-arch ppc -arch i386 -sysroot '\ +'/Developers/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -Wno-long-double '\ +'-no-cpp-precomp -DNDEBUG -f -O3' +linux_x86_cflags = r'-fno-strict-aliasing -DNDEBUG -g -O2 -Wall '\ + '-Wstrict-prototypes' +linux_x86_ldflags = r'-pthread -shared -Wl,-O1' + +# List of arguments taking an option (with space) +cflags_argument_options = [r'-arch', r'-sysroot'] +ldflags_argument_options = [r'-arch', r'-sysroot', r'-L'] + +def is_option(token): + return token.startswith('-') + +def has_argument(token): + """Returns True if current token is an option expecting an argument.""" + for i in cflags_argument_options: + if token.startswith(i): + return True + return False + +def cc_process_argument(lexer, token): + """Merge subsequent tokens while no option flag is detected.""" + token_list = [token] + token = lexer.get_token() + while token is not None and not is_option(token): + token_list.append(token) + token = lexer.get_token() + return token_list, token + +def ld_process_argument(lexer, token): + """Merge subsequent tokens while no option flag is detected.""" + token_list = [token] + token = lexer.get_token() + while token is not None and not is_option(token): + token_list.append(token) + token = lexer.get_token() + return token_list, token + +def parse_posix_ld_token(lexer, token): + if not token: + return None + + if has_argument(token): + token_list, next_token = ld_process_argument(lexer, token) + token = ' '.join(token_list) + else: + next_token = lexer.get_token() + + if token.startswith('-L'): + print "token %s is a libpath flag" % token + elif token.startswith('-W'): + print "token %s is a linker flag" % token + elif token.startswith('-O'): + print "token %s is a optim flag" % token + elif token.startswith('-g'): + print "token %s is a debug related flag" % token + elif token.startswith('-pthread'): + print "token %s is a thread related flag" % token + else: + print "token %s is unknown (extra)" % token + + return next_token + +def parse_posix_cc_token(lexer, token): + if not token: + return None + + if has_argument(token): + token_list, next_token = cc_process_argument(lexer, token) + token = ' '.join(token_list) + else: + next_token = lexer.get_token() + + if token.startswith('-W'): + print "token %s is a warning flag" % token + elif token.startswith('-D'): + print "token %s is a define flag" % token + elif token.startswith('-f'): + print "token %s is a compilation flag" % token + elif token.startswith('-O'): + print "token %s is a optim flag" % token + elif token.startswith('-g'): + print "token %s is a debug related flag" % token + elif token.startswith('-pthread'): + print "token %s is a thread related flag" % token + else: + print "token %s is unknown (extra)" % token + + return next_token + +if __name__ == '__main__': + def parse_cflags(flags): + a = shlex.shlex(flags, posix = True) + a.whitespace_split = True + t = a.get_token() + while t: + t = parse_posix_cc_token(a, t) + + def parse_ldflags(flags): + a = shlex.shlex(flags, posix = True) + a.whitespace_split = True + t = a.get_token() + while t: + t = parse_posix_ld_token(a, t) + + for i in [linux_x86_cflags, tiger_x86_cflags]: + parse_cflags(i) + + for i in [linux_x86_ldflags]: + parse_ldflags(i) From numpy-svn at scipy.org Mon Nov 5 05:23:10 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 5 Nov 2007 04:23:10 -0600 (CST) Subject: [Numpy-svn] r4388 - branches/numpy.scons/numpy/distutils/scons/checkers Message-ID: <20071105102310.2CC0539C02A@new.scipy.org> Author: cdavid Date: 2007-11-05 04:23:07 -0600 (Mon, 05 Nov 2007) New Revision: 4388 Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py Log: Support Mac OS X Accelerate for LAPACK checker. Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-05 10:11:27 UTC (rev 4387) +++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-05 10:23:07 UTC (rev 4388) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Wed Oct 31 07:00 PM 2007 J +# Last Change: Mon Nov 05 07:00 PM 2007 J # Module for custom, common checkers for numpy (and scipy) import sys @@ -75,19 +75,18 @@ if found: raise NotImplementedError("FIXME: siteconfig for lapack") # XXX: adapt this to libperf refactor - headers = ['cblas.h'] - linkflags = [] - cflags = [] - st = check_include_and_run(context, 'CBLAS', [], headers, cblas_src, - libs, libpath, linkflags, cflags, autoadd) - if st: - add_info(env, 'cblas', opt_info('cblas', site = 1)) - return st else: if sys.platform == 'nt': import warnings warning.warn('FIXME: LAPACK checks not implemented yet on win32') return 0 + if sys.platform == 'darwin': + st, opts = CheckAccelerate(context, autoadd) + if st: + if st: + add_info(env, 'lapack: Accelerate', opts) + return st + else: env = context.env @@ -99,6 +98,9 @@ if not CheckF77Clib(context): return 0 + # XXX: all the code below is a mess, refactor it with new code from + # support module. + # Get the mangled name of our test function sgesv_string = env['F77_NAME_MANGLER']('sgesv') test_src = lapack_sgesv % sgesv_string From numpy-svn at scipy.org Mon Nov 5 05:26:31 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 5 Nov 2007 04:26:31 -0600 (CST) Subject: [Numpy-svn] r4389 - branches/numpy.scons/numpy/distutils/scons/checkers Message-ID: <20071105102631.BD75B39C2C9@new.scipy.org> Author: cdavid Date: 2007-11-05 04:26:27 -0600 (Mon, 05 Nov 2007) New Revision: 4389 Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py Log: Fix missing env def in custom checkers. Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-05 10:23:07 UTC (rev 4388) +++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-05 10:26:27 UTC (rev 4389) @@ -68,6 +68,8 @@ return 0 def CheckLAPACK(context, autoadd = 1): + env = context.env + # If section lapack is in site.cfg, use those options. Otherwise, use default section = "lapack" siteconfig, cfgfiles = get_config() @@ -88,8 +90,6 @@ return st else: - env = context.env - # Get fortran stuff if not env.has_key('F77_NAME_MANGLER'): if not CheckF77Mangling(context): From numpy-svn at scipy.org Mon Nov 5 06:40:11 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 5 Nov 2007 05:40:11 -0600 (CST) Subject: [Numpy-svn] r4390 - branches/numpy.scons/numpy/distutils/scons/checkers Message-ID: <20071105114011.5CA4239C2E7@new.scipy.org> Author: cdavid Date: 2007-11-05 05:40:06 -0600 (Mon, 05 Nov 2007) New Revision: 4390 Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py Log: Make it possible to disable a perflib from env variable. Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-05 10:26:27 UTC (rev 4389) +++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-05 11:40:06 UTC (rev 4390) @@ -41,10 +41,10 @@ if st: add_info(env, 'cblas', opts) return st - #st, opts = CheckVeclib(context, autoadd) - #if st: - # add_info(env, 'cblas', opt_info('vecLib')) - # return st + st, opts = CheckVeclib(context, autoadd) + if st: + add_info(env, 'cblas', opt_info('vecLib')) + return st add_info(env, 'cblas', 'Def numpy implementation used') return 0 @@ -88,6 +88,11 @@ if st: add_info(env, 'lapack: Accelerate', opts) return st + st, opts = CheckAccelerate(context, autoadd) + if st: + if st: + add_info(env, 'lapack: vecLib', opts) + return st else: # Get fortran stuff Modified: branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-11-05 10:26:27 UTC (rev 4389) +++ branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-11-05 11:40:06 UTC (rev 4390) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Wed Oct 31 08:00 PM 2007 J +# Last Change: Mon Nov 05 07:00 PM 2007 J # This module defines checkers for performances libs providing standard API, # such as MKL (Intel), ATLAS, Sunperf (solaris and linux), Accelerate (Mac OS @@ -8,6 +8,7 @@ # Generally, you don't use those directly: they are used in 'meta' checkers, # such as BLAS, CBLAS, LAPACK checkers. import re +import os from os.path import join as pjoin from numpy.distutils.system_info import default_lib_dirs @@ -29,6 +30,13 @@ See CheckATLAS or CheckMKL for examples.""" context.Message("Checking %s ... " % name) + try: + value = os.environ[name] + if value == 'None': + return context.Result('Disabled from env through var %s !' % name), {} + except KeyError: + pass + # Get site.cfg customization if any siteconfig, cfgfiles = get_config() (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) @@ -200,7 +208,7 @@ return _check(context, name, section, defopts, headers, funcs, check_version, None, autoadd) -def CheckVeclib(context, autoadd = 1): +def CheckVeclib(context, autoadd = 1, check_version = 0): """Checker for Veclib framework (on Mac OS X < 10.3).""" name = 'Framework: Accelerate' # XXX: does it make sense to customize mac os X frameworks ? From numpy-svn at scipy.org Mon Nov 5 06:40:39 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 5 Nov 2007 05:40:39 -0600 (CST) Subject: [Numpy-svn] r4391 - in branches/numpy.scons/numpy/distutils/scons: . doc Message-ID: <20071105114039.ECA0C39C2E7@new.scipy.org> Author: cdavid Date: 2007-11-05 05:40:33 -0600 (Mon, 05 Nov 2007) New Revision: 4391 Added: branches/numpy.scons/numpy/distutils/scons/Changelog Modified: branches/numpy.scons/numpy/distutils/scons/doc/TODO Log: Add a changelog, update TODO Added: branches/numpy.scons/numpy/distutils/scons/Changelog =================================================================== --- branches/numpy.scons/numpy/distutils/scons/Changelog 2007-11-05 11:40:06 UTC (rev 4390) +++ branches/numpy.scons/numpy/distutils/scons/Changelog 2007-11-05 11:40:33 UTC (rev 4391) @@ -0,0 +1,33 @@ +Mon, 05 Nov 2007 19:44:07 +0900 (2nd alpha) +User-visible Changes: + * numpy/distutils/scons/checkers + Perflib checkers (MKL, ATLAS, etc...) can be disabled by using + NAME=None at the environment, and overriden through site.cfg + + * numpy/distutils/scons/checkers + LAPACK checker now checks Accelerate and vecLib on Darwin (Mac OS X) + + * numpy/distutils/scons/checkers + CBLAS checker supports ATLAS, MKL, Sunperf, and Accelerate/vecLib + frameworks. + + * numpy/distutils/scons/fortrahn + Fortran checkers for name mangling and link options for C/Fortran + interop added + + * Basic documentation on wiki + + * sdist command now works + + * show_config knows show meaningful informations (per package + configuration). + +Internal changes: + * Compilation options are now found from a CompilerConfig object, for + easier customization. + + * Heavy refactorization of perflib checkers; most of the code is now + shared by all of them. + + * Configuration options for libraries checkers is now passed through + configuration object Modified: branches/numpy.scons/numpy/distutils/scons/doc/TODO =================================================================== --- branches/numpy.scons/numpy/distutils/scons/doc/TODO 2007-11-05 11:40:06 UTC (rev 4390) +++ branches/numpy.scons/numpy/distutils/scons/doc/TODO 2007-11-05 11:40:33 UTC (rev 4391) @@ -1,6 +1,9 @@ Before second alpha (in order of priority): - - Basic warn, debug and optim flags : at least gcc+linux, mingw, VS, gcc+mac - os x, and posix ? (~ 2 hours). + - CheckHeader and CheckLib ala scons, with site.cfg support. + - Finish refactorization of perflib and custom checkers: check with + test_snippets in meta checkers, make meta-checkers overridable through + site.cfg + - f2py: supports the macro in doc/FORTRAN Before first beta: - f2py and scipy interoperability: N hours @@ -27,7 +30,6 @@ Implementation details: - Refactor code for API generation (numpy/core/code_generators) -> Mostly done - - Refactor code organization in numpy/distutils/scons Tests: - What can be tested ? From numpy-svn at scipy.org Mon Nov 5 10:01:09 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 5 Nov 2007 09:01:09 -0600 (CST) Subject: [Numpy-svn] r4392 - in branches/numpy.scons/numpy/distutils: command scons scons/doc Message-ID: <20071105150109.8A31B39C013@new.scipy.org> Author: cdavid Date: 2007-11-05 09:00:21 -0600 (Mon, 05 Nov 2007) New Revision: 4392 Modified: branches/numpy.scons/numpy/distutils/command/scons.py branches/numpy.scons/numpy/distutils/scons/doc/TODO branches/numpy.scons/numpy/distutils/scons/numpyenv.py Log: Starts supporting env wo fcompiler for scons Modified: branches/numpy.scons/numpy/distutils/command/scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/scons.py 2007-11-05 11:40:33 UTC (rev 4391) +++ branches/numpy.scons/numpy/distutils/command/scons.py 2007-11-05 15:00:21 UTC (rev 4392) @@ -173,7 +173,8 @@ verbose = self.verbose, dry_run = self.dry_run, force = self.force) - self.fcompiler.customize(self.distribution) + if self.fcompiler is not None: + self.fcompiler.customize(self.distribution) def run(self): # XXX: when a scons script is missing, scons only prints warnings, and @@ -201,8 +202,9 @@ cmd.append('cc_opt=%s' % dist2sconscc(self.compiler)) cmd.append('cc_opt_path=%s' % protect_path(get_tool_path(self.compiler))) - cmd.append('f77_opt=%s' % dist2sconsfc(self.fcompiler)) - cmd.append('f77_opt_path=%s' % protect_path(get_f77_tool_path(self.fcompiler))) + if self.fcompiler: + cmd.append('f77_opt=%s' % dist2sconsfc(self.fcompiler)) + cmd.append('f77_opt_path=%s' % protect_path(get_f77_tool_path(self.fcompiler))) cmd.append('include_bootstrap=%s' % dirl_to_str(get_numpy_include_dirs())) if self.silent: Modified: branches/numpy.scons/numpy/distutils/scons/doc/TODO =================================================================== --- branches/numpy.scons/numpy/distutils/scons/doc/TODO 2007-11-05 11:40:33 UTC (rev 4391) +++ branches/numpy.scons/numpy/distutils/scons/doc/TODO 2007-11-05 15:00:21 UTC (rev 4392) @@ -4,6 +4,7 @@ test_snippets in meta checkers, make meta-checkers overridable through site.cfg - f2py: supports the macro in doc/FORTRAN + - support environments wo fortran compilers Before first beta: - f2py and scipy interoperability: N hours Modified: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-11-05 11:40:33 UTC (rev 4391) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-11-05 15:00:21 UTC (rev 4392) @@ -167,13 +167,13 @@ # scons could not understand cc_opt (bad name ?) raise AssertionError("SCONS: Could not initialize tool ? Error is %s" % \ str(e)) + # XXX: really have to understand how fortran compilers work in scons... + env['F77'] = env['_FORTRAND'] else: - t = Tool(FindTool(DEF_FORTRAN_COMPILERS)) - t(env) + raise NotImplementedError('FIXME: Support for env wo fcompiler not tested yet !') + #t = Tool(FindTool(DEF_FORTRAN_COMPILERS)) + #t(env) - # XXX: really have to understand how fortran compilers work in scons... - env['F77'] = env['_FORTRAND'] - # XXX: Really, we should use our own subclass of Environment, instead of # adding Numpy* functions ! From numpy-svn at scipy.org Mon Nov 5 15:36:06 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 5 Nov 2007 14:36:06 -0600 (CST) Subject: [Numpy-svn] r4393 - trunk Message-ID: <20071105203606.D9A3539C172@new.scipy.org> Author: jarrod.millman Date: 2007-11-05 14:36:03 -0600 (Mon, 05 Nov 2007) New Revision: 4393 Modified: trunk/setup.py Log: remove old reference to deleted file (r4384) Modified: trunk/setup.py =================================================================== --- trunk/setup.py 2007-11-05 15:00:21 UTC (rev 4392) +++ trunk/setup.py 2007-11-05 20:36:03 UTC (rev 4393) @@ -50,7 +50,6 @@ config.add_data_files(('numpy','*.txt'), ('numpy','COMPATIBILITY'), - ('numpy','scipy_compatibility'), ('numpy','site.cfg.example')) config.get_version('numpy/version.py') # sets config.version From numpy-svn at scipy.org Mon Nov 5 15:44:08 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 5 Nov 2007 14:44:08 -0600 (CST) Subject: [Numpy-svn] r4394 - tags Message-ID: <20071105204408.7BCAE39C137@new.scipy.org> Author: jarrod.millman Date: 2007-11-05 14:44:05 -0600 (Mon, 05 Nov 2007) New Revision: 4394 Added: tags/1.0.4/ Log: Create the new release tag. Copied: tags/1.0.4 (from rev 4393, trunk) From numpy-svn at scipy.org Mon Nov 5 15:47:45 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 5 Nov 2007 14:47:45 -0600 (CST) Subject: [Numpy-svn] r4395 - trunk/numpy Message-ID: <20071105204745.136DB39C137@new.scipy.org> Author: jarrod.millman Date: 2007-11-05 14:47:43 -0600 (Mon, 05 Nov 2007) New Revision: 4395 Modified: trunk/numpy/version.py Log: This is the development code for the 1.0.5 release Modified: trunk/numpy/version.py =================================================================== --- trunk/numpy/version.py 2007-11-05 20:44:05 UTC (rev 4394) +++ trunk/numpy/version.py 2007-11-05 20:47:43 UTC (rev 4395) @@ -1,4 +1,4 @@ -version='1.0.4' +version='1.0.5' release=False if not release: From numpy-svn at scipy.org Mon Nov 5 15:48:58 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 5 Nov 2007 14:48:58 -0600 (CST) Subject: [Numpy-svn] r4396 - tags/1.0.4/numpy Message-ID: <20071105204858.C1C6C39C137@new.scipy.org> Author: jarrod.millman Date: 2007-11-05 14:48:57 -0600 (Mon, 05 Nov 2007) New Revision: 4396 Modified: tags/1.0.4/numpy/version.py Log: Making release candidate. Modified: tags/1.0.4/numpy/version.py =================================================================== --- tags/1.0.4/numpy/version.py 2007-11-05 20:47:43 UTC (rev 4395) +++ tags/1.0.4/numpy/version.py 2007-11-05 20:48:57 UTC (rev 4396) @@ -1,4 +1,4 @@ -version='1.0.4' +version='1.0.4-rc1' release=False if not release: From numpy-svn at scipy.org Mon Nov 5 23:19:33 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 5 Nov 2007 22:19:33 -0600 (CST) Subject: [Numpy-svn] r4397 - branches/numpy.scons/numpy/distutils/scons/checkers Message-ID: <20071106041933.DB8C439C1A3@new.scipy.org> Author: cdavid Date: 2007-11-05 22:19:29 -0600 (Mon, 05 Nov 2007) New Revision: 4397 Modified: branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py Log: - Remove trailing \n in source test code for header in perflib Modified: branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-11-05 20:48:57 UTC (rev 4396) +++ branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-11-06 04:19:29 UTC (rev 4397) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Mon Nov 05 07:00 PM 2007 J +# Last Change: Tue Nov 06 01:00 PM 2007 J # This module defines checkers for performances libs providing standard API, # such as MKL (Intel), ATLAS, Sunperf (solaris and linux), Accelerate (Mac OS @@ -53,7 +53,7 @@ saved = save_and_set(env, opts) try: # XXX: add dep vars in code - src = '\n'.join([r'#include <%s>\n' % h for h in headers_to_check]) + src = '\n'.join([r'#include <%s>' % h for h in headers_to_check]) st = context.TryCompile(src, '.c') finally: restore(env, saved) From numpy-svn at scipy.org Mon Nov 5 23:39:54 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 5 Nov 2007 22:39:54 -0600 (CST) Subject: [Numpy-svn] r4398 - in branches/numpy.scons: . numpy/distutils/scons/checkers numpy/scons_fake/checkers Message-ID: <20071106043954.1C67339C26D@new.scipy.org> Author: cdavid Date: 2007-11-05 22:39:41 -0600 (Mon, 05 Nov 2007) New Revision: 4398 Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py branches/numpy.scons/numpy/distutils/scons/checkers/support.py branches/numpy.scons/numpy/scons_fake/checkers/SConstruct branches/numpy.scons/test.sh Log: Refactor check_include_and_run to use ConfigOpts Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-06 04:19:29 UTC (rev 4397) +++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-06 04:39:41 UTC (rev 4398) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Mon Nov 05 07:00 PM 2007 J +# Last Change: Tue Nov 06 01:00 PM 2007 J # Module for custom, common checkers for numpy (and scipy) import sys @@ -18,6 +18,15 @@ from support import check_include_and_run def CheckCBLAS(context, autoadd = 1): + """This checker tries to find optimized library for cblas. + + This test is pretty strong: it first detects an optimized library, and then + tests that a simple cblas program can be run using this lib. + + It looks for the following libs: + - Mac OS X: Accelerate, and then vecLib. + - Others: MKL, then ATLAS, then Sunperf.""" + # XXX: rpath vs LD_LIBRARY_PATH ? env = context.env # If section cblas is in site.cfg, use those options. Otherwise, use default @@ -37,31 +46,52 @@ return st else: if sys.platform == 'darwin': - st, opts = CheckAccelerate(context, autoadd) + st, res = CheckAccelerate(context, autoadd) if st: - add_info(env, 'cblas', opts) + st = check_include_and_run(context, 'CBLAS (Accelerate Framework)', + res.cfgopts, ['cblas.h'], cblas_src, autoadd) + if st: + add_info(env, 'cblas', res) return st - st, opts = CheckVeclib(context, autoadd) + + st, res = CheckVeclib(context, autoadd) if st: - add_info(env, 'cblas', opt_info('vecLib')) + st = check_include_and_run(context, 'CBLAS (vecLib Framework)', + res.cfgopts, ['cblas.h'], cblas_src, autoadd) + if st: + add_info(env, 'cblas', res) return st add_info(env, 'cblas', 'Def numpy implementation used') return 0 else: - # Check MKL, then ATLAS, then Sunperf - st, opts = CheckMKL(context, autoadd) + # XXX: think about how to share headers info between checkers ? + # Check MKL + st, res = CheckMKL(context, autoadd) if st: - add_info(env, 'cblas', opts) + st = check_include_and_run(context, 'CBLAS (MKL)', res.cfgopts, + [], cblas_src, autoadd) + if st: + add_info(env, 'cblas', res) return st - st, opts = CheckATLAS(context, autoadd) + + # Check ATLAS + st, res = CheckATLAS(context, autoadd) if st: - add_info(env, 'cblas', opts) + st = check_include_and_run(context, 'CBLAS (ATLAS)', res.cfgopts, + ['cblas.h'], cblas_src, autoadd) + if st: + add_info(env, 'cblas', res) return st - st, opts = CheckSunperf(context, autoadd) + + # Check Sunperf + st, res = CheckSunperf(context, autoadd) if st: - add_info(env, 'cblas', opts) + st = check_include_and_run(context, 'CBLAS (Sunperf)', res.cfgopts, + ['sunperf.h'], cblas_src, autoadd) + if st: + add_info(env, 'cblas', res) return st add_info(env, 'cblas', 'Def numpy implementation used') Modified: branches/numpy.scons/numpy/distutils/scons/checkers/support.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/support.py 2007-11-06 04:19:29 UTC (rev 4397) +++ branches/numpy.scons/numpy/distutils/scons/checkers/support.py 2007-11-06 04:39:41 UTC (rev 4398) @@ -1,10 +1,12 @@ #! /usr/bin/env python -# Last Change: Mon Nov 05 05:00 PM 2007 J +# Last Change: Tue Nov 06 01:00 PM 2007 J # This module defines some helper functions, to be used by high level checkers from copy import deepcopy +# Tools to save and restore environments construction variables (the ones often +# altered for configuration tests) _arg2env = {'cpppath' : 'CPPPATH', 'cflags' : 'CFLAGS', 'libpath' : 'LIBPATH', @@ -33,26 +35,6 @@ kw = dict(kw) env.Replace(**kw) -def check_symbol(context, headers, sym, extra = r''): - # XXX: add dep vars in code - #code = [r'#include <%s>' %h for h in headers] - code = [] - code.append(r''' -#undef %(func)s -#ifdef __cplusplus -extern "C" -#endif -char %(func)s(); - -int main() -{ -return %(func)s(); -return 0; -} -''' % {'func' : sym}) - code.append(extra) - return context.TryLink('\n'.join(code), '.c') - class ConfigOpts: # Any added key should be added as an argument to __init__ _keys = ['cpppath', 'cflags', 'libpath', 'libs', 'linkflags', 'rpath', @@ -108,18 +90,39 @@ msg = [r'%s : %s' % (k, i) for k, i in self.data.items()] return '\n'.join(msg) +# Implementation function to check symbol in a library +def check_symbol(context, headers, sym, extra = r''): + # XXX: add dep vars in code + #code = [r'#include <%s>' %h for h in headers] + code = [] + code.append(r''' +#undef %(func)s +#ifdef __cplusplus +extern "C" +#endif +char %(func)s(); + +int main() +{ +return %(func)s(); +return 0; +} +''' % {'func' : sym}) + code.append(extra) + return context.TryLink('\n'.join(code), '.c') + class ConfigRes: def __init__(self, name, cfgopts, origin, version = None): self.name = name - self.data = cfgopts.data + self.cfgopts = cfgopts self.origin = origin self.version = version def __getitem__(self, key): - return self.data[key] + return self.cfgopts.data[key] def __setitem__(self, key, item): - self.data[key] = item + self.cfgopts.data[key] = item def is_customized(self): return bool(self.origin) @@ -131,7 +134,7 @@ else: msg += [' Using default configuration:'] - msg += [' %s : %s' % (k, i) for k, i in self.data.items() if len(i) > 0] + msg += [' %s : %s' % (k, i) for k, i in self.cfgopts.data.items() if len(i) > 0] msg += [' Version is : %s' % self.version] return '\n'.join(msg) @@ -161,12 +164,10 @@ if ret == 0 or autoadd == 0: env.Replace(CPPPATH = oldCPPPATH) env.Replace(CFLAGS = oldCFLAGS) - return 0 return ret -def check_include_and_run(context, name, cpppath, headers, run_src, libs, - libpath, linkflags, cflags, autoadd = 1): +def check_include_and_run(context, name, opts, headers, run_src, autoadd = 1): """This is a basic implementation for generic "test include and run" testers. @@ -188,36 +189,29 @@ context.Message('Checking for %s ... ' % name) env = context.env - ret = _check_headers(context, cpppath, cflags, headers, autoadd) + ret = _check_headers(context, opts['cpppath'], opts['cflags'], headers, + autoadd) if not ret: - context.Result('Failed: %s include not found' % name) + context.Result('Failed: %s include not found' % name) + return 0 #------------------------------ # Check a simple example works #------------------------------ - oldLIBPATH = (env.has_key('LIBPATH') and deepcopy(env['LIBPATH'])) or [] - oldLIBS = (env.has_key('LIBS') and deepcopy(env['LIBS'])) or [] - # XXX: RPATH, drawbacks using it ? - oldRPATH = (env.has_key('RPATH') and deepcopy(env['RPATH'])) or [] - oldLINKFLAGS = (env.has_key('LINKFLAGS') and deepcopy(env['LINKFLAGS'])) or [] - env.AppendUnique(LIBPATH = libpath) - env.AppendUnique(LIBS = libs) - env.AppendUnique(RPATH = libpath) - env.AppendUnique(LINKFLAGS = linkflags) + saved = save_and_set(env, opts) + try: + # XXX: reenable this + ## HACK: we add libpath and libs at the end of the source as a comment, to + ## add dependency of the check on those. + #src = '\n'.join(['#include <%s>' % h for h in headers] +\ + # [run_src, '#if 0', '%s' % libpath, + # '%s' % headers, '%s' % libs, '#endif']) + ret = context.TryRun(src, '.c') + except: + if (not ret or not autoadd): + # If test failed or autoadd is disabled, restore everything + restore(env, saved) - # HACK: we add libpath and libs at the end of the source as a comment, to - # add dependency of the check on those. - src = '\n'.join(['#include <%s>' % h for h in headers] +\ - [run_src, '#if 0', '%s' % libpath, - '%s' % headers, '%s' % libs, '#endif']) - ret = context.TryLink(src, '.c') - if (not ret or not autoadd): - # If test failed or autoadd = 0, restore everything - env.Replace(LIBS = oldLIBS) - env.Replace(LIBPATH = oldLIBPATH) - env.Replace(RPATH = oldRPATH) - env.Replace(LINKFLAGS = oldLINKFLAGS) - if not ret: context.Result('Failed: %s test could not be linked and run' % name) return 0 Modified: branches/numpy.scons/numpy/scons_fake/checkers/SConstruct =================================================================== --- branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-11-06 04:19:29 UTC (rev 4397) +++ branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-11-06 04:39:41 UTC (rev 4398) @@ -2,6 +2,7 @@ from numpy.distutils.scons import GetNumpyEnvironment from numpy.distutils.scons.checkers.perflib import \ CheckATLAS, CheckAccelerate, CheckMKL, CheckSunperf +from numpy.distutils.scons.checkers.custom_checkers import CheckCBLAS env = GetNumpyEnvironment(ARGUMENTS) @@ -16,6 +17,7 @@ {'CheckATLAS' : CheckATLAS, 'CheckMKL' : CheckMKL, 'CheckAccelerate' : CheckAccelerate, + 'CheckCBLAS' : CheckCBLAS, 'CheckSunperf' : CheckSunperf}) do_check = 1 @@ -30,9 +32,12 @@ if st: print opts st, opts = config.CheckSunperf(autoadd = 0) + if st: + print opts + st = config.CheckCBLAS(autoadd = 0) if env.has_key('LIBS'): - print env.Dump('LIBS') + print "LIBS of env is %s" % env.Dump('LIBS') else: print "No LIBS in env" Modified: branches/numpy.scons/test.sh =================================================================== --- branches/numpy.scons/test.sh 2007-11-06 04:19:29 UTC (rev 4397) +++ branches/numpy.scons/test.sh 2007-11-06 04:39:41 UTC (rev 4398) @@ -1,5 +1,5 @@ PREFIX=$PWD rm -rf $PREFIX/build rm -rf $PREFIX/tmp -python setup.py scons --jobs=4 install --prefix=$PREFIX/tmp +MKL=None python setup.py scons --jobs=4 install --prefix=$PREFIX/tmp (cd $PREFIX/tmp && PYTHONPATH=$PREFIX/tmp/lib/python2.5/site-packages python -c "import numpy; print numpy; numpy.test(level = 9999)") From numpy-svn at scipy.org Tue Nov 6 01:19:53 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 6 Nov 2007 00:19:53 -0600 (CST) Subject: [Numpy-svn] r4399 - in branches/numpy.scons: . numpy/distutils/scons/checkers numpy/scons_fake/checkers Message-ID: <20071106061953.BE6CB39C1E4@new.scipy.org> Author: cdavid Date: 2007-11-06 00:19:44 -0600 (Tue, 06 Nov 2007) New Revision: 4399 Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py branches/numpy.scons/numpy/distutils/scons/checkers/support.py branches/numpy.scons/numpy/scons_fake/checkers/SConstruct branches/numpy.scons/test.sh Log: CBLAS and LAPACK checkers are refactored to use ConfigOpts Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-06 04:39:41 UTC (rev 4398) +++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-06 06:19:44 UTC (rev 4399) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Tue Nov 06 01:00 PM 2007 J +# Last Change: Tue Nov 06 02:00 PM 2007 J # Module for custom, common checkers for numpy (and scipy) import sys @@ -17,6 +17,9 @@ from perflib import CheckMKL, CheckATLAS, CheckSunperf, CheckAccelerate from support import check_include_and_run +# XXX: many perlib can be used from both C and F (Atlas being a notable +# exception for LAPACK). So shall we make the difference between BLAS, CBLAS, +# LAPACK and CLAPACK ? How to test for fortran ? def CheckCBLAS(context, autoadd = 1): """This checker tries to find optimized library for cblas. @@ -71,7 +74,7 @@ st, res = CheckMKL(context, autoadd) if st: st = check_include_and_run(context, 'CBLAS (MKL)', res.cfgopts, - [], cblas_src, autoadd) + ['mkl.h'], cblas_src, autoadd) if st: add_info(env, 'cblas', res) return st @@ -98,6 +101,14 @@ return 0 def CheckLAPACK(context, autoadd = 1): + """This checker tries to find optimized library for lapack. + + This test is pretty strong: it first detects an optimized library, and then + tests that a simple cblas program can be run using this lib. + + It looks for the following libs: + - Mac OS X: Accelerate, and then vecLib. + - Others: MKL, then ATLAS.""" env = context.env # If section lapack is in site.cfg, use those options. Otherwise, use default @@ -112,6 +123,7 @@ import warnings warning.warn('FIXME: LAPACK checks not implemented yet on win32') return 0 + if sys.platform == 'darwin': st, opts = CheckAccelerate(context, autoadd) if st: @@ -125,7 +137,7 @@ return st else: - # Get fortran stuff + # Get fortran stuff (See XXX at the top on F77 vs C) if not env.has_key('F77_NAME_MANGLER'): if not CheckF77Mangling(context): return 0 @@ -133,41 +145,28 @@ if not CheckF77Clib(context): return 0 - # XXX: all the code below is a mess, refactor it with new code from - # support module. - # Get the mangled name of our test function sgesv_string = env['F77_NAME_MANGLER']('sgesv') test_src = lapack_sgesv % sgesv_string # Check MKL - st, opts = CheckMKL(context, autoadd = 1) + st, res = CheckMKL(context, autoadd) if st: - fdict = env.ParseFlags(context.env['F77_LDFLAGS']) - fdict['LIBS'].append('lapack') - if env.has_key('LIBS'): - fdict['LIBS'].extend(context.env['LIBS']) - if env.has_key('LIBPATH'): - fdict['LIBPATH'].extend(context.env['LIBPATH']) - st = check_include_and_run(context, 'LAPACK (MKL)', [], [], - test_src, fdict['LIBS'], fdict['LIBPATH'], [], [], autoadd = 1) + # Intel recommends linking lapack before mkl, guide and co + res.cfgopts['libs'].insert(0, 'lapack') + st = check_include_and_run(context, 'LAPACK (MKL)', res.cfgopts, + [], test_src, autoadd) if st: - add_info(env, 'lapack', opts) + add_info(env, 'lapack', res) return st # Check ATLAS st, opts = CheckATLAS(context, autoadd = 1) if st: - fdict = env.ParseFlags(context.env['F77_LDFLAGS']) - fdict['LIBS'].append('lapack') - if env.has_key('LIBS'): - fdict['LIBS'].extend(context.env['LIBS']) - if env.has_key('LIBPATH'): - fdict['LIBPATH'].extend(context.env['LIBPATH']) - st = check_include_and_run(context, 'LAPACK (ATLAS)', [], [], - test_src, fdict['LIBS'], fdict['LIBPATH'], [], [], autoadd = 1) + st = check_include_and_run(context, 'LAPACK (ATLAS)', res.cfgopts, + [], test_src, autoadd) if st: - add_info(env, 'lapack', opts) + add_info(env, 'lapack', res) # XXX: Check complete LAPACK or not. (Checking for not # implemented lapack symbols ?) return st Modified: branches/numpy.scons/numpy/distutils/scons/checkers/support.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/support.py 2007-11-06 04:39:41 UTC (rev 4398) +++ branches/numpy.scons/numpy/distutils/scons/checkers/support.py 2007-11-06 06:19:44 UTC (rev 4399) @@ -200,14 +200,12 @@ #------------------------------ saved = save_and_set(env, opts) try: - # XXX: reenable this - ## HACK: we add libpath and libs at the end of the source as a comment, to - ## add dependency of the check on those. - #src = '\n'.join(['#include <%s>' % h for h in headers] +\ - # [run_src, '#if 0', '%s' % libpath, - # '%s' % headers, '%s' % libs, '#endif']) - ret = context.TryRun(src, '.c') - except: + # HACK: we add libpath and libs at the end of the source as a comment, to + # add dependency of the check on those. + src = '\n'.join([r'#include <%s>' % h for h in headers] +\ + [run_src, r'#if 0', r'%s' % str(opts), r'#endif', '\n']) + ret, out = context.TryRun(src, '.c') + finally: if (not ret or not autoadd): # If test failed or autoadd is disabled, restore everything restore(env, saved) Modified: branches/numpy.scons/numpy/scons_fake/checkers/SConstruct =================================================================== --- branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-11-06 04:39:41 UTC (rev 4398) +++ branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-11-06 06:19:44 UTC (rev 4399) @@ -2,7 +2,7 @@ from numpy.distutils.scons import GetNumpyEnvironment from numpy.distutils.scons.checkers.perflib import \ CheckATLAS, CheckAccelerate, CheckMKL, CheckSunperf -from numpy.distutils.scons.checkers.custom_checkers import CheckCBLAS +from numpy.distutils.scons.checkers.custom_checkers import CheckCBLAS, CheckLAPACK env = GetNumpyEnvironment(ARGUMENTS) @@ -18,23 +18,17 @@ 'CheckMKL' : CheckMKL, 'CheckAccelerate' : CheckAccelerate, 'CheckCBLAS' : CheckCBLAS, + 'CheckLAPACK' : CheckLAPACK, 'CheckSunperf' : CheckSunperf}) do_check = 1 if do_check: st, opts = config.CheckATLAS(autoadd = 0) - if st: - print opts st, opts = config.CheckMKL(autoadd = 0) - if st: - print opts st, opts = config.CheckAccelerate(autoadd = 0) - if st: - print opts st, opts = config.CheckSunperf(autoadd = 0) - if st: - print opts st = config.CheckCBLAS(autoadd = 0) + st = config.CheckLAPACK(autoadd = 0) if env.has_key('LIBS'): print "LIBS of env is %s" % env.Dump('LIBS') Modified: branches/numpy.scons/test.sh =================================================================== --- branches/numpy.scons/test.sh 2007-11-06 04:39:41 UTC (rev 4398) +++ branches/numpy.scons/test.sh 2007-11-06 06:19:44 UTC (rev 4399) @@ -1,5 +1,5 @@ PREFIX=$PWD rm -rf $PREFIX/build rm -rf $PREFIX/tmp -MKL=None python setup.py scons --jobs=4 install --prefix=$PREFIX/tmp -(cd $PREFIX/tmp && PYTHONPATH=$PREFIX/tmp/lib/python2.5/site-packages python -c "import numpy; print numpy; numpy.test(level = 9999)") +python setup.py scons --jobs=4 install --prefix=$PREFIX/tmp +(cd $PREFIX/tmp && PYTHONPATH=$PREFIX/tmp/lib/python2.5/site-packages python -c "import numpy; print numpy; numpy.test(level = 9999); numpy.show_config()") From numpy-svn at scipy.org Tue Nov 6 02:58:52 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 6 Nov 2007 01:58:52 -0600 (CST) Subject: [Numpy-svn] r4400 - in branches/numpy.scons/numpy/distutils/scons: . checkers Message-ID: <20071106075852.2095239C030@new.scipy.org> Author: cdavid Date: 2007-11-06 01:58:46 -0600 (Tue, 06 Nov 2007) New Revision: 4400 Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py Log: LAPACK and CBLAS checkers are now overridable by site.cfg Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-06 06:19:44 UTC (rev 4399) +++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-06 07:58:46 UTC (rev 4400) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Tue Nov 06 02:00 PM 2007 J +# Last Change: Tue Nov 06 04:00 PM 2007 J # Module for custom, common checkers for numpy (and scipy) import sys @@ -15,11 +15,12 @@ from numpy.distutils.scons.configuration import add_info from perflib import CheckMKL, CheckATLAS, CheckSunperf, CheckAccelerate -from support import check_include_and_run +from support import check_include_and_run, ConfigOpts, ConfigRes # XXX: many perlib can be used from both C and F (Atlas being a notable # exception for LAPACK). So shall we make the difference between BLAS, CBLAS, # LAPACK and CLAPACK ? How to test for fortran ? + def CheckCBLAS(context, autoadd = 1): """This checker tries to find optimized library for cblas. @@ -37,16 +38,13 @@ siteconfig, cfgfiles = get_config() (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) if found: - raise NotImplementedError("FIXME: siteconfig for cblas") - # XXX: adapt this to libperf refactor - headers = ['cblas.h'] - linkflags = [] - cflags = [] - st = check_include_and_run(context, 'CBLAS', [], headers, cblas_src, - libs, libpath, linkflags, cflags, autoadd) + cfg = ConfigOpts(cpppath = cpppath, libs = libs, libpath = libpath, + rpath = libpath) + st = check_include_and_run(context, 'CBLAS (from site.cfg) ', cfg, + [], cblas_src, autoadd) if st: - add_info(env, 'cblas', opt_info('cblas', site = 1)) - return st + add_info(env, 'cblas', ConfigRes('cblas', cfg, found)) + return st else: if sys.platform == 'darwin': st, res = CheckAccelerate(context, autoadd) @@ -116,8 +114,25 @@ siteconfig, cfgfiles = get_config() (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) if found: - raise NotImplementedError("FIXME: siteconfig for lapack") - # XXX: adapt this to libperf refactor + cfg = ConfigOpts(cpppath = cpppath, libs = libs, libpath = libpath, + rpath = libpath) + + if not env.has_key('F77_NAME_MANGLER'): + if not CheckF77Mangling(context): + return 0 + if not env.has_key('F77_LDFLAGS'): + if not CheckF77Clib(context): + return 0 + + # Get the mangled name of our test function + sgesv_string = env['F77_NAME_MANGLER']('sgesv') + test_src = lapack_sgesv % sgesv_string + + st = check_include_and_run(context, 'LAPACK (from site.cfg) ', cfg, + [], test_src, autoadd) + if st: + add_info(env, 'lapack', ConfigRes('lapack', cfg, found)) + return st else: if sys.platform == 'nt': import warnings @@ -172,78 +187,3 @@ return st return 0 - -def _my_try_link(context, src, libs, libpath, autoadd = 0): - """Try to link the given text in src with libs and libpath.""" - env = context.env - - oldLIBS = (env.has_key('LIBS') and deepcopy(env['LIBS'])) or [] - oldLIBPATH = (env.has_key('LIBPATH') and deepcopy(env['LIBPATH'])) or [] - - ret = 0 - try: - env.AppendUnique(LIBS = libs, LIBPATH = libpath) - ret = context.TryLink(src, '.c') - finally: - if not ret or not autoadd: - env.Replace(LIBS = oldLIBS, LIBPATH = oldLIBPATH) - - return ret - -def CheckGenericBLAS(context, autoadd = 1, section = 'blas'): - """Check whether a BLAS library can be found. - - Use site.cfg if found (section given by section argument).""" - siteconfig, cfgfiles = get_config() - (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) - if not found: - libs.extend(['blas']) - - env = context.env - # Get fortran mangling - if not env.has_key('F77_NAME_MANGLER'): - if not CheckF77Mangling(context): - return 0 - - test_func_name = env['F77_NAME_MANGLER']('dgemm') - src = get_func_link_src(test_func_name) - - context.Message("Checking for Generic BLAS... ") - - st = _my_try_link(context, src, libs, libpath, autoadd) - if st: - env['F77_BLAS_LIBS'] = libs - env['F77_BLAS_LIBPATH'] = libpath - - context.Result(st) - - return st - -def CheckGenericLAPACK(context, autoadd = 1, section = 'lapack'): - """Check whether a LAPACK library can be found. - - Use site.cfg if found (section given by section argument).""" - siteconfig, cfgfiles = get_config() - (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) - if not found: - libs.extend(['lapack']) - - env = context.env - # Get fortran mangling - if not env.has_key('F77_NAME_MANGLER'): - if not CheckF77Mangling(context): - return 0 - - test_func_name = env['F77_NAME_MANGLER']('dpotri') - src = get_func_link_src(test_func_name) - - context.Message("Checking for Generic LAPACK... ") - - st = _my_try_link(context, src, libs, libpath, autoadd) - if st: - env['F77_LAPACK_LIBS'] = libs - env['F77_LAPACK_LIBPATH'] = libpath - - context.Result(st) - - return st Modified: branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py 2007-11-06 06:19:44 UTC (rev 4399) +++ branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py 2007-11-06 07:58:46 UTC (rev 4400) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Mon Oct 29 12:00 PM 2007 J +# Last Change: Tue Nov 06 04:00 PM 2007 J # This module should contains useful test code (as strings). They are mainly # useful for checkers who need to run the tests (to check the mere presence of @@ -7,7 +7,14 @@ # Check whether CBLAS sgemm works cblas_sgemm = r""" +enum CBLAS_ORDER {CblasRowMajor=101, CblasColMajor=102}; +enum CBLAS_TRANSPOSE {CblasNoTrans=111, CblasTrans=112, CblasConjTrans=113}; +void cblas_sgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, + const enum CBLAS_TRANSPOSE TransB, const int M, const int N, + const int K, const float alpha, const float *A, + const int lda, const float *B, const int ldb, + const float beta, float *C, const int ldc); int main (void) { From numpy-svn at scipy.org Tue Nov 6 04:04:22 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 6 Nov 2007 03:04:22 -0600 (CST) Subject: [Numpy-svn] r4401 - in branches/numpy.scons/numpy: distutils/scons distutils/scons/doc scons_fake/checkers Message-ID: <20071106090422.6D50C39C1AA@new.scipy.org> Author: cdavid Date: 2007-11-06 03:04:10 -0600 (Tue, 06 Nov 2007) New Revision: 4401 Modified: branches/numpy.scons/numpy/distutils/scons/Changelog branches/numpy.scons/numpy/distutils/scons/doc/DESIGN branches/numpy.scons/numpy/distutils/scons/doc/TODO branches/numpy.scons/numpy/distutils/scons/fortran_scons.py branches/numpy.scons/numpy/scons_fake/checkers/SConstruct Log: TODO and DESIGN documents updated, preliminary support for f2py in fortran checkers Modified: branches/numpy.scons/numpy/distutils/scons/Changelog =================================================================== --- branches/numpy.scons/numpy/distutils/scons/Changelog 2007-11-06 07:58:46 UTC (rev 4400) +++ branches/numpy.scons/numpy/distutils/scons/Changelog 2007-11-06 09:04:10 UTC (rev 4401) @@ -1,3 +1,14 @@ +Tue, 06 Nov 2007 16:48:51 +0900 +User-visible Changes: + * LAPACK and CBLAS checkers are now overridable from site.cfg + + * CheckF77Mangling and CheckF90Mangling define variables + NO_APPEND_FORTRAN, UPPERCASE_FORTRAN and UNDERSCORE_G77 (prepended by + F77_ or F90_ accordingly, e.g. F77_NO_APPEND_FORTRAN). PREPEND not + supported yet. + + * Basic design explained in doc/DESIGN + Mon, 05 Nov 2007 19:44:07 +0900 (2nd alpha) User-visible Changes: * numpy/distutils/scons/checkers Modified: branches/numpy.scons/numpy/distutils/scons/doc/DESIGN =================================================================== --- branches/numpy.scons/numpy/distutils/scons/doc/DESIGN 2007-11-06 07:58:46 UTC (rev 4400) +++ branches/numpy.scons/numpy/distutils/scons/doc/DESIGN 2007-11-06 09:04:10 UTC (rev 4401) @@ -1,4 +1,4 @@ -.. Last Change: Tue Oct 30 12:00 PM 2007 J +.. Last Change: Tue Nov 06 05:00 PM 2007 J .. vim:syntax=rest numpy.distutils.scons is basically an extension of numpy.distutils to use scons @@ -70,3 +70,71 @@ extensions are provided. I don't think static builders are necessary, since the code is unusable for any python extension, hence not really making sense for our usage. + +Global design +============= + +For now, distutils.scons consists in mainly 5 parts: + - the core part: numpyenv.py, default.py, utils.py, libinfo.py and + libinfo_scons.py + - custom builders: custom_builder.py, extension.py, extension_scons.py + - fortran support: fortran.py and fortran_scons.py. + - custom checkers: checker submodule + - additional tools: tools submodule + +Only the core is really necessary for basic scons use (that is code which does +not need BLAS/LAPACK or fortran support). Most of the other parts are necessary +for advanced only projects, which mix fortran/C code, etc... + +Core +---- + +This makes interop with distutils possible. Some small parts are also parts of +numpy.distutils. Parts which communicate directly with distutils are kept to a +bare minimum, to avoid problems when setuptools will be better supported. The +core main function is GetNumpyEnvironment, which is what user will use in +SConscripts to get environments. + +A function NumpyCheckLib is also provided, to check libraries ala autoconf +(that is by trying to link a give library with a given list of symbols). The +function is designed to behave exactly like CheckLib, except that is also +supports being overridable by site.cfg and env var (ala system_info). + +custom builders +--------------- + +For now, only building C based and Ctypes-based is supported (SWIG and Pyrex +will be next). Only the function whose names are prepended by Numpy should be +used (those take care of build dir configuration and so on). Those are +effectively scons builders. + +When you implement a new generic builder, please follow the separation: a part +which has nothing to do with numpy, and a part based on the former to take care +of build dir configuration. This enables upstream integration of some code. + +fortran support +--------------- + +This consists mainly in checkers usable from scons for mangling, link options +for Fortran/C interop, etc... + +custom_checkers +--------------- + +This submodule defines some code for custom checkers. This is where performance +libraries checks are implemented, as well as meta-checkers. The idea is that +perflib defines functions to check for one performance library (say ATLAS, +MKL), and that checkers in checkers/custom_checkers.py are 'meta' checkers +based on perflib checkers. This makes meta-checkers easy to build on existing code. + +Most of the code for perflib checkers is generic enough so that writing a new +one is easy (generally, a few lines of code). Those checkers can also +optionally find version information if you implement the version_check +function. + +Tools +----- + +For now, it implements a gfortran tool (not yet supported by upstream scons), +and a substinfile tool which is useful to generated a configuration file from a +python dictionary (think config.h.in -> config.h). Modified: branches/numpy.scons/numpy/distutils/scons/doc/TODO =================================================================== --- branches/numpy.scons/numpy/distutils/scons/doc/TODO 2007-11-06 07:58:46 UTC (rev 4400) +++ branches/numpy.scons/numpy/distutils/scons/doc/TODO 2007-11-06 09:04:10 UTC (rev 4401) @@ -1,13 +1,9 @@ Before second alpha (in order of priority): - CheckHeader and CheckLib ala scons, with site.cfg support. - - Finish refactorization of perflib and custom checkers: check with - test_snippets in meta checkers, make meta-checkers overridable through - site.cfg - - f2py: supports the macro in doc/FORTRAN - support environments wo fortran compilers Before first beta: - - f2py and scipy interoperability: N hours + - f2py and scipy interoperability: N hours ? Design questions: - improve BrokenMathlib and Mathlib in core, and make them available to Modified: branches/numpy.scons/numpy/distutils/scons/fortran_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-11-06 07:58:46 UTC (rev 4400) +++ branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-11-06 09:04:10 UTC (rev 4401) @@ -1,4 +1,4 @@ -# Last Change: Fri Nov 02 05:00 PM 2007 J +# Last Change: Tue Nov 06 05:00 PM 2007 J import os import sys import string @@ -159,6 +159,8 @@ # Fortran name mangling def _CheckFMangling(context, fc, dummym, ext): + # XXX: rewrite this in a more straightfoward manner, and support prepending + # underscore subr = """ subroutine foobar() return @@ -220,6 +222,23 @@ env.Replace(LIBS = savedLIBS) return result, mangler, u, du, c +def _set_mangling_var(context, u, du, case, type = 'F77'): + env = context.env + if du == '_': + env['%s_UNDERSCORE_G77' % type] = 1 + else: + env['%s_UNDERSCORE_G77' % type] = 0 + + if u == '_': + env['%s_NO_APPEND_FORTRAN' % type] = 0 + else: + env['%s_NO_APPEND_FORTRAN' % type] = 1 + + if case == 'upper': + env['%s_UPERCASE_FORTRAN' % type] = 1 + else: + env['%s_UPERCASE_FORTRAN' % type] = 0 + def CheckF77Mangling(context): """Find mangling of the F77 compiler. @@ -235,6 +254,7 @@ if res: context.Result("'%s', '%s', %s-case." % (u, du, c)) env['F77_NAME_MANGLER'] = mangler + _set_mangling_var(context, u, du, c, 'F77') else: context.Result("all variants failed.") return res @@ -246,6 +266,7 @@ if res: context.Result("'%s', '%s', %s-case." % (u, du, c)) env['F90_NAME_MANGLER'] = mangler + _set_mangling_var(context, u, du, c, 'F90') else: context.Result("all variants failed.") return res Modified: branches/numpy.scons/numpy/scons_fake/checkers/SConstruct =================================================================== --- branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-11-06 07:58:46 UTC (rev 4400) +++ branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-11-06 09:04:10 UTC (rev 4401) @@ -3,6 +3,7 @@ from numpy.distutils.scons.checkers.perflib import \ CheckATLAS, CheckAccelerate, CheckMKL, CheckSunperf from numpy.distutils.scons.checkers.custom_checkers import CheckCBLAS, CheckLAPACK +from numpy.distutils.scons import CheckF77Mangling env = GetNumpyEnvironment(ARGUMENTS) @@ -19,6 +20,7 @@ 'CheckAccelerate' : CheckAccelerate, 'CheckCBLAS' : CheckCBLAS, 'CheckLAPACK' : CheckLAPACK, + 'CheckF77Mangling' : CheckF77Mangling, 'CheckSunperf' : CheckSunperf}) do_check = 1 @@ -29,6 +31,7 @@ st, opts = config.CheckSunperf(autoadd = 0) st = config.CheckCBLAS(autoadd = 0) st = config.CheckLAPACK(autoadd = 0) + st = config.CheckF77Mangling() if env.has_key('LIBS'): print "LIBS of env is %s" % env.Dump('LIBS') From numpy-svn at scipy.org Tue Nov 6 04:19:06 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 6 Nov 2007 03:19:06 -0600 (CST) Subject: [Numpy-svn] r4402 - in branches/numpy.scons/numpy: core distutils/scons distutils/scons/checkers distutils/scons/core Message-ID: <20071106091906.F343B39C1AA@new.scipy.org> Author: cdavid Date: 2007-11-06 03:18:44 -0600 (Tue, 06 Nov 2007) New Revision: 4402 Added: branches/numpy.scons/numpy/distutils/scons/core/ branches/numpy.scons/numpy/distutils/scons/core/__init__.py branches/numpy.scons/numpy/distutils/scons/core/custom_builders.py branches/numpy.scons/numpy/distutils/scons/core/default.py branches/numpy.scons/numpy/distutils/scons/core/extension.py branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py branches/numpy.scons/numpy/distutils/scons/core/libinfo.py branches/numpy.scons/numpy/distutils/scons/core/libinfo_scons.py branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py branches/numpy.scons/numpy/distutils/scons/core/parser.py branches/numpy.scons/numpy/distutils/scons/core/utils.py Removed: branches/numpy.scons/numpy/distutils/scons/custom_builders.py branches/numpy.scons/numpy/distutils/scons/default.py branches/numpy.scons/numpy/distutils/scons/extension.py branches/numpy.scons/numpy/distutils/scons/extension_scons.py branches/numpy.scons/numpy/distutils/scons/libinfo.py branches/numpy.scons/numpy/distutils/scons/libinfo_scons.py branches/numpy.scons/numpy/distutils/scons/numpyenv.py branches/numpy.scons/numpy/distutils/scons/parser.py branches/numpy.scons/numpy/distutils/scons/utils.py Modified: branches/numpy.scons/numpy/core/scons_support.py branches/numpy.scons/numpy/distutils/scons/__init__.py branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py branches/numpy.scons/numpy/distutils/scons/fortran_scons.py Log: Reogarnize a bit scons module Modified: branches/numpy.scons/numpy/core/scons_support.py =================================================================== --- branches/numpy.scons/numpy/core/scons_support.py 2007-11-06 09:04:10 UTC (rev 4401) +++ branches/numpy.scons/numpy/core/scons_support.py 2007-11-06 09:18:44 UTC (rev 4402) @@ -10,7 +10,7 @@ do_generate_api as nowrap_do_generate_ufunc_api from numpy.distutils.conv_template import process_str -from numpy.distutils.scons.utils import _rsplit as rsplit, isstring +from numpy.distutils.scons import rsplit, isstring import SCons.Node Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-11-06 09:04:10 UTC (rev 4401) +++ branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-11-06 09:18:44 UTC (rev 4402) @@ -1,9 +1,10 @@ -from numpyenv import GetNumpyEnvironment, GetNumpyOptions -from libinfo_scons import NumpyCheckLib -from libinfo import get_paths as scons_get_paths +from core.numpyenv import GetNumpyEnvironment, GetNumpyOptions +from core.libinfo_scons import NumpyCheckLib +from core.libinfo import get_paths as scons_get_paths +from core.extension import get_python_inc, get_pythonlib_dir +from core.utils import isstring, rsplit + from checkers import CheckCBLAS, CheckLAPACK -from extension import get_python_inc, get_pythonlib_dir -from utils import isstring from fortran_scons import CheckF77Verbose, CheckF77Clib, CheckF77Mangling def test(level=1, verbosity=1): Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-06 09:04:10 UTC (rev 4401) +++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-06 09:18:44 UTC (rev 4402) @@ -1,12 +1,12 @@ #! /usr/bin/env python -# Last Change: Tue Nov 06 04:00 PM 2007 J +# Last Change: Tue Nov 06 06:00 PM 2007 J # Module for custom, common checkers for numpy (and scipy) import sys import os.path from distutils.util import get_platform -from numpy.distutils.scons.libinfo import get_config_from_section, get_config +from numpy.distutils.scons.core.libinfo import get_config_from_section, get_config from numpy.distutils.scons.testcode_snippets import cblas_sgemm as cblas_src, \ c_sgemm as sunperf_src, lapack_sgesv Modified: branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-11-06 09:04:10 UTC (rev 4401) +++ branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-11-06 09:18:44 UTC (rev 4402) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Tue Nov 06 01:00 PM 2007 J +# Last Change: Tue Nov 06 06:00 PM 2007 J # This module defines checkers for performances libs providing standard API, # such as MKL (Intel), ATLAS, Sunperf (solaris and linux), Accelerate (Mac OS @@ -12,7 +12,7 @@ from os.path import join as pjoin from numpy.distutils.system_info import default_lib_dirs -from numpy.distutils.scons.libinfo import get_config_from_section, get_config +from numpy.distutils.scons.core.libinfo import get_config_from_section, get_config from numpy.distutils.scons.testcode_snippets import cblas_sgemm as cblas_src, \ c_sgemm as sunperf_src, lapack_sgesv Property changes on: branches/numpy.scons/numpy/distutils/scons/core ___________________________________________________________________ Name: svn:ignore + *.pyc Added: branches/numpy.scons/numpy/distutils/scons/core/__init__.py =================================================================== Copied: branches/numpy.scons/numpy/distutils/scons/core/custom_builders.py (from rev 4396, branches/numpy.scons/numpy/distutils/scons/custom_builders.py) Copied: branches/numpy.scons/numpy/distutils/scons/core/default.py (from rev 4396, branches/numpy.scons/numpy/distutils/scons/default.py) Copied: branches/numpy.scons/numpy/distutils/scons/core/extension.py (from rev 4396, branches/numpy.scons/numpy/distutils/scons/extension.py) Copied: branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py (from rev 4396, branches/numpy.scons/numpy/distutils/scons/extension_scons.py) Copied: branches/numpy.scons/numpy/distutils/scons/core/libinfo.py (from rev 4396, branches/numpy.scons/numpy/distutils/scons/libinfo.py) Copied: branches/numpy.scons/numpy/distutils/scons/core/libinfo_scons.py (from rev 4396, branches/numpy.scons/numpy/distutils/scons/libinfo_scons.py) Copied: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py (from rev 4396, branches/numpy.scons/numpy/distutils/scons/numpyenv.py) Copied: branches/numpy.scons/numpy/distutils/scons/core/parser.py (from rev 4396, branches/numpy.scons/numpy/distutils/scons/parser.py) Copied: branches/numpy.scons/numpy/distutils/scons/core/utils.py (from rev 4396, branches/numpy.scons/numpy/distutils/scons/utils.py) Deleted: branches/numpy.scons/numpy/distutils/scons/custom_builders.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/custom_builders.py 2007-11-06 09:04:10 UTC (rev 4401) +++ branches/numpy.scons/numpy/distutils/scons/custom_builders.py 2007-11-06 09:18:44 UTC (rev 4402) @@ -1,48 +0,0 @@ -from os.path import join as pjoin - -def NumpySharedLibrary(env, target, source, *args, **kw): - """This builder is the same than SharedLibrary, except for the fact that it - takes into account build dir info passed by distutils, and put the target at - the right location in distutils build directory for correct installation.""" - 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 - -def NumpyPythonExtension(env, target, source, *args, **kw): - """This builder is the same than PythonExtension, except for the fact that it - takes into account build dir info passed by distutils, and put the target at - the right location in distutils build directory for correct installation.""" - import SCons.Util - newsource = [] - for i in source: - if SCons.Util.is_String(i): - newsource.append(pjoin(env['build_dir'], i)) - else: - newsource.append(i) - # XXX: why target is a list ? It is always true ? - lib = env.PythonExtension("$build_dir/%s" % target[0], newsource, *args, **kw) - - inst_lib = env.Install("$distutils_installdir", lib) - return lib, inst_lib - - -def NumpyCtypes(env, target, source, *args, **kw): - """This builder is essentially the same than SharedLibrary, but should be - used for libraries which will only be used through ctypes. - - In particular, it does not install .exp/.lib files on windows. """ - source = [pjoin(env['build_dir'], i) for i in source] - # XXX: why target is a list ? It is always true ? - # XXX: handle cases where SHLIBPREFIX is in args - lib = env.SharedLibrary("$build_dir/%s" % target[0], - source, - SHLIBPREFIX = '', - *args, - **kw) - lib = [i for i in lib if not (str(i).endswith('.exp') or str(i).endswith('.lib')) ] - inst_lib = env.Install("$distutils_installdir", lib) - return lib, inst_lib - Deleted: branches/numpy.scons/numpy/distutils/scons/default.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/default.py 2007-11-06 09:04:10 UTC (rev 4401) +++ branches/numpy.scons/numpy/distutils/scons/default.py 2007-11-06 09:18:44 UTC (rev 4402) @@ -1,174 +0,0 @@ -#! /usr/bin/env python -# Last Change: Mon Nov 05 06:00 PM 2007 J -import sys -import distutils.sysconfig - -# This is a copy of scons/Tools/__init__.py, because scons does not offer any -# public api for this -def tool_list(platform): - """platform should be the value returned by enbv['PLATFORM'], not - sys.platform !!!!.""" - # Here, we set the list of default tools as used by numpy.distutils.scons. This - # is ripped of scons, because scons does not provide a way to get separate - # default lists for separate tools (e.g linker, C compiler, etc...) - - if str(platform) == 'win32': - "prefer Microsoft tools on Windows" - linkers = ['mslink', 'gnulink', 'ilink', 'linkloc', 'ilink32' ] - c_compilers = ['msvc', 'mingw', 'gcc', 'intelc', 'icl', 'icc', 'cc', 'bcc32' ] - cxx_compilers = ['msvc', 'intelc', 'icc', 'g++', 'c++', 'bcc32' ] - assemblers = ['masm', 'nasm', 'gas', '386asm' ] - fortran_compilers = ['g77', 'ifl', 'cvf', 'f95', 'f90', 'fortran'] - ars = ['mslib', 'ar', 'tlib'] - elif str(platform) == 'os2': - "prefer IBM tools on OS/2" - linkers = ['ilink', 'gnulink', 'mslink'] - c_compilers = ['icc', 'gcc', 'msvc', 'cc'] - cxx_compilers = ['icc', 'g++', 'msvc', 'c++'] - assemblers = ['nasm', 'masm', 'gas'] - fortran_compilers = ['ifl', 'g77'] - ars = ['ar', 'mslib'] - elif str(platform) == 'irix': - "prefer MIPSPro on IRIX" - linkers = ['sgilink', 'gnulink'] - c_compilers = ['sgicc', 'gcc', 'cc'] - cxx_compilers = ['sgic++', 'g++', 'c++'] - assemblers = ['as', 'gas'] - fortran_compilers = ['f95', 'f90', 'f77', 'g77', 'fortran'] - ars = ['sgiar'] - elif str(platform) == 'sunos': - "prefer Forte tools on SunOS" - linkers = ['sunlink', 'gnulink'] - c_compilers = ['suncc', 'gcc', 'cc'] - cxx_compilers = ['sunc++', 'g++', 'c++'] - assemblers = ['as', 'gas'] - fortran_compilers = ['f95', 'f90', 'f77', 'g77', 'fortran'] - ars = ['sunar'] - elif str(platform) == 'hpux': - "prefer aCC tools on HP-UX" - linkers = ['hplink', 'gnulink'] - c_compilers = ['hpcc', 'gcc', 'cc'] - cxx_compilers = ['hpc++', 'g++', 'c++'] - assemblers = ['as', 'gas'] - fortran_compilers = ['f95', 'f90', 'f77', 'g77', 'fortran'] - ars = ['ar'] - elif str(platform) == 'aix': - "prefer AIX Visual Age tools on AIX" - linkers = ['aixlink', 'gnulink'] - c_compilers = ['aixcc', 'gcc', 'cc'] - cxx_compilers = ['aixc++', 'g++', 'c++'] - assemblers = ['as', 'gas'] - fortran_compilers = ['f95', 'f90', 'aixf77', 'g77', 'fortran'] - ars = ['ar'] - elif str(platform) == 'darwin': - "prefer GNU tools on Mac OS X, except for some linkers and IBM tools" - linkers = ['applelink', 'gnulink'] - c_compilers = ['gcc', 'cc'] - cxx_compilers = ['g++', 'c++'] - assemblers = ['as'] - fortran_compilers = ['f95', 'f90', 'g77'] - ars = ['ar'] - else: - "prefer GNU tools on all other platforms" - linkers = ['gnulink', 'mslink', 'ilink'] - c_compilers = ['gcc', 'msvc', 'intelc', 'icc', 'cc'] - cxx_compilers = ['g++', 'msvc', 'intelc', 'icc', 'c++'] - assemblers = ['gas', 'nasm', 'masm'] - fortran_compilers = ['f95', 'f90', 'g77', 'ifort', 'ifl', 'fortran'] - ars = ['ar', 'mslib'] - - other_tools = ['BitKeeper', 'CVS', 'dmd', 'dvipdf', 'dvips', 'gs', 'jar', - 'javac', 'javah', 'latex', 'lex', 'm4', 'midl', 'msvs', 'pdflatex', - 'pdftex', 'Perforce', 'RCS', 'rmic', 'rpcgen', 'SCCS', 'swig', - 'tar', 'tex', 'yacc', 'zip'] - return linkers, c_compilers, cxx_compilers, assemblers, fortran_compilers, \ - ars, other_tools - -# Handling compiler configuration: only flags which change how to build object -# files. Nothing related to linking, search path, etc... should be given here. -# Basically, limit yourself to optimization/debug/warning flags. - -# XXX: customization from site.cfg or other ? -class CompilerConfig: - def __init__(self, optim = None, warn = None, debug = None, debug_symbol = - None, thread = None, extra = None): - # XXX: several level of optimizations ? - self.optim = optim - # XXX: several level of warnings ? - self.warn = warn - # To enable putting debugging info in binaries - self.debug_symbol = debug_symbol - # To enable friendly debugging - self.debug = debug - # XXX - self.thread = thread - # XXX - self.extra = extra - - def get_flags_dict(self): - d = {'NUMPY_OPTIM_CFLAGS' : self.optim, - 'NUMPY_WARN_CFLAGS' : self.warn, - 'NUMPY_THREAD_CFLAGS' : self.thread, - 'NUMPY_EXTRA_CFLAGS' : self.debug, - 'NUMPY_DEBUG_CFLAGS' : self.debug, - 'NUMPY_DEBUG_SYMBOL_CFLAGS' : self.debug_symbol} - for k, v in d.items(): - if v is None: - d[k] = [] - return d - -# It seems that scons consider any option with space in it as a multi option, -# which breaks command line options. So just don't put space. -def get_cc_config(name): - if name == 'gcc': - if distutils.sysconfig.get_config_vars('LDFLAGS')[0].find('-pthread'): - thread = ['-pthread'] - else: - thread = [] - cfg = CompilerConfig(optim = ['-O2', '-fno-strict-aliasing', '-DNDEBUG'], - warn = ['-Wall', '-Wstrict-prototypes'], - debug_symbol = ['-g'], - thread = thread) - elif name == 'intelc': - if sys.platform[:5] == 'win32': - raise NotImplementedError('FIXME: intel compiler on windows not '\ - ' supported yet') - - cfg = CompilerConfig(optim = ['-O2', '-fno-strict-aliasing', '-DNDEBUG'], - warn = ['-Wall', '-Wstrict-prototypes'], - debug_symbol = ['-g'], - thread = ['-pthread']) - elif name == 'msvc': - # XXX: distutils part of customization: - # if self.__arch == "Intel": - # self.compile_options = [ '/nologo', '/Ox', '/MD', '/W3', '/GX' , '/DNDEBUG'] - # self.compile_options_debug = ['/nologo', '/Od', '/MDd', '/W3', '/GX', '/Z7', '/D_DEBUG'] - # else: - # # Win64 - # self.compile_options = [ '/nologo', '/Ox', '/MD', '/W3', '/GS-' , - # '/DNDEBUG'] - # self.compile_options_debug = ['/nologo', '/Od', '/MDd', '/W3', '/GS-', - # '/Z7', '/D_DEBUG'] - # - # self.ldflags_shared = ['/DLL', '/nologo', '/INCREMENTAL:NO'] - # if self.__version >= 7: - # self.ldflags_shared_debug = [ - # '/DLL', '/nologo', '/INCREMENTAL:no', '/DEBUG' - # ] - # else: - # self.ldflags_shared_debug = [ - # '/DLL', '/nologo', '/INCREMENTAL:no', '/pdb:None', '/DEBUG' - # ] - # self.ldflags_static = [ '/nologo'] - - cfg = CompilerConfig(optim = ['/Ox', '/DNDEBUG'], - warn = ['/W3', '/Wall'], - thread = ['/MD', '/GX'], - extra = ['/nologo']) - else: - # For not yet supported compiler, just put everything in optims from - # distutils - cfg = CompilerConfig(optims = - distutils.sysconfig.get_config_vars('CFLAGS')) - - return cfg Deleted: branches/numpy.scons/numpy/distutils/scons/extension.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/extension.py 2007-11-06 09:04:10 UTC (rev 4401) +++ branches/numpy.scons/numpy/distutils/scons/extension.py 2007-11-06 09:18:44 UTC (rev 4402) @@ -1,25 +0,0 @@ -#! /usr/bin/env python -# Last Change: Tue Oct 09 03:00 PM 2007 J - -# Module for support to build python extension. KEEP THIS INDEPENDANT OF SCONS - -# XXX: we should avoid clashing between distutils and numpy.distutils. Maybe by -# defining our own functions here, and accessing any info related to python -# build option and co from here only. -import sys -import os -from os.path import join as pjoin - -from distutils.sysconfig import get_python_version, get_python_inc, get_config_vars - -def get_pythonlib_dir(): - """Returns a list of path to look for the python engine library - (pythonX.X.lib on win32, libpythonX.X.so on unix, etc...).""" - if os.name == 'nt': - return [pjoin(sys.exec_prefix, 'libs')] - else: - return [pjoin(sys.exec_prefix, 'lib')] - -if __name__ == '__main__': - print "Python version is %s" % get_python_version() - print "Python include dir is %s" % get_python_inc() Deleted: branches/numpy.scons/numpy/distutils/scons/extension_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/extension_scons.py 2007-11-06 09:04:10 UTC (rev 4401) +++ branches/numpy.scons/numpy/distutils/scons/extension_scons.py 2007-11-06 09:18:44 UTC (rev 4402) @@ -1,43 +0,0 @@ -#! /usr/bin/env python -# Last Change: Fri Oct 19 11:00 AM 2007 J - -# Module for support to build python extension. scons specific code goes here. -import sys -from copy import deepcopy - -from extension import get_pythonlib_dir, get_python_inc - -def built_with_mstools(env): - """Return True if built with MS tools (compiler + linker).""" - return env.has_key('MSVS') - -def PythonExtension(env, target, source, *args, **kw): - # XXX Check args and kw - # XXX: Some things should not be set here... - if env.has_key('LINKFLAGS'): - LINKFLAGS = deepcopy(env['LINKFLAGS']) - else: - LINKFLAGS = [] - - if env.has_key('CPPPATH'): - CPPPATH = deepcopy(env['CPPPATH']) - else: - CPPPATH = [] - - CPPPATH.append(get_python_inc()) - if sys.platform == 'win32': - if built_with_mstools(env): - # XXX: We add the path where to find python2.5.lib (or any other - # version, of course). This seems to be necessary for MS compilers. - env.AppendUnique(LIBPATH = get_pythonlib_dir()) - elif sys.platform == "darwin": - # XXX: When those should be used ? (which version of Mac OS X ?) - LINKFLAGS += ' -undefined dynamic_lookup ' - - # Use LoadableModule because of Mac OS X - wrap = env.LoadableModule(target, source, SHLIBPREFIX = '', - LDMODULESUFFIX = '$PYEXTSUFFIX', - SHLIBSUFFIX = '$PYEXTSUFFIX', - LINKFLAGS = LINKFLAGS, - CPPPATH = CPPPATH, *args, **kw) - return wrap Modified: branches/numpy.scons/numpy/distutils/scons/fortran_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-11-06 09:04:10 UTC (rev 4401) +++ branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-11-06 09:18:44 UTC (rev 4402) @@ -1,4 +1,4 @@ -# Last Change: Tue Nov 06 05:00 PM 2007 J +# Last Change: Tue Nov 06 06:00 PM 2007 J import os import sys import string @@ -6,7 +6,7 @@ from os.path import basename, join as pjoin, dirname from copy import deepcopy -from utils import popen_wrapper +from numpy.distutils.scons.core.utils import popen_wrapper from fortran import parse_f77link, check_link_verbose #----------------- Deleted: branches/numpy.scons/numpy/distutils/scons/libinfo.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/libinfo.py 2007-11-06 09:04:10 UTC (rev 4401) +++ branches/numpy.scons/numpy/distutils/scons/libinfo.py 2007-11-06 09:18:44 UTC (rev 4402) @@ -1,117 +0,0 @@ -#! /usr/bin/env python -# Last Change: Mon Oct 29 03:00 PM 2007 J - -# Module for support to look for external code (replacement of -# numpy.distutils.system_info). KEEP THIS INDEPENDANT OF SCONS ! -import os -import ConfigParser - -from numpy.distutils.system_info import default_lib_dirs, \ - default_include_dirs, default_src_dirs, get_standard_file - -# Think about a cache mechanism, to avoid reparsing the config file everytime. -def get_config(): - """ This tries to read .cfg files in several locations, and merge its - information into a ConfigParser object for the first found file. - - Returns the ConfigParser instance. This copies the logic in system_info - from numpy.distutils.""" - # Below is the feature we are copying from numpy.distutils: - # - # The file 'site.cfg' is looked for in - - # 1) Directory of main setup.py file being run. - # 2) Home directory of user running the setup.py file as ~/.numpy-site.cfg - # 3) System wide directory (location of this file...) - - # The first one found is used to get system configuration options The - # format is that used by ConfigParser (i.e., Windows .INI style). The - # section DEFAULT has options that are the default for each section. The - # available sections are fftw, atlas, and x11. Appropiate defaults are - # used if nothing is specified. - - section = 'DEFAULT' - defaults = {} - defaults['libraries'] = '' - defaults['library_dirs'] = os.pathsep.join(default_lib_dirs) - defaults['include_dirs'] = os.pathsep.join(default_include_dirs) - defaults['src_dirs'] = os.pathsep.join(default_src_dirs) - cp = ConfigParser.ConfigParser(defaults) - files = [] - files.extend(get_standard_file('.numpy-site.cfg')) - files.extend(get_standard_file('site.cfg')) - - def parse_config_files(): - cp.read(files) - if not cp.has_section(section): - cp.add_section(section) - - parse_config_files() - return cp, files - -def parse_config_param(var): - """Given var, the output of ConfirParser.get(section, name), returns a list - of each item of its content.""" - varl = var.split(',') - return [i.strip() for i in varl] - -def get_paths(var): - """Given var, the output of ConfirParser.get(section, name), returns a list - of each item of its content, assuming the content is a list of directoris. - - Example: if var is foo:bar, it will return ['foo', 'bar'] on posix.""" - return var.split(os.pathsep) - -def get_config_from_section(siteconfig, section): - """For the given siteconfig and section, return the found information. - - Returns a tuple (info, found), where: - info : tuple (cpppath, libs, libpath), containing a list of path or libraries - found: 1 if the section was found, 0 otherwise.""" - if siteconfig.has_section(section): - try: - libpath = get_paths(siteconfig.get(section, 'library_dirs')) - except ConfigParser.NoSectionError, e: - libpath = [] - - try: - cpppath = get_paths(siteconfig.get(section, 'include_dirs')) - except ConfigParser.NoSectionError, e: - cpppath = [] - - try: - libs = parse_config_param(siteconfig.get(section, 'libraries')) - except ConfigParser.NoSectionError, e: - libs = [] - return (cpppath, libs, libpath), 1 - else: - return ([], [], []), 0 - -def get_func_link_src(func, includes = None): - """Given a function, return the source code to compile and link to - test for this symbol. - - includes is a list of (optional) headers""" - src = [] - if includes: - src.extend([r'#include <%s>\n' for h in includes]) - - src.append(r""" -#undef %(func)s - -#ifdef __cplusplus -extern "C" -#endif -char %(func)s (); - -int -main () -{ - return %(func)s(); -} -""" % {'func' : func}) - - return '\n'.join(src) - -if __name__ == '__main__': - pass Deleted: branches/numpy.scons/numpy/distutils/scons/libinfo_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/libinfo_scons.py 2007-11-06 09:04:10 UTC (rev 4401) +++ branches/numpy.scons/numpy/distutils/scons/libinfo_scons.py 2007-11-06 09:18:44 UTC (rev 4402) @@ -1,196 +0,0 @@ -#! /usr/bin/env python -# Last Change: Fri Oct 26 04:00 PM 2007 J - -# Module for support to look for external code (replacement of -# numpy.distutils.system_info). scons dependant code. -import ConfigParser -from copy import deepcopy - -from libinfo import get_config, get_paths, parse_config_param -from utils import get_empty - -_SYMBOL_DEF_STR = """ -#ifdef __cplusplus -extern "C" -#endif -char %s();\n""" - -_MAIN_CALL_CENTER = """ -int main(int argc, char** argv) -{ - %s - return 0; -}\n """ - -def _CheckLib(context, libs, symbols, header, language, section, siteconfig, - libpath, cpppath, verbose): - """Implementation for checking a list of symbols, with libs. - - Assumes that libs, symbol, header, libpath and cpppath are sequences (list - or tuples). DO NOT USE DIRECTLY IN SCONSCRIPT !!!""" - # XXX: sanitize API for section/siteconfig option: if section is not given, - # can we just say to ignore the sitecfg ? - if not siteconfig: - siteconfig, cfgfiles = get_config() - - def get_descr(): - try: - descr = siteconfig.items(section) - except ConfigParser.NoSectionError: - descr = "" - sdescr = "" - for i in descr: - sdescr += str(i) + '\n' - return sdescr - - # Generate the source string of the conftest - src = "" - callstr = "" - - if symbols: - for s in symbols: - # XXX: should put undef here (ala autoconf) - src += _SYMBOL_DEF_STR % s - callstr += "%s();" % s - - src += _MAIN_CALL_CENTER % callstr - # HUGE HACK: we want this test to depend on site.cfg files obviously, since - # a change in them can change the libraries tested. But Depends does not - # seem to work in configuration context, and I don't see any simple way to - # have the same functionality. So I put the configuration we got from - # get_config into the source code, such as a change in site.cfg will change - # the source file, and thus taken into account to decide whether to rebuild - # from tjhe SconfTaskMaster point of view. - - # XXX: I put the content between #if 0 / #endif, which is the most portable - # way I am aware of for multilines comments in C and C++ (this is also - # recommended in C++ portability guide of mozilla for nested comments, - # which may happen here). This is also the most robust, since it seems - # unlikely to have any #endif somewhere in the return value of get_descr. - src += "#if 0\n" - src += get_descr() - src += "\n#endif\n" - - # XXX: handle autoadd - # XXX: handle extension - extension = '.c' - - if section and siteconfig: - #print "Checking %s from section %s" % (libs[0], section) - res = _check_lib_section(context, siteconfig, section, src, libs, - libpath, cpppath) - else: - oldLIBS = context.env.has_key('LIBS') and deepcopy(context.env['LIBS']) - context.env.Append(LIBS = libs) - res = context.TryLink(src, '.c') - if not res: - context.env.Replace(LIBS = oldLIBS) - - return res - - -def NumpyCheckLib(context, libs, symbols = None, header = None, - language = None, section = None, siteconfig = None, name = None, verbose = None): - """Check for symbol in libs. - - This is the general purpose replacement for numpy.distutils.system_info. It - uses the options in siteconfig so that search path can be overwritten in - *.cfg files (using section given by section argument). If siteconfig is - None, it does uses get_config function to get the configuration, which - gives the old numpy.distutils behaviour to get options. - - - Convention: if the section has *dirs parameters, it will use them all in - one pass, e.g if library_dirs is ['/usr/local/lib', '/usr/local/mylib'], it - will try to link the given libraries by appending both directories to the - LIBPATH.""" - #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - # This is really preliminary, and needs a lot of love before being in good - # shape !!!!! - # - # Biggest problem: how to show information about found libraries ? Since - # they are found implicitely through build tools (compiler and linker), we - # can not give explicit information. IMHO (David Cournapeau), it is better - # to find them implicitely because it is much more robust. But for the info... - # - # This needs testing, too. - #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - from SCons.Util import is_List - - env = context.env - - # XXX: would be nice for each extension to add an option to - # command line. - # XXX: handle env var - # XXX: handle language - if language: - raise NotImplementedError("FIXME: language selection not implemented yet !") - - # Make sure libs and symbols are lists - if libs and not is_List(libs): - libs = [libs] - if symbols and not is_List(symbols): - symbols = [symbols] - - if not name: - name = libs[0] - - # Display message - if symbols: - sbstr = ', '.join(symbols) - context.Message('Checking for symbol(s) %s in %s... ' % (sbstr, name)) - else: - context.Message('Checking for %s... ' % name) - - # Call the implementation - libpath = None - cpppath = None - res = _CheckLib(context, libs, symbols, header, language, section, - siteconfig, libpath, cpppath, verbose) - context.Result(res) - return res - -def _check_lib_section(context, siteconfig, section, src, libs, libpath, cpppath): - # Convention: if an option is found in site.cfg for the given - # section, it takes precedence on the arguments libs, libpath, - # cpppath. - res = 1 - - # XXX: refactor this mess - try: - newLIBPATH = get_paths(siteconfig.get(section, 'library_dirs')) - except ConfigParser.NoSectionError, e: - if libpath: - newLIBPATH = libpath - else: - newLIBPATH = [] - - try: - newCPPPATH = get_paths(siteconfig.get(section, 'include_dirs')) - except ConfigParser.NoSectionError, e: - if cpppath: - newCPPPATH = cpppath - else: - newCPPPATH = [] - - try: - newLIBS = parse_config_param(siteconfig.get(section, 'libraries')) - except ConfigParser.NoSectionError, e: - if libs: - newLIBS = libs - else: - newLIBS = [] - - lastLIBPATH = get_empty(context.env,'LIBPATH') - lastLIBS = get_empty(context.env,'LIBS') - lastCPPPATH = get_empty(context.env,'CPPPATH') - context.env.Append(LIBPATH = newLIBPATH) - context.env.Append(LIBS = newLIBS) - context.env.Append(CPPPATH = newCPPPATH) - res *= context.TryLink(src, '.c') - if not res: - context.env.Replace(LIBS = lastLIBS, - LIBPATH = lastLIBPATH, - CPPPATH = lastCPPPATH) - - return res Deleted: branches/numpy.scons/numpy/distutils/scons/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-11-06 09:04:10 UTC (rev 4401) +++ branches/numpy.scons/numpy/distutils/scons/numpyenv.py 2007-11-06 09:18:44 UTC (rev 4402) @@ -1,240 +0,0 @@ -# Last Changed: . -import os.path -from os.path import join as pjoin, dirname as pdirname -import sys - -from distutils.sysconfig import get_config_vars - -from numpy.distutils.misc_util import get_scons_build_dir, get_scons_configres_dir,\ - get_scons_configres_filename - -from default import tool_list, get_cc_config -from custom_builders import NumpySharedLibrary, NumpyCtypes, NumpyPythonExtension -from libinfo import get_config -from extension_scons import PythonExtension - -from numpy.distutils.scons.tools.substinfile import TOOL_SUBST - -def pyplat2sconsplat(): - # XXX: should see how env['PLATFORM'] is defined, make this a dictionary - if sys.platform[:5] == 'linux': - return 'posix' - elif sys.platform[:5] == 'sunos': - return 'sunos' - else: - return sys.platform - -DEF_LINKERS, DEF_C_COMPILERS, DEF_CXX_COMPILERS, DEF_ASSEMBLERS, \ -DEF_FORTRAN_COMPILERS, DEF_ARS, DEF_OTHER_TOOLS = tool_list(pyplat2sconsplat()) - -def is_cc_suncc(fullpath): - """Return true if the compiler is suncc.""" - # I wish there was a better way: we launch suncc -V, read the output, and - # returns true if Sun is found in the output. We cannot check the status - # code, because the compiler does not seem to have a way to do nothing - # while returning success (0). - - import os - import re - suncc = re.compile('Sun C') - # Redirect stderr to stdout - cmd = fullpath + ' -V 2>&1' - out = os.popen(cmd) - cnt = out.read() - st = out.close() - - return suncc.search(cnt) - -def GetNumpyOptions(args): - """Call this with args=ARGUMENTS to take into account command line args.""" - from SCons.Options import Options - - opts = Options(None, args) - # Add directories related info - opts.Add('pkg_name', 'name of the package (including parent package if any)', '') - opts.Add('src_dir', 'src dir relative to top called', '.') - opts.Add('build_prefix', 'build prefix (NOT including the package name)', - get_scons_build_dir()) - opts.Add('distutils_libdir', - 'build dir for libraries of distutils (NOT including the package name)', - pjoin('build', 'lib')) - opts.Add('include_bootstrap', - "include directories for boostraping numpy (if you do not know" \ - " what that means, you don't need it)" , - '') - - # Add compiler related info - opts.Add('cc_opt', 'name of C compiler', '') - opts.Add('cc_opt_path', 'path of the C compiler set in cc_opt', '') - - opts.Add('f77_opt', 'name of F77 compiler', '') - opts.Add('f77_opt_path', 'path of the F77 compiler set in cc_opt', '') - - return opts - -def customize_cc(name, env): - """Customize env options related to the given tool.""" - cfg = get_cc_config(name) - env.AppendUnique(**cfg.get_flags_dict()) - -def GetNumpyEnvironment(args): - env = _GetNumpyEnvironment(args) - env.AppendUnique(CFLAGS = env['NUMPY_WARN_CFLAGS'] + env['NUMPY_OPTIM_CFLAGS'] +\ - env['NUMPY_DEBUG_SYMBOL_CFLAGS'] +\ - env['NUMPY_EXTRA_CFLAGS'] +\ - env['NUMPY_THREAD_CFLAGS']) - return env - -def _GetNumpyEnvironment(args): - """Call this with args = ARGUMENTS.""" - from SCons.Environment import Environment - from SCons.Tool import Tool, FindTool, FindAllTools - from SCons.Script import BuildDir, Help - - # XXX: I would prefer subclassing Environment, because we really expect - # some different behaviour than just Environment instances... - opts = GetNumpyOptions(args) - - # Get the python extension suffix - # XXX this should be defined somewhere else. Is there a way to reliably get - # all the necessary informations specific to python extensions (linkflags, - # etc...) dynamically ? - pyextsuffix = get_config_vars('SO') - - # We set tools to an empty list, to be sure that the custom options are - # given first. We have to - env = Environment(options = opts, tools = [], PYEXTSUFFIX = pyextsuffix) - - # Add the file substitution tool - TOOL_SUBST(env) - - # Setting dirs according to command line options - env.AppendUnique(build_dir = pjoin(env['build_prefix'], env['src_dir'])) - env.AppendUnique(distutils_installdir = pjoin(env['distutils_libdir'], - env['pkg_name'])) - - # =============================================== - # Setting tools according to command line options - - # XXX: how to handle tools which are not in standard location ? Is adding - # the full path of the compiler enough ? (I am sure some compilers also - # need LD_LIBRARY_SHARED and other variables to be set, too....) - if len(env['cc_opt']) > 0: - try: - if len(env['cc_opt_path']) > 0: - if env['cc_opt'] == 'intelc': - # Intel Compiler SCons.Tool has a special way to set the - # path, o we use this one instead of changing - # env['ENV']['PATH']. - t = Tool(env['cc_opt'], - topdir = os.path.split(env['cc_opt_path'])[0]) - t(env) - customize_cc(t.name, env) - else: - if is_cc_suncc(pjoin(env['cc_opt_path'], env['cc_opt'])): - env['cc_opt'] = 'suncc' - # XXX: what is the right way to add one directory in the - # PATH ? (may not work on windows). - t = Tool(env['cc_opt']) - t(env) - customize_cc(t.name, env) - if sys.platform == 'win32': - env['ENV']['PATH'] += ';%s' % env['cc_opt_path'] - else: - env['ENV']['PATH'] += ':%s' % env['cc_opt_path'] - except EnvironmentError, e: - # scons could not understand cc_opt (bad name ?) - raise AssertionError("SCONS: Could not initialize tool ? Error is %s" % \ - str(e)) - else: - t = Tool(FindTool(DEF_C_COMPILERS)) - t(env) - customize_cc(t.name, env) - - # F77 compiler - if len(env['f77_opt']) > 0: - try: - if len(env['f77_opt_path']) > 0: - # XXX: what is the right way to add one directory in the - # PATH ? (may not work on windows). - t = Tool(env['f77_opt'], toolpath = ['numpy/distutils/scons/tools']) - t(env) - if sys.platform == 'win32': - env['ENV']['PATH'] += ';%s' % env['f77_opt_path'] - else: - env['ENV']['PATH'] += ':%s' % env['f77_opt_path'] - except EnvironmentError, e: - # scons could not understand cc_opt (bad name ?) - raise AssertionError("SCONS: Could not initialize tool ? Error is %s" % \ - str(e)) - # XXX: really have to understand how fortran compilers work in scons... - env['F77'] = env['_FORTRAND'] - else: - raise NotImplementedError('FIXME: Support for env wo fcompiler not tested yet !') - #t = Tool(FindTool(DEF_FORTRAN_COMPILERS)) - #t(env) - - # XXX: Really, we should use our own subclass of Environment, instead of - # adding Numpy* functions ! - - # Put config code and log in separate dir for each subpackage - from utils import curry - NumpyConfigure = curry(env.Configure, - conf_dir = pjoin(env['build_dir'], '.sconf'), - log_file = pjoin(env['build_dir'], 'config.log')) - env.NumpyConfigure = NumpyConfigure - - # XXX: Huge, ugly hack ! SConsign needs an absolute path or a path - # relative to where the SConstruct file is. We have to find the path of - # the build dir relative to the src_dir: we add n .., where n is the number - # of occureant of the path separator in the src dir. - def get_build_relative_src(srcdir, builddir): - n = srcdir.count(os.sep) + 1 - return pjoin(os.sep.join([os.pardir for i in range(n)]), builddir) - sconsign = pjoin(get_build_relative_src(env['src_dir'], - env['build_dir']), - '.sconsign.dblite') - env.SConsignFile(sconsign) - - # ======================================================================== - # Adding default tools for the one we do not customize: mingw is special - # according to scons, don't ask me why, but this does not work as expected - # for this tool. - if not env['cc_opt'] == 'mingw': - for i in [DEF_LINKERS, DEF_CXX_COMPILERS, DEF_ASSEMBLERS, DEF_ARS]: - t = FindTool(i, env) or i[0] - Tool(t)(env) - - for t in FindAllTools(DEF_OTHER_TOOLS, env): - Tool(t)(env) - - try: - env['ENV']['HOME'] = os.environ['HOME'] - except KeyError: - pass - - # Adding custom builder - env['BUILDERS']['NumpySharedLibrary'] = NumpySharedLibrary - env['BUILDERS']['NumpyCtypes'] = NumpyCtypes - env['BUILDERS']['PythonExtension'] = PythonExtension - env['BUILDERS']['NumpyPythonExtension'] = NumpyPythonExtension - - # Setting build directory according to command line option - if len(env['src_dir']) > 0: - BuildDir(env['build_dir'], env['src_dir']) - else: - BuildDir(env['build_dir'], '.') - - # Generate help (if calling scons directly during debugging, this could be useful) - Help(opts.GenerateHelpText(env)) - - # Getting the config options from *.cfg files - config = get_config() - env['NUMPY_SITE_CONFIG'] = config - - # This will be used to keep configuration information on a per package basis - env['NUMPY_PKG_CONFIG'] = {} - env['NUMPY_PKG_CONFIG_FILE'] = pjoin(get_scons_configres_dir(), env['src_dir'], - get_scons_configres_filename()) - - return env Deleted: branches/numpy.scons/numpy/distutils/scons/parser.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/parser.py 2007-11-06 09:04:10 UTC (rev 4401) +++ branches/numpy.scons/numpy/distutils/scons/parser.py 2007-11-06 09:18:44 UTC (rev 4402) @@ -1,117 +0,0 @@ -#! /usr/bin/env python -# Last Change: Mon Nov 05 07:00 PM 2007 J -import re -import shlex - -# Those are obtained from distutils.sysconfig.get_config_vars('CFLAGS') -tiger_x86_cflags = r'-arch ppc -arch i386 -sysroot '\ -'/Developers/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -Wno-long-double '\ -'-no-cpp-precomp -DNDEBUG -f -O3' -linux_x86_cflags = r'-fno-strict-aliasing -DNDEBUG -g -O2 -Wall '\ - '-Wstrict-prototypes' -linux_x86_ldflags = r'-pthread -shared -Wl,-O1' - -# List of arguments taking an option (with space) -cflags_argument_options = [r'-arch', r'-sysroot'] -ldflags_argument_options = [r'-arch', r'-sysroot', r'-L'] - -def is_option(token): - return token.startswith('-') - -def has_argument(token): - """Returns True if current token is an option expecting an argument.""" - for i in cflags_argument_options: - if token.startswith(i): - return True - return False - -def cc_process_argument(lexer, token): - """Merge subsequent tokens while no option flag is detected.""" - token_list = [token] - token = lexer.get_token() - while token is not None and not is_option(token): - token_list.append(token) - token = lexer.get_token() - return token_list, token - -def ld_process_argument(lexer, token): - """Merge subsequent tokens while no option flag is detected.""" - token_list = [token] - token = lexer.get_token() - while token is not None and not is_option(token): - token_list.append(token) - token = lexer.get_token() - return token_list, token - -def parse_posix_ld_token(lexer, token): - if not token: - return None - - if has_argument(token): - token_list, next_token = ld_process_argument(lexer, token) - token = ' '.join(token_list) - else: - next_token = lexer.get_token() - - if token.startswith('-L'): - print "token %s is a libpath flag" % token - elif token.startswith('-W'): - print "token %s is a linker flag" % token - elif token.startswith('-O'): - print "token %s is a optim flag" % token - elif token.startswith('-g'): - print "token %s is a debug related flag" % token - elif token.startswith('-pthread'): - print "token %s is a thread related flag" % token - else: - print "token %s is unknown (extra)" % token - - return next_token - -def parse_posix_cc_token(lexer, token): - if not token: - return None - - if has_argument(token): - token_list, next_token = cc_process_argument(lexer, token) - token = ' '.join(token_list) - else: - next_token = lexer.get_token() - - if token.startswith('-W'): - print "token %s is a warning flag" % token - elif token.startswith('-D'): - print "token %s is a define flag" % token - elif token.startswith('-f'): - print "token %s is a compilation flag" % token - elif token.startswith('-O'): - print "token %s is a optim flag" % token - elif token.startswith('-g'): - print "token %s is a debug related flag" % token - elif token.startswith('-pthread'): - print "token %s is a thread related flag" % token - else: - print "token %s is unknown (extra)" % token - - return next_token - -if __name__ == '__main__': - def parse_cflags(flags): - a = shlex.shlex(flags, posix = True) - a.whitespace_split = True - t = a.get_token() - while t: - t = parse_posix_cc_token(a, t) - - def parse_ldflags(flags): - a = shlex.shlex(flags, posix = True) - a.whitespace_split = True - t = a.get_token() - while t: - t = parse_posix_ld_token(a, t) - - for i in [linux_x86_cflags, tiger_x86_cflags]: - parse_cflags(i) - - for i in [linux_x86_ldflags]: - parse_ldflags(i) Deleted: branches/numpy.scons/numpy/distutils/scons/utils.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/utils.py 2007-11-06 09:04:10 UTC (rev 4401) +++ branches/numpy.scons/numpy/distutils/scons/utils.py 2007-11-06 09:18:44 UTC (rev 4402) @@ -1,117 +0,0 @@ -#! /usr/bin/env python -# Last Change: Mon Oct 29 07:00 PM 2007 J - -# This module defines various utilities used throughout the scons support -# library. - -import os -import re - -from copy import deepcopy - -_START_WITH_MINUS = re.compile('^\s*-') - -def popen_wrapper(cmd, merge = False): - """This works like popen, but it returns both the status and the output. - - If merge is True, then output contains both stdout and stderr. - - Returns: (st, out), where st is an integer (the return status of the - subprocess, and out the string of the output). - - NOTE: - - it tries to be robust to find non existing command. For example, is - cmd starts with a minus, a nonzero status is returned, and no junk is - displayed on the interpreter stdout.""" - if _START_WITH_MINUS.match(cmd): - return 1, '' - if merge: - # XXX: I have a bad feeling about this. Does it really work reliably on - # all supported platforms ? - cmd += ' 2>& 1 ' - output = os.popen(cmd) - out = output.read() - st = output.close() - if st: - status = st - else: - status = 0 - - return status, out - -def get_empty(dict, key): - """Assuming dict is a dictionary with lists as values, returns an empty - list if key is not found, or a (deep) copy of the existing value if it - does.""" - try: - return deepcopy(dict[key]) - except KeyError, e: - return [] - -def rsplit(s, sep, max = -1): - """Equivalent of rsplit, but works on 2.3.""" - try: - return s.rsplit(sep, max) - except AttributeError: - return _rsplit(s, sep, max) - -def _rsplit(s, sep, max): - """Equivalent of rsplit, but works on 2.3.""" - l = s.split(sep) - if len(l) < 2 or max == 0: - return [s] - elif max < 0: - return l[-len(l):] - else: - st = sep.join(l[0:-max]) - return [st] + l[-max:] - -class curry: - def __init__(self, fun, *args, **kwargs): - self.fun = fun - self.pending = args[:] - self.kwargs = kwargs.copy() - - def __call__(self, *args, **kwargs): - if kwargs and self.kwargs: - kw = self.kwargs.copy() - kw.update(kwargs) - else: - kw = kwargs or self.kwargs - - return self.fun(*(self.pending + args), **kw) - -import types -# Don't "from types import ..." these because we need to get at the -# types module later to look for UnicodeType. -DictType = types.DictType -InstanceType = types.InstanceType -ListType = types.ListType -StringType = types.StringType -TupleType = types.TupleType -if hasattr(types, 'UnicodeType'): - UnicodeType = types.UnicodeType - def isstring(obj): - t = type(obj) - return t is StringType \ - or t is UnicodeType \ - or (t is InstanceType and isinstance(obj, UserString)) -else: - def isstring(obj): - t = type(obj) - return t is StringType \ - or (t is InstanceType and isinstance(obj, UserString)) - -if __name__ == '__main__': - a1 = 'a.b.c' - assert a1.split('.', -1) == a1.rsplit('.', -1) == _rsplit(a1, '.', -1) - - assert a1.rsplit('.', 1) == _rsplit(a1, '.', 1) - - assert a1.rsplit('.', 0) == _rsplit(a1, '.', 0) - - assert a1.rsplit('.', 2) == _rsplit(a1, '.', 2) - - a2 = 'floupi' - assert a2.rsplit('.') == _rsplit(a2, '.', -1) - assert a2.rsplit('.', 1) == _rsplit(a2, '.', 1) From numpy-svn at scipy.org Tue Nov 6 04:21:56 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 6 Nov 2007 03:21:56 -0600 (CST) Subject: [Numpy-svn] r4403 - branches/numpy.scons/numpy/distutils/scons/checkers Message-ID: <20071106092156.4D7FF39C1AA@new.scipy.org> Author: cdavid Date: 2007-11-06 03:21:52 -0600 (Tue, 06 Nov 2007) New Revision: 4403 Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py Log: Set correct headers for veclib/accelerate-based CBLAS Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-06 09:18:44 UTC (rev 4402) +++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-06 09:21:52 UTC (rev 4403) @@ -50,7 +50,7 @@ st, res = CheckAccelerate(context, autoadd) if st: st = check_include_and_run(context, 'CBLAS (Accelerate Framework)', - res.cfgopts, ['cblas.h'], cblas_src, autoadd) + res.cfgopts, ['Accelerate/Accelerate.h'], cblas_src, autoadd) if st: add_info(env, 'cblas', res) return st @@ -58,7 +58,7 @@ st, res = CheckVeclib(context, autoadd) if st: st = check_include_and_run(context, 'CBLAS (vecLib Framework)', - res.cfgopts, ['cblas.h'], cblas_src, autoadd) + res.cfgopts, ['vecLib/vecLib.h'], cblas_src, autoadd) if st: add_info(env, 'cblas', res) return st From numpy-svn at scipy.org Tue Nov 6 04:24:05 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 6 Nov 2007 03:24:05 -0600 (CST) Subject: [Numpy-svn] r4404 - branches/numpy.scons/numpy/distutils/scons/checkers Message-ID: <20071106092405.269A739C1AE@new.scipy.org> Author: cdavid Date: 2007-11-06 03:24:01 -0600 (Tue, 06 Nov 2007) New Revision: 4404 Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py Log: More trivial correction for CBLAS checker Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-06 09:21:52 UTC (rev 4403) +++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-06 09:24:01 UTC (rev 4404) @@ -50,7 +50,7 @@ st, res = CheckAccelerate(context, autoadd) if st: st = check_include_and_run(context, 'CBLAS (Accelerate Framework)', - res.cfgopts, ['Accelerate/Accelerate.h'], cblas_src, autoadd) + res.cfgopts, [], cblas_src, autoadd) if st: add_info(env, 'cblas', res) return st @@ -58,7 +58,7 @@ st, res = CheckVeclib(context, autoadd) if st: st = check_include_and_run(context, 'CBLAS (vecLib Framework)', - res.cfgopts, ['vecLib/vecLib.h'], cblas_src, autoadd) + res.cfgopts, [], cblas_src, autoadd) if st: add_info(env, 'cblas', res) return st @@ -72,7 +72,7 @@ st, res = CheckMKL(context, autoadd) if st: st = check_include_and_run(context, 'CBLAS (MKL)', res.cfgopts, - ['mkl.h'], cblas_src, autoadd) + [], cblas_src, autoadd) if st: add_info(env, 'cblas', res) return st @@ -81,7 +81,7 @@ st, res = CheckATLAS(context, autoadd) if st: st = check_include_and_run(context, 'CBLAS (ATLAS)', res.cfgopts, - ['cblas.h'], cblas_src, autoadd) + [], cblas_src, autoadd) if st: add_info(env, 'cblas', res) return st @@ -90,7 +90,7 @@ st, res = CheckSunperf(context, autoadd) if st: st = check_include_and_run(context, 'CBLAS (Sunperf)', res.cfgopts, - ['sunperf.h'], cblas_src, autoadd) + [], cblas_src, autoadd) if st: add_info(env, 'cblas', res) return st From numpy-svn at scipy.org Tue Nov 6 06:01:21 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 6 Nov 2007 05:01:21 -0600 (CST) Subject: [Numpy-svn] r4405 - in branches/numpy.scons/numpy: distutils/scons distutils/scons/checkers distutils/scons/core distutils/scons/doc scons_fake/checklib scons_fake/ctypesext Message-ID: <20071106110121.E4E5839C305@new.scipy.org> Author: cdavid Date: 2007-11-06 05:01:09 -0600 (Tue, 06 Nov 2007) New Revision: 4405 Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py branches/numpy.scons/numpy/distutils/scons/core/libinfo.py branches/numpy.scons/numpy/distutils/scons/core/libinfo_scons.py branches/numpy.scons/numpy/distutils/scons/doc/TODO branches/numpy.scons/numpy/scons_fake/checklib/SConstruct branches/numpy.scons/numpy/scons_fake/ctypesext/SConstruct Log: A generic lib and header check is now available Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-11-06 09:24:01 UTC (rev 4404) +++ branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-11-06 11:01:09 UTC (rev 4405) @@ -1,5 +1,5 @@ from core.numpyenv import GetNumpyEnvironment, GetNumpyOptions -from core.libinfo_scons import NumpyCheckLib +from core.libinfo_scons import NumpyCheckLibAndHeader from core.libinfo import get_paths as scons_get_paths from core.extension import get_python_inc, get_pythonlib_dir from core.utils import isstring, rsplit Modified: branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-11-06 09:24:01 UTC (rev 4404) +++ branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-11-06 11:01:09 UTC (rev 4405) @@ -42,6 +42,8 @@ (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) if found: opts = ConfigOpts(cpppath = cpppath, libpath = libpath, libs = libs) + if len(libs) == 1 and len(libs[0]) == 0: + opts['libs'] = defopts['libs'] else: opts = defopts @@ -52,8 +54,9 @@ # Check whether the header is available (CheckHeader-like checker) saved = save_and_set(env, opts) try: - # XXX: add dep vars in code - src = '\n'.join([r'#include <%s>' % h for h in headers_to_check]) + src_code = [r'#include <%s>' % h for h in headers_to_check] + src_code.extend([r'#if 0', str(opts), r'#endif', '\n']) + src = '\n'.join(src_code) st = context.TryCompile(src, '.c') finally: restore(env, saved) @@ -67,8 +70,8 @@ saved = save_and_set(env, opts) try: for sym in funcs_to_check: - # XXX: add dep vars in code - st = check_symbol(context, headers_to_check, sym) + extra = [r'#if 0', str(opts), r'#endif', '\n'] + st = check_symbol(context, headers_to_check, sym, '\n'.join(extra)) if not st: break finally: Modified: branches/numpy.scons/numpy/distutils/scons/core/libinfo.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/libinfo.py 2007-11-06 09:24:01 UTC (rev 4404) +++ branches/numpy.scons/numpy/distutils/scons/core/libinfo.py 2007-11-06 11:01:09 UTC (rev 4405) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Mon Oct 29 03:00 PM 2007 J +# Last Change: Tue Nov 06 06:00 PM 2007 J # Module for support to look for external code (replacement of # numpy.distutils.system_info). KEEP THIS INDEPENDANT OF SCONS ! @@ -71,17 +71,17 @@ if siteconfig.has_section(section): try: libpath = get_paths(siteconfig.get(section, 'library_dirs')) - except ConfigParser.NoSectionError, e: + except ConfigParser.NoOptionError, e: libpath = [] try: cpppath = get_paths(siteconfig.get(section, 'include_dirs')) - except ConfigParser.NoSectionError, e: + except ConfigParser.NoOptionError, e: cpppath = [] try: libs = parse_config_param(siteconfig.get(section, 'libraries')) - except ConfigParser.NoSectionError, e: + except ConfigParser.NoOptionError, e: libs = [] return (cpppath, libs, libpath), 1 else: Modified: branches/numpy.scons/numpy/distutils/scons/core/libinfo_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/libinfo_scons.py 2007-11-06 09:24:01 UTC (rev 4404) +++ branches/numpy.scons/numpy/distutils/scons/core/libinfo_scons.py 2007-11-06 11:01:09 UTC (rev 4405) @@ -1,11 +1,16 @@ #! /usr/bin/env python -# Last Change: Fri Oct 26 04:00 PM 2007 J +# Last Change: Tue Nov 06 07:00 PM 2007 J # Module for support to look for external code (replacement of # numpy.distutils.system_info). scons dependant code. import ConfigParser from copy import deepcopy +import os +from numpy.distutils.scons.core.libinfo import get_config_from_section, get_config +from numpy.distutils.scons.checkers.support import ConfigOpts, save_and_set, \ + restore, check_symbol + from libinfo import get_config, get_paths, parse_config_param from utils import get_empty @@ -22,106 +27,16 @@ return 0; }\n """ -def _CheckLib(context, libs, symbols, header, language, section, siteconfig, - libpath, cpppath, verbose): - """Implementation for checking a list of symbols, with libs. - - Assumes that libs, symbol, header, libpath and cpppath are sequences (list - or tuples). DO NOT USE DIRECTLY IN SCONSCRIPT !!!""" - # XXX: sanitize API for section/siteconfig option: if section is not given, - # can we just say to ignore the sitecfg ? - if not siteconfig: - siteconfig, cfgfiles = get_config() +def NumpyCheckLibAndHeader(context, libs, symbols = None, headers = None, + language = None, section = None, name = None, + autoadd = 1): + # XXX: would be nice for each extension to add an option to + # command line. - def get_descr(): - try: - descr = siteconfig.items(section) - except ConfigParser.NoSectionError: - descr = "" - sdescr = "" - for i in descr: - sdescr += str(i) + '\n' - return sdescr - - # Generate the source string of the conftest - src = "" - callstr = "" - - if symbols: - for s in symbols: - # XXX: should put undef here (ala autoconf) - src += _SYMBOL_DEF_STR % s - callstr += "%s();" % s - - src += _MAIN_CALL_CENTER % callstr - # HUGE HACK: we want this test to depend on site.cfg files obviously, since - # a change in them can change the libraries tested. But Depends does not - # seem to work in configuration context, and I don't see any simple way to - # have the same functionality. So I put the configuration we got from - # get_config into the source code, such as a change in site.cfg will change - # the source file, and thus taken into account to decide whether to rebuild - # from tjhe SconfTaskMaster point of view. - - # XXX: I put the content between #if 0 / #endif, which is the most portable - # way I am aware of for multilines comments in C and C++ (this is also - # recommended in C++ portability guide of mozilla for nested comments, - # which may happen here). This is also the most robust, since it seems - # unlikely to have any #endif somewhere in the return value of get_descr. - src += "#if 0\n" - src += get_descr() - src += "\n#endif\n" - - # XXX: handle autoadd - # XXX: handle extension - extension = '.c' - - if section and siteconfig: - #print "Checking %s from section %s" % (libs[0], section) - res = _check_lib_section(context, siteconfig, section, src, libs, - libpath, cpppath) - else: - oldLIBS = context.env.has_key('LIBS') and deepcopy(context.env['LIBS']) - context.env.Append(LIBS = libs) - res = context.TryLink(src, '.c') - if not res: - context.env.Replace(LIBS = oldLIBS) - - return res - - -def NumpyCheckLib(context, libs, symbols = None, header = None, - language = None, section = None, siteconfig = None, name = None, verbose = None): - """Check for symbol in libs. - - This is the general purpose replacement for numpy.distutils.system_info. It - uses the options in siteconfig so that search path can be overwritten in - *.cfg files (using section given by section argument). If siteconfig is - None, it does uses get_config function to get the configuration, which - gives the old numpy.distutils behaviour to get options. - - - Convention: if the section has *dirs parameters, it will use them all in - one pass, e.g if library_dirs is ['/usr/local/lib', '/usr/local/mylib'], it - will try to link the given libraries by appending both directories to the - LIBPATH.""" - #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - # This is really preliminary, and needs a lot of love before being in good - # shape !!!!! - # - # Biggest problem: how to show information about found libraries ? Since - # they are found implicitely through build tools (compiler and linker), we - # can not give explicit information. IMHO (David Cournapeau), it is better - # to find them implicitely because it is much more robust. But for the info... - # - # This needs testing, too. - #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ from SCons.Util import is_List env = context.env - # XXX: would be nice for each extension to add an option to - # command line. - # XXX: handle env var # XXX: handle language if language: raise NotImplementedError("FIXME: language selection not implemented yet !") @@ -131,66 +46,78 @@ libs = [libs] if symbols and not is_List(symbols): symbols = [symbols] + if headers and not is_List(headers): + headers = [headers] if not name: name = libs[0] + # Get site.cfg customization if any + siteconfig, cfgfiles = get_config() + (cus_cpppath, cus_libs, cus_libpath), found = \ + get_config_from_section(siteconfig, section) + if found: + opts = ConfigOpts(cpppath = cus_cpppath, libpath = cus_libpath, + libs = cus_libs) + # XXX: fix this + if len(cus_libs) == 1 and len(cus_libs[0]) == 0: + opts['libs'] = libs + else: + opts = ConfigOpts(libs = libs) + # Display message if symbols: sbstr = ', '.join(symbols) - context.Message('Checking for symbol(s) %s in %s... ' % (sbstr, name)) + msg = 'Checking for symbol(s) %s in %s... ' % (sbstr, name) + if found: + msg += '(customized from site.cfg) ' else: - context.Message('Checking for %s... ' % name) + msg = 'Checking for %s... ' % name + if found: + msg += '(customized from site.cfg) ' + context.Message(msg) - # Call the implementation - libpath = None - cpppath = None - res = _CheckLib(context, libs, symbols, header, language, section, - siteconfig, libpath, cpppath, verbose) - context.Result(res) - return res - -def _check_lib_section(context, siteconfig, section, src, libs, libpath, cpppath): - # Convention: if an option is found in site.cfg for the given - # section, it takes precedence on the arguments libs, libpath, - # cpppath. - res = 1 - - # XXX: refactor this mess + # Disable from environment if name=None is in it try: - newLIBPATH = get_paths(siteconfig.get(section, 'library_dirs')) - except ConfigParser.NoSectionError, e: - if libpath: - newLIBPATH = libpath - else: - newLIBPATH = [] + value = os.environ[name] + if value == 'None': + return context.Result('Disabled from env through var %s !' % name), {} + except KeyError: + pass + # Check whether the header is available (CheckHeader-like checker) + saved = save_and_set(env, opts) try: - newCPPPATH = get_paths(siteconfig.get(section, 'include_dirs')) - except ConfigParser.NoSectionError, e: - if cpppath: - newCPPPATH = cpppath - else: - newCPPPATH = [] + src_code = [r'#include <%s>' % h for h in headers] + src_code.extend([r'#if 0', str(opts), r'#endif', '\n']) + src = '\n'.join(src_code) + st = context.TryCompile(src, '.c') + finally: + restore(env, saved) - try: - newLIBS = parse_config_param(siteconfig.get(section, 'libraries')) - except ConfigParser.NoSectionError, e: - if libs: - newLIBS = libs - else: - newLIBS = [] + if not st: + context.Result('Failed (could not check header(s) : check config.log '\ + 'in %s for more details)' % env['build_dir']) + return st - lastLIBPATH = get_empty(context.env,'LIBPATH') - lastLIBS = get_empty(context.env,'LIBS') - lastCPPPATH = get_empty(context.env,'CPPPATH') - context.env.Append(LIBPATH = newLIBPATH) - context.env.Append(LIBS = newLIBS) - context.env.Append(CPPPATH = newCPPPATH) - res *= context.TryLink(src, '.c') - if not res: - context.env.Replace(LIBS = lastLIBS, - LIBPATH = lastLIBPATH, - CPPPATH = lastCPPPATH) - - return res + # Check whether the library is available (CheckLib-like checker) + saved = save_and_set(env, opts) + try: + for sym in symbols: + # Add opts at the end of the source code to force dependency of + # check from options. + extra = [r'#if 0', str(opts), r'#endif', '\n'] + st = check_symbol(context, None, sym, '\n'.join(extra)) + if not st: + break + finally: + if st == 0 or autoadd == 0: + restore(env, saved) + + if not st: + context.Result('Failed (could not check symbol %s : check config.log '\ + 'in %s for more details))' % (sym, env['build_dir'])) + return st + + context.Result(st) + return st Modified: branches/numpy.scons/numpy/distutils/scons/doc/TODO =================================================================== --- branches/numpy.scons/numpy/distutils/scons/doc/TODO 2007-11-06 09:24:01 UTC (rev 4404) +++ branches/numpy.scons/numpy/distutils/scons/doc/TODO 2007-11-06 11:01:09 UTC (rev 4405) @@ -1,9 +1,9 @@ Before second alpha (in order of priority): - CheckHeader and CheckLib ala scons, with site.cfg support. - - support environments wo fortran compilers Before first beta: - f2py and scipy interoperability: N hours ? + - support environments wo fortran compilers Design questions: - improve BrokenMathlib and Mathlib in core, and make them available to Modified: branches/numpy.scons/numpy/scons_fake/checklib/SConstruct =================================================================== --- branches/numpy.scons/numpy/scons_fake/checklib/SConstruct 2007-11-06 09:24:01 UTC (rev 4404) +++ branches/numpy.scons/numpy/scons_fake/checklib/SConstruct 2007-11-06 11:01:09 UTC (rev 4405) @@ -1,9 +1,9 @@ # vim:syntax=python -from numpy.distutils.scons import GetNumpyEnvironment, NumpyCheckLib +from numpy.distutils.scons import GetNumpyEnvironment, NumpyCheckLibAndHeader env = GetNumpyEnvironment(ARGUMENTS) -config = env.NumpyConfigure(custom_tests = {'NumpyCheckLib' : NumpyCheckLib}) -if not config.NumpyCheckLib('sndfile', 'sf_open', section = 'sndfile'): +config = env.NumpyConfigure(custom_tests = {'NumpyCheckLibAndHeader' : NumpyCheckLibAndHeader}) +if not config.NumpyCheckLibAndHeader('sndfile', 'sf_open', 'sndfile.h', section = 'sndfile'): print "sndfile not found, this package cannot work without sndfile !" config.Finish() Modified: branches/numpy.scons/numpy/scons_fake/ctypesext/SConstruct =================================================================== --- branches/numpy.scons/numpy/scons_fake/ctypesext/SConstruct 2007-11-06 09:24:01 UTC (rev 4404) +++ branches/numpy.scons/numpy/scons_fake/ctypesext/SConstruct 2007-11-06 11:01:09 UTC (rev 4405) @@ -1,5 +1,5 @@ # vim:syntax=python -from numpy.distutils.scons import GetNumpyEnvironment, NumpyCheckLib +from numpy.distutils.scons import GetNumpyEnvironment env = GetNumpyEnvironment(ARGUMENTS) From numpy-svn at scipy.org Tue Nov 6 06:08:09 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 6 Nov 2007 05:08:09 -0600 (CST) Subject: [Numpy-svn] r4406 - branches/numpy.scons/numpy/core Message-ID: <20071106110809.0B3C039C2EA@new.scipy.org> Author: cdavid Date: 2007-11-06 05:08:06 -0600 (Tue, 06 Nov 2007) New Revision: 4406 Modified: branches/numpy.scons/numpy/core/SConstruct Log: Remove unused (and deprecated) NumpyCheckLib Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-11-06 11:01:09 UTC (rev 4405) +++ branches/numpy.scons/numpy/core/SConstruct 2007-11-06 11:08:06 UTC (rev 4406) @@ -1,4 +1,4 @@ -# Last Change: Fri Nov 02 06:00 PM 2007 J +# Last Change: Tue Nov 06 07:00 PM 2007 J # vim:syntax=python import os import sys @@ -7,7 +7,6 @@ from numpy.distutils.scons import get_python_inc, get_pythonlib_dir from numpy.distutils.scons import GetNumpyEnvironment -from numpy.distutils.scons import NumpyCheckLib from numpy.distutils.scons import CheckCBLAS from numpy.distutils.scons.configuration import write_info @@ -29,8 +28,7 @@ # XXX: separate env for configuration config = env.NumpyConfigure(custom_tests = {'CheckBrokenMathlib' : CheckBrokenMathlib, 'CheckMathlib' : CheckMathlib, - 'CheckCBLAS' : CheckCBLAS, - 'NumpyCheckLib' : NumpyCheckLib}) + 'CheckCBLAS' : CheckCBLAS}) # Convention: list of tuples (definition, value). value: # - 0: #undef definition From numpy-svn at scipy.org Tue Nov 6 06:16:13 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 6 Nov 2007 05:16:13 -0600 (CST) Subject: [Numpy-svn] r4407 - in branches/numpy.scons/numpy: distutils/scons distutils/scons/checkers scons_fake/checkers Message-ID: <20071106111613.4302639C2EA@new.scipy.org> Author: cdavid Date: 2007-11-06 05:16:05 -0600 (Tue, 06 Nov 2007) New Revision: 4407 Modified: branches/numpy.scons/numpy/distutils/scons/Changelog branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py branches/numpy.scons/numpy/scons_fake/checkers/SConstruct Log: Fix invalid CBLAS and LAPACK checks when used with atlas Modified: branches/numpy.scons/numpy/distutils/scons/Changelog =================================================================== --- branches/numpy.scons/numpy/distutils/scons/Changelog 2007-11-06 11:08:06 UTC (rev 4406) +++ branches/numpy.scons/numpy/distutils/scons/Changelog 2007-11-06 11:16:05 UTC (rev 4407) @@ -1,5 +1,9 @@ Tue, 06 Nov 2007 16:48:51 +0900 User-visible Changes: + * NumpyCheckLibAndHeader checker. This can be used as a generic + checker for simple checks (list of libraries/headers/symbols to + check). + * LAPACK and CBLAS checkers are now overridable from site.cfg * CheckF77Mangling and CheckF90Mangling define variables Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-06 11:08:06 UTC (rev 4406) +++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-06 11:16:05 UTC (rev 4407) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Tue Nov 06 06:00 PM 2007 J +# Last Change: Tue Nov 06 08:00 PM 2007 J # Module for custom, common checkers for numpy (and scipy) import sys @@ -80,6 +80,7 @@ # Check ATLAS st, res = CheckATLAS(context, autoadd) if st: + res.cfgopts['libs'].insert(0, 'blas') st = check_include_and_run(context, 'CBLAS (ATLAS)', res.cfgopts, [], cblas_src, autoadd) if st: @@ -176,8 +177,9 @@ return st # Check ATLAS - st, opts = CheckATLAS(context, autoadd = 1) + st, res = CheckATLAS(context, autoadd = 1) if st: + res.cfgopts['libs'].insert(0, 'lapack') st = check_include_and_run(context, 'LAPACK (ATLAS)', res.cfgopts, [], test_src, autoadd) if st: Modified: branches/numpy.scons/numpy/scons_fake/checkers/SConstruct =================================================================== --- branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-11-06 11:08:06 UTC (rev 4406) +++ branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-11-06 11:16:05 UTC (rev 4407) @@ -9,10 +9,11 @@ import os try: - os.environ['DEBUG_SCONS_CHECK'] + val = os.environ['DEBUG_SCONS_CHECK'] + do_check = val +except KeyError: do_check = 1 -except KeyError: - do_check = 0 +print "do_check is %s" % do_check config = env.NumpyConfigure(custom_tests = {'CheckATLAS' : CheckATLAS, @@ -23,8 +24,7 @@ 'CheckF77Mangling' : CheckF77Mangling, 'CheckSunperf' : CheckSunperf}) -do_check = 1 -if do_check: +if do_check == 1: st, opts = config.CheckATLAS(autoadd = 0) st, opts = config.CheckMKL(autoadd = 0) st, opts = config.CheckAccelerate(autoadd = 0) From numpy-svn at scipy.org Tue Nov 6 09:16:37 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 6 Nov 2007 08:16:37 -0600 (CST) Subject: [Numpy-svn] r4408 - in branches/numpy.scons/numpy/distutils/scons: . checkers Message-ID: <20071106141637.DA30939C323@new.scipy.org> Author: cdavid Date: 2007-11-06 08:16:31 -0600 (Tue, 06 Nov 2007) New Revision: 4408 Modified: branches/numpy.scons/numpy/distutils/scons/Changelog branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py Log: Disable sunperf because of buggy sun compiler not linking sunperf for shared libraries... Modified: branches/numpy.scons/numpy/distutils/scons/Changelog =================================================================== --- branches/numpy.scons/numpy/distutils/scons/Changelog 2007-11-06 11:16:05 UTC (rev 4407) +++ branches/numpy.scons/numpy/distutils/scons/Changelog 2007-11-06 14:16:31 UTC (rev 4408) @@ -1,5 +1,9 @@ Tue, 06 Nov 2007 16:48:51 +0900 User-visible Changes: + * CBLAS and LAPACK checkers now both handles MKL, ATLAS, + Accelerate/vecLib frameworks (Mac OS X only) and Sunperf (Solaris + only). + * NumpyCheckLibAndHeader checker. This can be used as a generic checker for simple checks (list of libraries/headers/symbols to check). Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-06 11:16:05 UTC (rev 4407) +++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-06 14:16:31 UTC (rev 4408) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Tue Nov 06 08:00 PM 2007 J +# Last Change: Tue Nov 06 11:00 PM 2007 J # Module for custom, common checkers for numpy (and scipy) import sys @@ -87,14 +87,14 @@ add_info(env, 'cblas', res) return st - # Check Sunperf - st, res = CheckSunperf(context, autoadd) - if st: - st = check_include_and_run(context, 'CBLAS (Sunperf)', res.cfgopts, - [], cblas_src, autoadd) - if st: - add_info(env, 'cblas', res) - return st + # # Check Sunperf + # st, res = CheckSunperf(context, autoadd) + # if st: + # st = check_include_and_run(context, 'CBLAS (Sunperf)', res.cfgopts, + # [], cblas_src, autoadd) + # if st: + # add_info(env, 'cblas', res) + # return st add_info(env, 'cblas', 'Def numpy implementation used') return 0 From numpy-svn at scipy.org Wed Nov 7 04:55:14 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 7 Nov 2007 03:55:14 -0600 (CST) Subject: [Numpy-svn] r4409 - branches/numpy.scons/numpy/distutils/scons/core Message-ID: <20071107095514.F03DC39C04B@new.scipy.org> Author: cdavid Date: 2007-11-07 03:55:10 -0600 (Wed, 07 Nov 2007) New Revision: 4409 Modified: branches/numpy.scons/numpy/distutils/scons/core/default.py Log: Typo in compiler config Modified: branches/numpy.scons/numpy/distutils/scons/core/default.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/default.py 2007-11-06 14:16:31 UTC (rev 4408) +++ branches/numpy.scons/numpy/distutils/scons/core/default.py 2007-11-07 09:55:10 UTC (rev 4409) @@ -168,7 +168,7 @@ else: # For not yet supported compiler, just put everything in optims from # distutils - cfg = CompilerConfig(optims = + cfg = CompilerConfig(optim = distutils.sysconfig.get_config_vars('CFLAGS')) return cfg From numpy-svn at scipy.org Wed Nov 7 06:14:35 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 7 Nov 2007 05:14:35 -0600 (CST) Subject: [Numpy-svn] r4410 - in branches/numpy.scons/numpy: distutils/scons/checkers scons_fake Message-ID: <20071107111435.8120E39C188@new.scipy.org> Author: cdavid Date: 2007-11-07 05:14:25 -0600 (Wed, 07 Nov 2007) New Revision: 4410 Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py branches/numpy.scons/numpy/scons_fake/setup.py branches/numpy.scons/numpy/scons_fake/setupscons.py Log: Proper support for unsperf: since xlic_lib=sunperf does not work for shared libraries, hack to get link options from verbose link Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-07 09:55:10 UTC (rev 4409) +++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-07 11:14:25 UTC (rev 4410) @@ -87,14 +87,14 @@ add_info(env, 'cblas', res) return st - # # Check Sunperf - # st, res = CheckSunperf(context, autoadd) - # if st: - # st = check_include_and_run(context, 'CBLAS (Sunperf)', res.cfgopts, - # [], cblas_src, autoadd) - # if st: - # add_info(env, 'cblas', res) - # return st + # Check Sunperf + st, res = CheckSunperf(context, autoadd) + if st: + st = check_include_and_run(context, 'CBLAS (Sunperf)', res.cfgopts, + [], cblas_src, autoadd) + if st: + add_info(env, 'cblas', res) + return st add_info(env, 'cblas', 'Def numpy implementation used') return 0 Modified: branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-11-07 09:55:10 UTC (rev 4409) +++ branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-11-07 11:14:25 UTC (rev 4410) @@ -10,6 +10,7 @@ import re import os from os.path import join as pjoin +from copy import deepcopy from numpy.distutils.system_info import default_lib_dirs from numpy.distutils.scons.core.libinfo import get_config_from_section, get_config @@ -20,7 +21,7 @@ from support import save_and_set, restore, ConfigOpts, ConfigRes def _check(context, name, section, defopts, headers_to_check, funcs_to_check, - check_version, version_checker, autoadd): + check_version, version_checker, autoadd, rpath_is_libpath = True): """Generic implementation for perflib check. This checks for header (by compiling code including them) and symbols in @@ -47,7 +48,8 @@ else: opts = defopts - opts['rpath'] = opts['libpath'] + if rpath_is_libpath: + opts['rpath'] = deepcopy(opts['libpath']) env = context.env @@ -224,6 +226,11 @@ check_version, None, autoadd) +from os.path import basename, dirname +from copy import deepcopy +from numpy.distutils.scons.core.utils import popen_wrapper +from numpy.distutils.scons.testcode_snippets import cblas_sgemm + def CheckSunperf(context, autoadd = 1, check_version = 0): """Checker for sunperf.""" name = 'Sunperf' @@ -233,5 +240,104 @@ headers = ['sunperf.h'] funcs = ['cblas_sgemm'] - return _check(context, name, section, defopts, headers, funcs, - check_version, None, autoadd) + st, res = _check(context, name, section, defopts, headers, funcs, + check_version, None, autoadd) + + if not st: + return st, res + # We are not done: the option -xlic_lib=sunperf is not used by the linked + # for shared libraries, I have no idea why. So if the test is succesfull, + # we need more work to get the link options necessary to make the damn + # thing work. + context.Message('Getting link options of sunperf ... ') + + opts = res.cfgopts + test_code = cblas_sgemm + env = context.env + saved = save_and_set(env, opts) + try: + st = context.TryCompile(test_code, '.c') + finally: + restore(env, saved) + + if not res: + return context.Result('Failed !'), res + + saved = save_and_set(env, opts) + env.Append(LINKFLAGS = '-#') + oldLINK = env['LINK'] + env['LINK'] = '$CC' + try: + # XXX: does this scheme to get the program name always work ? Can + # we use Scons to get the target name from the object name ? + slast = str(context.lastTarget) + dir = dirname(slast) + test_prog = pjoin(dir, basename(slast).split('.')[0]) + + cmd = context.env.subst('$LINKCOM', + target = context.env.File(test_prog), + source = context.lastTarget) + st, out = popen_wrapper(cmd, merge = True) + finally: + restore(env, saved) + env['LINK'] = oldLINK + + # If the verbose output succeeds, parse the output + if not st: + st = 1 + pa = floupi(out) + for k, v in pa.items(): + opts[k].extend(deepcopy(v)) + res = ConfigRes(name, opts, res.is_customized()) + context.Result('Succeeded !') + else: + st = 0 + context.Result('Failed !') + + return st, res + +haha = r""" +cc -o build/scons/numpy/scons_fake/checkers/.sconf/conftest_5 -xlic_lib=sunperf -# build/scons/numpy/scons_fake/checkers/.sconf/conftest_5.o +### Note: NLSPATH = /opt/SUNWspro/prod/bin/../lib/locale/%L/LC_MESSAGES/%N.cat:/opt/SUNWspro/prod/bin/../../lib/locale/%L/LC_MESSAGES/%N.cat +### command line files and options (expanded): + ### -xlic_lib=sunperf build/scons/numpy/scons_fake/checkers/.sconf/conftest_5.o -o build/scons/numpy/scons_fake/checkers/.sconf/conftest_5 + ### Note: LD_LIBRARY_PATH = + ### Note: LD_RUN_PATH = + /usr/ccs/bin/ld /opt/SUNWspro/prod/lib/crti.o /opt/SUNWspro/prod/lib/crt1.o /opt/SUNWspro/prod/lib/values-xa.o -o build/scons/numpy/scons_fake/checkers/.sconf/conftest_5 -lsunperf -lfui -lfsu -lmtsk -lsunmath -lpicl -lm build/scons/numpy/scons_fake/checkers/.sconf/conftest_5.o -Y "P,/opt/SUNWspro/lib:/opt/SUNWspro/prod/lib:/usr/ccs/lib:/lib:/usr/lib" -Qy -R/opt/SUNWspro/lib -lc /opt/SUNWspro/prod/lib/crtn.o""" + +def floupi(out): + import shlex + import os + lexer = shlex.shlex(out, posix = True) + lexer.whitespace_split = True + + accept_libs = ['sunperf', 'fui', 'fsu', 'mtsk', 'sunmath'] + keep = dict(zip(['libs', 'libpath', 'rpath'], [[], [], []])) + t = lexer.get_token() + while t: + def parse(token): + if token.startswith('-l'): + n = token.split('-l')[1] + if n in accept_libs: + keep['libs'].append(n) + t = lexer.get_token() + elif token.startswith('-Y'): + n = token + t = lexer.get_token() + if t.startswith('P,'): + t = t[2:] + nt = t.split(os.pathsep) + keep['libpath'].extend(nt) + elif token.startswith('-Qy'): + n = token + t = lexer.get_token() + if t.startswith('-R'): + arg = t.split('-R', 1)[1] + nt = arg.split(os.pathsep) + keep['rpath'].extend(nt) + else: + t = lexer.get_token() + return t + t = parse(t) + + return keep Modified: branches/numpy.scons/numpy/scons_fake/setup.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/setup.py 2007-11-07 09:55:10 UTC (rev 4409) +++ branches/numpy.scons/numpy/scons_fake/setup.py 2007-11-07 11:14:25 UTC (rev 4410) @@ -5,10 +5,10 @@ from numpy.distutils.misc_util import Configuration config = Configuration('scons_fake',parent_package,top_path) + config.add_subpackage('checkers') config.add_subpackage('pyext') config.add_subpackage('ctypesext') config.add_subpackage('checklib') - config.add_subpackage('checkers') config.add_subpackage('hook') return config Modified: branches/numpy.scons/numpy/scons_fake/setupscons.py =================================================================== --- branches/numpy.scons/numpy/scons_fake/setupscons.py 2007-11-07 09:55:10 UTC (rev 4409) +++ branches/numpy.scons/numpy/scons_fake/setupscons.py 2007-11-07 11:14:25 UTC (rev 4410) @@ -5,10 +5,10 @@ from numpy.distutils.misc_util import Configuration config = Configuration('scons_fake',parent_package,top_path) + config.add_subpackage('checkers') config.add_subpackage('pyext') config.add_subpackage('ctypesext') config.add_subpackage('checklib') - config.add_subpackage('checkers') config.add_subpackage('hook') return config From numpy-svn at scipy.org Wed Nov 7 15:53:03 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 7 Nov 2007 14:53:03 -0600 (CST) Subject: [Numpy-svn] r4411 - tags/1.0.4/numpy Message-ID: <20071107205303.6C6CA39C0CA@new.scipy.org> Author: jarrod.millman Date: 2007-11-07 14:53:01 -0600 (Wed, 07 Nov 2007) New Revision: 4411 Modified: tags/1.0.4/numpy/version.py Log: making release Modified: tags/1.0.4/numpy/version.py =================================================================== --- tags/1.0.4/numpy/version.py 2007-11-07 11:14:25 UTC (rev 4410) +++ tags/1.0.4/numpy/version.py 2007-11-07 20:53:01 UTC (rev 4411) @@ -1,5 +1,5 @@ -version='1.0.4-rc1' -release=False +version='1.0.4' +release=True if not release: version += '.dev' From numpy-svn at scipy.org Wed Nov 7 16:46:25 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 7 Nov 2007 15:46:25 -0600 (CST) Subject: [Numpy-svn] r4412 - trunk Message-ID: <20071107214625.652FFC7C027@new.scipy.org> Author: chanley Date: 2007-11-07 15:46:06 -0600 (Wed, 07 Nov 2007) New Revision: 4412 Modified: trunk/TEST_COMMIT Log: test commit Modified: trunk/TEST_COMMIT =================================================================== --- trunk/TEST_COMMIT 2007-11-07 20:53:01 UTC (rev 4411) +++ trunk/TEST_COMMIT 2007-11-07 21:46:06 UTC (rev 4412) @@ -2,7 +2,7 @@ rkern: yes pearu: yes fperez: yes -chanley: yes - still +chanley: yes cookedm: yes swalton: yes eric: yes From numpy-svn at scipy.org Wed Nov 7 17:41:46 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 7 Nov 2007 16:41:46 -0600 (CST) Subject: [Numpy-svn] r4413 - tags/1.0.4/numpy/core Message-ID: <20071107224146.4F1B539C09E@new.scipy.org> Author: oliphant Date: 2007-11-07 16:41:44 -0600 (Wed, 07 Nov 2007) New Revision: 4413 Modified: tags/1.0.4/numpy/core/setup.py Log: Fix a python2.3 compatibility problem. Modified: tags/1.0.4/numpy/core/setup.py =================================================================== --- tags/1.0.4/numpy/core/setup.py 2007-11-07 21:46:06 UTC (rev 4412) +++ tags/1.0.4/numpy/core/setup.py 2007-11-07 22:41:44 UTC (rev 4413) @@ -105,7 +105,7 @@ if sys.platform == 'win32': moredefs.append('NPY_NO_SIGNAL') - if sys.platform=='win32' or os.name=='nt': + if sys.version[:3] > '2.4' and (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) From numpy-svn at scipy.org Thu Nov 8 03:52:41 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 8 Nov 2007 02:52:41 -0600 (CST) Subject: [Numpy-svn] r4414 - branches/numpy.scons/numpy/core Message-ID: <20071108085241.7714739C03E@new.scipy.org> Author: cdavid Date: 2007-11-08 02:52:27 -0600 (Thu, 08 Nov 2007) New Revision: 4414 Modified: branches/numpy.scons/numpy/core/SConstruct Log: numpy.core: when checking for maths funcs, just check for symbol (func;) instead of calling the funct (f();) to keep consistent with disstutils config.check_func Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-11-07 22:41:44 UTC (rev 4413) +++ branches/numpy.scons/numpy/core/SConstruct 2007-11-08 08:52:27 UTC (rev 4414) @@ -104,7 +104,7 @@ """Check that f is available in mlib, and add the symbol appropriately. f is expected to be a tuble (symbol, cpp define).""" - st = config.CheckLib(mlib, f[0], autoadd = autoadd) + st = config.CheckLibWithHeader(mlib, 'math.h', language = 'C', call = '%s;' % f[0], autoadd = autoadd) if st: config_sym.append((f[1], 1)) else: From numpy-svn at scipy.org Thu Nov 8 03:54:09 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 8 Nov 2007 02:54:09 -0600 (CST) Subject: [Numpy-svn] r4415 - branches/numpy.scons/numpy/distutils/scons/core Message-ID: <20071108085409.5D5F839C03E@new.scipy.org> Author: cdavid Date: 2007-11-08 02:54:02 -0600 (Thu, 08 Nov 2007) New Revision: 4415 Modified: branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py Log: Use SharedLibrary builer with mingw instead of LoadableModule because the latter is buggy with current scons Modified: branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py 2007-11-08 08:52:27 UTC (rev 4414) +++ branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py 2007-11-08 08:54:02 UTC (rev 4415) @@ -5,12 +5,34 @@ import sys from copy import deepcopy +from distutils.unixccompiler import UnixCCompiler +from numpy.distutils.misc_util import msvc_runtime_library + from extension import get_pythonlib_dir, get_python_inc def built_with_mstools(env): """Return True if built with MS tools (compiler + linker).""" - return env.has_key('MSVS') + # Handle case where MSVS is found, but mingw is used + return env.has_key('MSVS') and not built_with_mingw +def built_with_mingw(env): + """Return true if built with mingw compiler.""" + return env['cc_opt'] == 'mingw' + +def get_pythonlib_name(debug = 0): + """Return the name of python library (necessary to link on NT with + mingw.""" + # Yeah, distutils burried the link option on NT deep down in + # Extension module, we cannot reuse it ! + if debug == 1: + template = 'python%d%d_d' + else: + template = 'python%d%d' + + return template % (sys.hexversion >> 24, + (sys.hexversion >> 16) & 0xff) + + def PythonExtension(env, target, source, *args, **kw): # XXX Check args and kw # XXX: Some things should not be set here... @@ -24,20 +46,58 @@ else: CPPPATH = [] + if env.has_key('LIBPATH'): + LIBPATH = deepcopy(env['LIBPATH']) + else: + LIBPATH = [] + + if env.has_key('LIBS'): + LIBS = deepcopy(env['LIBS']) + else: + LIBS = [] + CPPPATH.append(get_python_inc()) if sys.platform == 'win32': if built_with_mstools(env): - # XXX: We add the path where to find python2.5.lib (or any other + # XXX: We add the path where to find python lib (or any other # version, of course). This seems to be necessary for MS compilers. - env.AppendUnique(LIBPATH = get_pythonlib_dir()) + #env.AppendUnique(LIBPATH = get_pythonlib_dir()) + LIBPATH.append(get_pythonlib_dir()) + elif built_with_mingw(env): + # XXX: this part should be moved elsewhere (mingw abstraction + # for python) + + # This is copied from mingw32ccompiler.py in numpy.distutils + # (not supported by distutils.) + + # Include the appropiate MSVC runtime library if Python was + # built with MSVC >= 7.0 (MinGW standard is msvcrt) + py_runtime_library = msvc_runtime_library() + LIBPATH.append(get_pythonlib_dir()) + LIBS.extend([get_pythonlib_name(), py_runtime_library]) + elif sys.platform == "darwin": # XXX: When those should be used ? (which version of Mac OS X ?) LINKFLAGS += ' -undefined dynamic_lookup ' # Use LoadableModule because of Mac OS X - wrap = env.LoadableModule(target, source, SHLIBPREFIX = '', - LDMODULESUFFIX = '$PYEXTSUFFIX', - SHLIBSUFFIX = '$PYEXTSUFFIX', - LINKFLAGS = LINKFLAGS, - CPPPATH = CPPPATH, *args, **kw) + # ... but scons has a bug (#issue 1669) with mingw and Loadable + # Module, so use SharedLibrary with mingw. + if built_with_mingw(env): + wrap = env.SharedLibrary(target, source, SHLIBPREFIX = '', + #LDMODULESUFFIX = '$PYEXTSUFFIX', + SHLIBSUFFIX = '$PYEXTSUFFIX', + LINKFLAGS = LINKFLAGS, + LIBS = LIBS, + LIBPATH = LIBPATH, + CPPPATH = CPPPATH, + *args, **kw) + else: + wrap = env.LoadableModule(target, source, SHLIBPREFIX = '', + LDMODULESUFFIX = '$PYEXTSUFFIX', + SHLIBSUFFIX = '$PYEXTSUFFIX', + LINKFLAGS = LINKFLAGS, + LIBS = LIBS, + LIBPATH = LIBPATH, + CPPPATH = CPPPATH, *args, **kw) return wrap From numpy-svn at scipy.org Thu Nov 8 03:55:38 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 8 Nov 2007 02:55:38 -0600 (CST) Subject: [Numpy-svn] r4416 - branches/numpy.scons/numpy/distutils/scons/core Message-ID: <20071108085538.9EA5439C03E@new.scipy.org> Author: cdavid Date: 2007-11-08 02:55:31 -0600 (Thu, 08 Nov 2007) New Revision: 4416 Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py Log: Use g++ for linking with mingw to keep compatible with numpy.distutils Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-08 08:54:02 UTC (rev 4415) +++ branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-08 08:55:31 UTC (rev 4416) @@ -90,6 +90,7 @@ from SCons.Environment import Environment from SCons.Tool import Tool, FindTool, FindAllTools from SCons.Script import BuildDir, Help + from SCons.Errors import EnvironmentError # XXX: I would prefer subclassing Environment, because we really expect # some different behaviour than just Environment instances... @@ -204,6 +205,12 @@ for i in [DEF_LINKERS, DEF_CXX_COMPILERS, DEF_ASSEMBLERS, DEF_ARS]: t = FindTool(i, env) or i[0] Tool(t)(env) + else: + try: + t = FindTool(['g++'], env) + env['LINK'] = t + except EnvironmentError: + raise RuntimeError('g++ not found: this is necessary with mingw32 to build numpy !') for t in FindAllTools(DEF_OTHER_TOOLS, env): Tool(t)(env) @@ -214,6 +221,7 @@ pass # Adding custom builder + # XXX: Put them into tools ? env['BUILDERS']['NumpySharedLibrary'] = NumpySharedLibrary env['BUILDERS']['NumpyCtypes'] = NumpyCtypes env['BUILDERS']['PythonExtension'] = PythonExtension From numpy-svn at scipy.org Thu Nov 8 03:56:40 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 8 Nov 2007 02:56:40 -0600 (CST) Subject: [Numpy-svn] r4417 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071108085640.DE3AB39C03E@new.scipy.org> Author: cdavid Date: 2007-11-08 02:56:34 -0600 (Thu, 08 Nov 2007) New Revision: 4417 Modified: branches/numpy.scons/numpy/distutils/scons/fortran_scons.py Log: Re-enable CheckF77Clib under win32 Modified: branches/numpy.scons/numpy/distutils/scons/fortran_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-11-08 08:55:31 UTC (rev 4416) +++ branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-11-08 08:56:34 UTC (rev 4417) @@ -74,9 +74,9 @@ def CheckF77Clib(context): """This tries to get Fortran runtime facilities necessary at link stage, and put the relevant flags in env['F77_LDFLAGS'].""" - if sys.platform[:5] == 'win32': - raise Exception("FIXME: This is not tested on windows.... No chance "\ - "of working if using visual Intel") + #if sys.platform[:5] == 'win32': + # raise Exception("FIXME: This is not tested on windows.... No chance "\ + # "of working if using visual Intel") fcompiler = 'F77' # TODO: check that F77 exists, and can be run if not context.env.has_key(fcompiler): From numpy-svn at scipy.org Thu Nov 8 04:18:02 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 8 Nov 2007 03:18:02 -0600 (CST) Subject: [Numpy-svn] r4418 - in branches/numpy.scons/numpy/distutils/scons: . core Message-ID: <20071108091802.8226C39C03E@new.scipy.org> Author: cdavid Date: 2007-11-08 03:17:50 -0600 (Thu, 08 Nov 2007) New Revision: 4418 Modified: branches/numpy.scons/numpy/distutils/scons/Changelog branches/numpy.scons/numpy/distutils/scons/core/default.py branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py Log: Add compiler configuration for mingw, update Changelog Modified: branches/numpy.scons/numpy/distutils/scons/Changelog =================================================================== --- branches/numpy.scons/numpy/distutils/scons/Changelog 2007-11-08 08:56:34 UTC (rev 4417) +++ branches/numpy.scons/numpy/distutils/scons/Changelog 2007-11-08 09:17:50 UTC (rev 4418) @@ -1,4 +1,17 @@ +Thu, 08 Nov 2007 17:55:17 +0900 + +User-visible Changes: + * numpy.scons can now built numpy on windows with mingw + +Wed, 07 Nov 2007 20:45:00 +0900 (3rd alpha) + +User-visible Changes: + * Sunperf hack to get linker options, because -xlic_lib does not seem + to work for shared libraries. I hope it works now. + + Tue, 06 Nov 2007 16:48:51 +0900 + User-visible Changes: * CBLAS and LAPACK checkers now both handles MKL, ATLAS, Accelerate/vecLib frameworks (Mac OS X only) and Sunperf (Solaris @@ -18,6 +31,7 @@ * Basic design explained in doc/DESIGN Mon, 05 Nov 2007 19:44:07 +0900 (2nd alpha) + User-visible Changes: * numpy/distutils/scons/checkers Perflib checkers (MKL, ATLAS, etc...) can be disabled by using Modified: branches/numpy.scons/numpy/distutils/scons/core/default.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/default.py 2007-11-08 08:56:34 UTC (rev 4417) +++ branches/numpy.scons/numpy/distutils/scons/core/default.py 2007-11-08 09:17:50 UTC (rev 4418) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Mon Nov 05 06:00 PM 2007 J +# Last Change: Thu Nov 08 06:00 PM 2007 J import sys import distutils.sysconfig @@ -89,6 +89,9 @@ # Basically, limit yourself to optimization/debug/warning flags. # XXX: customization from site.cfg or other ? +# XXX: cache this between different scons calls (would need to move outside +# scons invocation, and in distutils scons command....) + class CompilerConfig: def __init__(self, optim = None, warn = None, debug = None, debug_symbol = None, thread = None, extra = None): @@ -120,6 +123,7 @@ # It seems that scons consider any option with space in it as a multi option, # which breaks command line options. So just don't put space. def get_cc_config(name): + # name is the scons name for the tool if name == 'gcc': if distutils.sysconfig.get_config_vars('LDFLAGS')[0].find('-pthread'): thread = ['-pthread'] @@ -165,6 +169,9 @@ warn = ['/W3', '/Wall'], thread = ['/MD', '/GX'], extra = ['/nologo']) + elif name == 'mingw': + cfg = CompilerConfig(optim = ['-O2', '-fno-strict-aliasing'], + warn = ['-Wall', '-Wstrict-prototypes']) else: # For not yet supported compiler, just put everything in optims from # distutils Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-08 08:56:34 UTC (rev 4417) +++ branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-08 09:17:50 UTC (rev 4418) @@ -207,10 +207,13 @@ Tool(t)(env) else: try: - t = FindTool(['g++'], env) - env['LINK'] = t - except EnvironmentError: - raise RuntimeError('g++ not found: this is necessary with mingw32 to build numpy !') + t = FindTool(['g++'], env) + env['LINK'] = t + except EnvironmentError: + raise RuntimeError('g++ not found: this is necessary with mingw32 '\ + 'to build numpy !') + # XXX: is this really the right place ? + env.AppendUnique(CFLAGS = '-mno-cygwin') for t in FindAllTools(DEF_OTHER_TOOLS, env): Tool(t)(env) From numpy-svn at scipy.org Thu Nov 8 06:27:56 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 8 Nov 2007 05:27:56 -0600 (CST) Subject: [Numpy-svn] r4419 - branches/numpy.scons/numpy/distutils/scons/core Message-ID: <20071108112756.0021739C043@new.scipy.org> Author: cdavid Date: 2007-11-08 05:27:50 -0600 (Thu, 08 Nov 2007) New Revision: 4419 Modified: branches/numpy.scons/numpy/distutils/scons/core/default.py branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py Log: Fix typo in built_with_mstools, causing all kind of headache... Modified: branches/numpy.scons/numpy/distutils/scons/core/default.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/default.py 2007-11-08 09:17:50 UTC (rev 4418) +++ branches/numpy.scons/numpy/distutils/scons/core/default.py 2007-11-08 11:27:50 UTC (rev 4419) @@ -165,8 +165,10 @@ # ] # self.ldflags_static = [ '/nologo'] - cfg = CompilerConfig(optim = ['/Ox', '/DNDEBUG'], - warn = ['/W3', '/Wall'], + cfg = CompilerConfig(#optim = ['/Ox', '/DNDEBUG'], + #/Wall is too strong, huge amount of warnings.... + #warn = ['/W3', '/Wall'], + warn = ['/W3'], thread = ['/MD', '/GX'], extra = ['/nologo']) elif name == 'mingw': Modified: branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py 2007-11-08 09:17:50 UTC (rev 4418) +++ branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py 2007-11-08 11:27:50 UTC (rev 4419) @@ -13,7 +13,7 @@ def built_with_mstools(env): """Return True if built with MS tools (compiler + linker).""" # Handle case where MSVS is found, but mingw is used - return env.has_key('MSVS') and not built_with_mingw + return env.has_key('MSVS') and not built_with_mingw(env) def built_with_mingw(env): """Return true if built with mingw compiler.""" @@ -35,7 +35,8 @@ def PythonExtension(env, target, source, *args, **kw): # XXX Check args and kw - # XXX: Some things should not be set here... + # XXX: Some things should not be set here... Actually, this whole + # thing is a mess. if env.has_key('LINKFLAGS'): LINKFLAGS = deepcopy(env['LINKFLAGS']) else: @@ -79,6 +80,8 @@ elif sys.platform == "darwin": # XXX: When those should be used ? (which version of Mac OS X ?) LINKFLAGS += ' -undefined dynamic_lookup ' + else: + pass # Use LoadableModule because of Mac OS X # ... but scons has a bug (#issue 1669) with mingw and Loadable From numpy-svn at scipy.org Thu Nov 8 11:12:41 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 8 Nov 2007 10:12:41 -0600 (CST) Subject: [Numpy-svn] r4420 - trunk/numpy/linalg Message-ID: <20071108161241.2D76039C0C9@new.scipy.org> Author: cookedm Date: 2007-11-08 10:12:38 -0600 (Thu, 08 Nov 2007) New Revision: 4420 Modified: trunk/numpy/linalg/lapack_litemodule.c Log: Fix for #609: numpy/linalg/lapack_litemodule.c:lapack_lite_zgeqrf int vs. long Modified: trunk/numpy/linalg/lapack_litemodule.c =================================================================== --- trunk/numpy/linalg/lapack_litemodule.c 2007-11-08 11:27:50 UTC (rev 4419) +++ trunk/numpy/linalg/lapack_litemodule.c 2007-11-08 16:12:38 UTC (rev 4420) @@ -765,7 +765,7 @@ lapack_lite_status__ = \ FNAME(zgeqrf)(&m, &n, ZDATA(a), &lda, ZDATA(tau), ZDATA(work), &lwork, &info); - return Py_BuildValue("{s:l,s:l,s:l,s:l,s:l,s:l}","zgeqrf_",lapack_lite_status__,"m",m,"n",n,"lda",lda,"lwork",lwork,"info",info); + return Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:i}","zgeqrf_",lapack_lite_status__,"m",m,"n",n,"lda",lda,"lwork",lwork,"info",info); } From numpy-svn at scipy.org Thu Nov 8 14:26:52 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 8 Nov 2007 13:26:52 -0600 (CST) Subject: [Numpy-svn] r4421 - branches/numpy.scons/numpy/distutils/scons/checkers Message-ID: <20071108192652.A360239C050@new.scipy.org> Author: cdavid Date: 2007-11-08 13:26:47 -0600 (Thu, 08 Nov 2007) New Revision: 4421 Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py Log: Reenable sunperf for LAPACK (works on solaris studio express) Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-08 16:12:38 UTC (rev 4420) +++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-08 19:26:47 UTC (rev 4421) @@ -188,4 +188,14 @@ # implemented lapack symbols ?) return st + # Check Sunperf + st, res = CheckSunperf(context, autoadd) + if st: + st = check_include_and_run(context, 'LAPACK (Sunperf)', res.cfgopts, + [], test_src, autoadd) + if st: + add_info(env, 'lapack', res) + return st + + add_info(env, 'lapack', 'Def numpy implementation used') return 0 From numpy-svn at scipy.org Thu Nov 8 16:57:46 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 8 Nov 2007 15:57:46 -0600 (CST) Subject: [Numpy-svn] r4422 - trunk/numpy/distutils/command Message-ID: <20071108215746.0296839C0A3@new.scipy.org> Author: oliphant Date: 2007-11-08 15:57:44 -0600 (Thu, 08 Nov 2007) New Revision: 4422 Modified: trunk/numpy/distutils/command/build_ext.py Log: Back out change made in r4380 which causes scipy.fftpack not to build correctly. Modified: trunk/numpy/distutils/command/build_ext.py =================================================================== --- trunk/numpy/distutils/command/build_ext.py 2007-11-08 19:26:47 UTC (rev 4421) +++ trunk/numpy/distutils/command/build_ext.py 2007-11-08 21:57:44 UTC (rev 4422) @@ -89,7 +89,6 @@ ' overwriting build_info\n%s... \nwith\n%s...' \ % (libname, `clibs[libname]`[:300], `build_info`[:300])) clibs[libname] = build_info - local_clibs = clibs.copy() # .. and distribution libraries: for libname,build_info in self.distribution.libraries or []: if clibs.has_key(libname): @@ -113,11 +112,7 @@ for m in binfo.get('macros',[]): if m not in macros: macros.append(m) - if libname in local_clibs: - c = self.compiler - outname = c.library_filename(libname, - output_dir=self.build_temp) - ext.depends.append(outname) + for l in clibs.get(libname,{}).get('source_languages',[]): ext_languages.add(l) if c_libs: From numpy-svn at scipy.org Thu Nov 8 17:06:20 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 8 Nov 2007 16:06:20 -0600 (CST) Subject: [Numpy-svn] r4423 - tags/1.0.4/numpy/distutils/command Message-ID: <20071108220620.B0AE139C0AC@new.scipy.org> Author: oliphant Date: 2007-11-08 16:06:18 -0600 (Thu, 08 Nov 2007) New Revision: 4423 Modified: tags/1.0.4/numpy/distutils/command/build_ext.py Log: Travis O is doing a bad thing by modifying this tagged release. However, it is worse to have a release that causes SciPy to fail on build. Hopefully, not too many people have now invalidated releases. Modified: tags/1.0.4/numpy/distutils/command/build_ext.py =================================================================== --- tags/1.0.4/numpy/distutils/command/build_ext.py 2007-11-08 21:57:44 UTC (rev 4422) +++ tags/1.0.4/numpy/distutils/command/build_ext.py 2007-11-08 22:06:18 UTC (rev 4423) @@ -89,7 +89,6 @@ ' overwriting build_info\n%s... \nwith\n%s...' \ % (libname, `clibs[libname]`[:300], `build_info`[:300])) clibs[libname] = build_info - local_clibs = clibs.copy() # .. and distribution libraries: for libname,build_info in self.distribution.libraries or []: if clibs.has_key(libname): @@ -113,11 +112,6 @@ for m in binfo.get('macros',[]): if m not in macros: macros.append(m) - if libname in local_clibs: - c = self.compiler - outname = c.library_filename(libname, - output_dir=self.build_temp) - ext.depends.append(outname) for l in clibs.get(libname,{}).get('source_languages',[]): ext_languages.add(l) if c_libs: From numpy-svn at scipy.org Fri Nov 9 01:37:44 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 9 Nov 2007 00:37:44 -0600 (CST) Subject: [Numpy-svn] r4424 - branches/numpy.scons/numpy/distutils/scons/core Message-ID: <20071109063744.C6C3439C379@new.scipy.org> Author: cdavid Date: 2007-11-09 00:37:38 -0600 (Fri, 09 Nov 2007) New Revision: 4424 Modified: branches/numpy.scons/numpy/distutils/scons/core/default.py Log: Basic optimization flags for Sun CC Modified: branches/numpy.scons/numpy/distutils/scons/core/default.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/default.py 2007-11-08 22:06:18 UTC (rev 4423) +++ branches/numpy.scons/numpy/distutils/scons/core/default.py 2007-11-09 06:37:38 UTC (rev 4424) @@ -174,6 +174,9 @@ elif name == 'mingw': cfg = CompilerConfig(optim = ['-O2', '-fno-strict-aliasing'], warn = ['-Wall', '-Wstrict-prototypes']) + elif name == 'suncc': + cfg = CompilerConfig(optim = ['-fast'], + debug_symbol = ['-g']) else: # For not yet supported compiler, just put everything in optims from # distutils From numpy-svn at scipy.org Fri Nov 9 02:37:06 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 9 Nov 2007 01:37:06 -0600 (CST) Subject: [Numpy-svn] r4425 - in branches/numpy.scons: . numpy/distutils/scons/core Message-ID: <20071109073706.4CFB439C0BF@new.scipy.org> Author: cdavid Date: 2007-11-09 01:36:57 -0600 (Fri, 09 Nov 2007) New Revision: 4425 Modified: branches/numpy.scons/numpy/distutils/scons/core/default.py branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py branches/numpy.scons/test.sh Log: Add optim flags for link step in compiler configuration Modified: branches/numpy.scons/numpy/distutils/scons/core/default.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/default.py 2007-11-09 06:37:38 UTC (rev 4424) +++ branches/numpy.scons/numpy/distutils/scons/core/default.py 2007-11-09 07:36:57 UTC (rev 4425) @@ -94,7 +94,7 @@ class CompilerConfig: def __init__(self, optim = None, warn = None, debug = None, debug_symbol = - None, thread = None, extra = None): + None, thread = None, extra = None, link_optim = None): # XXX: several level of optimizations ? self.optim = optim # XXX: several level of warnings ? @@ -107,9 +107,12 @@ self.thread = thread # XXX self.extra = extra + # XXX + self.link_optim = link_optim def get_flags_dict(self): d = {'NUMPY_OPTIM_CFLAGS' : self.optim, + 'NUMPY_OPTIM_LDFLAGS' : self.link_optim, 'NUMPY_WARN_CFLAGS' : self.warn, 'NUMPY_THREAD_CFLAGS' : self.thread, 'NUMPY_EXTRA_CFLAGS' : self.debug, @@ -175,8 +178,14 @@ cfg = CompilerConfig(optim = ['-O2', '-fno-strict-aliasing'], warn = ['-Wall', '-Wstrict-prototypes']) elif name == 'suncc': + # -xtarget and co (-xarch, etc...) should be put in link_optim and + # optim for optimal performances. If you do not need the package to be + # redistributable, using -xtarget=native is a good choice. See man cc + # for more info. + # XXX: detect this automatically ? cfg = CompilerConfig(optim = ['-fast'], - debug_symbol = ['-g']) + debug_symbol = ['-g'], + link_optim = []) else: # For not yet supported compiler, just put everything in optims from # distutils Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-09 06:37:38 UTC (rev 4424) +++ branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-09 07:36:57 UTC (rev 4425) @@ -83,6 +83,7 @@ env['NUMPY_DEBUG_SYMBOL_CFLAGS'] +\ env['NUMPY_EXTRA_CFLAGS'] +\ env['NUMPY_THREAD_CFLAGS']) + env.AppendUnique(LINKFLAGS = env['NUMPY_OPTIM_LDFLAGS']) return env def _GetNumpyEnvironment(args): Modified: branches/numpy.scons/test.sh =================================================================== --- branches/numpy.scons/test.sh 2007-11-09 06:37:38 UTC (rev 4424) +++ branches/numpy.scons/test.sh 2007-11-09 07:36:57 UTC (rev 4425) @@ -1,5 +1,5 @@ PREFIX=$PWD rm -rf $PREFIX/build rm -rf $PREFIX/tmp -python setup.py scons --jobs=4 install --prefix=$PREFIX/tmp -(cd $PREFIX/tmp && PYTHONPATH=$PREFIX/tmp/lib/python2.5/site-packages python -c "import numpy; print numpy; numpy.test(level = 9999); numpy.show_config()") +DEBUG_SCONS_CHECK=0 python setup.py scons --jobs=1 install --prefix=$PREFIX/tmp +(cd $PREFIX/tmp && PYTHONPATH=$PREFIX/tmp/lib/python2.4/site-packages python -c "import numpy; print numpy; numpy.test(level = 9999); numpy.show_config()") From numpy-svn at scipy.org Fri Nov 9 05:49:05 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 9 Nov 2007 04:49:05 -0600 (CST) Subject: [Numpy-svn] r4426 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071109104905.D220939C3A1@new.scipy.org> Author: cdavid Date: 2007-11-09 04:48:37 -0600 (Fri, 09 Nov 2007) New Revision: 4426 Modified: branches/numpy.scons/numpy/distutils/scons/Changelog Log: Update changelog Modified: branches/numpy.scons/numpy/distutils/scons/Changelog =================================================================== --- branches/numpy.scons/numpy/distutils/scons/Changelog 2007-11-09 07:36:57 UTC (rev 4425) +++ branches/numpy.scons/numpy/distutils/scons/Changelog 2007-11-09 10:48:37 UTC (rev 4426) @@ -1,3 +1,9 @@ +Fri, 09 Nov 2007 18:22:44 +0900 + +User-visible Changes: + * CPU optimized sunperf (sse, etc...) can now be picked up if correct + compilation flags are given. + Thu, 08 Nov 2007 17:55:17 +0900 User-visible Changes: From numpy-svn at scipy.org Fri Nov 9 15:48:19 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 9 Nov 2007 14:48:19 -0600 (CST) Subject: [Numpy-svn] r4427 - trunk/numpy/core/src Message-ID: <20071109204819.8E99739C0B2@new.scipy.org> Author: oliphant Date: 2007-11-09 14:48:17 -0600 (Fri, 09 Nov 2007) New Revision: 4427 Modified: trunk/numpy/core/src/scalartypes.inc.src Log: Fix up empty if statement probem. Modified: trunk/numpy/core/src/scalartypes.inc.src =================================================================== --- trunk/numpy/core/src/scalartypes.inc.src 2007-11-09 10:48:37 UTC (rev 4426) +++ trunk/numpy/core/src/scalartypes.inc.src 2007-11-09 20:48:17 UTC (rev 4427) @@ -282,10 +282,9 @@ if (outcode == NULL) return r; if (outcode->type_num == typecode->type_num) { - if (!PyTypeNum_ISEXTENDED(typecode->type_num)) + if (!PyTypeNum_ISEXTENDED(typecode->type_num) || + (outcode->elsize == typecode->elsize)) return r; - if (outcode->elsize == typecode->elsize); - return r; } /* cast if necessary to desired output typecode */ From numpy-svn at scipy.org Sat Nov 10 04:42:53 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 10 Nov 2007 03:42:53 -0600 (CST) Subject: [Numpy-svn] r4428 - branches/numpy.scons/numpy/distutils/command Message-ID: <20071110094253.1D9C439C1EA@new.scipy.org> Author: cdavid Date: 2007-11-10 03:42:48 -0600 (Sat, 10 Nov 2007) New Revision: 4428 Modified: branches/numpy.scons/numpy/distutils/command/scons.py Log: If --compiler=msvc is used, force the use of VS, even if incompatible Modified: branches/numpy.scons/numpy/distutils/command/scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/scons.py 2007-11-09 20:48:17 UTC (rev 4427) +++ branches/numpy.scons/numpy/distutils/command/scons.py 2007-11-10 09:42:48 UTC (rev 4428) @@ -2,8 +2,9 @@ import os.path from os.path import join as pjoin, dirname as pdirname -#from distutils.core import build_py as old_build_py +from distutils.errors import DistutilsPlatformError from distutils.errors import DistutilsExecError, DistutilsSetupError + from numpy.distutils.command.build_ext import build_ext as old_build_ext from numpy.distutils.ccompiler import CCompiler from numpy.distutils.fcompiler import FCompiler @@ -35,20 +36,20 @@ example: ['foo/bar', 'bar/foo'] will return 'foo/bar:bar/foo'.""" return os.pathsep.join(dirlist) -def dist2sconscc(compiler): +def dist2sconscc(compiler_type): """This converts the name passed to distutils to scons name convention (C - compiler). The argument should be a CCompiler instance. + compiler). Example: --compiler=intel -> intelc""" - if compiler.compiler_type == 'msvc': + if compiler_type == 'msvc': return 'msvc' - elif compiler.compiler_type == 'intel': + elif compiler_type == 'intel': return 'intelc' - elif compiler.compiler_type == 'mingw32': + elif compiler_type == 'mingw32': return 'mingw' else: - return compiler.compiler[0] + return compiler_type def dist2sconsfc(compiler): """This converts the name passed to distutils to scons name convention @@ -134,11 +135,14 @@ old_build_ext.initialize_options(self) self.jobs = None self.silent = 0 + # If true, we bypass distutils to find the c compiler altogether. This + # is to be used in desperate cases (like incompatible visual studio + # version). + self._bypass_distutils_cc = False def finalize_options(self): old_build_ext.finalize_options(self) if self.distribution.has_scons_scripts(): - #print "Got it: scons scripts are %s" % self.distribution.scons_scripts self.sconscripts = self.distribution.get_scons_scripts() self.pre_hooks = self.distribution.get_scons_pre_hooks() self.post_hooks = self.distribution.get_scons_post_hooks() @@ -154,18 +158,27 @@ # got the c compiler used, we use numpy.distutils function to get the # full path, and add the path to the env['PATH'] variable in env # instance (this is done in numpy.distutils.scons module). + + # XXX: The logic to bypass distutils is ... not so logic. compiler_type = self.compiler + if compiler_type == 'msvc': + self._bypass_distutils_cc = True from numpy.distutils.ccompiler import new_compiler - self.compiler = new_compiler(compiler=compiler_type, - verbose=self.verbose, - dry_run=self.dry_run, - force=self.force) - self.compiler.customize(self.distribution) - - # This initialization seems necessary, sometimes, for find_executable to work... - if hasattr(self.compiler, 'initialize'): - self.compiler.initialize() - + try: + self.compiler = new_compiler(compiler=compiler_type, + verbose=self.verbose, + dry_run=self.dry_run, + force=self.force) + self.compiler.customize(self.distribution) + # This initialization seems necessary, sometimes, for find_executable to work... + if hasattr(self.compiler, 'initialize'): + self.compiler.initialize() + except DistutilsPlatformError, e: + if not self._bypass_distutils_cc: + raise e + else: + self.compiler = compiler_type + # We do the same for the fortran compiler fcompiler_type = self.fcompiler from numpy.distutils.fcompiler import new_fcompiler @@ -199,9 +212,14 @@ cmd.append('src_dir="%s"' % pdirname(sconscript)) cmd.append('distutils_libdir=%s' % protect_path(pjoin(self.build_lib, pdirname(sconscript)))) - cmd.append('cc_opt=%s' % dist2sconscc(self.compiler)) - cmd.append('cc_opt_path=%s' % protect_path(get_tool_path(self.compiler))) + if not self._bypass_distutils_cc: + cmd.append('cc_opt=%s' % dist2sconscc(self.compiler.compiler_type)) + cmd.append('cc_opt_path=%s' % protect_path(get_tool_path(self.compiler))) + else: + cmd.append('cc_opt=%s' % dist2sconscc(self.compiler)) + + if self.fcompiler: cmd.append('f77_opt=%s' % dist2sconsfc(self.fcompiler)) cmd.append('f77_opt_path=%s' % protect_path(get_f77_tool_path(self.fcompiler))) From numpy-svn at scipy.org Sat Nov 10 05:38:27 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 10 Nov 2007 04:38:27 -0600 (CST) Subject: [Numpy-svn] r4429 - branches/numpy.scons/numpy/distutils/scons/core Message-ID: <20071110103827.C7EA439C05D@new.scipy.org> Author: cdavid Date: 2007-11-10 04:38:20 -0600 (Sat, 10 Nov 2007) New Revision: 4429 Modified: branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py Log: DLL manifest now handled for VS 2005 in scons builders Modified: branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py 2007-11-10 09:42:48 UTC (rev 4428) +++ branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py 2007-11-10 10:38:20 UTC (rev 4429) @@ -12,8 +12,7 @@ def built_with_mstools(env): """Return True if built with MS tools (compiler + linker).""" - # Handle case where MSVS is found, but mingw is used - return env.has_key('MSVS') and not built_with_mingw(env) + return env['cc_opt'] == 'msvc' def built_with_mingw(env): """Return true if built with mingw compiler.""" Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-10 09:42:48 UTC (rev 4428) +++ branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-10 10:38:20 UTC (rev 4429) @@ -3,6 +3,7 @@ from os.path import join as pjoin, dirname as pdirname import sys +import re from distutils.sysconfig import get_config_vars from numpy.distutils.misc_util import get_scons_build_dir, get_scons_configres_dir,\ @@ -11,7 +12,7 @@ from default import tool_list, get_cc_config from custom_builders import NumpySharedLibrary, NumpyCtypes, NumpyPythonExtension from libinfo import get_config -from extension_scons import PythonExtension +from extension_scons import PythonExtension, built_with_mstools from numpy.distutils.scons.tools.substinfile import TOOL_SUBST @@ -35,7 +36,6 @@ # while returning success (0). import os - import re suncc = re.compile('Sun C') # Redirect stderr to stdout cmd = fullpath + ' -V 2>&1' @@ -45,6 +45,19 @@ return suncc.search(cnt) +def get_vs_version(env): + try: + version = env['MSVS']['VERSION'] + m = re.compile("([0-9]).([0-9])").match(version) + if m: + major = int(m.group(1)) + minor = int(m.group(2)) + return (major, minor) + else: + raise RuntimeError("FIXME: failed to parse VS version") + except KeyError: + raise RuntimeError("Could not get VS version !") + def GetNumpyOptions(args): """Call this with args=ARGUMENTS to take into account command line args.""" from SCons.Options import Options @@ -77,6 +90,21 @@ cfg = get_cc_config(name) env.AppendUnique(**cfg.get_flags_dict()) +def finalize_env(env): + if built_with_mstools(env): + major, minor = get_vs_version(env) + # For VS 8 and above (VS 2005), use manifest for DLL + if major >= 8: + env['LINKCOM'] = [env['LINKCOM'], + 'mt.exe -nologo -manifest ${TARGET}.manifest '\ + '-outputresource:$TARGET;1'] + env['SHLINKCOM'] = [env['SHLINKCOM'], + 'mt.exe -nologo -manifest ${TARGET}.manifest '\ + '-outputresource:$TARGET;2'] + env['LDMODULECOM'] = [env['LDMODULECOM'], + 'mt.exe -nologo -manifest ${TARGET}.manifest '\ + '-outputresource:$TARGET;2'] + def GetNumpyEnvironment(args): env = _GetNumpyEnvironment(args) env.AppendUnique(CFLAGS = env['NUMPY_WARN_CFLAGS'] + env['NUMPY_OPTIM_CFLAGS'] +\ @@ -117,6 +145,8 @@ # =============================================== # Setting tools according to command line options + if not env['ENV'].has_key('PATH'): + env['ENV']['PATH'] = [] # XXX: how to handle tools which are not in standard location ? Is adding # the full path of the compiler enough ? (I am sure some compilers also @@ -144,6 +174,12 @@ env['ENV']['PATH'] += ';%s' % env['cc_opt_path'] else: env['ENV']['PATH'] += ':%s' % env['cc_opt_path'] + else: + # Do not care about PATH info because none given from scons + # distutils command + t = Tool(env['cc_opt']) + t(env) + customize_cc(t.name, env) except EnvironmentError, e: # scons could not understand cc_opt (bad name ?) raise AssertionError("SCONS: Could not initialize tool ? Error is %s" % \ @@ -219,6 +255,8 @@ for t in FindAllTools(DEF_OTHER_TOOLS, env): Tool(t)(env) + finalize_env(env) + try: env['ENV']['HOME'] = os.environ['HOME'] except KeyError: From numpy-svn at scipy.org Sat Nov 10 21:50:55 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 10 Nov 2007 20:50:55 -0600 (CST) Subject: [Numpy-svn] r4430 - in branches/numpy.scons/numpy/distutils: command scons scons/doc Message-ID: <20071111025055.51B5339C0C1@new.scipy.org> Author: cdavid Date: 2007-11-10 20:50:20 -0600 (Sat, 10 Nov 2007) New Revision: 4430 Modified: branches/numpy.scons/numpy/distutils/command/scons.py branches/numpy.scons/numpy/distutils/scons/Changelog branches/numpy.scons/numpy/distutils/scons/doc/TODO Log: Move all the logic to convert distutils compiler to info understood by scons in finalize func from scons command Modified: branches/numpy.scons/numpy/distutils/command/scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/scons.py 2007-11-10 10:38:20 UTC (rev 4429) +++ branches/numpy.scons/numpy/distutils/command/scons.py 2007-11-11 02:50:20 UTC (rev 4430) @@ -36,12 +36,13 @@ example: ['foo/bar', 'bar/foo'] will return 'foo/bar:bar/foo'.""" return os.pathsep.join(dirlist) -def dist2sconscc(compiler_type): +def dist2sconscc(compiler): """This converts the name passed to distutils to scons name convention (C - compiler). + compiler). compiler should be a CCompiler instance. Example: --compiler=intel -> intelc""" + compiler_type = compiler.compiler_type if compiler_type == 'msvc': return 'msvc' elif compiler_type == 'intel': @@ -49,7 +50,7 @@ elif compiler_type == 'mingw32': return 'mingw' else: - return compiler_type + return compiler.compiler[0] def dist2sconsfc(compiler): """This converts the name passed to distutils to scons name convention @@ -135,10 +136,13 @@ old_build_ext.initialize_options(self) self.jobs = None self.silent = 0 - # If true, we bypass distutils to find the c compiler altogether. This - # is to be used in desperate cases (like incompatible visual studio - # version). - self._bypass_distutils_cc = False + # If true, we bypass distutils to find the c compiler altogether. This + # is to be used in desperate cases (like incompatible visual studio + # version). + self._bypass_distutils_cc = False + self.scons_compiler = None + self.scons_compiler_path = None + self.scons_fcompiler = None def finalize_options(self): old_build_ext.finalize_options(self) @@ -159,25 +163,27 @@ # full path, and add the path to the env['PATH'] variable in env # instance (this is done in numpy.distutils.scons module). - # XXX: The logic to bypass distutils is ... not so logic. + # XXX: The logic to bypass distutils is ... not so logic. compiler_type = self.compiler - if compiler_type == 'msvc': - self._bypass_distutils_cc = True + if compiler_type == 'msvc': + self._bypass_distutils_cc = True from numpy.distutils.ccompiler import new_compiler - try: - self.compiler = new_compiler(compiler=compiler_type, + try: + distutils_compiler = new_compiler(compiler=compiler_type, verbose=self.verbose, dry_run=self.dry_run, force=self.force) - self.compiler.customize(self.distribution) - # This initialization seems necessary, sometimes, for find_executable to work... - if hasattr(self.compiler, 'initialize'): - self.compiler.initialize() - except DistutilsPlatformError, e: - if not self._bypass_distutils_cc: - raise e - else: - self.compiler = compiler_type + distutils_compiler.customize(self.distribution) + # This initialization seems necessary, sometimes, for find_executable to work... + if hasattr(distutils_compiler, 'initialize'): + distutils_compiler.initialize() + self.scons_compiler = dist2sconscc(distutils_compiler) + self.scons_compiler_path = protect_path(get_tool_path(distutils_compiler)) + except DistutilsPlatformError, e: + if not self._bypass_distutils_cc: + raise e + else: + self.scons_compiler = compiler_type # We do the same for the fortran compiler fcompiler_type = self.fcompiler @@ -186,8 +192,8 @@ verbose = self.verbose, dry_run = self.dry_run, force = self.force) - if self.fcompiler is not None: - self.fcompiler.customize(self.distribution) + if self.fcompiler is not None: + self.fcompiler.customize(self.distribution) def run(self): # XXX: when a scons script is missing, scons only prints warnings, and @@ -213,14 +219,14 @@ cmd.append('distutils_libdir=%s' % protect_path(pjoin(self.build_lib, pdirname(sconscript)))) - if not self._bypass_distutils_cc: - cmd.append('cc_opt=%s' % dist2sconscc(self.compiler.compiler_type)) - cmd.append('cc_opt_path=%s' % protect_path(get_tool_path(self.compiler))) - else: - cmd.append('cc_opt=%s' % dist2sconscc(self.compiler)) + if not self._bypass_distutils_cc: + cmd.append('cc_opt=%s' % self.scons_compiler) + cmd.append('cc_opt_path=%s' % self.scons_compiler_path) + else: + cmd.append('cc_opt=%s' % self.scons_compiler) - if self.fcompiler: + if self.fcompiler: cmd.append('f77_opt=%s' % dist2sconsfc(self.fcompiler)) cmd.append('f77_opt_path=%s' % protect_path(get_f77_tool_path(self.fcompiler))) Modified: branches/numpy.scons/numpy/distutils/scons/Changelog =================================================================== --- branches/numpy.scons/numpy/distutils/scons/Changelog 2007-11-10 10:38:20 UTC (rev 4429) +++ branches/numpy.scons/numpy/distutils/scons/Changelog 2007-11-11 02:50:20 UTC (rev 4430) @@ -7,7 +7,9 @@ Thu, 08 Nov 2007 17:55:17 +0900 User-visible Changes: - * numpy.scons can now built numpy on windows with mingw + * numpy.scons can now build numpy on windows with mingw. + + * sunperf works on solaris express, both blas/lapack. Wed, 07 Nov 2007 20:45:00 +0900 (3rd alpha) Modified: branches/numpy.scons/numpy/distutils/scons/doc/TODO =================================================================== --- branches/numpy.scons/numpy/distutils/scons/doc/TODO 2007-11-10 10:38:20 UTC (rev 4429) +++ branches/numpy.scons/numpy/distutils/scons/doc/TODO 2007-11-11 02:50:20 UTC (rev 4430) @@ -1,7 +1,7 @@ -Before second alpha (in order of priority): - - CheckHeader and CheckLib ala scons, with site.cfg support. - Before first beta: + - rewrite CheckLibAndHeader to reuse save/restore thing from checkers + - fortran / VS interaction: look at build_ext of numpy.distutils, need hack + to make this works - f2py and scipy interoperability: N hours ? - support environments wo fortran compilers @@ -31,6 +31,9 @@ Tests: - What can be tested ? +Fortran: + - Rewrite verbose output parser using shlex for quote handling + Documentation: - scons / distutils integration, global design (BuildDir, directories, etc...) - use cases: package developers (examples, etc...), numpy developers, From numpy-svn at scipy.org Sat Nov 10 21:57:20 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 10 Nov 2007 20:57:20 -0600 (CST) Subject: [Numpy-svn] r4431 - branches/numpy.scons/numpy/distutils/scons/core Message-ID: <20071111025720.A8B9939C0C1@new.scipy.org> Author: cdavid Date: 2007-11-10 20:57:05 -0600 (Sat, 10 Nov 2007) New Revision: 4431 Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py Log: Scons environment can now be initialized wo fortran compiler Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-11 02:50:20 UTC (rev 4430) +++ branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-11 02:57:05 UTC (rev 4431) @@ -208,9 +208,13 @@ # XXX: really have to understand how fortran compilers work in scons... env['F77'] = env['_FORTRAND'] else: - raise NotImplementedError('FIXME: Support for env wo fcompiler not tested yet !') - #t = Tool(FindTool(DEF_FORTRAN_COMPILERS)) - #t(env) + #raise NotImplementedError('FIXME: Support for env wo fcompiler not tested yet !') + def_fcompiler = FindTool(DEF_FORTRAN_COMPILERS, env) + if def_fcompiler: + t = Tool(def_fcompiler) + t(env) + else: + print "========== NO FORTRAN COMPILER FOUND ===========" # XXX: Really, we should use our own subclass of Environment, instead of # adding Numpy* functions ! From numpy-svn at scipy.org Sat Nov 10 22:05:00 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 10 Nov 2007 21:05:00 -0600 (CST) Subject: [Numpy-svn] r4432 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071111030500.1038239C0C1@new.scipy.org> Author: cdavid Date: 2007-11-10 21:04:55 -0600 (Sat, 10 Nov 2007) New Revision: 4432 Modified: branches/numpy.scons/numpy/distutils/scons/fortran_scons.py Log: Handle missing fortran compiler case in dummy main fortran checkers Modified: branches/numpy.scons/numpy/distutils/scons/fortran_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-11-11 02:57:05 UTC (rev 4431) +++ branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-11-11 03:04:55 UTC (rev 4432) @@ -109,6 +109,12 @@ # If need a dummy main def _CheckFDummyMain(context, fcomp): + if not context.env.has_key(fcomp): + context.Message('No %s compiler defined: cannot check dummy main ') + return 0 + else: + context.Message('Checking if %s needs dummy main - ' % context.env[fcomp]) + fcn_tmpl = """ int %s() { return 0; } """ @@ -136,7 +142,6 @@ # XXX: refactor those by using function templates def CheckF77DummyMain(context): - context.Message('Checking if %s needs dummy main - ' % context.env['F77']) res, m = _CheckFDummyMain(context, 'F77') if res: context.Result("%s." % str(m)) @@ -147,7 +152,6 @@ return res def CheckF90DummyMain(context): - context.Message('Checking if %s needs dummy main - ' % context.env['F90']) res, m = _CheckFDummyMain(context, 'F90') if res: context.Result("%s." % str(m)) From numpy-svn at scipy.org Sat Nov 10 22:27:00 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 10 Nov 2007 21:27:00 -0600 (CST) Subject: [Numpy-svn] r4433 - in branches/numpy.scons/numpy/distutils/scons: . checkers Message-ID: <20071111032700.109F439C102@new.scipy.org> Author: cdavid Date: 2007-11-10 21:26:54 -0600 (Sat, 10 Nov 2007) New Revision: 4433 Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py branches/numpy.scons/numpy/distutils/scons/fortran_scons.py Log: Add config info when F77 compiler not found for lapack checkers Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-11 03:04:55 UTC (rev 4432) +++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-11 03:26:54 UTC (rev 4433) @@ -156,9 +156,11 @@ # Get fortran stuff (See XXX at the top on F77 vs C) if not env.has_key('F77_NAME_MANGLER'): if not CheckF77Mangling(context): + add_info(env, 'lapack', 'Def numpy implementation used') return 0 if not env.has_key('F77_LDFLAGS'): if not CheckF77Clib(context): + add_info(env, 'lapack', 'Def numpy implementation used') return 0 # Get the mangled name of our test function Modified: branches/numpy.scons/numpy/distutils/scons/fortran_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-11-11 03:04:55 UTC (rev 4432) +++ branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-11-11 03:26:54 UTC (rev 4433) @@ -110,8 +110,8 @@ # If need a dummy main def _CheckFDummyMain(context, fcomp): if not context.env.has_key(fcomp): - context.Message('No %s compiler defined: cannot check dummy main ') - return 0 + context.Message('Checking dummy main: no %s compiler defined: cannot check dummy main ' % fcomp) + return 0, None else: context.Message('Checking if %s needs dummy main - ' % context.env[fcomp]) From numpy-svn at scipy.org Mon Nov 12 00:12:18 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 11 Nov 2007 23:12:18 -0600 (CST) Subject: [Numpy-svn] r4434 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071112051218.3B4A839C08C@new.scipy.org> Author: cdavid Date: 2007-11-11 23:12:09 -0600 (Sun, 11 Nov 2007) New Revision: 4434 Modified: branches/numpy.scons/numpy/distutils/scons/fortran_scons.py Log: Starts working on mingw fortran / MS interaction Modified: branches/numpy.scons/numpy/distutils/scons/fortran_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-11-11 03:26:54 UTC (rev 4433) +++ branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-11-12 05:12:09 UTC (rev 4434) @@ -7,6 +7,7 @@ from copy import deepcopy from numpy.distutils.scons.core.utils import popen_wrapper +from numpy.distutils.scons.core.extension_scons import built_with_mstools, built_with_mingw from fortran import parse_f77link, check_link_verbose #----------------- @@ -311,11 +312,43 @@ else: raise RuntimeError("fcomp %s not implemented..." % fcomp) return 0 + if res: + if not built_with_mstools(context.env): + res, cnt = _build_empty_program_posix(context, fcomp) + else: + res, cnt = _build_empty_program_ms(context, fcomp) + + return res, cnt + +def _build_empty_program_ms(context, fcomp): + # MS tools and g77/gfortran semantics are totally + # difference, so we cannot just compile a program + # replacing MS linker by g77/gfortran as we can for + # all other platforms. + slast = str(context.lastTarget) + dir = dirname(slast) + test_prog = pjoin(dir, basename(slast).split('.')[0]) + cmd = context.env.subst("$%s -v -o $TARGET $SOURCES" % fcomp, + target = context.env.File(test_prog), + source = context.lastTarget) + + print cmd + st, out = popen_wrapper(cmd, merge = True) + if st: + res = 0 + else: + res = 1 + cnt = out.split('\n') + print cnt + raise "YATA" + +def _build_empty_program_posix(context, fcomp): oldLINK = context.env['LINK'] # XXX: get the fortran compiler context.env['LINK'] = '$' + fcomp res = 0 + cnt = '' try: # We always want to do this build, and we do not want scons cache # to interfer. So we build a command executed directly through our @@ -337,9 +370,9 @@ cnt = out.split('\n') finally: context.env['LINK'] = oldLINK - - return res, cnt + return res, cnt + # Helper to generate combinations of lists def _RecursiveGenerator(*sets): """Returns a generator that yields one tuple per element combination. From numpy-svn at scipy.org Mon Nov 12 02:32:23 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 12 Nov 2007 01:32:23 -0600 (CST) Subject: [Numpy-svn] r4435 - in branches/numpy.scons/numpy/distutils/scons: . tests Message-ID: <20071112073223.AF4F439C219@new.scipy.org> Author: cdavid Date: 2007-11-12 01:32:05 -0600 (Mon, 12 Nov 2007) New Revision: 4435 Modified: branches/numpy.scons/numpy/distutils/scons/fortran.py branches/numpy.scons/numpy/distutils/scons/fortran_scons.py branches/numpy.scons/numpy/distutils/scons/tests/fortran_output.py Log: More work on gnu fortran / Visual interaction: dummy main and Clibs now works Modified: branches/numpy.scons/numpy/distutils/scons/fortran.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/fortran.py 2007-11-12 05:12:09 UTC (rev 4434) +++ branches/numpy.scons/numpy/distutils/scons/fortran.py 2007-11-12 07:32:05 UTC (rev 4435) @@ -15,7 +15,7 @@ # linkflags which match those are ignored LINKFLAGS_IGNORED = [r'-lang*', r'-lcrt[a-zA-Z0-9]*\.o', r'-lc', r'-lgcc*', - r'-lSystem', r'-libmil', r'-LIST:*', r'-LNO:*'] + r'-lSystem', r'-libmil', r'-LIST:*', r'-LNO:*', r'-lfrt*', r'-luser32', r'-lkernel32', r'-ladvapi32', r'-lmsvcrt', r'-lshell32', r'-lmingw', r'-lmoldname'] RLINKFLAGS_IGNORED = [re.compile(i) for i in LINKFLAGS_IGNORED] # linkflags which match those are the one we are interested in Modified: branches/numpy.scons/numpy/distutils/scons/fortran_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-11-12 05:12:09 UTC (rev 4434) +++ branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-11-12 07:32:05 UTC (rev 4435) @@ -110,36 +110,58 @@ # If need a dummy main def _CheckFDummyMain(context, fcomp): + # Check whether the Fortran runtime needs a dummy main. if not context.env.has_key(fcomp): context.Message('Checking dummy main: no %s compiler defined: cannot check dummy main ' % fcomp) return 0, None else: context.Message('Checking if %s needs dummy main - ' % context.env[fcomp]) - fcn_tmpl = """ + env = context.env + if not built_with_mstools(context.env): + savedLINK = env.has_key('LINK') and deepcopy(env['LINK']) or [] + try: + env['LINK'] = env[fcomp] + res, m =_dummy_main_imp(context) + finally: + env.Replace(LINK = savedLINK) + else: + # Using MS tools (Visual studio) with fortran compiler + # XXX: this has to be dirty... As scons is using visual studio, it + # uses the related convention (prefix names for libraries, etc...). + # Here, we want to compile object code with cl.exe, but link with + # the fortran compiler which may be totally different than cl.exe + # (think gnu fortran compiler). So we have to bypass scons + # commands, and use our own: since this is only used for + # configuration, it should not matter much. + savedLINKCOM = env.has_key('LINKCOM') and deepcopy(env['LINKCOM']) or [] + try: + env['LINKCOM'] = "$F77 -o $TARGET $SOURCES" + res, m = _dummy_main_imp(context) + finally: + env.Replace(LINKCOM = savedLINKCOM) + + return res, m + +def _dummy_main_imp(context): + fcn_tmpl = """ int %s() { return 0; } """ - env = context.env - savedLINK = env.has_key('LINK') and deepcopy(env['LINK']) or [] - try: - env['LINK'] = env[fcomp] - mains = ["MAIN__", "__MAIN", "_MAIN", "MAIN_"] - mains.extend([string.lower(m) for m in mains]) - mains.insert(0, "") - mains.append("MAIN") - mains.append("main") - for m in mains: - prog = fcn_tmpl % "dummy" - if m: - prog = fcn_tmpl % m + prog - result = context.TryLink(prog, '.c') - if result: - if not m: - m = None - break - finally: - env.Replace(LINK = savedLINK) - return result, m + mains = ["MAIN__", "__MAIN", "_MAIN", "MAIN_"] + mains.extend([string.lower(m) for m in mains]) + mains.insert(0, "") + mains.append("MAIN") + mains.append("main") + for m in mains: + prog = fcn_tmpl % "dummy" + if m: + prog = fcn_tmpl % m + prog + result = context.TryLink(prog, '.c') + if result: + if not m: + m = None + break + return result, m # XXX: refactor those by using function templates def CheckF77DummyMain(context): @@ -333,15 +355,13 @@ target = context.env.File(test_prog), source = context.lastTarget) - print cmd st, out = popen_wrapper(cmd, merge = True) if st: res = 0 else: res = 1 - cnt = out.split('\n') - print cnt - raise "YATA" + cnt = out.split('\n') + return res, cnt def _build_empty_program_posix(context, fcomp): oldLINK = context.env['LINK'] Modified: branches/numpy.scons/numpy/distutils/scons/tests/fortran_output.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/tests/fortran_output.py 2007-11-12 05:12:09 UTC (rev 4434) +++ branches/numpy.scons/numpy/distutils/scons/tests/fortran_output.py 2007-11-12 07:32:05 UTC (rev 4435) @@ -57,6 +57,9 @@ '-L/usr/lib/gcc/i486-linux-gnu/4.1.3/../../../', '-lifport', '-lifcore', '-limf', '-lm', '-lipgo', '-lirc', '-lirc_s', '-ldl'] +mingw_g77_link_output = """ +['Driving: g77 -v -o build\\scons\\numpy\\scons_fake\\checkers\\.sconf\\conftest_0 build\\scons\\numpy\\scons_fake\\checkers\\.sconf\\conftest_0.obj -lfrtbegin -lg2c', 'Reading specs from c:/MINGW/bin/../lib/gcc/mingw32/3.4.5/specs', 'Configured with: ../gcc-3.4.5/configure --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --disable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-synchronization --enable-libstdcxx-debug', 'Thread model: win32', 'gcc version 3.4.5 (mingw special)', ' c:/MINGW/bin/../libexec/gcc/mingw32/3.4.5/collect2.exe -Bdynamic -o build\\scons\\numpy\\scons_fake\\checkers\\.sconf\\conftest_0.exe /mingw/lib/crt2.o c:/MINGW/bin/../lib/gcc/mingw32/3.4.5/crtbegin.o -Lc:/MINGW/bin/../lib/gcc/mingw32/3.4.5 -Lc:/MINGW/bin/../lib/gcc -L/mingw/lib/gcc/mingw32/3.4.5 -Lc:/MINGW/bin/../lib/gcc/mingw32/3.4.5/../../../../mingw32/lib -L/mingw/lib/gcc/mingw32/3.4.5/../../../../mingw32/lib -L/mingw/lib -Lc:/MINGW/bin/../lib/gcc/mingw32/3.4.5/../../.. -L/mingw/lib/gcc/mingw32/3.4.5/../../.. build\\scons\\numpy\\scons_fake\\checkers\\.sconf\\conftest_0.obj -lfrtbegin -lg2c -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt c:/MINGW/bin/../lib/gcc/mingw32/3.4.5/crtend.o', '']""" + def generate_output(fcomp, verbose): import os os.system('%s -c %s &> /dev/null ' % (fcomp, 'empty.f')) From numpy-svn at scipy.org Mon Nov 12 03:42:23 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 12 Nov 2007 02:42:23 -0600 (CST) Subject: [Numpy-svn] r4436 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071112084223.CD54D39C0B8@new.scipy.org> Author: cdavid Date: 2007-11-12 02:42:18 -0600 (Mon, 12 Nov 2007) New Revision: 4436 Modified: branches/numpy.scons/numpy/distutils/scons/fortran_scons.py Log: mangling checks now works with g77 and Visual Studio Modified: branches/numpy.scons/numpy/distutils/scons/fortran_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-11-12 07:32:05 UTC (rev 4435) +++ branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-11-12 08:42:18 UTC (rev 4436) @@ -188,7 +188,37 @@ def _CheckFMangling(context, fc, dummym, ext): # XXX: rewrite this in a more straightfoward manner, and support prepending # underscore - subr = """ + env = context.env + # TODO: if does not exist, call the function to get the F77_DUMMY_MAIN + if not built_with_mstools(env): + savedLINK = env.has_key('LINK') and deepcopy(env['LINK']) or [] + savedLIBS = env.has_key('LIBS') and deepcopy(env['LIBS']) or [] + try: + env['LINK'] = env[fc] + result, mangler, u, du, c = _check_f_mangling_imp(context, fc, dummym, ext) + finally: + env.Replace(LINK = savedLINK) + env.Replace(LIBS = savedLIBS) + else: + # XXX: instead of recreating our own build commands, can we use the + # ones from scons ? (defined in Tools directory) + savedLINKCOM = env.has_key('LINKCOM') and deepcopy(env['LINKCOM']) or [] + savedLIBLINKPREFFIX = env.has_key('LIBLINKPREFFIX') and deepcopy(env['LIBLINKPREFFIX']) or [] + savedLIBLINKSUFFIX = env.has_key('LIBLINKSUFFIX') and deepcopy(env['LIBLINKSUFFIX']) or [] + savedLIBS = env.has_key('LIBS') and deepcopy(env['LIBS']) or [] + try: + env['LINKCOM'] = '$%s -o $TARGET $SOURCES $_LIBFLAGS' % fc + result, mangler, u, du, c = _check_f_mangling_imp(context, fc, dummym, ext) + finally: + env.Replace(LINKCOM = savedLINKCOM) + env.Replace(LIBS = savedLIBS) + env.Replace(LIBLINKPREFFIX = savedLIBLINKPREFFIX) + env.Replace(LIBLINKSUFFIX = savedLIBLINKSUFFIX) + return result, mangler, u, du, c + +def _check_f_mangling_imp(context, fc, m, ext): + env = context.env + subr = """ subroutine foobar() return end @@ -196,10 +226,10 @@ return end """ - main_tmpl = """ + main_tmpl = """ int %s() { return 1; } """ - prog_tmpl = """ + prog_tmpl = """ void %s(void); void %s(void); int my_main() { @@ -208,13 +238,6 @@ return 0; } """ - env = context.env - savedLINK = env.has_key('LINK') and deepcopy(env['LINK']) or [] - savedLIBS = env.has_key('LIBS') and deepcopy(env['LIBS']) or [] - # TODO: if does not exist, call the function to get the F77_DUMMY_MAIN - m = dummym - try: - env['LINK'] = env[fc] # variants: # lower-case, no underscore, no double underscore: foobar, foo_bar # ... @@ -244,11 +267,9 @@ except StopIteration: result = mangler = u = du = c = None break - finally: - env.Replace(LINK = savedLINK) - env.Replace(LIBS = savedLIBS) - return result, mangler, u, du, c + return result, mangler, u, du, c + def _set_mangling_var(context, u, du, case, type = 'F77'): env = context.env if du == '_': From numpy-svn at scipy.org Mon Nov 12 05:00:03 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 12 Nov 2007 04:00:03 -0600 (CST) Subject: [Numpy-svn] r4437 - in branches/numpy.scons/numpy/distutils/scons: . checkers Message-ID: <20071112100003.EF62B39C00A@new.scipy.org> Author: cdavid Date: 2007-11-12 03:59:51 -0600 (Mon, 12 Nov 2007) New Revision: 4437 Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py branches/numpy.scons/numpy/distutils/scons/fortran.py Log: Fortran-based checkers + LAPACK checker works on windows with g77 / MS Visual combo Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-12 08:42:18 UTC (rev 4436) +++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-12 09:59:51 UTC (rev 4437) @@ -4,15 +4,16 @@ # Module for custom, common checkers for numpy (and scipy) import sys import os.path +from copy import deepcopy from distutils.util import get_platform from numpy.distutils.scons.core.libinfo import get_config_from_section, get_config from numpy.distutils.scons.testcode_snippets import cblas_sgemm as cblas_src, \ c_sgemm as sunperf_src, lapack_sgesv - from numpy.distutils.scons.fortran_scons import CheckF77Mangling, CheckF77Clib - from numpy.distutils.scons.configuration import add_info +from numpy.distutils.scons.core.utils import rsplit +from numpy.distutils.scons.core.extension_scons import built_with_mstools, built_with_mingw from perflib import CheckMKL, CheckATLAS, CheckSunperf, CheckAccelerate from support import check_include_and_run, ConfigOpts, ConfigRes @@ -115,8 +116,11 @@ siteconfig, cfgfiles = get_config() (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) if found: + # XXX: handle def library names correctly + if len(libs) == 1 and len(libs[0]) == 0: + libs = ['lapack', 'blas'] cfg = ConfigOpts(cpppath = cpppath, libs = libs, libpath = libpath, - rpath = libpath) + rpath = deepcopy(libpath)) if not env.has_key('F77_NAME_MANGLER'): if not CheckF77Mangling(context): @@ -129,17 +133,25 @@ sgesv_string = env['F77_NAME_MANGLER']('sgesv') test_src = lapack_sgesv % sgesv_string - st = check_include_and_run(context, 'LAPACK (from site.cfg) ', cfg, + # fortrancfg is used to merge info from fortran checks and site.cfg + fortrancfg = deepcopy(cfg) + if not built_with_mstools(env): + fortrancfg['linkflags'].append(env['F77_LDFLAGS']) + else: + # XXX: do this the right way (abstract a minimal posix -> MS flags + # convertor) + for i in env['F77_LDFLAGS'].split(' '): + if i.startswith('-L'): + fortrancfg['libpath'].append(i[2:]) + elif i.startswith('-l'): + fortrancfg['linkflags'].append('lib%s.a' % i[2:]) + + st = check_include_and_run(context, 'LAPACK (from site.cfg) ', fortrancfg, [], test_src, autoadd) if st: add_info(env, 'lapack', ConfigRes('lapack', cfg, found)) return st else: - if sys.platform == 'nt': - import warnings - warning.warn('FIXME: LAPACK checks not implemented yet on win32') - return 0 - if sys.platform == 'darwin': st, opts = CheckAccelerate(context, autoadd) if st: Modified: branches/numpy.scons/numpy/distutils/scons/fortran.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/fortran.py 2007-11-12 08:42:18 UTC (rev 4436) +++ branches/numpy.scons/numpy/distutils/scons/fortran.py 2007-11-12 09:59:51 UTC (rev 4437) @@ -7,6 +7,7 @@ import sys import re +import os GCC_DRIVER_LINE = re.compile('^Driving:') POSIX_STATIC_EXT = re.compile('\S+\.a') @@ -14,8 +15,14 @@ MERGE_SPACE_R1 = re.compile('^-[LRuYz]$') # linkflags which match those are ignored -LINKFLAGS_IGNORED = [r'-lang*', r'-lcrt[a-zA-Z0-9]*\.o', r'-lc', r'-lgcc*', - r'-lSystem', r'-libmil', r'-LIST:*', r'-LNO:*', r'-lfrt*', r'-luser32', r'-lkernel32', r'-ladvapi32', r'-lmsvcrt', r'-lshell32', r'-lmingw', r'-lmoldname'] +LINKFLAGS_IGNORED = [r'-lang*', r'-lcrt[a-zA-Z0-9]*\.o', r'-lc', r'-lSystem', r'-libmil', r'-LIST:*', r'-LNO:*'] +if os.name == 'nt': + LINKFLAGS_IGNORED.extend([r'-lfrt*', r'-luser32', + r'-lkernel32', r'-ladvapi32', r'-lmsvcrt', + r'-lshell32', r'-lmingw', r'-lmoldname']) +else: + LINKFLAGS_IGNORED.append(r'-lgcc*') + RLINKFLAGS_IGNORED = [re.compile(i) for i in LINKFLAGS_IGNORED] # linkflags which match those are the one we are interested in From numpy-svn at scipy.org Mon Nov 12 05:24:05 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 12 Nov 2007 04:24:05 -0600 (CST) Subject: [Numpy-svn] r4438 - in branches/numpy.scons/numpy/distutils/scons: . checkers core tests Message-ID: <20071112102405.46A8339C120@new.scipy.org> Author: cdavid Date: 2007-11-12 04:23:54 -0600 (Mon, 12 Nov 2007) New Revision: 4438 Modified: branches/numpy.scons/numpy/distutils/scons/Changelog branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py branches/numpy.scons/numpy/distutils/scons/fortran_scons.py branches/numpy.scons/numpy/distutils/scons/tests/test_fortran.py Log: Correct wrong indendation Modified: branches/numpy.scons/numpy/distutils/scons/Changelog =================================================================== --- branches/numpy.scons/numpy/distutils/scons/Changelog 2007-11-12 09:59:51 UTC (rev 4437) +++ branches/numpy.scons/numpy/distutils/scons/Changelog 2007-11-12 10:23:54 UTC (rev 4438) @@ -1,3 +1,16 @@ +Sat, 11 Nov 2007 19:35:54 +0900 + +User-visible Changes: + * numpy.scons can now be used when no F77 is found. In perticular, the + CheckF77* funcs fail graciously when no F77 are found. + +Sat, 10 Nov 2007 19:35:54 +0900 + +User-visible Changes: + * VS 2005 can now be used, modulo a small modification in the + numpy.distutils.command.build_ext (rename the run method, and add a + dummy run instead). + Fri, 09 Nov 2007 18:22:44 +0900 User-visible Changes: Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-12 09:59:51 UTC (rev 4437) +++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-12 10:23:54 UTC (rev 4438) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Tue Nov 06 11:00 PM 2007 J +# Last Change: Mon Nov 12 07:00 PM 2007 J # Module for custom, common checkers for numpy (and scipy) import sys @@ -116,9 +116,9 @@ siteconfig, cfgfiles = get_config() (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) if found: - # XXX: handle def library names correctly - if len(libs) == 1 and len(libs[0]) == 0: - libs = ['lapack', 'blas'] + # XXX: handle def library names correctly + if len(libs) == 1 and len(libs[0]) == 0: + libs = ['lapack', 'blas'] cfg = ConfigOpts(cpppath = cpppath, libs = libs, libpath = libpath, rpath = deepcopy(libpath)) @@ -133,18 +133,18 @@ sgesv_string = env['F77_NAME_MANGLER']('sgesv') test_src = lapack_sgesv % sgesv_string - # fortrancfg is used to merge info from fortran checks and site.cfg - fortrancfg = deepcopy(cfg) - if not built_with_mstools(env): - fortrancfg['linkflags'].append(env['F77_LDFLAGS']) - else: - # XXX: do this the right way (abstract a minimal posix -> MS flags - # convertor) - for i in env['F77_LDFLAGS'].split(' '): - if i.startswith('-L'): - fortrancfg['libpath'].append(i[2:]) - elif i.startswith('-l'): - fortrancfg['linkflags'].append('lib%s.a' % i[2:]) + # fortrancfg is used to merge info from fortran checks and site.cfg + fortrancfg = deepcopy(cfg) + if not built_with_mstools(env): + fortrancfg['linkflags'].append(env['F77_LDFLAGS']) + else: + # XXX: do this the right way (abstract a minimal posix -> MS flags + # convertor) + for i in env['F77_LDFLAGS'].split(' '): + if i.startswith('-L'): + fortrancfg['libpath'].append(i[2:]) + elif i.startswith('-l'): + fortrancfg['linkflags'].append('lib%s.a' % i[2:]) st = check_include_and_run(context, 'LAPACK (from site.cfg) ', fortrancfg, [], test_src, autoadd) Modified: branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py 2007-11-12 09:59:51 UTC (rev 4437) +++ branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py 2007-11-12 10:23:54 UTC (rev 4438) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Fri Oct 19 11:00 AM 2007 J +# Last Change: Mon Nov 12 07:00 PM 2007 J # Module for support to build python extension. scons specific code goes here. import sys @@ -10,6 +10,9 @@ from extension import get_pythonlib_dir, get_python_inc +# Those built_* are not good: we should have a better way to get the real type +# of compiler instead of being based on names (to support things like colorgcc, +# gcc-4.2, etc...). Fortunately, we mostly need this on MS platform. def built_with_mstools(env): """Return True if built with MS tools (compiler + linker).""" return env['cc_opt'] == 'msvc' @@ -18,6 +21,10 @@ """Return true if built with mingw compiler.""" return env['cc_opt'] == 'mingw' +def built_with_gnu_f77(env): + """Return true if f77 compiler is gnu (g77, gfortran, etc...).""" + return env['f77_opt'] == 'g77' or env['f77_opt'] == 'gfortran' + def get_pythonlib_name(debug = 0): """Return the name of python library (necessary to link on NT with mingw.""" Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-12 09:59:51 UTC (rev 4437) +++ branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-12 10:23:54 UTC (rev 4438) @@ -93,17 +93,17 @@ def finalize_env(env): if built_with_mstools(env): major, minor = get_vs_version(env) - # For VS 8 and above (VS 2005), use manifest for DLL - if major >= 8: - env['LINKCOM'] = [env['LINKCOM'], - 'mt.exe -nologo -manifest ${TARGET}.manifest '\ - '-outputresource:$TARGET;1'] - env['SHLINKCOM'] = [env['SHLINKCOM'], - 'mt.exe -nologo -manifest ${TARGET}.manifest '\ - '-outputresource:$TARGET;2'] - env['LDMODULECOM'] = [env['LDMODULECOM'], - 'mt.exe -nologo -manifest ${TARGET}.manifest '\ - '-outputresource:$TARGET;2'] + # For VS 8 and above (VS 2005), use manifest for DLL + if major >= 8: + env['LINKCOM'] = [env['LINKCOM'], + 'mt.exe -nologo -manifest ${TARGET}.manifest '\ + '-outputresource:$TARGET;1'] + env['SHLINKCOM'] = [env['SHLINKCOM'], + 'mt.exe -nologo -manifest ${TARGET}.manifest '\ + '-outputresource:$TARGET;2'] + env['LDMODULECOM'] = [env['LDMODULECOM'], + 'mt.exe -nologo -manifest ${TARGET}.manifest '\ + '-outputresource:$TARGET;2'] def GetNumpyEnvironment(args): env = _GetNumpyEnvironment(args) @@ -146,7 +146,7 @@ # =============================================== # Setting tools according to command line options if not env['ENV'].has_key('PATH'): - env['ENV']['PATH'] = [] + env['ENV']['PATH'] = [] # XXX: how to handle tools which are not in standard location ? Is adding # the full path of the compiler enough ? (I am sure some compilers also @@ -174,9 +174,9 @@ env['ENV']['PATH'] += ';%s' % env['cc_opt_path'] else: env['ENV']['PATH'] += ':%s' % env['cc_opt_path'] - else: - # Do not care about PATH info because none given from scons - # distutils command + else: + # Do not care about PATH info because none given from scons + # distutils command t = Tool(env['cc_opt']) t(env) customize_cc(t.name, env) @@ -208,13 +208,12 @@ # XXX: really have to understand how fortran compilers work in scons... env['F77'] = env['_FORTRAND'] else: - #raise NotImplementedError('FIXME: Support for env wo fcompiler not tested yet !') - def_fcompiler = FindTool(DEF_FORTRAN_COMPILERS, env) - if def_fcompiler: - t = Tool(def_fcompiler) - t(env) + def_fcompiler = FindTool(DEF_FORTRAN_COMPILERS, env) + if def_fcompiler: + t = Tool(def_fcompiler) + t(env) else: - print "========== NO FORTRAN COMPILER FOUND ===========" + print "========== NO FORTRAN COMPILER FOUND ===========" # XXX: Really, we should use our own subclass of Environment, instead of # adding Numpy* functions ! Modified: branches/numpy.scons/numpy/distutils/scons/fortran_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-11-12 09:59:51 UTC (rev 4437) +++ branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-11-12 10:23:54 UTC (rev 4438) @@ -1,4 +1,4 @@ -# Last Change: Tue Nov 06 06:00 PM 2007 J +# Last Change: Mon Nov 12 07:00 PM 2007 J import os import sys import string @@ -357,30 +357,29 @@ return 0 if res: - if not built_with_mstools(context.env): - res, cnt = _build_empty_program_posix(context, fcomp) - else: - res, cnt = _build_empty_program_ms(context, fcomp) + if not built_with_mstools(context.env): + res, cnt = _build_empty_program_posix(context, fcomp) + else: + res, cnt = _build_empty_program_ms(context, fcomp) return res, cnt def _build_empty_program_ms(context, fcomp): - # MS tools and g77/gfortran semantics are totally - # difference, so we cannot just compile a program - # replacing MS linker by g77/gfortran as we can for - # all other platforms. - slast = str(context.lastTarget) - dir = dirname(slast) - test_prog = pjoin(dir, basename(slast).split('.')[0]) + # MS tools and g77/gfortran semantics are totally different, so we cannot + # just compile a program replacing MS linker by g77/gfortran as we can for + # all other platforms. + slast = str(context.lastTarget) + dir = dirname(slast) + test_prog = pjoin(dir, basename(slast).split('.')[0]) cmd = context.env.subst("$%s -v -o $TARGET $SOURCES" % fcomp, - target = context.env.File(test_prog), - source = context.lastTarget) + target = context.env.File(test_prog), + source = context.lastTarget) - st, out = popen_wrapper(cmd, merge = True) - if st: - res = 0 - else: - res = 1 + st, out = popen_wrapper(cmd, merge = True) + if st: + res = 0 + else: + res = 1 cnt = out.split('\n') return res, cnt Modified: branches/numpy.scons/numpy/distutils/scons/tests/test_fortran.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/tests/test_fortran.py 2007-11-12 09:59:51 UTC (rev 4437) +++ branches/numpy.scons/numpy/distutils/scons/tests/test_fortran.py 2007-11-12 10:23:54 UTC (rev 4438) @@ -1,14 +1,15 @@ -#! Last Change: Fri Oct 26 04:00 PM 2007 J +#! Last Change: Mon Nov 12 03:00 PM 2007 J from numpy.testing import NumpyTestCase, set_package_path, restore_path, set_local_path -set_package_path() -from scons.fortran import parse_f77link +set_local_path('..') +from fortran import parse_f77link restore_path() set_local_path() from fortran_output import g77_link_output, gfortran_link_output, \ sunfort_v12_link_output, ifort_v10_link_output, \ + mingw_g77_link_output, \ g77_link_expected, gfortran_link_expected, \ sunfort_v12_link_expected, ifort_v10_link_expected restore_path() @@ -40,6 +41,10 @@ """Parsing ifort link output on win32.""" print "FIXME: testing verbose output of win32 intel fortran" + def test_mingw_g77(self): + """Parsing mingw g77 link output on win32 (native, i.e. no cygwin)""" + print parse_f77link(mingw_g77_link_output.split('\n')) + if __name__ == '__main__': from numpy.testing import NumpyTest NumpyTest().test() From numpy-svn at scipy.org Mon Nov 12 05:39:52 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 12 Nov 2007 04:39:52 -0600 (CST) Subject: [Numpy-svn] r4439 - in branches/numpy.scons/numpy/distutils/scons: . checkers Message-ID: <20071112103952.9365E39C018@new.scipy.org> Author: cdavid Date: 2007-11-12 04:39:46 -0600 (Mon, 12 Nov 2007) New Revision: 4439 Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py branches/numpy.scons/numpy/distutils/scons/fortran.py branches/numpy.scons/numpy/distutils/scons/fortran_scons.py Log: More indent fixing in scons module, and refactor gnu -> ms lib and libpath flags convertion for F77_LDFLAGS Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-12 10:23:54 UTC (rev 4438) +++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-12 10:39:46 UTC (rev 4439) @@ -135,16 +135,7 @@ # fortrancfg is used to merge info from fortran checks and site.cfg fortrancfg = deepcopy(cfg) - if not built_with_mstools(env): - fortrancfg['linkflags'].append(env['F77_LDFLAGS']) - else: - # XXX: do this the right way (abstract a minimal posix -> MS flags - # convertor) - for i in env['F77_LDFLAGS'].split(' '): - if i.startswith('-L'): - fortrancfg['libpath'].append(i[2:]) - elif i.startswith('-l'): - fortrancfg['linkflags'].append('lib%s.a' % i[2:]) + fortrancfg['linkflags'].append(env['F77_LDFLAGS']) st = check_include_and_run(context, 'LAPACK (from site.cfg) ', fortrancfg, [], test_src, autoadd) Modified: branches/numpy.scons/numpy/distutils/scons/fortran.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/fortran.py 2007-11-12 10:23:54 UTC (rev 4438) +++ branches/numpy.scons/numpy/distutils/scons/fortran.py 2007-11-12 10:39:46 UTC (rev 4439) @@ -1,4 +1,4 @@ -#! Last Change: Fri Oct 26 04:00 PM 2007 J +#! Last Change: Mon Nov 12 07:00 PM 2007 J # This module defines some functions/classes useful for testing fortran-related # features (name mangling, F77/C runtime, etc...). @@ -29,6 +29,17 @@ LINKFLAGS_INTERESTING = [r'-[lLR][a-zA-Z0-9]*'] RLINKFLAGS_INTERESTING = [re.compile(i) for i in LINKFLAGS_INTERESTING] +def gnu_to_ms_link(linkflags): + # XXX: This is bogus. Instead of manually playing with those flags, we + # should use scons facilities, but this is not so easy because we want to + # use posix environment and MS environment at the same time + newflags = [] + for flag in linkflags: + if flag.startswith('-L'): + newflags.append('/LIBPATH:i[2:]') + elif flag.startswith('-l'): + newflags.append('lib%s.a' % i[2:]) + def _check_link_verbose_posix(lines): """Returns true if useful link options can be found in output. Modified: branches/numpy.scons/numpy/distutils/scons/fortran_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-11-12 10:23:54 UTC (rev 4438) +++ branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-11-12 10:39:46 UTC (rev 4439) @@ -7,8 +7,9 @@ from copy import deepcopy from numpy.distutils.scons.core.utils import popen_wrapper -from numpy.distutils.scons.core.extension_scons import built_with_mstools, built_with_mingw -from fortran import parse_f77link, check_link_verbose +from numpy.distutils.scons.core.extension_scons import built_with_mstools, \ + built_with_mingw, built_with_gnu_f77 +from fortran import parse_f77link, check_link_verbose, gnu_to_ms_link #----------------- # Public functions @@ -75,11 +76,8 @@ def CheckF77Clib(context): """This tries to get Fortran runtime facilities necessary at link stage, and put the relevant flags in env['F77_LDFLAGS'].""" - #if sys.platform[:5] == 'win32': - # raise Exception("FIXME: This is not tested on windows.... No chance "\ - # "of working if using visual Intel") fcompiler = 'F77' - # TODO: check that F77 exists, and can be run + if not context.env.has_key(fcompiler): raise Exception("F77 should be set before calling CheckF77Clib !") @@ -101,6 +99,8 @@ if res == 1: final_flags = parse_f77link(cnt) + if built_with_mstools(env) and built_with_gnu_f77(env): + final_flags = gnu_to_ms_link(final_flags) env.Append(F77_LDFLAGS = ' '.join(final_flags)) context.Result(env['F77_LDFLAGS']) else: @@ -121,30 +121,31 @@ if not built_with_mstools(context.env): savedLINK = env.has_key('LINK') and deepcopy(env['LINK']) or [] try: - env['LINK'] = env[fcomp] - res, m =_dummy_main_imp(context) + env['LINK'] = env[fcomp] + res, m =_dummy_main_imp(context) finally: - env.Replace(LINK = savedLINK) + env.Replace(LINK = savedLINK) else: - # Using MS tools (Visual studio) with fortran compiler - # XXX: this has to be dirty... As scons is using visual studio, it - # uses the related convention (prefix names for libraries, etc...). - # Here, we want to compile object code with cl.exe, but link with - # the fortran compiler which may be totally different than cl.exe - # (think gnu fortran compiler). So we have to bypass scons - # commands, and use our own: since this is only used for - # configuration, it should not matter much. + # Using MS tools (Visual studio) with fortran compiler + + # XXX: this has to be dirty... As scons is using visual studio, it uses + # the related convention (prefix names for libraries, etc...). Here, + # we want to compile object code with cl.exe, but link with the fortran + # compiler which may be totally different than cl.exe (think gnu + # fortran compiler). So we have to bypass scons commands, and use our + # own: since this is only used for configuration, it should not matter + # much. savedLINKCOM = env.has_key('LINKCOM') and deepcopy(env['LINKCOM']) or [] try: - env['LINKCOM'] = "$F77 -o $TARGET $SOURCES" - res, m = _dummy_main_imp(context) + env['LINKCOM'] = "$F77 -o $TARGET $SOURCES" + res, m = _dummy_main_imp(context) finally: - env.Replace(LINKCOM = savedLINKCOM) + env.Replace(LINKCOM = savedLINKCOM) return res, m def _dummy_main_imp(context): - fcn_tmpl = """ + fcn_tmpl = """ int %s() { return 0; } """ mains = ["MAIN__", "__MAIN", "_MAIN", "MAIN_"] @@ -155,12 +156,12 @@ for m in mains: prog = fcn_tmpl % "dummy" if m: - prog = fcn_tmpl % m + prog + prog = fcn_tmpl % m + prog result = context.TryLink(prog, '.c') if result: - if not m: - m = None - break + if not m: + m = None + break return result, m # XXX: refactor those by using function templates @@ -194,11 +195,11 @@ savedLINK = env.has_key('LINK') and deepcopy(env['LINK']) or [] savedLIBS = env.has_key('LIBS') and deepcopy(env['LIBS']) or [] try: - env['LINK'] = env[fc] - result, mangler, u, du, c = _check_f_mangling_imp(context, fc, dummym, ext) + env['LINK'] = env[fc] + result, mangler, u, du, c = _check_f_mangling_imp(context, fc, dummym, ext) finally: - env.Replace(LINK = savedLINK) - env.Replace(LIBS = savedLIBS) + env.Replace(LINK = savedLINK) + env.Replace(LIBS = savedLIBS) else: # XXX: instead of recreating our own build commands, can we use the # ones from scons ? (defined in Tools directory) @@ -207,18 +208,19 @@ savedLIBLINKSUFFIX = env.has_key('LIBLINKSUFFIX') and deepcopy(env['LIBLINKSUFFIX']) or [] savedLIBS = env.has_key('LIBS') and deepcopy(env['LIBS']) or [] try: - env['LINKCOM'] = '$%s -o $TARGET $SOURCES $_LIBFLAGS' % fc - result, mangler, u, du, c = _check_f_mangling_imp(context, fc, dummym, ext) + env['LINKCOM'] = '$%s -o $TARGET $SOURCES $_LIBFLAGS' % fc + result, mangler, u, du, c = _check_f_mangling_imp(context, fc, dummym, ext) finally: - env.Replace(LINKCOM = savedLINKCOM) - env.Replace(LIBS = savedLIBS) - env.Replace(LIBLINKPREFFIX = savedLIBLINKPREFFIX) - env.Replace(LIBLINKSUFFIX = savedLIBLINKSUFFIX) + env.Replace(LINKCOM = savedLINKCOM) + env.Replace(LIBS = savedLIBS) + env.Replace(LIBLINKPREFFIX = savedLIBLINKPREFFIX) + env.Replace(LIBLINKSUFFIX = savedLIBLINKSUFFIX) + return result, mangler, u, du, c def _check_f_mangling_imp(context, fc, m, ext): - env = context.env - subr = """ + env = context.env + subr = """ subroutine foobar() return end @@ -226,47 +228,47 @@ return end """ - main_tmpl = """ -int %s() { return 1; } + main_tmpl = """ + int %s() { return 1; } """ - prog_tmpl = """ -void %s(void); -void %s(void); -int my_main() { - %s(); - %s(); - return 0; -} + prog_tmpl = """ + void %s(void); + void %s(void); + int my_main() { + %s(); + %s(); + return 0; + } """ - # variants: - # lower-case, no underscore, no double underscore: foobar, foo_bar - # ... - # upper-case, underscore, double underscore: FOOBAR_, FOO_BAR__ - context.TryCompile(subr, ext) - obj = context.lastTarget - env.Append(LIBS = env.StaticLibrary(obj)) - under = ['', '_'] - doubleunder = ['', '_'] - casefcn = ["lower", "upper"] - gen = _RecursiveGenerator(under, doubleunder, casefcn) - while True: - try: - u, du, c = gen.next() - def make_mangler(u, du, c): - return lambda n: getattr(string, c)(n) +\ - u + (n.find('_') != -1 and du or '') - mangler = make_mangler(u, du, c) - foobar = mangler("foobar") - foo_bar = mangler("foo_bar") - prog = prog_tmpl % (foobar, foo_bar, foobar, foo_bar) - if m: - prog = main_tmpl % m + prog - result = context.TryLink(prog, '.c') - if result: - break - except StopIteration: - result = mangler = u = du = c = None + # variants: + # lower-case, no underscore, no double underscore: foobar, foo_bar + # ... + # upper-case, underscore, double underscore: FOOBAR_, FOO_BAR__ + context.TryCompile(subr, ext) + obj = context.lastTarget + env.Append(LIBS = env.StaticLibrary(obj)) + under = ['', '_'] + doubleunder = ['', '_'] + casefcn = ["lower", "upper"] + gen = _RecursiveGenerator(under, doubleunder, casefcn) + while True: + try: + u, du, c = gen.next() + def make_mangler(u, du, c): + return lambda n: getattr(string, c)(n) +\ + u + (n.find('_') != -1 and du or '') + mangler = make_mangler(u, du, c) + foobar = mangler("foobar") + foo_bar = mangler("foo_bar") + prog = prog_tmpl % (foobar, foo_bar, foobar, foo_bar) + if m: + prog = main_tmpl % m + prog + result = context.TryLink(prog, '.c') + if result: break + except StopIteration: + result = mangler = u = du = c = None + break return result, mangler, u, du, c @@ -384,32 +386,32 @@ return res, cnt def _build_empty_program_posix(context, fcomp): - oldLINK = context.env['LINK'] - # XXX: get the fortran compiler - context.env['LINK'] = '$' + fcomp - res = 0 + oldLINK = context.env['LINK'] + # XXX: get the fortran compiler + context.env['LINK'] = '$' + fcomp + res = 0 cnt = '' - try: - # We always want to do this build, and we do not want scons cache - # to interfer. So we build a command executed directly through our - # popen_wrapper, which output is captured. + try: + # We always want to do this build, and we do not want scons cache + # to interfer. So we build a command executed directly through our + # popen_wrapper, which output is captured. - # XXX: does this scheme to get the program name always work ? Can - # we use Scons to get the target name from the object name ? - slast = str(context.lastTarget) - dir = dirname(slast) - test_prog = pjoin(dir, basename(slast).split('.')[0]) - cmd = context.env.subst('$LINKCOM', - target = context.env.File(test_prog), - source = context.lastTarget) - st, out = popen_wrapper(cmd, merge = True) - if st: - res = 0 - else: - res = 1 - cnt = out.split('\n') - finally: - context.env['LINK'] = oldLINK + # XXX: does this scheme to get the program name always work ? Can + # we use Scons to get the target name from the object name ? + slast = str(context.lastTarget) + dir = dirname(slast) + test_prog = pjoin(dir, basename(slast).split('.')[0]) + cmd = context.env.subst('$LINKCOM', + target = context.env.File(test_prog), + source = context.lastTarget) + st, out = popen_wrapper(cmd, merge = True) + if st: + res = 0 + else: + res = 1 + cnt = out.split('\n') + finally: + context.env['LINK'] = oldLINK return res, cnt From numpy-svn at scipy.org Mon Nov 12 05:45:58 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 12 Nov 2007 04:45:58 -0600 (CST) Subject: [Numpy-svn] r4440 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071112104558.6A51539C1D1@new.scipy.org> Author: cdavid Date: 2007-11-12 04:45:54 -0600 (Mon, 12 Nov 2007) New Revision: 4440 Modified: branches/numpy.scons/numpy/distutils/scons/fortran_scons.py Log: More indentation fixing.... Modified: branches/numpy.scons/numpy/distutils/scons/fortran_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-11-12 10:39:46 UTC (rev 4439) +++ branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-11-12 10:45:54 UTC (rev 4440) @@ -119,11 +119,11 @@ env = context.env if not built_with_mstools(context.env): - savedLINK = env.has_key('LINK') and deepcopy(env['LINK']) or [] - try: + savedLINK = env.has_key('LINK') and deepcopy(env['LINK']) or [] + try: env['LINK'] = env[fcomp] res, m =_dummy_main_imp(context) - finally: + finally: env.Replace(LINK = savedLINK) else: # Using MS tools (Visual studio) with fortran compiler @@ -135,11 +135,11 @@ # fortran compiler). So we have to bypass scons commands, and use our # own: since this is only used for configuration, it should not matter # much. - savedLINKCOM = env.has_key('LINKCOM') and deepcopy(env['LINKCOM']) or [] - try: + savedLINKCOM = env.has_key('LINKCOM') and deepcopy(env['LINKCOM']) or [] + try: env['LINKCOM'] = "$F77 -o $TARGET $SOURCES" res, m = _dummy_main_imp(context) - finally: + finally: env.Replace(LINKCOM = savedLINKCOM) return res, m @@ -148,21 +148,21 @@ fcn_tmpl = """ int %s() { return 0; } """ - mains = ["MAIN__", "__MAIN", "_MAIN", "MAIN_"] - mains.extend([string.lower(m) for m in mains]) - mains.insert(0, "") - mains.append("MAIN") - mains.append("main") - for m in mains: - prog = fcn_tmpl % "dummy" - if m: + mains = ["MAIN__", "__MAIN", "_MAIN", "MAIN_"] + mains.extend([string.lower(m) for m in mains]) + mains.insert(0, "") + mains.append("MAIN") + mains.append("main") + for m in mains: + prog = fcn_tmpl % "dummy" + if m: prog = fcn_tmpl % m + prog - result = context.TryLink(prog, '.c') - if result: + result = context.TryLink(prog, '.c') + if result: if not m: m = None break - return result, m + return result, m # XXX: refactor those by using function templates def CheckF77DummyMain(context): @@ -192,25 +192,25 @@ env = context.env # TODO: if does not exist, call the function to get the F77_DUMMY_MAIN if not built_with_mstools(env): - savedLINK = env.has_key('LINK') and deepcopy(env['LINK']) or [] - savedLIBS = env.has_key('LIBS') and deepcopy(env['LIBS']) or [] - try: + savedLINK = env.has_key('LINK') and deepcopy(env['LINK']) or [] + savedLIBS = env.has_key('LIBS') and deepcopy(env['LIBS']) or [] + try: env['LINK'] = env[fc] result, mangler, u, du, c = _check_f_mangling_imp(context, fc, dummym, ext) - finally: + finally: env.Replace(LINK = savedLINK) env.Replace(LIBS = savedLIBS) else: - # XXX: instead of recreating our own build commands, can we use the - # ones from scons ? (defined in Tools directory) - savedLINKCOM = env.has_key('LINKCOM') and deepcopy(env['LINKCOM']) or [] - savedLIBLINKPREFFIX = env.has_key('LIBLINKPREFFIX') and deepcopy(env['LIBLINKPREFFIX']) or [] - savedLIBLINKSUFFIX = env.has_key('LIBLINKSUFFIX') and deepcopy(env['LIBLINKSUFFIX']) or [] - savedLIBS = env.has_key('LIBS') and deepcopy(env['LIBS']) or [] - try: + # XXX: instead of recreating our own build commands, can we use the + # ones from scons ? (defined in Tools directory) + savedLINKCOM = env.has_key('LINKCOM') and deepcopy(env['LINKCOM']) or [] + savedLIBLINKPREFFIX = env.has_key('LIBLINKPREFFIX') and deepcopy(env['LIBLINKPREFFIX']) or [] + savedLIBLINKSUFFIX = env.has_key('LIBLINKSUFFIX') and deepcopy(env['LIBLINKSUFFIX']) or [] + savedLIBS = env.has_key('LIBS') and deepcopy(env['LIBS']) or [] + try: env['LINKCOM'] = '$%s -o $TARGET $SOURCES $_LIBFLAGS' % fc result, mangler, u, du, c = _check_f_mangling_imp(context, fc, dummym, ext) - finally: + finally: env.Replace(LINKCOM = savedLINKCOM) env.Replace(LIBS = savedLIBS) env.Replace(LIBLINKPREFFIX = savedLIBLINKPREFFIX) @@ -270,7 +270,7 @@ result = mangler = u = du = c = None break - return result, mangler, u, du, c + return result, mangler, u, du, c def _set_mangling_var(context, u, du, case, type = 'F77'): env = context.env @@ -373,7 +373,7 @@ slast = str(context.lastTarget) dir = dirname(slast) test_prog = pjoin(dir, basename(slast).split('.')[0]) - cmd = context.env.subst("$%s -v -o $TARGET $SOURCES" % fcomp, + cmd = context.env.subst("$%s -v -o $TARGET $SOURCES" % fcomp, target = context.env.File(test_prog), source = context.lastTarget) @@ -382,15 +382,15 @@ res = 0 else: res = 1 - cnt = out.split('\n') - return res, cnt + cnt = out.split('\n') + return res, cnt def _build_empty_program_posix(context, fcomp): oldLINK = context.env['LINK'] # XXX: get the fortran compiler context.env['LINK'] = '$' + fcomp res = 0 - cnt = '' + cnt = '' try: # We always want to do this build, and we do not want scons cache # to interfer. So we build a command executed directly through our @@ -413,7 +413,7 @@ finally: context.env['LINK'] = oldLINK - return res, cnt + return res, cnt # Helper to generate combinations of lists def _RecursiveGenerator(*sets): From numpy-svn at scipy.org Mon Nov 12 05:47:20 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 12 Nov 2007 04:47:20 -0600 (CST) Subject: [Numpy-svn] r4441 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071112104720.B708939C1D1@new.scipy.org> Author: cdavid Date: 2007-11-12 04:47:16 -0600 (Mon, 12 Nov 2007) New Revision: 4441 Modified: branches/numpy.scons/numpy/distutils/scons/fortran.py Log: Fix forgotten return in gnu_to_ms_link Modified: branches/numpy.scons/numpy/distutils/scons/fortran.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/fortran.py 2007-11-12 10:45:54 UTC (rev 4440) +++ branches/numpy.scons/numpy/distutils/scons/fortran.py 2007-11-12 10:47:16 UTC (rev 4441) @@ -39,6 +39,7 @@ newflags.append('/LIBPATH:i[2:]') elif flag.startswith('-l'): newflags.append('lib%s.a' % i[2:]) + return newflags def _check_link_verbose_posix(lines): """Returns true if useful link options can be found in output. From numpy-svn at scipy.org Mon Nov 12 05:48:07 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 12 Nov 2007 04:48:07 -0600 (CST) Subject: [Numpy-svn] r4442 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071112104807.9FEE839C1D1@new.scipy.org> Author: cdavid Date: 2007-11-12 04:48:04 -0600 (Mon, 12 Nov 2007) New Revision: 4442 Modified: branches/numpy.scons/numpy/distutils/scons/fortran.py Log: Fix stupid typo in gnu_to_ms_link Modified: branches/numpy.scons/numpy/distutils/scons/fortran.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/fortran.py 2007-11-12 10:47:16 UTC (rev 4441) +++ branches/numpy.scons/numpy/distutils/scons/fortran.py 2007-11-12 10:48:04 UTC (rev 4442) @@ -36,7 +36,7 @@ newflags = [] for flag in linkflags: if flag.startswith('-L'): - newflags.append('/LIBPATH:i[2:]') + newflags.append('/LIBPATH:%s' i[2:]) elif flag.startswith('-l'): newflags.append('lib%s.a' % i[2:]) return newflags From numpy-svn at scipy.org Mon Nov 12 05:49:01 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 12 Nov 2007 04:49:01 -0600 (CST) Subject: [Numpy-svn] r4443 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071112104901.4BB3E39C1D1@new.scipy.org> Author: cdavid Date: 2007-11-12 04:48:54 -0600 (Mon, 12 Nov 2007) New Revision: 4443 Modified: branches/numpy.scons/numpy/distutils/scons/fortran.py Log: Fix more stupid typo in gnu_to_ms_link Modified: branches/numpy.scons/numpy/distutils/scons/fortran.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/fortran.py 2007-11-12 10:48:04 UTC (rev 4442) +++ branches/numpy.scons/numpy/distutils/scons/fortran.py 2007-11-12 10:48:54 UTC (rev 4443) @@ -36,7 +36,7 @@ newflags = [] for flag in linkflags: if flag.startswith('-L'): - newflags.append('/LIBPATH:%s' i[2:]) + newflags.append('/LIBPATH:%s' % i[2:]) elif flag.startswith('-l'): newflags.append('lib%s.a' % i[2:]) return newflags From numpy-svn at scipy.org Mon Nov 12 06:06:28 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 12 Nov 2007 05:06:28 -0600 (CST) Subject: [Numpy-svn] r4444 - in branches/numpy.scons/numpy/distutils/scons: . checkers Message-ID: <20071112110628.1D92039C0F7@new.scipy.org> Author: cdavid Date: 2007-11-12 05:06:23 -0600 (Mon, 12 Nov 2007) New Revision: 4444 Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py branches/numpy.scons/numpy/distutils/scons/fortran.py branches/numpy.scons/numpy/distutils/scons/fortran_scons.py Log: Make F77_LDFLAGS a list instead of a string Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-12 10:48:54 UTC (rev 4443) +++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-12 11:06:23 UTC (rev 4444) @@ -122,6 +122,8 @@ cfg = ConfigOpts(cpppath = cpppath, libs = libs, libpath = libpath, rpath = deepcopy(libpath)) + # XXX: How to know whether we need fortran or not + # ? if not env.has_key('F77_NAME_MANGLER'): if not CheckF77Mangling(context): return 0 @@ -135,7 +137,7 @@ # fortrancfg is used to merge info from fortran checks and site.cfg fortrancfg = deepcopy(cfg) - fortrancfg['linkflags'].append(env['F77_LDFLAGS']) + fortrancfg['linkflags'].extend(env['F77_LDFLAGS']) st = check_include_and_run(context, 'LAPACK (from site.cfg) ', fortrancfg, [], test_src, autoadd) Modified: branches/numpy.scons/numpy/distutils/scons/fortran.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/fortran.py 2007-11-12 10:48:54 UTC (rev 4443) +++ branches/numpy.scons/numpy/distutils/scons/fortran.py 2007-11-12 11:06:23 UTC (rev 4444) @@ -36,9 +36,9 @@ newflags = [] for flag in linkflags: if flag.startswith('-L'): - newflags.append('/LIBPATH:%s' % i[2:]) + newflags.append(r'/LIBPATH:%s' % flag[2:]) elif flag.startswith('-l'): - newflags.append('lib%s.a' % i[2:]) + newflags.append(r'lib%s.a' % flag[2:]) return newflags def _check_link_verbose_posix(lines): Modified: branches/numpy.scons/numpy/distutils/scons/fortran_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-11-12 10:48:54 UTC (rev 4443) +++ branches/numpy.scons/numpy/distutils/scons/fortran_scons.py 2007-11-12 11:06:23 UTC (rev 4444) @@ -101,8 +101,10 @@ final_flags = parse_f77link(cnt) if built_with_mstools(env) and built_with_gnu_f77(env): final_flags = gnu_to_ms_link(final_flags) - env.Append(F77_LDFLAGS = ' '.join(final_flags)) - context.Result(env['F77_LDFLAGS']) + print final_flags + #env.Append(F77_LDFLAGS = ' '.join(final_flags)) + env['F77_LDFLAGS'] = final_flags + context.Result(str(env['F77_LDFLAGS'])) else: context.Result('Failed !') From numpy-svn at scipy.org Mon Nov 12 06:09:13 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 12 Nov 2007 05:09:13 -0600 (CST) Subject: [Numpy-svn] r4445 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071112110913.41D6939C083@new.scipy.org> Author: cdavid Date: 2007-11-12 05:09:09 -0600 (Mon, 12 Nov 2007) New Revision: 4445 Modified: branches/numpy.scons/numpy/distutils/scons/Changelog branches/numpy.scons/numpy/distutils/scons/fortran.py Log: Update Changelog Modified: branches/numpy.scons/numpy/distutils/scons/Changelog =================================================================== --- branches/numpy.scons/numpy/distutils/scons/Changelog 2007-11-12 11:06:23 UTC (rev 4444) +++ branches/numpy.scons/numpy/distutils/scons/Changelog 2007-11-12 11:09:09 UTC (rev 4445) @@ -1,3 +1,10 @@ +Mon, 12 Nov 2007 19:57:24 +0900 + + * g77 and MS visual studio can now be used together. CheckF77Mangler, + CheckF77Clib and CheckF77DummyMain supports this configuration, and + using NETLIB BLAS/LAPACK compiled by g77 in visual C++ built numpy + works. + Sat, 11 Nov 2007 19:35:54 +0900 User-visible Changes: Modified: branches/numpy.scons/numpy/distutils/scons/fortran.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/fortran.py 2007-11-12 11:06:23 UTC (rev 4444) +++ branches/numpy.scons/numpy/distutils/scons/fortran.py 2007-11-12 11:09:09 UTC (rev 4445) @@ -32,7 +32,8 @@ def gnu_to_ms_link(linkflags): # XXX: This is bogus. Instead of manually playing with those flags, we # should use scons facilities, but this is not so easy because we want to - # use posix environment and MS environment at the same time + # use posix environment and MS environment at the same time. If we need it + # at several places, we will have to think on a better way. newflags = [] for flag in linkflags: if flag.startswith('-L'): From numpy-svn at scipy.org Tue Nov 13 00:30:52 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 12 Nov 2007 23:30:52 -0600 (CST) Subject: [Numpy-svn] r4446 - in branches/numpy.scons/numpy/distutils/scons: . doc Message-ID: <20071113053052.4AB9239C29E@new.scipy.org> Author: cdavid Date: 2007-11-12 23:30:45 -0600 (Mon, 12 Nov 2007) New Revision: 4446 Added: branches/numpy.scons/numpy/distutils/scons/doc/THANKS.txt Modified: branches/numpy.scons/numpy/distutils/scons/doc/TODO branches/numpy.scons/numpy/distutils/scons/setup.py Log: Update TODO, add THANKS and add forgotten core sub module in the setup.py of numpy.distutils.scons Added: branches/numpy.scons/numpy/distutils/scons/doc/THANKS.txt =================================================================== --- branches/numpy.scons/numpy/distutils/scons/doc/THANKS.txt 2007-11-12 11:09:09 UTC (rev 4445) +++ branches/numpy.scons/numpy/distutils/scons/doc/THANKS.txt 2007-11-13 05:30:45 UTC (rev 4446) @@ -0,0 +1,4 @@ +I would like to thank the following people: + - Stefan Van der Walt for help with numpy build bot. + - Matthieu Brucher for his windows expertise and Visual studio testing. + - Raphael Langella for access to a solaris box. Modified: branches/numpy.scons/numpy/distutils/scons/doc/TODO =================================================================== --- branches/numpy.scons/numpy/distutils/scons/doc/TODO 2007-11-12 11:09:09 UTC (rev 4445) +++ branches/numpy.scons/numpy/distutils/scons/doc/TODO 2007-11-13 05:30:45 UTC (rev 4446) @@ -1,22 +1,12 @@ Before first beta: - - rewrite CheckLibAndHeader to reuse save/restore thing from checkers - - fortran / VS interaction: look at build_ext of numpy.distutils, need hack - to make this works - f2py and scipy interoperability: N hours ? - - support environments wo fortran compilers Design questions: - improve BrokenMathlib and Mathlib in core, and make them available to everyone - - How to provide a usable framework for checks (+ doc) - overriding compilation flags: env variables, site.cfg ? (autotools convention ?) -Code cleaning: - - improve Fortran runtime detection for upstream integration - - improve Fortran mangling and dummy main detection for upstream - integration - Builder: - Get a PythonExtension builder independant of distutils for upstream integration @@ -25,15 +15,16 @@ - Generic Api builders (with dep tracking) - Generic FromTemplate builder (with dep tracking) -Implementation details: - - Refactor code for API generation (numpy/core/code_generators) -> Mostly done - Tests: - What can be tested ? Fortran: - Rewrite verbose output parser using shlex for quote handling + - improve Fortran runtime detection for upstream integration + - improve Fortran mangling and dummy main detection for upstream + integration + Documentation: - scons / distutils integration, global design (BuildDir, directories, etc...) - use cases: package developers (examples, etc...), numpy developers, Modified: branches/numpy.scons/numpy/distutils/scons/setup.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/setup.py 2007-11-12 11:09:09 UTC (rev 4445) +++ branches/numpy.scons/numpy/distutils/scons/setup.py 2007-11-13 05:30:45 UTC (rev 4446) @@ -3,9 +3,10 @@ def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('scons',parent_package,top_path) - config.add_subpackage('tools') config.add_subpackage('checkers') + config.add_subpackage('core') config.add_data_dir('tests') + config.add_subpackage('tools') return config if __name__ == '__main__': From numpy-svn at scipy.org Tue Nov 13 01:30:01 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 13 Nov 2007 00:30:01 -0600 (CST) Subject: [Numpy-svn] r4447 - branches/numpy.scons/numpy/distutils/scons/core Message-ID: <20071113063001.504D739C039@new.scipy.org> Author: cdavid Date: 2007-11-13 00:29:57 -0600 (Tue, 13 Nov 2007) New Revision: 4447 Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py Log: Correct get_build_relative_src to work when src_dir is the empty string Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-13 05:30:45 UTC (rev 4446) +++ branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-13 06:29:57 UTC (rev 4447) @@ -230,7 +230,9 @@ # the build dir relative to the src_dir: we add n .., where n is the number # of occureant of the path separator in the src dir. def get_build_relative_src(srcdir, builddir): - n = srcdir.count(os.sep) + 1 + n = srcdir.count(os.sep) + if len(srcdir): + n += 1 return pjoin(os.sep.join([os.pardir for i in range(n)]), builddir) sconsign = pjoin(get_build_relative_src(env['src_dir'], env['build_dir']), From numpy-svn at scipy.org Tue Nov 13 06:28:31 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 13 Nov 2007 05:28:31 -0600 (CST) Subject: [Numpy-svn] r4448 - branches/numpy.scons/numpy/core Message-ID: <20071113112831.4B15739C0FE@new.scipy.org> Author: cdavid Date: 2007-11-13 05:28:16 -0600 (Tue, 13 Nov 2007) New Revision: 4448 Modified: branches/numpy.scons/numpy/core/SConstruct branches/numpy.scons/numpy/core/scons_support.py Log: Remove unused CheckMathlib Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-11-13 06:29:57 UTC (rev 4447) +++ branches/numpy.scons/numpy/core/SConstruct 2007-11-13 11:28:16 UTC (rev 4448) @@ -1,4 +1,4 @@ -# Last Change: Tue Nov 06 07:00 PM 2007 J +# Last Change: Tue Nov 13 08:00 PM 2007 J # vim:syntax=python import os import sys @@ -11,8 +11,7 @@ from numpy.distutils.scons.configuration import write_info from scons_support import CheckBrokenMathlib, define_no_smp, \ - generate_config_header, generate_config_header_emitter, \ - CheckMathlib + generate_config_header, generate_config_header_emitter env = GetNumpyEnvironment(ARGUMENTS) env.Append(CPPPATH = [get_python_inc()]) @@ -27,7 +26,6 @@ #======================= # XXX: separate env for configuration config = env.NumpyConfigure(custom_tests = {'CheckBrokenMathlib' : CheckBrokenMathlib, - 'CheckMathlib' : CheckMathlib, 'CheckCBLAS' : CheckCBLAS}) # Convention: list of tuples (definition, value). value: Modified: branches/numpy.scons/numpy/core/scons_support.py =================================================================== --- branches/numpy.scons/numpy/core/scons_support.py 2007-11-13 06:29:57 UTC (rev 4447) +++ branches/numpy.scons/numpy/core/scons_support.py 2007-11-13 11:28:16 UTC (rev 4448) @@ -1,3 +1,8 @@ +#! Last Change: Tue Nov 13 08:00 PM 2007 J + +__docstring__ = """Code to support special facilities to scons which are only +useful for numpy.core, hence not put into numpy.distutils.scons""" + import sys import os From numpy-svn at scipy.org Tue Nov 13 06:51:09 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 13 Nov 2007 05:51:09 -0600 (CST) Subject: [Numpy-svn] r4449 - in branches/numpy.scons/numpy/core: . include/numpy Message-ID: <20071113115109.2673039C0FE@new.scipy.org> Author: cdavid Date: 2007-11-13 05:50:59 -0600 (Tue, 13 Nov 2007) New Revision: 4449 Modified: branches/numpy.scons/numpy/core/SConstruct branches/numpy.scons/numpy/core/include/numpy/numpyconfig.h.in branches/numpy.scons/numpy/core/scons_support.py Log: Put the MATHLIB value in both numpyconfig.h and config.h (temporary workaround) Modified: branches/numpy.scons/numpy/core/SConstruct =================================================================== --- branches/numpy.scons/numpy/core/SConstruct 2007-11-13 11:28:16 UTC (rev 4448) +++ branches/numpy.scons/numpy/core/SConstruct 2007-11-13 11:50:59 UTC (rev 4449) @@ -96,7 +96,8 @@ raise SCons.Errors.UserError("No usable mathlib was found: chose another "\ "one using the MATHLIB env variable, eg "\ "'MATHLIB=m python setup.py build'") -config_sym.append(('MATHLIB', mlib)) +# XXX: this is ugly: mathlib has nothing to do in a public header file +config_sym.append(('MATHLIB', ','.join(mlib))) def check_lib(f, autoadd = 0): """Check that f is available in mlib, and add the symbol appropriately. Modified: branches/numpy.scons/numpy/core/include/numpy/numpyconfig.h.in =================================================================== --- branches/numpy.scons/numpy/core/include/numpy/numpyconfig.h.in 2007-11-13 11:28:16 UTC (rev 4448) +++ branches/numpy.scons/numpy/core/include/numpy/numpyconfig.h.in 2007-11-13 11:50:59 UTC (rev 4449) @@ -8,7 +8,9 @@ #define NPY_NOSMP @NPY_NOSMP@ -/* Conditionally define them */ +/* XXX: this has really nothing to do in a config file... */ +#define NPY_MATHLIB @MATHLIB@ + /* XXX: this has to be done outside config files !!!! */ #ifdef PY_LONG_LONG #define NPY_SIZEOF_LONGLONG @SIZEOF_PY_LONG_LONG@ Modified: branches/numpy.scons/numpy/core/scons_support.py =================================================================== --- branches/numpy.scons/numpy/core/scons_support.py 2007-11-13 11:28:16 UTC (rev 4448) +++ branches/numpy.scons/numpy/core/scons_support.py 2007-11-13 11:50:59 UTC (rev 4449) @@ -109,7 +109,7 @@ elif isstring(value): return "#define %s %s\n\n" % (define, value) else: - return "#define %s %s\n\n" % (define, ' '.join(value)) + return "#define %s %s\n\n" % (define, ','.join(value)) t.writelines([write_symbol(i[0], i[1]) for i in sym]) t.write('\n') t.close() @@ -132,33 +132,6 @@ #----------------------------------------- # Other functions related to configuration #----------------------------------------- -def CheckMathlib(context, mathlib): - src = """ -/* check whether exp can be found with current link/compile options */ -#include -int main(int argc, char *argv[]) -{ - double a = exp(0); -} -""" - try: - oldLIBS = deepcopy(context.env['LIBS']) - except: - oldLIBS = [] - - try: - context.Message("Checking if math lib %s defines exp ... " % mathlib) - context.env.AppendUnique(LIBS = mathlib) - st = context.TryLink(src, '.c') - finally: - context.env['LIBS'] = oldLIBS - - if st: - context.Result(' Yes') - else: - context.Result(' No ') - return st - def CheckBrokenMathlib(context, mathlib): src = """ /* check whether libm is broken */ From numpy-svn at scipy.org Tue Nov 13 08:11:09 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 13 Nov 2007 07:11:09 -0600 (CST) Subject: [Numpy-svn] r4450 - trunk/numpy/distutils Message-ID: <20071113131109.C758A39C086@new.scipy.org> Author: cdavid Date: 2007-11-13 07:10:59 -0600 (Tue, 13 Nov 2007) New Revision: 4450 Modified: trunk/numpy/distutils/misc_util.py Log: Fix get_mathlib when path argument is None Modified: trunk/numpy/distutils/misc_util.py =================================================================== --- trunk/numpy/distutils/misc_util.py 2007-11-13 11:50:59 UTC (rev 4449) +++ trunk/numpy/distutils/misc_util.py 2007-11-13 13:10:59 UTC (rev 4450) @@ -115,7 +115,7 @@ """Return the MATHLIB line from config.h """ if path is None: - path = get_numpy_include_dirs()[0] + path = os.path.join(get_numpy_include_dirs()[0], 'numpy') config_file = os.path.join(path,'config.h') fid = open(config_file) mathlibs = [] From numpy-svn at scipy.org Tue Nov 13 08:53:34 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 13 Nov 2007 07:53:34 -0600 (CST) Subject: [Numpy-svn] r4451 - in branches/numpy.scons: . numpy numpy/core numpy/core/blasdot numpy/core/code_generators numpy/core/include/numpy numpy/core/src numpy/core/tests numpy/distutils numpy/distutils/command numpy/distutils/fcompiler numpy/distutils/tests numpy/distutils/tests/f2py_ext/tests numpy/distutils/tests/f2py_f90_ext/tests numpy/distutils/tests/gen_ext/tests numpy/distutils/tests/pyrex_ext/tests numpy/distutils/tests/swig_ext/tests numpy/doc numpy/f2py numpy/f2py/doc numpy/f2py/lib numpy/f2py/lib/extgen numpy/f2py/lib/parser numpy/f2py/lib/tests numpy/f2py/tests/mixed numpy/fft/tests numpy/lib numpy/lib/tests numpy/linalg numpy/linalg/lapack_lite numpy/numarray numpy/oldnumeric numpy/random/tests numpy/testing numpy/tests Message-ID: <20071113135334.66D3839C0DF@new.scipy.org> Author: cdavid Date: 2007-11-13 07:51:35 -0600 (Tue, 13 Nov 2007) New Revision: 4451 Added: branches/numpy.scons/setup.py branches/numpy.scons/setupscons.py Removed: branches/numpy.scons/scipy_compatibility branches/numpy.scons/setup.old.py branches/numpy.scons/setup.py Modified: branches/numpy.scons/TEST_COMMIT branches/numpy.scons/numpy/core/blasdot/_dotblas.c branches/numpy.scons/numpy/core/code_generators/generate_umath.py branches/numpy.scons/numpy/core/defchararray.py branches/numpy.scons/numpy/core/defmatrix.py branches/numpy.scons/numpy/core/fromnumeric.py branches/numpy.scons/numpy/core/include/numpy/ndarrayobject.h branches/numpy.scons/numpy/core/ma.py branches/numpy.scons/numpy/core/memmap.py branches/numpy.scons/numpy/core/numeric.py branches/numpy.scons/numpy/core/records.py branches/numpy.scons/numpy/core/setup.py branches/numpy.scons/numpy/core/src/arraytypes.inc.src branches/numpy.scons/numpy/core/src/multiarraymodule.c branches/numpy.scons/numpy/core/src/scalartypes.inc.src branches/numpy.scons/numpy/core/src/ucsnarrow.c branches/numpy.scons/numpy/core/src/ufuncobject.c branches/numpy.scons/numpy/core/tests/test_defmatrix.py branches/numpy.scons/numpy/core/tests/test_errstate.py branches/numpy.scons/numpy/core/tests/test_ma.py branches/numpy.scons/numpy/core/tests/test_multiarray.py branches/numpy.scons/numpy/core/tests/test_numeric.py branches/numpy.scons/numpy/core/tests/test_numerictypes.py branches/numpy.scons/numpy/core/tests/test_records.py branches/numpy.scons/numpy/core/tests/test_scalarmath.py branches/numpy.scons/numpy/core/tests/test_umath.py branches/numpy.scons/numpy/distutils/__init__.py branches/numpy.scons/numpy/distutils/ccompiler.py branches/numpy.scons/numpy/distutils/command/build_ext.py branches/numpy.scons/numpy/distutils/command/build_src.py branches/numpy.scons/numpy/distutils/command/config.py branches/numpy.scons/numpy/distutils/core.py branches/numpy.scons/numpy/distutils/cpuinfo.py branches/numpy.scons/numpy/distutils/fcompiler/__init__.py branches/numpy.scons/numpy/distutils/fcompiler/gnu.py branches/numpy.scons/numpy/distutils/misc_util.py branches/numpy.scons/numpy/distutils/system_info.py branches/numpy.scons/numpy/distutils/tests/f2py_ext/tests/test_fib2.py branches/numpy.scons/numpy/distutils/tests/f2py_f90_ext/tests/test_foo.py branches/numpy.scons/numpy/distutils/tests/gen_ext/tests/test_fib3.py branches/numpy.scons/numpy/distutils/tests/pyrex_ext/tests/test_primes.py branches/numpy.scons/numpy/distutils/tests/swig_ext/tests/test_example.py branches/numpy.scons/numpy/distutils/tests/swig_ext/tests/test_example2.py branches/numpy.scons/numpy/distutils/tests/test_fcompiler_gnu.py branches/numpy.scons/numpy/distutils/tests/test_misc_util.py branches/numpy.scons/numpy/doc/CAPI.txt branches/numpy.scons/numpy/doc/DISTUTILS.txt branches/numpy.scons/numpy/doc/HOWTO_DOCUMENT.txt branches/numpy.scons/numpy/doc/example.py branches/numpy.scons/numpy/doc/pep_buffer.txt branches/numpy.scons/numpy/doc/records.txt branches/numpy.scons/numpy/doc/ufuncs.txt branches/numpy.scons/numpy/f2py/auxfuncs.py branches/numpy.scons/numpy/f2py/capi_maps.py branches/numpy.scons/numpy/f2py/cb_rules.py branches/numpy.scons/numpy/f2py/common_rules.py branches/numpy.scons/numpy/f2py/crackfortran.py branches/numpy.scons/numpy/f2py/doc/collectinput.py branches/numpy.scons/numpy/f2py/f2py2e.py branches/numpy.scons/numpy/f2py/f90mod_rules.py branches/numpy.scons/numpy/f2py/func2subr.py branches/numpy.scons/numpy/f2py/lib/extgen/base.py branches/numpy.scons/numpy/f2py/lib/extgen/c_support.py branches/numpy.scons/numpy/f2py/lib/extgen/py_support.py branches/numpy.scons/numpy/f2py/lib/extgen/setup_py.py branches/numpy.scons/numpy/f2py/lib/extgen/utils.py branches/numpy.scons/numpy/f2py/lib/main.py branches/numpy.scons/numpy/f2py/lib/parser/test_Fortran2003.py branches/numpy.scons/numpy/f2py/lib/parser/test_parser.py branches/numpy.scons/numpy/f2py/lib/py_wrap_type.py branches/numpy.scons/numpy/f2py/lib/tests/test_derived_scalar.py branches/numpy.scons/numpy/f2py/lib/tests/test_module_module.py branches/numpy.scons/numpy/f2py/lib/tests/test_module_scalar.py branches/numpy.scons/numpy/f2py/lib/tests/test_scalar_function_in.py branches/numpy.scons/numpy/f2py/lib/tests/test_scalar_in_out.py branches/numpy.scons/numpy/f2py/rules.py branches/numpy.scons/numpy/f2py/tests/mixed/run.py branches/numpy.scons/numpy/f2py/use_rules.py branches/numpy.scons/numpy/fft/tests/test_fftpack.py branches/numpy.scons/numpy/fft/tests/test_helper.py branches/numpy.scons/numpy/lib/function_base.py branches/numpy.scons/numpy/lib/index_tricks.py branches/numpy.scons/numpy/lib/shape_base.py branches/numpy.scons/numpy/lib/tests/test_arraysetops.py branches/numpy.scons/numpy/lib/tests/test_function_base.py branches/numpy.scons/numpy/lib/tests/test_getlimits.py branches/numpy.scons/numpy/lib/tests/test_index_tricks.py branches/numpy.scons/numpy/lib/tests/test_polynomial.py branches/numpy.scons/numpy/lib/tests/test_shape_base.py branches/numpy.scons/numpy/lib/tests/test_twodim_base.py branches/numpy.scons/numpy/lib/tests/test_type_check.py branches/numpy.scons/numpy/lib/tests/test_ufunclike.py branches/numpy.scons/numpy/lib/twodim_base.py branches/numpy.scons/numpy/lib/type_check.py branches/numpy.scons/numpy/lib/utils.py branches/numpy.scons/numpy/linalg/SConstruct branches/numpy.scons/numpy/linalg/lapack_lite/clapack_scrub.py branches/numpy.scons/numpy/linalg/lapack_lite/make_lite.py branches/numpy.scons/numpy/linalg/lapack_litemodule.c branches/numpy.scons/numpy/matlib.py branches/numpy.scons/numpy/numarray/image.py branches/numpy.scons/numpy/numarray/matrix.py branches/numpy.scons/numpy/numarray/numerictypes.py branches/numpy.scons/numpy/oldnumeric/arrayfns.py branches/numpy.scons/numpy/oldnumeric/ma.py branches/numpy.scons/numpy/oldnumeric/matrix.py branches/numpy.scons/numpy/oldnumeric/precision.py branches/numpy.scons/numpy/oldnumeric/random_array.py branches/numpy.scons/numpy/random/tests/test_random.py branches/numpy.scons/numpy/testing/numpytest.py branches/numpy.scons/numpy/tests/test_ctypeslib.py branches/numpy.scons/numpy/version.py branches/numpy.scons/test.sh Log: Merge back from trunk, update make numpy.linalg sconscript work Modified: branches/numpy.scons/TEST_COMMIT =================================================================== --- branches/numpy.scons/TEST_COMMIT 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/TEST_COMMIT 2007-11-13 13:51:35 UTC (rev 4451) @@ -2,7 +2,7 @@ rkern: yes pearu: yes fperez: yes -chanley: yes - still +chanley: yes cookedm: yes swalton: yes eric: yes Modified: branches/numpy.scons/numpy/core/blasdot/_dotblas.c =================================================================== --- branches/numpy.scons/numpy/core/blasdot/_dotblas.c 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/core/blasdot/_dotblas.c 2007-11-13 13:51:35 UTC (rev 4451) @@ -20,7 +20,8 @@ register int nb = strideb / sizeof(float); if ((sizeof(float) * na == stridea) && - (sizeof(float) * nb == strideb)) + (sizeof(float) * nb == strideb) && + (na >= 0) && (nb >= 0)) *((float *)res) = cblas_sdot((int)n, (float *)a, na, (float *)b, nb); else @@ -35,7 +36,8 @@ register int nb = strideb / sizeof(double); if ((sizeof(double) * na == stridea) && - (sizeof(double) * nb == strideb)) + (sizeof(double) * nb == strideb) && + (na >= 0) && (nb >= 0)) *((double *)res) = cblas_ddot((int)n, (double *)a, na, (double *)b, nb); else oldFunctions[PyArray_DOUBLE](a, stridea, b, strideb, res, n, tmp); @@ -50,7 +52,8 @@ register int nb = strideb / sizeof(cfloat); if ((sizeof(cfloat) * na == stridea) && - (sizeof(cfloat) * nb == strideb)) + (sizeof(cfloat) * nb == strideb) && + (na >= 0) && (nb >= 0)) cblas_cdotu_sub((int)n, (float *)a, na, (float *)b, nb, (float *)res); else oldFunctions[PyArray_CFLOAT](a, stridea, b, strideb, res, n, tmp); @@ -64,7 +67,8 @@ register int nb = strideb / sizeof(cdouble); if ((sizeof(cdouble) * na == stridea) && - (sizeof(cdouble) * nb == strideb)) + (sizeof(cdouble) * nb == strideb) && + (na >= 0) && (nb >= 0)) cblas_zdotu_sub((int)n, (double *)a, na, (double *)b, nb, (double *)res); else oldFunctions[PyArray_CDOUBLE](a, stridea, b, strideb, res, n, tmp); @@ -172,6 +176,21 @@ } +static int +_bad_strides(PyArrayObject *ap) +{ + register int itemsize = PyArray_ITEMSIZE(ap); + register int i, N=PyArray_NDIM(ap); + register intp *strides = PyArray_STRIDES(ap); + + for (i=0; ind > 2) || (ap2->nd > 2)) { - /* This function doesn't handle dimensions greater than 2 -- other + /* This function doesn't handle dimensions greater than 2 + (or negative striding) -- other than to ensure the dot function is altered */ if (!altered) { @@ -235,13 +256,13 @@ return PyArray_Return(ret); } - if (!PyArray_ElementStrides((PyObject *)ap1)) { + if (_bad_strides(ap1)) { op1 = PyArray_NewCopy(ap1, PyArray_ANYORDER); Py_DECREF(ap1); ap1 = (PyArrayObject *)op1; if (ap1 == NULL) goto fail; } - if (!PyArray_ElementStrides((PyObject *)ap2)) { + if (_bad_strides(ap2)) { op2 = PyArray_NewCopy(ap2, PyArray_ANYORDER); Py_DECREF(ap2); ap2 = (PyArrayObject *)op2; Modified: branches/numpy.scons/numpy/core/code_generators/generate_umath.py =================================================================== --- branches/numpy.scons/numpy/core/code_generators/generate_umath.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/core/code_generators/generate_umath.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -1,4 +1,3 @@ -import string import re Zero = "PyUFunc_Zero" @@ -484,7 +483,7 @@ def indent(st,spaces): indention = ' '*spaces - indented = indention + string.replace(st,'\n','\n'+indention) + indented = indention + st.replace('\n','\n'+indention) # trim off any trailing spaces indented = re.sub(r' +$',r'',indented) return indented Modified: branches/numpy.scons/numpy/core/defchararray.py =================================================================== --- branches/numpy.scons/numpy/core/defchararray.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/core/defchararray.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -1,7 +1,7 @@ +import sys from numerictypes import string_, unicode_, integer, object_ from numeric import ndarray, broadcast, empty, compare_chararrays from numeric import array as narray -import sys __all__ = ['chararray'] Modified: branches/numpy.scons/numpy/core/defmatrix.py =================================================================== --- branches/numpy.scons/numpy/core/defmatrix.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/core/defmatrix.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -1,9 +1,8 @@ __all__ = ['matrix', 'bmat', 'mat', 'asmatrix'] +import sys import numeric as N from numeric import concatenate, isscalar, binary_repr -import string as str_ -import sys # make translation table _table = [None]*256 @@ -11,8 +10,7 @@ _table[k] = chr(k) _table = ''.join(_table) -_numchars = str_.digits + ".-+jeEL" -del str_ +_numchars = '0123456789.-+jeEL' _todelete = [] for k in _table: if k not in _numchars: Modified: branches/numpy.scons/numpy/core/fromnumeric.py =================================================================== --- branches/numpy.scons/numpy/core/fromnumeric.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/core/fromnumeric.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -35,7 +35,7 @@ except AttributeError: wrap = None result = getattr(asarray(obj),method)(*args, **kwds) - if wrap and isinstance(result, mu.ndarray): + if wrap: if not isinstance(result, mu.ndarray): result = asarray(result) result = wrap(result) Modified: branches/numpy.scons/numpy/core/include/numpy/ndarrayobject.h =================================================================== --- branches/numpy.scons/numpy/core/include/numpy/ndarrayobject.h 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/core/include/numpy/ndarrayobject.h 2007-11-13 13:51:35 UTC (rev 4451) @@ -1283,7 +1283,7 @@ and WRITEABLE. */ #define NPY_ENSURECOPY 0x0020 -/* Make sure the returned array is an ndarray or a bigndarray */ +/* Make sure the returned array is a base-class ndarray */ #define NPY_ENSUREARRAY 0x0040 /* Make sure that the strides are in units of the element size Modified: branches/numpy.scons/numpy/core/ma.py =================================================================== --- branches/numpy.scons/numpy/core/ma.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/core/ma.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -396,19 +396,20 @@ m = make_mask(m, copy=1) m.shape = (1,) if m is nomask: - return masked_array (self.f.reduce (t, axis)) + t = self.f.reduce(t, axis) else: t = masked_array (t, m) # XXX: "or t.dtype" below is a workaround for what appears # XXX: to be a bug in reduce. - t = self.f.reduce(filled(t, self.filly), axis, dtype=dtype or t.dtype) + t = self.f.reduce(filled(t, self.filly), axis, + dtype=dtype or t.dtype) m = umath.logical_and.reduce(m, axis) - if isinstance(t, ndarray): - return masked_array(t, m, get_fill_value(target)) - elif m: - return masked - else: - return t + if isinstance(t, ndarray): + return masked_array(t, m, get_fill_value(target)) + elif m: + return masked + else: + return t def outer (self, a, b): "Return the function applied to the outer product of a and b." Modified: branches/numpy.scons/numpy/core/memmap.py =================================================================== --- branches/numpy.scons/numpy/core/memmap.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/core/memmap.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -100,5 +100,4 @@ try: self.close() except ValueError: - pass - + pass Modified: branches/numpy.scons/numpy/core/numeric.py =================================================================== --- branches/numpy.scons/numpy/core/numeric.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/core/numeric.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -658,8 +658,8 @@ dtype - the data-type of the resulting array. If this is a record data-type, the the resulting array will be 1-d and each row will be interpreted as an element of the array. The number of columns - used must match the number of fields in the data-type in this case. - + used must match the number of fields in the data-type in this case. + comments - the character used to indicate the start of a comment in the file @@ -699,21 +699,21 @@ dtype = multiarray.dtype(dtype) defconv = _getconv(dtype) - converterseq = None + converterseq = None if converters is None: converters = {} if dtype.names is not None: converterseq = [_getconv(dtype.fields[name][0]) \ for name in dtype.names] - + for i,line in enumerate(fh): if i>> seterr(over='raise') # doctest: +SKIP {'over': 'ignore', 'divide': 'ignore', 'invalid': 'ignore', 'under': 'ignore'} - + >>> seterr(all='warn', over='raise') # doctest: +SKIP {'over': 'raise', 'divide': 'ignore', 'invalid': 'ignore', 'under': 'ignore'} - + >>> int16(32000) * int16(3) # doctest: +SKIP Traceback (most recent call last): File "", line 1, in ? Modified: branches/numpy.scons/numpy/core/records.py =================================================================== --- branches/numpy.scons/numpy/core/records.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/core/records.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -375,7 +375,7 @@ >>> r.col1 array([456, 2]) >>> r.col2 - chararray(['dbe', 'de'], + chararray(['dbe', 'de'], dtype='|S3') >>> import cPickle >>> print cPickle.loads(cPickle.dumps(r)) Modified: branches/numpy.scons/numpy/core/setup.py =================================================================== --- branches/numpy.scons/numpy/core/setup.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/core/setup.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -463,4 +463,3 @@ if __name__=='__main__': from numpy.distutils.core import setup setup(configuration=configuration) - Modified: branches/numpy.scons/numpy/core/src/arraytypes.inc.src =================================================================== --- branches/numpy.scons/numpy/core/src/arraytypes.inc.src 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/core/src/arraytypes.inc.src 2007-11-13 13:51:35 UTC (rev 4451) @@ -398,6 +398,9 @@ return -1; } memcpy(ov, ptr, MIN(ap->descr->elsize,len)); + /* If string lenth is smaller than room in array + Then fill the rest of the element size + with NULL */ if (ap->descr->elsize > len) { memset(ov + len, 0, (ap->descr->elsize - len)); } Modified: branches/numpy.scons/numpy/core/src/multiarraymodule.c =================================================================== --- branches/numpy.scons/numpy/core/src/multiarraymodule.c 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/core/src/multiarraymodule.c 2007-11-13 13:51:35 UTC (rev 4451) @@ -5710,6 +5710,9 @@ return ret; } +/* This function is needed for supporting Pickles of + numpy scalar objects. +*/ static PyObject * array_scalar(PyObject *ignored, PyObject *args, PyObject *kwds) { Modified: branches/numpy.scons/numpy/core/src/scalartypes.inc.src =================================================================== --- branches/numpy.scons/numpy/core/src/scalartypes.inc.src 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/core/src/scalartypes.inc.src 2007-11-13 13:51:35 UTC (rev 4451) @@ -282,10 +282,9 @@ if (outcode == NULL) return r; if (outcode->type_num == typecode->type_num) { - if (!PyTypeNum_ISEXTENDED(typecode->type_num)) + if (!PyTypeNum_ISEXTENDED(typecode->type_num) || + (outcode->elsize == typecode->elsize)) return r; - if (outcode->elsize == typecode->elsize); - return r; } /* cast if necessary to desired output typecode */ @@ -1271,9 +1270,47 @@ Py_BuildValue("NO", obj, mod)); } else { +#ifndef Py_UNICODE_WIDE + /* We need to expand the buffer so that we always write + UCS4 to disk for pickle of unicode scalars. + + This could be in a unicode_reduce function, but + that would require re-factoring. + */ + int alloc=0; + char *tmp; + int newlen; + + if (PyArray_IsScalar(self, Unicode)) { + tmp = _pya_malloc(buflen*2); + if (tmp == NULL) { + Py_DECREF(ret); + return PyErr_NoMemory(); + } + alloc = 1; + newlen = PyUCS2Buffer_AsUCS4((Py_UNICODE *)buffer, + (PyArray_UCS4 *)tmp, + buflen / 2, buflen / 2); + buflen = newlen*4; + buffer = tmp; + } +#endif mod = PyString_FromStringAndSize(buffer, buflen); + if (mod == NULL) { + Py_DECREF(ret); +#ifndef Py_UNICODE_WIDE + ret = NULL; + goto fail; +#else + return NULL; +#endif + } PyTuple_SET_ITEM(ret, 1, Py_BuildValue("NN", obj, mod)); +#ifndef Py_UNICODE_WIDE + fail: + if (alloc) _pya_free((char *)buffer); +#endif } return ret; } Modified: branches/numpy.scons/numpy/core/src/ucsnarrow.c =================================================================== --- branches/numpy.scons/numpy/core/src/ucsnarrow.c 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/core/src/ucsnarrow.c 2007-11-13 13:51:35 UTC (rev 4451) @@ -39,7 +39,7 @@ It converts up to ucs4len characters of UCS2 It returns the number of characters converted which can - be less than ucslen if there are surrogate pairs in ucs2. + be less than ucs2len if there are surrogate pairs in ucs2. The return value is the actual size of the used part of the ucs4 buffer. */ Modified: branches/numpy.scons/numpy/core/src/ufuncobject.c =================================================================== --- branches/numpy.scons/numpy/core/src/ufuncobject.c 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/core/src/ufuncobject.c 2007-11-13 13:51:35 UTC (rev 4451) @@ -3197,7 +3197,7 @@ static int ufunc_update_use_defaults(void) { - PyObject *errobj; + PyObject *errobj=NULL; int errmask, bufsize; int res; @@ -3206,7 +3206,7 @@ &errobj); PyUFunc_NUM_NODEFAULTS -= 1; - if (res < 0) return -1; + if (res < 0) {Py_XDECREF(errobj); return -1;} if ((errmask != UFUNC_ERR_DEFAULT) || \ (bufsize != PyArray_BUFSIZE) || \ @@ -3216,6 +3216,7 @@ else if (PyUFunc_NUM_NODEFAULTS > 0) { PyUFunc_NUM_NODEFAULTS -= 1; } + Py_XDECREF(errobj); return 0; } #endif Modified: branches/numpy.scons/numpy/core/tests/test_defmatrix.py =================================================================== --- branches/numpy.scons/numpy/core/tests/test_defmatrix.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/core/tests/test_defmatrix.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -4,7 +4,7 @@ from numpy.core import * restore_path() -class test_ctor(NumpyTestCase): +class TestCtor(NumpyTestCase): def check_basic(self): A = array([[1,2],[3,4]]) mA = matrix(A) @@ -23,7 +23,7 @@ mvec = matrix(vec) assert mvec.shape == (1,5) -class test_properties(NumpyTestCase): +class TestProperties(NumpyTestCase): def check_sum(self): """Test whether matrix.sum(axis=1) preserves orientation. Fails in NumPy <= 0.9.6.2127. @@ -91,7 +91,7 @@ assert A.sum() == matrix(2) assert A.mean() == matrix(0.5) -class test_casting(NumpyTestCase): +class TestCasting(NumpyTestCase): def check_basic(self): A = arange(100).reshape(10,10) mA = matrix(A) @@ -109,7 +109,7 @@ assert mC.dtype.type == complex128 assert all(mA != mB) -class test_algebra(NumpyTestCase): +class TestAlgebra(NumpyTestCase): def check_basic(self): import numpy.linalg as linalg @@ -132,7 +132,7 @@ assert allclose((mA + mA).A, (A + A)) assert allclose((3*mA).A, (3*A)) -class test_matrix_return(NumpyTestCase): +class TestMatrixReturn(NumpyTestCase): def check_instance_methods(self): a = matrix([1.0], dtype='f8') methodargs = { @@ -171,7 +171,7 @@ assert type(c) is matrix assert type(d) is matrix -class test_indexing(NumpyTestCase): +class TestIndexing(NumpyTestCase): def check_basic(self): x = asmatrix(zeros((3,2),float)) y = zeros((3,1),float) Modified: branches/numpy.scons/numpy/core/tests/test_errstate.py =================================================================== --- branches/numpy.scons/numpy/core/tests/test_errstate.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/core/tests/test_errstate.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -14,7 +14,7 @@ -class test_errstate(NumpyTestCase): +class TestErrstate(NumpyTestCase): def test_invalid(self): Modified: branches/numpy.scons/numpy/core/tests/test_ma.py =================================================================== --- branches/numpy.scons/numpy/core/tests/test_ma.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/core/tests/test_ma.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -13,7 +13,7 @@ %s"""% (msg, str(v), str(w)) return result -class test_ma(NumpyTestCase): +class TestMa(NumpyTestCase): def __init__(self, *args, **kwds): NumpyTestCase.__init__(self, *args, **kwds) self.setUp() @@ -647,7 +647,7 @@ self.failUnlessEqual(b[0].shape, ()) self.failUnlessEqual(b[1].shape, ()) -class test_ufuncs(NumpyTestCase): +class TestUfuncs(NumpyTestCase): def setUp(self): self.d = (array([1.0, 0, -1, pi/2]*2, mask=[0,1]+[0]*6), array([1.0, 0, -1, pi/2]*2, mask=[1,0]+[0]*6),) @@ -714,7 +714,7 @@ self.failUnless(eq(nonzero(x), [0])) -class test_array_methods(NumpyTestCase): +class TestArrayMethods(NumpyTestCase): def setUp(self): x = numpy.array([ 8.375, 7.545, 8.828, 8.5 , 1.757, 5.928, Modified: branches/numpy.scons/numpy/core/tests/test_multiarray.py =================================================================== --- branches/numpy.scons/numpy/core/tests/test_multiarray.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/core/tests/test_multiarray.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -3,7 +3,7 @@ from numpy import random import numpy as N -class test_flags(NumpyTestCase): +class TestFlags(NumpyTestCase): def setUp(self): self.a = arange(10) @@ -27,7 +27,7 @@ assert_equal(self.a.flags.updateifcopy, False) -class test_attributes(NumpyTestCase): +class TestAttributes(NumpyTestCase): def setUp(self): self.one = arange(10) self.two = arange(20).reshape(4,5) @@ -104,14 +104,14 @@ x.fill(x[0]) assert_equal(x['f1'][1], x['f1'][0]) -class test_dtypedescr(NumpyTestCase): +class TestDtypedescr(NumpyTestCase): def check_construction(self): d1 = dtype('i4') assert_equal(d1, dtype(int32)) d2 = dtype('f8') assert_equal(d2, dtype(float64)) -class test_fromstring(NumpyTestCase): +class TestFromstring(NumpyTestCase): def check_binary(self): a = fromstring('\x00\x00\x80?\x00\x00\x00@\x00\x00@@\x00\x00\x80@',dtype=' g2, [g1[i] > g2[i] for i in [0,1,2]]) -class test_argmax(NumpyTestCase): +class TestArgmax(NumpyTestCase): def check_all(self): a = random.normal(0,1,(4,5,6,7,8)) for i in xrange(a.ndim): @@ -363,13 +363,13 @@ axes.remove(i) assert all(amax == aargmax.choose(*a.transpose(i,*axes))) -class test_newaxis(NumpyTestCase): +class TestNewaxis(NumpyTestCase): def check_basic(self): sk = array([0,-0.1,0.1]) res = 250*sk[:,newaxis] assert_almost_equal(res.ravel(),250*sk) -class test_clip(NumpyTestCase): +class TestClip(NumpyTestCase): def _check_range(self,x,cmin,cmax): assert N.all(x >= cmin) assert N.all(x <= cmax) Modified: branches/numpy.scons/numpy/core/tests/test_numeric.py =================================================================== --- branches/numpy.scons/numpy/core/tests/test_numeric.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/core/tests/test_numeric.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -31,7 +31,7 @@ return "Vec("+repr(self.array.tolist())+")" __str__=__repr__ -class test_dot(NumpyTestCase): +class TestDot(NumpyTestCase): def setUp(self): self.A = rand(10,8) self.b1 = rand(8,1) @@ -141,7 +141,7 @@ assert_equal(zeros[1].array, zeros_test[1].array) -class test_bool_scalar(NumpyTestCase): +class TestBoolScalar(NumpyTestCase): def test_logical(self): f = False_ t = True_ @@ -174,7 +174,7 @@ self.failUnless((f ^ f) is f) -class test_seterr(NumpyTestCase): +class TestSeterr(NumpyTestCase): def test_set(self): err = seterr() old = seterr(divide='warn') @@ -198,7 +198,7 @@ array([1.]) / array([0.]) -class test_fromiter(NumpyTestCase): +class TestFromiter(NumpyTestCase): def makegen(self): for x in xrange(24): @@ -232,7 +232,7 @@ self.failUnless(alltrue(a == expected,axis=0)) self.failUnless(alltrue(a20 == expected[:20],axis=0)) -class test_index(NumpyTestCase): +class TestIndex(NumpyTestCase): def test_boolean(self): a = rand(3,5,8) V = rand(5,8) @@ -241,7 +241,7 @@ V[g1,g2] = -V[g1,g2] assert (array([a[0][V>0],a[1][V>0],a[2][V>0]]) == a[:,V>0]).all() -class test_binary_repr(NumpyTestCase): +class TestBinaryRepr(NumpyTestCase): def test_zero(self): assert_equal(binary_repr(0),'0') @@ -260,7 +260,7 @@ assert x.dtype.isnative == y.dtype.isnative -class test_clip(NumpyTestCase): +class TestClip(NumpyTestCase): def setUp(self): self.nr = 5 self.nc = 3 @@ -275,13 +275,13 @@ # use slow-clip selector = less(a, m)+2*greater(a, M) return selector.choose((a, m, M), out=out) - + # Handy functions def _generate_data(self, n, m): return randn(n, m) def _generate_data_complex(self, n, m): - return randn(n, m) + 1.j *rand(n, m) + return randn(n, m) + 1.j *rand(n, m) def _generate_flt_data(self, n, m): return (randn(n, m)).astype(float32) @@ -320,7 +320,7 @@ def test_simple_int(self): """Test native int input with scalar min/max.""" a = self._generate_int_data(self.nr, self.nc) - a = a.astype(int) + a = a.astype(int) m = -2 M = 4 ac = self.fastclip(a, m, M) @@ -484,7 +484,7 @@ def test_type_cast_02(self): "Test native int32 input with int32 scalar min/max." a = self._generate_int_data(self.nr, self.nc) - a = a.astype(int32) + a = a.astype(int32) m = -2 M = 4 ac = self.fastclip(a, m, M) @@ -507,7 +507,7 @@ M = float32(4) act = self.fastclip(a,m,M) ac = self.clip(a,m,M) - assert_array_strict_equal(ac, act) + assert_array_strict_equal(ac, act) def test_type_cast_04(self): "Test native int32 with double arrays min/max." Modified: branches/numpy.scons/numpy/core/tests/test_numerictypes.py =================================================================== --- branches/numpy.scons/numpy/core/tests/test_numerictypes.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/core/tests/test_numerictypes.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -331,7 +331,7 @@ multiple_rows = True _buffer = NbufferT -class test_empty_field(NumpyTestCase): +class TestEmptyField(NumpyTestCase): def check_assign(self): a = numpy.arange(10, dtype=numpy.float32) a.dtype = [("int", "<0i4"),("float", "<2f4")] Modified: branches/numpy.scons/numpy/core/tests/test_records.py =================================================================== --- branches/numpy.scons/numpy/core/tests/test_records.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/core/tests/test_records.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -6,7 +6,7 @@ from numpy.core import * restore_path() -class test_fromrecords(NumpyTestCase): +class TestFromrecords(NumpyTestCase): def check_fromrecords(self): r = rec.fromrecords([[456,'dbe',1.2],[2,'de',1.3]],names='col1,col2,col3') assert_equal(r[0].item(),(456, 'dbe', 1.2)) @@ -85,7 +85,7 @@ assert_array_equal(ra['field'], [[5,5,5]]) assert callable(ra.field) -class test_record(NumpyTestCase): +class TestRecord(NumpyTestCase): def setUp(self): self.data = rec.fromrecords([(1,2,3),(4,5,6)], dtype=[("col1", "=0: + if hasattr(self,'compiler') and 'cc' in self.compiler[0]: if not self.compiler_cxx: if self.compiler[0].startswith('gcc'): a, b = 'gcc', 'g++' @@ -217,7 +217,7 @@ + self.compiler[1:] else: if hasattr(self,'compiler'): - log.warn("#### %s #######" % (self.compiler,)) + log.warn("#### %s #######" % (self.compiler,)) log.warn('Missing compiler_cxx fix for '+self.__class__.__name__) return @@ -384,6 +384,15 @@ return lib_opts ccompiler.gen_lib_options = gen_lib_options +# Also fix up the various compiler modules, which do +# from distutils.ccompiler import gen_lib_options +# Don't bother with mwerks, as we don't support Classic Mac. +for _cc in ['msvc', 'bcpp', 'cygwinc', 'emxc', 'unixc']: + _m = sys.modules.get('distutils.'+_cc+'compiler') + if _m is not None: + setattr(getattr(_m, _cc+'compiler'), 'gen_lib_options', + gen_lib_options) + _distutils_gen_preprocess_options = gen_preprocess_options def gen_preprocess_options (macros, include_dirs): include_dirs = quote_args(include_dirs) @@ -391,7 +400,8 @@ ccompiler.gen_preprocess_options = gen_preprocess_options ##Fix distutils.util.split_quoted: -import re,string +import re +import string _wordchars_re = re.compile(r'[^\\\'\"%s ]*' % string.whitespace) _squote_re = re.compile(r"'(?:[^'\\]|\\.)*'") _dquote_re = re.compile(r'"(?:[^"\\]|\\.)*"') Modified: branches/numpy.scons/numpy/distutils/command/build_ext.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/build_ext.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/distutils/command/build_ext.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -105,13 +105,14 @@ c_lib_dirs = [] macros = [] for libname in ext.libraries: - if clibs.has_key(libname): + if libname in clibs: binfo = clibs[libname] c_libs += binfo.get('libraries',[]) c_lib_dirs += binfo.get('library_dirs',[]) for m in binfo.get('macros',[]): if m not in macros: macros.append(m) + for l in clibs.get(libname,{}).get('source_languages',[]): ext_languages.add(l) if c_libs: Modified: branches/numpy.scons/numpy/distutils/command/build_src.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/build_src.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/distutils/command/build_src.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -1,4 +1,4 @@ -""" Build swig, f2py, weave, sources. +""" Build swig, f2py, pyrex sources. """ import os @@ -116,7 +116,7 @@ self.swig_cpp = build_ext.swig_cpp for c in ['swig','swig_opt']: o = '--'+c.replace('_','-') - v = getattr(build_ext,c,None) + v = getattr(build_ext,c,None) if v: if getattr(self,c): log.warn('both build_src and build_ext define %s option' % (o)) @@ -376,35 +376,43 @@ for source in sources: (base, ext) = os.path.splitext(source) if ext == '.pyx': - if self.inplace or not have_pyrex: - target_dir = os.path.dirname(base) - else: - target_dir = appendpath(self.build_src, os.path.dirname(base)) - target_file = os.path.join(target_dir, ext_name + '.c') - depends = [source] + extension.depends - if (self.force or newer_group(depends, target_file, 'newer')): - if have_pyrex: - log.info("pyrexc:> %s" % (target_file)) - self.mkpath(target_dir) - options = Pyrex.Compiler.Main.CompilationOptions( - defaults=Pyrex.Compiler.Main.default_options, - output_file=target_file) - pyrex_result = Pyrex.Compiler.Main.compile(source, - options=options) - if pyrex_result.num_errors != 0: - raise DistutilsError,"%d errors while compiling %r with Pyrex" \ - % (pyrex_result.num_errors, source) - elif os.path.isfile(target_file): - log.warn("Pyrex required for compiling %r but not available,"\ - " using old target %r"\ - % (source, target_file)) - else: - raise DistutilsError,"Pyrex required for compiling %r but not available" % (source) + target_file = self.generate_a_pyrex_source(base, ext_name, + source, + extension) new_sources.append(target_file) else: new_sources.append(source) return new_sources + def generate_a_pyrex_source(self, base, ext_name, source, extension): + if self.inplace or not have_pyrex: + target_dir = os.path.dirname(base) + else: + target_dir = appendpath(self.build_src, os.path.dirname(base)) + target_file = os.path.join(target_dir, ext_name + '.c') + depends = [source] + extension.depends + if self.force or newer_group(depends, target_file, 'newer'): + if have_pyrex: + log.info("pyrexc:> %s" % (target_file)) + self.mkpath(target_dir) + options = Pyrex.Compiler.Main.CompilationOptions( + defaults=Pyrex.Compiler.Main.default_options, + include_path=extension.include_dirs, + output_file=target_file) + pyrex_result = Pyrex.Compiler.Main.compile(source, + options=options) + if pyrex_result.num_errors != 0: + raise DistutilsError,"%d errors while compiling %r with Pyrex" \ + % (pyrex_result.num_errors, source) + elif os.path.isfile(target_file): + log.warn("Pyrex required for compiling %r but not available,"\ + " using old target %r"\ + % (source, target_file)) + else: + raise DistutilsError("Pyrex required for compiling %r"\ + " but notavailable" % (source,)) + return target_file + def f2py_sources(self, sources, extension): new_sources = [] f2py_sources = [] Modified: branches/numpy.scons/numpy/distutils/command/config.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/config.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/distutils/command/config.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -156,4 +156,3 @@ self._clean() return exitcode, output - Modified: branches/numpy.scons/numpy/distutils/core.py =================================================================== --- branches/numpy.scons/numpy/distutils/core.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/distutils/core.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -94,30 +94,30 @@ # We can't use isinstance, as the DistributionWithoutHelpCommands # class is local to a function in setuptools.command.easy_install if dist is not None and \ - repr(dist).find('DistributionWithoutHelpCommands') != -1: + 'DistributionWithoutHelpCommands' in repr(dist): raise NotImplementedError("setuptools not supported yet for numpy.scons branch") dist = None if always and dist is None: dist = NumpyDistribution() return dist -def _exit_interactive_session(_cache=[]): - if _cache: - return # been here - _cache.append(1) - print '-'*72 - raw_input('Press ENTER to close the interactive session..') - print '='*72 +def _exit_interactive_session(_cache=[]): + if _cache: + return # been here + _cache.append(1) + print '-'*72 + raw_input('Press ENTER to close the interactive session..') + print '='*72 def setup(**attr): - if len(sys.argv)<=1 and not attr.get('script_args',[]): - from interactive import interactive_sys_argv - import atexit - atexit.register(_exit_interactive_session) - sys.argv[:] = interactive_sys_argv(sys.argv) - if len(sys.argv)>1: - return setup(**attr) + if len(sys.argv)<=1 and not attr.get('script_args',[]): + from interactive import interactive_sys_argv + import atexit + atexit.register(_exit_interactive_session) + sys.argv[:] = interactive_sys_argv(sys.argv) + if len(sys.argv)>1: + return setup(**attr) cmdclass = numpy_cmdclass.copy() Modified: branches/numpy.scons/numpy/distutils/cpuinfo.py =================================================================== --- branches/numpy.scons/numpy/distutils/cpuinfo.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/distutils/cpuinfo.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -8,22 +8,55 @@ terms of the NumPy (BSD style) license. See LICENSE.txt that came with this distribution for specifics. -Note: This should be merged into proc at some point. Perhaps proc should -be returning classes like this instead of using dictionaries. - NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. -$Revision: 1.1 $ -$Date: 2005/04/09 19:29:34 $ Pearu Peterson """ -__version__ = "$Id: cpuinfo.py,v 1.1 2005/04/09 19:29:34 pearu Exp $" - __all__ = ['cpu'] -import sys,string,re,types +import sys, re, types +import os +import commands +import warnings -class cpuinfo_base: +def getoutput(cmd, successful_status=(0,), stacklevel=1): + try: + status, output = commands.getstatusoutput(cmd) + except EnvironmentError, e: + warnings.warn(str(e), UserWarning, stacklevel=stacklevel) + return False, output + if os.WIFEXITED(status) and os.WEXITSTATUS(status) in successful_status: + return True, output + return False, output + +def command_info(successful_status=(0,), stacklevel=1, **kw): + info = {} + for key in kw: + ok, output = getoutput(kw[key], successful_status=successful_status, + stacklevel=stacklevel+1) + if ok: + info[key] = output.strip() + return info + +def command_by_line(cmd, successful_status=(0,), stacklevel=1): + ok, output = getoutput(cmd, successful_status=successful_status, + stacklevel=stacklevel+1) + if not ok: + return + for line in output.splitlines(): + yield line.strip() + +def key_value_from_command(cmd, sep, successful_status=(0,), + stacklevel=1): + d = {} + for line in command_by_line(cmd, successful_status=successful_status, + stacklevel=stacklevel+1): + l = [s.strip() for s in line.split(sep, 1)] + if len(l) == 2: + d[l[0]] = l[1] + return d + +class CPUInfoBase(object): """Holds CPU information and provides methods for requiring the availability of various CPU features. """ @@ -35,7 +68,7 @@ pass def __getattr__(self,name): - if name[0]!='_': + if not name.startswith('_'): if hasattr(self,'_'+name): attr = getattr(self,'_'+name) if type(attr) is types.MethodType: @@ -50,30 +83,31 @@ def _is_32bit(self): return not self.is_64bit() -class linux_cpuinfo(cpuinfo_base): +class LinuxCPUInfo(CPUInfoBase): info = None def __init__(self): if self.info is not None: return - info = [] + info = [ {} ] + ok, output = getoutput('uname -m') + if ok: + info[0]['uname_m'] = output.strip() try: - for line in open('/proc/cpuinfo').readlines(): - name_value = map(string.strip,string.split(line,':',1)) - if len(name_value)!=2: + fo = open('/proc/cpuinfo') + except EnvironmentError, e: + warnings.warn(str(e), UserWarning) + else: + for line in fo: + name_value = [s.strip() for s in line.split(':', 1)] + if len(name_value) != 2: continue - name,value = name_value + name, value = name_value if not info or info[-1].has_key(name): # next processor info.append({}) info[-1][name] = value - import commands - status,output = commands.getstatusoutput('uname -m') - if not status: - if not info: info.append({}) - info[-1]['uname_m'] = string.strip(output) - except: - print sys.exc_value,'(ignoring)' + fo.close() self.__class__.info = info def _not_impl(self): pass @@ -99,6 +133,9 @@ return re.match(r'.*?Athlon\(tm\) MP\b', self.info[0]['model name']) is not None + def _is_AMD64(self): + return self.is_AMD() and self.info[0]['family'] == '15' + def _is_Athlon64(self): return re.match(r'.*?Athlon\(tm\) 64\b', self.info[0]['model name']) is not None @@ -248,42 +285,26 @@ def _is_32bit(self): return not self.is_64bit() -class irix_cpuinfo(cpuinfo_base): - +class IRIXCPUInfo(CPUInfoBase): info = None def __init__(self): if self.info is not None: return - info = [] - try: - import commands - status,output = commands.getstatusoutput('sysconf') - if status not in [0,256]: - return - for line in output.split('\n'): - name_value = map(string.strip,string.split(line,' ',1)) - if len(name_value)!=2: - continue - name,value = name_value - if not info: - info.append({}) - info[-1][name] = value - except: - print sys.exc_value,'(ignoring)' + info = key_value_from_command('sysconf', sep=' ', + successful_status=(0,1)) self.__class__.info = info - #print info def _not_impl(self): pass def _is_singleCPU(self): - return self.info[0].get('NUM_PROCESSORS') == '1' + return self.info.get('NUM_PROCESSORS') == '1' def _getNCPUs(self): - return int(self.info[0].get('NUM_PROCESSORS')) + return int(self.info.get('NUM_PROCESSORS', 1)) def __cputype(self,n): - return self.info[0].get('PROCESSORS').split()[0].lower() == 'r%s' % (n) + return self.info.get('PROCESSORS').split()[0].lower() == 'r%s' % (n) def _is_r2000(self): return self.__cputype(2000) def _is_r3000(self): return self.__cputype(3000) def _is_r3900(self): return self.__cputype(3900) @@ -301,10 +322,10 @@ def _is_rorion(self): return self.__cputype('orion') def get_ip(self): - try: return self.info[0].get('MACHINE') + try: return self.info.get('MACHINE') except: pass def __machine(self,n): - return self.info[0].get('MACHINE').lower() == 'ip%s' % (n) + return self.info.get('MACHINE').lower() == 'ip%s' % (n) def _is_IP19(self): return self.__machine(19) def _is_IP20(self): return self.__machine(20) def _is_IP21(self): return self.__machine(21) @@ -321,53 +342,33 @@ def _is_IP32_5k(self): return self.__machine(32) and self._is_r5000() def _is_IP32_10k(self): return self.__machine(32) and self._is_r10000() -class darwin_cpuinfo(cpuinfo_base): +class DarwinCPUInfo(CPUInfoBase): info = None def __init__(self): if self.info is not None: return - info = [] - try: - import commands - status,output = commands.getstatusoutput('arch') - if not status: - if not info: info.append({}) - info[-1]['arch'] = string.strip(output) - status,output = commands.getstatusoutput('machine') - if not status: - if not info: info.append({}) - info[-1]['machine'] = string.strip(output) - status,output = commands.getstatusoutput('sysctl hw') - if not status: - if not info: info.append({}) - d = {} - for l in string.split(output,'\n'): - l = map(string.strip,string.split(l, '=')) - if len(l)==2: - d[l[0]]=l[1] - info[-1]['sysctl_hw'] = d - except: - print sys.exc_value,'(ignoring)' + info = command_info(arch='arch', + machine='machine') + info['sysctl_hw'] = key_value_from_command('sysctl hw', sep='=') self.__class__.info = info def _not_impl(self): pass def _getNCPUs(self): - try: return int(self.info[0]['sysctl_hw']['hw.ncpu']) - except: return 1 + return int(self.info['sysctl_hw'].get('hw.ncpu', 1)) def _is_Power_Macintosh(self): - return self.info[0]['sysctl_hw']['hw.machine']=='Power Macintosh' + return self.info['sysctl_hw']['hw.machine']=='Power Macintosh' def _is_i386(self): - return self.info[0]['arch']=='i386' + return self.info['arch']=='i386' def _is_ppc(self): - return self.info[0]['arch']=='ppc' + return self.info['arch']=='ppc' def __machine(self,n): - return self.info[0]['machine'] == 'ppc%s'%n + return self.info['machine'] == 'ppc%s'%n def _is_ppc601(self): return self.__machine(601) def _is_ppc602(self): return self.__machine(602) def _is_ppc603(self): return self.__machine(603) @@ -387,120 +388,90 @@ def _is_ppc823(self): return self.__machine(823) def _is_ppc860(self): return self.__machine(860) -class sunos_cpuinfo(cpuinfo_base): +class SunOSCPUInfo(CPUInfoBase): + info = None def __init__(self): if self.info is not None: return - info = [] - try: - import commands - status,output = commands.getstatusoutput('arch') - if not status: - if not info: info.append({}) - info[-1]['arch'] = string.strip(output) - status,output = commands.getstatusoutput('mach') - if not status: - if not info: info.append({}) - info[-1]['mach'] = string.strip(output) - status,output = commands.getstatusoutput('uname -i') - if not status: - if not info: info.append({}) - info[-1]['uname_i'] = string.strip(output) - status,output = commands.getstatusoutput('uname -X') - if not status: - if not info: info.append({}) - d = {} - for l in string.split(output,'\n'): - l = map(string.strip,string.split(l, '=')) - if len(l)==2: - d[l[0]]=l[1] - info[-1]['uname_X'] = d - status,output = commands.getstatusoutput('isainfo -b') - if not status: - if not info: info.append({}) - info[-1]['isainfo_b'] = string.strip(output) - status,output = commands.getstatusoutput('isainfo -n') - if not status: - if not info: info.append({}) - info[-1]['isainfo_n'] = string.strip(output) - status,output = commands.getstatusoutput('psrinfo -v 0') - if not status: - if not info: info.append({}) - for l in string.split(output,'\n'): - m = re.match(r'\s*The (?P

[\w\d]+) processor operates at',l) - if m: - info[-1]['processor'] = m.group('p') - break - except: - print sys.exc_value,'(ignoring)' + info = command_info(arch='arch', + mach='mach', + uname_i='uname_i', + isainfo_b='isainfo -b', + isainfo_n='isainfo -n', + ) + info['uname_X'] = key_value_from_command('uname -X', sep='=') + for line in command_by_line('psrinfo -v 0'): + m = re.match(r'\s*The (?P

[\w\d]+) processor operates at', line) + if m: + info['processor'] = m.group('p') + break self.__class__.info = info def _not_impl(self): pass def _is_32bit(self): - return self.info[0]['isainfo_b']=='32' + return self.info['isainfo_b']=='32' def _is_64bit(self): - return self.info[0]['isainfo_b']=='64' + return self.info['isainfo_b']=='64' def _is_i386(self): - return self.info[0]['isainfo_n']=='i386' + return self.info['isainfo_n']=='i386' def _is_sparc(self): - return self.info[0]['isainfo_n']=='sparc' + return self.info['isainfo_n']=='sparc' def _is_sparcv9(self): - return self.info[0]['isainfo_n']=='sparcv9' + return self.info['isainfo_n']=='sparcv9' def _getNCPUs(self): - try: return int(self.info[0]['uname_X']['NumCPU']) - except: return 1 + return int(self.info['uname_X'].get('NumCPU', 1)) def _is_sun4(self): - return self.info[0]['arch']=='sun4' + return self.info['arch']=='sun4' def _is_SUNW(self): - return re.match(r'SUNW',self.info[0]['uname_i']) is not None + return re.match(r'SUNW',self.info['uname_i']) is not None def _is_sparcstation5(self): - return re.match(r'.*SPARCstation-5',self.info[0]['uname_i']) is not None + return re.match(r'.*SPARCstation-5',self.info['uname_i']) is not None def _is_ultra1(self): - return re.match(r'.*Ultra-1',self.info[0]['uname_i']) is not None + return re.match(r'.*Ultra-1',self.info['uname_i']) is not None def _is_ultra250(self): - return re.match(r'.*Ultra-250',self.info[0]['uname_i']) is not None + return re.match(r'.*Ultra-250',self.info['uname_i']) is not None def _is_ultra2(self): - return re.match(r'.*Ultra-2',self.info[0]['uname_i']) is not None + return re.match(r'.*Ultra-2',self.info['uname_i']) is not None def _is_ultra30(self): - return re.match(r'.*Ultra-30',self.info[0]['uname_i']) is not None + return re.match(r'.*Ultra-30',self.info['uname_i']) is not None def _is_ultra4(self): - return re.match(r'.*Ultra-4',self.info[0]['uname_i']) is not None + return re.match(r'.*Ultra-4',self.info['uname_i']) is not None def _is_ultra5_10(self): - return re.match(r'.*Ultra-5_10',self.info[0]['uname_i']) is not None + return re.match(r'.*Ultra-5_10',self.info['uname_i']) is not None def _is_ultra5(self): - return re.match(r'.*Ultra-5',self.info[0]['uname_i']) is not None + return re.match(r'.*Ultra-5',self.info['uname_i']) is not None def _is_ultra60(self): - return re.match(r'.*Ultra-60',self.info[0]['uname_i']) is not None + return re.match(r'.*Ultra-60',self.info['uname_i']) is not None def _is_ultra80(self): - return re.match(r'.*Ultra-80',self.info[0]['uname_i']) is not None + return re.match(r'.*Ultra-80',self.info['uname_i']) is not None def _is_ultraenterprice(self): - return re.match(r'.*Ultra-Enterprise',self.info[0]['uname_i']) is not None + return re.match(r'.*Ultra-Enterprise',self.info['uname_i']) is not None def _is_ultraenterprice10k(self): - return re.match(r'.*Ultra-Enterprise-10000',self.info[0]['uname_i']) is not None + return re.match(r'.*Ultra-Enterprise-10000',self.info['uname_i']) is not None def _is_sunfire(self): - return re.match(r'.*Sun-Fire',self.info[0]['uname_i']) is not None + return re.match(r'.*Sun-Fire',self.info['uname_i']) is not None def _is_ultra(self): - return re.match(r'.*Ultra',self.info[0]['uname_i']) is not None + return re.match(r'.*Ultra',self.info['uname_i']) is not None def _is_cpusparcv7(self): - return self.info[0]['processor']=='sparcv7' + return self.info['processor']=='sparcv7' def _is_cpusparcv8(self): - return self.info[0]['processor']=='sparcv8' + return self.info['processor']=='sparcv8' def _is_cpusparcv9(self): - return self.info[0]['processor']=='sparcv9' + return self.info['processor']=='sparcv9' -class win32_cpuinfo(cpuinfo_base): +class Win32CPUInfo(CPUInfoBase): info = None - pkey = "HARDWARE\\DESCRIPTION\\System\\CentralProcessor" + pkey = r"HARDWARE\DESCRIPTION\System\CentralProcessor" # XXX: what does the value of # HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0 # mean? @@ -512,10 +483,9 @@ try: #XXX: Bad style to use so long `try:...except:...`. Fix it! import _winreg - pkey = "HARDWARE\\DESCRIPTION\\System\\CentralProcessor" prgx = re.compile(r"family\s+(?P\d+)\s+model\s+(?P\d+)"\ "\s+stepping\s+(?P\d+)",re.IGNORECASE) - chnd=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,pkey) + chnd=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, self.pkey) pnum=0 while 1: try: @@ -574,16 +544,15 @@ return self.is_AMD() and self.info[0]['Family']==5 \ and self.info[0]['Model']==9 - def _is_Athlon(self): - return self.is_AMD() and self.info[0]['Family']==6 + def _is_AMDK7(self): + return self.is_AMD() and self.info[0]['Family'] == 6 - def _is_Athlon64(self): - return self.is_AMD() and self.info[0]['Family']==15 \ - and self.info[0]['Model']==4 + # To reliably distinguish between the different types of AMD64 chips + # (Athlon64, Operton, Athlon64 X2, Semperon, Turion 64, etc.) would + # require looking at the 'brand' from cpuid - def _is_Opteron(self): - return self.is_AMD() and self.info[0]['Family']==15 \ - and self.info[0]['Model']==5 + def _is_AMD64(self): + return self.is_AMD() and self.info[0]['Family'] == 15 # Intel @@ -624,6 +593,14 @@ def _is_PentiumIV(self): return self.is_Intel() and self.info[0]['Family']==15 + def _is_PentiumM(self): + return self.is_Intel() and self.info[0]['Family'] == 6 \ + and self.info[0]['Model'] in [9, 13, 14] + + def _is_Core2(self): + return self.is_Intel() and self.info[0]['Family'] == 6 \ + and self.info[0]['Model'] in [15, 16, 17] + # Varia def _is_singleCPU(self): @@ -638,6 +615,8 @@ or (self.info[0]['Family'] in [6,15]) elif self.is_AMD(): return self.info[0]['Family'] in [5,6,15] + else: + return False def _has_sse(self): if self.is_Intel(): @@ -648,32 +627,39 @@ return (self.info[0]['Family']==6 and \ self.info[0]['Model'] in [6,7,8,10]) \ or self.info[0]['Family']==15 + else: + return False def _has_sse2(self): - return self.info[0]['Family']==15 + if self.is_Intel(): + return self.is_Pentium4() or self.is_PentiumM() \ + or self.is_Core2() + elif self.is_AMD(): + return self.is_AMD64() + else: + return False def _has_3dnow(self): - # XXX: does only AMD have 3dnow?? return self.is_AMD() and self.info[0]['Family'] in [5,6,15] def _has_3dnowext(self): return self.is_AMD() and self.info[0]['Family'] in [6,15] -if sys.platform[:5] == 'linux': # variations: linux2,linux-i386 (any others?) - cpuinfo = linux_cpuinfo -elif sys.platform[:4] == 'irix': - cpuinfo = irix_cpuinfo +if sys.platform.startswith('linux'): # variations: linux2,linux-i386 (any others?) + cpuinfo = LinuxCPUInfo +elif sys.platform.startswith('irix'): + cpuinfo = IRIXCPUInfo elif sys.platform == 'darwin': - cpuinfo = darwin_cpuinfo -elif sys.platform[:5] == 'sunos': - cpuinfo = sunos_cpuinfo -elif sys.platform[:5] == 'win32': - cpuinfo = win32_cpuinfo -elif sys.platform[:6] == 'cygwin': - cpuinfo = linux_cpuinfo + cpuinfo = DarwinCPUInfo +elif sys.platform.startswith('sunos'): + cpuinfo = SunOSCPUInfo +elif sys.platform.startswith('win32'): + cpuinfo = Win32CPUInfo +elif sys.platform.startswith('cygwin'): + cpuinfo = LinuxCPUInfo #XXX: other OS's. Eg. use _winreg on Win32. Or os.uname on unices. else: - cpuinfo = cpuinfo_base + cpuinfo = CPUInfoBase cpu = cpuinfo() Modified: branches/numpy.scons/numpy/distutils/fcompiler/__init__.py =================================================================== --- branches/numpy.scons/numpy/distutils/fcompiler/__init__.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/distutils/fcompiler/__init__.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -207,7 +207,7 @@ # This will be set by new_fcompiler when called in # command/{build_ext.py, build_clib.py, config.py} files. c_compiler = None - + def __init__(self, *args, **kw): CCompiler.__init__(self, *args, **kw) self.distutils_vars = self.distutils_vars.clone(self._environment_hook) Modified: branches/numpy.scons/numpy/distutils/fcompiler/gnu.py =================================================================== --- branches/numpy.scons/numpy/distutils/fcompiler/gnu.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/distutils/fcompiler/gnu.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -237,10 +237,13 @@ march_opt = '-march=pentium2' if gnu_ver >= '3.4': + # Actually, I think these all do the same things if cpu.is_Opteron(): march_opt = '-march=opteron' elif cpu.is_Athlon64(): march_opt = '-march=athlon64' + elif cpu.is_AMD64(): + march_opt = '-march=k8' if gnu_ver >= '3.4.4': if cpu.is_PentiumM(): Modified: branches/numpy.scons/numpy/distutils/misc_util.py =================================================================== --- branches/numpy.scons/numpy/distutils/misc_util.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/distutils/misc_util.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -116,7 +116,7 @@ """Return the MATHLIB line from config.h """ if path is None: - path = get_numpy_include_dirs()[0] + path = os.path.join(get_numpy_include_dirs()[0], 'numpy') config_file = os.path.join(path,'config.h') fid = open(config_file) mathlibs = [] Modified: branches/numpy.scons/numpy/distutils/system_info.py =================================================================== --- branches/numpy.scons/numpy/distutils/system_info.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/distutils/system_info.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -143,7 +143,18 @@ '/opt/include', '/usr/include', '/opt/local/include', '/sw/include'] default_src_dirs = ['.','/usr/local/src', '/opt/src','/sw/src'] - default_x11_lib_dirs = ['/usr/X11R6/lib','/usr/X11/lib','/usr/lib'] + + try: + platform = os.uname() + bit64 = platform[-1].endswith('64') + except: + bit64 = False + + if bit64: + default_x11_lib_dirs = ['/usr/lib64'] + else: + default_x11_lib_dirs = ['/usr/X11R6/lib','/usr/X11/lib','/usr/lib'] + default_x11_include_dirs = ['/usr/X11R6/include','/usr/X11/include', '/usr/include'] @@ -830,7 +841,7 @@ lapack_libs = self.get_libs('lapack_libs',['mkl_lapack']) else: lapack_libs = self.get_libs('lapack_libs',['mkl_lapack32','mkl_lapack64']) - + info = {'libraries': lapack_libs} dict_append(info,**mkl) self.set_info(**info) @@ -1073,7 +1084,7 @@ tgexc tgsen tgsja tgsna tgsy2 tgsyl tpcon tprfs tptri tptrs trcon trevc trexc trrfs trsen trsna trsyl trti2 trtri trtrs tzrqf tzrzf - + lacn2 lahr2 stemr laqr0 laqr1 laqr2 laqr3 laqr4 laqr5 ''' # [s|c|d|z]*.f sd_lasrc = ''' Modified: branches/numpy.scons/numpy/distutils/tests/f2py_ext/tests/test_fib2.py =================================================================== --- branches/numpy.scons/numpy/distutils/tests/f2py_ext/tests/test_fib2.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/distutils/tests/f2py_ext/tests/test_fib2.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -4,7 +4,7 @@ from f2py_ext import fib2 del sys.path[0] -class test_fib2(NumpyTestCase): +class TestFib2(NumpyTestCase): def check_fib(self): assert_array_equal(fib2.fib(6),[0,1,1,2,3,5]) Modified: branches/numpy.scons/numpy/distutils/tests/f2py_f90_ext/tests/test_foo.py =================================================================== --- branches/numpy.scons/numpy/distutils/tests/f2py_f90_ext/tests/test_foo.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/distutils/tests/f2py_f90_ext/tests/test_foo.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -4,7 +4,7 @@ from f2py_f90_ext import foo del sys.path[0] -class test_foo(NumpyTestCase): +class TestFoo(NumpyTestCase): def check_foo_free(self): assert_equal(foo.foo_free.bar13(),13) Modified: branches/numpy.scons/numpy/distutils/tests/gen_ext/tests/test_fib3.py =================================================================== --- branches/numpy.scons/numpy/distutils/tests/gen_ext/tests/test_fib3.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/distutils/tests/gen_ext/tests/test_fib3.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -4,7 +4,7 @@ from gen_ext import fib3 del sys.path[0] -class test_fib3(NumpyTestCase): +class TestFib3(NumpyTestCase): def check_fib(self): assert_array_equal(fib3.fib(6),[0,1,1,2,3,5]) Modified: branches/numpy.scons/numpy/distutils/tests/pyrex_ext/tests/test_primes.py =================================================================== --- branches/numpy.scons/numpy/distutils/tests/pyrex_ext/tests/test_primes.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/distutils/tests/pyrex_ext/tests/test_primes.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -5,7 +5,7 @@ from pyrex_ext.primes import primes restore_path() -class test_primes(NumpyTestCase): +class TestPrimes(NumpyTestCase): def check_simple(self, level=1): l = primes(10) assert_equal(l, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]) Modified: branches/numpy.scons/numpy/distutils/tests/swig_ext/tests/test_example.py =================================================================== --- branches/numpy.scons/numpy/distutils/tests/swig_ext/tests/test_example.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/distutils/tests/swig_ext/tests/test_example.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -4,7 +4,7 @@ from swig_ext import example restore_path() -class test_example(NumpyTestCase): +class TestExample(NumpyTestCase): def check_fact(self): assert_equal(example.fact(10),3628800) Modified: branches/numpy.scons/numpy/distutils/tests/swig_ext/tests/test_example2.py =================================================================== --- branches/numpy.scons/numpy/distutils/tests/swig_ext/tests/test_example2.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/distutils/tests/swig_ext/tests/test_example2.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -4,7 +4,7 @@ from swig_ext import example2 restore_path() -class test_example2(NumpyTestCase): +class TestExample2(NumpyTestCase): def check_zoo(self): z = example2.Zoo() Modified: branches/numpy.scons/numpy/distutils/tests/test_fcompiler_gnu.py =================================================================== --- branches/numpy.scons/numpy/distutils/tests/test_fcompiler_gnu.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/distutils/tests/test_fcompiler_gnu.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -21,7 +21,7 @@ ('GNU Fortran (GCC) 4.3.0 20070316 (experimental)', '4.3.0'), ] -class test_g77_versions(NumpyTestCase): +class TestG77Versions(NumpyTestCase): def test_g77_version(self): fc = numpy.distutils.fcompiler.new_fcompiler(compiler='gnu') for vs, version in g77_version_strings: @@ -34,7 +34,7 @@ v = fc.version_match(vs) assert v is None, (vs, v) -class test_gortran_versions(NumpyTestCase): +class TestGortranVersions(NumpyTestCase): def test_gfortran_version(self): fc = numpy.distutils.fcompiler.new_fcompiler(compiler='gnu95') for vs, version in gfortran_version_strings: Modified: branches/numpy.scons/numpy/distutils/tests/test_misc_util.py =================================================================== --- branches/numpy.scons/numpy/distutils/tests/test_misc_util.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/distutils/tests/test_misc_util.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -8,7 +8,7 @@ ajoin = lambda *paths: join(*((sep,)+paths)) -class test_appendpath(NumpyTestCase): +class TestAppendpath(NumpyTestCase): def check_1(self): assert_equal(appendpath('prefix','name'),join('prefix','name')) @@ -32,7 +32,7 @@ assert_equal(appendpath('/prefix/sub/sub2','/prefix/sub/sup/name'), ajoin('prefix','sub','sub2','sup','name')) -class test_minrelpath(NumpyTestCase): +class TestMinrelpath(NumpyTestCase): def check_1(self): import os @@ -47,7 +47,7 @@ assert_equal(minrelpath(n('.././..')),n('../..')) assert_equal(minrelpath(n('aa/bb/.././../dd')),n('dd')) -class test_gpaths(NumpyTestCase): +class TestGpaths(NumpyTestCase): def check_gpaths(self): local_path = minrelpath(os.path.join(os.path.dirname(__file__),'..')) Modified: branches/numpy.scons/numpy/doc/CAPI.txt =================================================================== --- branches/numpy.scons/numpy/doc/CAPI.txt 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/doc/CAPI.txt 2007-11-13 13:51:35 UTC (rev 4451) @@ -3,9 +3,11 @@ =============== :Author: Travis Oliphant -:Discussions to: scipy-dev at scipy.org +:Discussions to: `numpy-discussion at scipy.org`__ :Created: October 2005 +__ http://www.scipy.org/Mailing_Lists + The C API of NumPy is (mostly) backward compatible with Numeric. There are a few non-standard Numeric usages (that were not really part Modified: branches/numpy.scons/numpy/doc/DISTUTILS.txt =================================================================== --- branches/numpy.scons/numpy/doc/DISTUTILS.txt 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/doc/DISTUTILS.txt 2007-11-13 13:51:35 UTC (rev 4451) @@ -34,39 +34,37 @@ ''''''''''''''''''''''''''''''' SciPy consists of Python packages, called SciPy packages, that are -available to Python users via ``scipy`` name space. Each SciPy package -may contain other SciPy packages. And so on. So, SciPy directory tree -is a tree of packages with arbitrary depth and width. Any SciPy -package may depend on NumPy packages but the dependence on other +available to Python users via the ``scipy`` namespace. Each SciPy package +may contain other SciPy packages. And so on. Therefore, the SciPy +directory tree is a tree of packages with arbitrary depth and width. +Any SciPy package may depend on NumPy packages but the dependence on other SciPy packages should be kept minimal or zero. -A SciPy package contains in addition to its sources, the following +A SciPy package contains, in addition to its sources, the following files and directories: - ``setup.py`` --- building script - ``info.py`` --- contains documentation and import flags - ``__init__.py`` --- package initializer - ``tests/`` --- directory of unittests + + ``setup.py`` --- building script + + ``info.py`` --- contains documentation and import flags + + ``__init__.py`` --- package initializer + + ``tests/`` --- directory of unittests -Their contents will be described below. +Their contents are described below. The ``setup.py`` file ''''''''''''''''''''' -In order to add a Python package to SciPy, its building script (the -``setup.py`` file) must meet certain requirements. The minimal and the -most important one is that it must define a function -``configuration(parent_package='',top_path=None)`` that returns a -dictionary suitable for passing to ``numpy.distutils.core.setup(..)`` -function. In order to simplify the construction of such an distionary, -``numpy.distutils.misc_util`` provides a class ``Configuration``, the -usage of will be described below. +In order to add a Python package to SciPy, its build script (``setup.py``) +must meet certain requirements. The most important requirement is that the +package define a ``configuration(parent_package='',top_path=None)`` function +which returns a dictionary suitable for passing to +``numpy.distutils.core.setup(..)``. To simplify the construction of +this dictionary, ``numpy.distutils.misc_util`` provides the +``Configuration`` class, described below. SciPy pure Python package example --------------------------------- -Here follows a minimal example for a pure Python SciPy package -``setup.py`` file that will be explained in detail below:: +Below is an example of a minimal ``setup.py`` file for a pure Scipy package:: #!/usr/bin/env python def configuration(parent_package='',top_path=None): @@ -79,16 +77,15 @@ #setup(**configuration(top_path='').todict()) setup(configuration=configuration) -The first argument ``parent_package`` of the main configuration -function will contain a name of the parent SciPy package and the -second argument ``top_path`` contains the name of the directory where -the main ``setup.py`` script is located. Both arguments should be -passed to the ``Configuration`` constructor after the name of the -current package. +The arguments of the ``configuration`` function specifiy the name of +parent SciPy package (``parent_package``) and the directory location +of the main ``setup.py`` script (``top_path``). These arguments, +along with the name of the current package, should be passed to the +``Configuration`` constructor. -The ``Configuration`` constructor has also fourth optional argument, +The ``Configuration`` constructor has a fourth optional argument, ``package_path``, that can be used when package files are located in -some other location than the directory of the ``setup.py`` file. +a different location than the directory of the ``setup.py`` file. Remaining ``Configuration`` arguments are all keyword arguments that will be used to initialize attributes of ``Configuration`` @@ -122,7 +119,7 @@ ``Configuration`` instance methods ---------------------------------- -+ ``config.todict()`` --- returns configuration distionary suitable for ++ ``config.todict()`` --- returns configuration dictionary suitable for passing to ``numpy.distutils.core.setup(..)`` function. + ``config.paths(*paths) --- applies ``glob.glob(..)`` to items of @@ -409,12 +406,12 @@ The ``info.py`` file '''''''''''''''''''' -Scipy package import hooks assume that each Scipy package contains -``info.py`` file that contains overall documentation about the package -and some variables defining the order of package imports, dependence +Scipy package import hooks assume that each package contains a +``info.py`` file. This file contains overall documentation about the package +and variables defining the order of package imports, dependency relations between packages, etc. -The following information will be looked in the ``info.py`` file: +On import, the following information will be looked for in ``info.py``: __doc__ The documentation string of the package. @@ -444,15 +441,14 @@ The ``__init__.py`` file '''''''''''''''''''''''' -To speed up the import time as well as to minimize memory usage, numpy -uses ppimport hooks to transparently postpone importing large modules -that might not be used during the Scipy usage session. But in order to -have an access to the documentation of all Scipy packages, including -of the postponed packages, the documentation string of a package (that would -usually reside in ``__init__.py`` file) should be copied also -to ``info.py`` file. +To speed up the import time and minimize memory usage, numpy +uses ``ppimport`` hooks to transparently postpone importing large modules, +which might not be used during the Scipy session. In order to +have access to the documentation of all Scipy packages, including +postponed packages, the docstring from ``info.py`` is imported +into ``__init__.py``. -So, the header a typical ``__init__.py`` file is:: +The header of a typical ``__init__.py`` is:: # # Package ... - ... Modified: branches/numpy.scons/numpy/doc/HOWTO_DOCUMENT.txt =================================================================== --- branches/numpy.scons/numpy/doc/HOWTO_DOCUMENT.txt 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/doc/HOWTO_DOCUMENT.txt 2007-11-13 13:51:35 UTC (rev 4451) @@ -1,33 +1,49 @@ -================================= -A Guide to NumPy/SciPy Docstrings -================================= +==================================== +A Guide to NumPy/SciPy Documentation +==================================== .. Contents:: Overview -------- +In general, we follow the standard Python style conventions as described here: + * `Style Guide for C Code `__ + * `Style Guide for Python Code `__ + * `Docstring Conventions `__ +Additional PEPs of interest regarding documentation of code: + * `Docstring Processing Framework `__ + * `Docutils Design Specification `__ + +Use a code checker: + * `pylint `__ + * `pep8.py `__ + +Docstring Standard +------------------ + A documentation string (docstring) is a string that describes a module, function, class, or method definition. The docstring is a special attribute of the object (``object.__doc__``) and, for consistency, is surrounded by -triple double quotes. +triple double quotes. -Obviously, it is highly desireable that both NumPy and SciPy follow a common -convention for docstrings that provide for consistency while also allowing -epydoc to produce nicely-formatted reference guides. This document describes -the current community consensus for this standard. If you have suggestions -for improvements, post them on the numpy-dev list together with the epydoc -output so they may be discussed. +It is highly desireable that both NumPy and SciPy_ follow a common +convention for docstrings that provide for consistency while also +allowing epydoc_ to produce nicely-formatted reference guides. This +document describes the current community consensus for this standard. +If you have suggestions for improvements, post them on the +`numpy-discussion list`_, together with the epydoc output. -Our docstring standard uses `reST `__ -syntax and is rendered using `epydoc `__. The -markup in this proposal is as basic as possible and in particular avoids the -use of epydoc consolidated fields. This is both because there are a limited -number of such fields, inadequate to our current needs, and because epydoc -moves the fields to the end of the documentation, messing up the ordering. So -here standard definition lists are used instead. Likewise, epydoc moves -headings and have an unwelcome size in the default style sheet, hence they -have also been avoided. +Our docstring standard uses `reST +`__ syntax and is rendered +using epydoc_. The markup in this proposal is as basic as possible +and, in particular, avoids the use of epydoc consolidated fields. This +is both because there are a limited number of such fields, inadequate +to our current needs, and because epydoc moves the fields to the end +of the documentation, messing up the ordering. Standard definition +lists are used instead. Likewise, epydoc moves headings and have an +unwelcome size in the default style sheet, therefore they are also +avoided. Status @@ -37,11 +53,11 @@ 1. Agree on docstring standards. -2. Work with Ed loper to ensure that epydoc provides the functionality we -need. +2. Work with Ed loper to ensure that epydoc_ provides the functionality + we need. -3. Convert existing docstrings to the new format and write them for those -that currently lack docstrings. +3. Convert existing docstrings to the new format and write them for + those that currently lack docstrings. Sections @@ -50,50 +66,60 @@ The proposed sections of the docstring are: 1. **Short summary:** -A one-line summary not using variable names or the function name (unless a -C-function). + A one-line summary not using variable names or the function name + (unless a C-function). 2. **Extended summary:** -A few sentences giving an extended description. + A few sentences giving an extended description. 3. **Parameters:** + Description of the function arguments, keywords and their + respective types. -4. **Returns:**' +4. **Returns:** + Explanation of the returned values and their types. 5. **Other parameters:** -An optional section used to describe little used -parameters so that functions with a large number of keyword argument can still -be well documented without cluttering the main parameters' list. + An optional section used to describe little used parameters so that + functions with a large number of keyword argument can still be well + documented without cluttering the main parameters' list. 6. **See also:** -An optional section used to refer to related code. This section can be -extremely useful, but needs to be used with caution. It can be difficult -to maintain and if not used judiciously this section can quickly loose its -usefulness. The purpose of this section is to direct users to other -functions they may not be aware of or have easy means to discover (i.e., -by looking at the docstring of the module). Thus, repeating functions -that are in the same module is not useful and can create a cluttered -document. Routines that provide additional information in their -docstrings for this function may be useful to include here. + An optional section used to refer to related code. This section + can be very useful, but should be used judiciously. The goal is to + direct users to other functions they may not be aware of, or have + easy means of discovering (by looking at the module docstring, for + example). Routines whose docstrings further explain parameters + used by this function are good candidates. 7. **Notes:** -An optional section that provides additional information -about the code possibly including a discussion or presentation of the -algorithm. This section may include mathematical equations possibly written -in `LaTeX `__. + An optional section that provides additional information about the + code, possibly including a discussion of the algorithm. This + section may include mathematical equations, possibly written in + `LaTeX `__. 8. **Examples:** -An optional section for examples using the -`doctest `__ format. It -can provide an inline mini-tutorial as well as additional regression testing. -While optional, this section is strongly encouraged. (Comment by Chuck: -blank lines in the numpy output, for instance in multidimensional arrays, -will break doctest.) You can run the tests by doing:: + An optional section for examples, using the `doctest + `__ format. It + can provide an inline mini-tutorial as well as additional + regression testing. While optional, this section is strongly + encouraged. You can run the tests by doing:: - >>> import doctest - >>> doctest.testfile('example.py') + >>> import doctest + >>> doctest.testfile('example.py') + Blank lines are used to seperate doctests. When they occur in the + expected output, they should be replaced by ```` (see + `doctest options + `_), e.g. + :: + + >>> print "a\n\nb" + a + + b + Common reST concepts -------------------- @@ -101,10 +127,10 @@ __docformat__ = 'restructuredtext en' -at the top level in accordance with -`PEP 258 `__. Note that the -__docformat__ variable in a package's __init__.py file does not apply to -objects defined in subpackages and submodules. +at the top level in accordance with `PEP 258 +`__. Note that the +``__docformat__`` variable in a package's ``__init__.py`` file does +not apply to objects defined in subpackages and submodules. For paragraphs, indentation is significant and indicates indentation in the output. New paragraphs are marked with blank line. @@ -123,12 +149,11 @@ -Using Epydoc ------------- +Using Epydoc_ +------------- +Currently, we recommend that you build epydoc from the trunk:: -Currently we recommend that you build eydoc from the trunk:: - svn co https://epydoc.svn.sourceforge.net/svnroot/epydoc/trunk/epydoc epydoc cd epydoc/src sudo python setup.py install @@ -153,21 +178,39 @@ Use optional in the "type" field for parameters that are non-keyword optional for C-functions. +Epydoc depends on Docutils for reStructuredText parsing. You can download +Docutils from the +`Docutils sourceforge page. `__ +You may also be able to use a package manager like yum to install a +current version:: + + $ sudo yum install python-docutils + + Example ------- -Here is a short example module in +Here is a short example module, `plain text `__ -and -`rendered `__ +or +`rendered `__ in HTML. To try this yourself, simply download the example.py:: svn co http://svn.scipy.org/svn/numpy/trunk/numpy/doc/example.py . -You can run epydoc on this file like so:: +Then, run epydoc:: $ epydoc example.txt -The output will be in a directory named html in the same directory as this -document and may be viewed by loading the index.html file into your browser. +The output is placed in ``./html``, and may be viewed by loading the +``index.html`` file into your browser. + +This document itself was written in ReStructuredText, and may be converted to +HTML using:: + + $ rst2html HOWTO_DOCUMENT.txt HOWTO_DOCUMENT.html + +.. _SciPy: http://www.scipy.org +.. _numpy-discussion list: http://www.scipy.org/Mailing_Lists +.. _epydoc: http://epydoc.sourceforge.net/ Modified: branches/numpy.scons/numpy/doc/example.py =================================================================== --- branches/numpy.scons/numpy/doc/example.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/doc/example.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -96,4 +96,3 @@ """ pass - Modified: branches/numpy.scons/numpy/doc/pep_buffer.txt =================================================================== --- branches/numpy.scons/numpy/doc/pep_buffer.txt 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/doc/pep_buffer.txt 2007-11-13 13:51:35 UTC (rev 4451) @@ -1,13 +1,13 @@ -PEP: 3118 -Title: Revising the buffer protocol -Version: $Revision$ -Last-Modified: $Date$ -Authors: Travis Oliphant , Carl Banks -Status: Draft -Type: Standards Track -Content-Type: text/x-rst -Created: 28-Aug-2006 -Python-Version: 3000 +:PEP: 3118 +:Title: Revising the buffer protocol +:Version: $Revision$ +:Last-Modified: $Date$ +:Authors: Travis Oliphant , Carl Banks +:Status: Draft +:Type: Standards Track +:Content-Type: text/x-rst +:Created: 28-Aug-2006 +:Python-Version: 3000 Abstract ======== @@ -16,17 +16,17 @@ function pointers) to improve the way Python allows memory sharing in Python 3.0 -In particular, it is proposed that the character buffer portion -of the API be elminated and the multiple-segment portion be +In particular, it is proposed that the character buffer portion +of the API be elminated and the multiple-segment portion be re-designed in conjunction with allowing for strided memory -to be shared. In addition, the new buffer interface will +to be shared. In addition, the new buffer interface will allow the sharing of any multi-dimensional nature of the -memory and what data-format the memory contains. +memory and what data-format the memory contains. -This interface will allow any extension module to either +This interface will allow any extension module to either create objects that share memory or create algorithms that -use and manipulate raw memory from arbitrary objects that -export the interface. +use and manipulate raw memory from arbitrary objects that +export the interface. Rationale @@ -39,7 +39,7 @@ has issues: 1. There is the little used "sequence-of-segments" option - (bf_getsegcount) that is not well motivated. + (bf_getsegcount) that is not well motivated. 2. There is the apparently redundant character-buffer option (bf_getcharbuffer) @@ -62,36 +62,36 @@ Libraries, ctypes, NumPy, data-base interfaces, etc.) 6. There is no way to share discontiguous memory (except through - the sequence of segments notion). + the sequence of segments notion). There are two widely used libraries that use the concept of discontiguous memory: PIL and NumPy. Their view of discontiguous arrays is different, though. The proposed buffer interface allows - sharing of either memory model. Exporters will use only one - approach and consumers may choose to support discontiguous - arrays of each type however they choose. + sharing of either memory model. Exporters will use only one + approach and consumers may choose to support discontiguous + arrays of each type however they choose. NumPy uses the notion of constant striding in each dimension as its basic concept of an array. With this concept, a simple sub-region - of a larger array can be described without copying the data. + of a larger array can be described without copying the data. Thus, stride information is the additional information that must be - shared. + shared. The PIL uses a more opaque memory representation. Sometimes an image is contained in a contiguous segment of memory, but sometimes it is contained in an array of pointers to the contiguous segments (usually lines) of the image. The PIL is where the idea of multiple - buffer segments in the original buffer interface came from. + buffer segments in the original buffer interface came from. NumPy's strided memory model is used more often in computational libraries and because it is so simple it makes sense to support - memory sharing using this model. The PIL memory model is sometimes + memory sharing using this model. The PIL memory model is sometimes used in C-code where a 2-d array can be then accessed using double - pointer indirection: e.g. image[i][j]. + pointer indirection: e.g. image[i][j]. The buffer interface should allow the object to export either of these memory models. Consumers are free to either require contiguous memory - or write code to handle one or both of these memory models. + or write code to handle one or both of these memory models. Proposal Overview ================= @@ -102,7 +102,7 @@ * Unify the read/write versions of getting the buffer. * Add a new function to the interface that should be called when - the consumer object is "done" with the memory area. + the consumer object is "done" with the memory area. * Add a new variable to allow the interface to describe what is in memory (unifying what is currently done now in struct and @@ -112,8 +112,8 @@ * Add a new variable for sharing stride information -* Add a new mechanism for sharing arrays that must - be accessed using pointer indirection. +* Add a new mechanism for sharing arrays that must + be accessed using pointer indirection. * Fix all objects in the core and the standard library to conform to the new interface @@ -121,10 +121,10 @@ * Extend the struct module to handle more format specifiers * Extend the buffer object into a new memory object which places - a Python veneer around the buffer interface. + a Python veneer around the buffer interface. * Add a few functions to make it easy to copy contiguous data - in and out of object supporting the buffer interface. + in and out of object supporting the buffer interface. Specification ============= @@ -151,7 +151,7 @@ :: - typedef int (*getbufferproc)(PyObject *obj, PyBuffer *view, int flags) + typedef int (*getbufferproc)(PyObject *obj, PyBuffer *view, int flags) This function returns 0 on success and -1 on failure (and raises an error). The first variable is the "exporting" object. The second @@ -167,29 +167,29 @@ The exporter can use this information to simplify how much of the PyBuffer structure is filled in and/or raise an error if the object can't support -a simpler view of its memory. +a simpler view of its memory. Thus, the caller can request a simple "view" and either receive it or have an error raised if it is not possible. All of the following assume that at least buf, len, and readonly -will always be utilized by the caller. +will always be utilized by the caller. -Py_BUF_SIMPLE +Py_BUF_SIMPLE The returned buffer will be assumed to be readable (the object may or may not have writeable memory). Only the buf, len, and readonly variables may be accessed. The format will be assumed to be unsigned bytes . This is a "stand-alone" flag constant. It never - needs to be |'d to the others. The exporter will raise an - error if it cannot provide such a contiguous buffer. + needs to be \|'d to the others. The exporter will raise an + error if it cannot provide such a contiguous buffer. Py_BUF_WRITEABLE The returned buffer must be writeable. If it is not writeable, then raise an error. -Py_BUF_READONLY +Py_BUF_READONLY The returned buffer must be readonly. If the object is already read-only or it can make its memory read-only (and there are no @@ -198,32 +198,32 @@ (or cannot make it read-only), then an error should be raised. Py_BUF_FORMAT - - The returned buffer must have true format information. This would + + The returned buffer must have true format information. This would be used when the consumer is going to be checking for what 'kind' of data is actually stored. An exporter should always be able - to provide this information if requested. + to provide this information if requested. -Py_BUF_SHAPE +Py_BUF_SHAPE The returned buffer must have shape information. The memory will be assumed C-style contiguous (last dimension varies the fastest). - The exporter may raise an error if it cannot provide this kind - of contiguous buffer. - -Py_BUF_STRIDES (implies Py_BUF_SHAPE) + The exporter may raise an error if it cannot provide this kind + of contiguous buffer. +Py_BUF_STRIDES (implies Py_BUF_SHAPE) + The returned buffer must have strides information. This would be - used when the consumer can handle strided, discontiguous arrays. - Handling strides automatically assumes you can handle shape. + used when the consumer can handle strided, discontiguous arrays. + Handling strides automatically assumes you can handle shape. The exporter may raise an error if cannot provide a strided-only - representation of the data (i.e. without the suboffsets). + representation of the data (i.e. without the suboffsets). Py_BUF_OFFSETS (implies Py_BUF_STRIDES) The returned buffer must have suboffsets information. This would be used when the consumer can handle indirect array referencing - implied by these suboffsets. + implied by these suboffsets. Py_BUF_FULL (Py_BUF_OFFSETS | Py_BUF_WRITEABLE | Py_BUF_FORMAT) @@ -232,7 +232,7 @@ how to make use of the most complicated cases could use Py_BUF_INDIRECT. If format information is going to be probed, then Py_BUF_FORMAT must -be |'d to the flags otherwise the consumer assumes it is unsigned +be \|'d to the flags otherwise the consumer assumes it is unsigned bytes. There is a C-API that simple exporting objects can use to fill-in the @@ -268,7 +268,7 @@ buf a pointer to the start of the memory for the object -len +len the total bytes of memory the object uses. This should be the same as the product of the shape array multiplied by the number of bytes per item of memory. @@ -278,7 +278,7 @@ readonly. 1 means the memory is readonly, zero means the memory is writeable. -format +format a NULL-terminated format-string (following the struct-style syntax including extensions) indicating what is in each element of memory. The number of elements is len / itemsize, where itemsize @@ -287,7 +287,7 @@ ndims a variable storing the number of dimensions the memory represents. - Must be >=0. + Must be >=0. shape an array of ``Py_ssize_t`` of length ``ndims`` indicating the @@ -295,7 +295,7 @@ ... * (*shape)[ndims-1])*itemsize = len``. If ndims is 0 (indicating a scalar), then this must be NULL. -strides +strides address of a ``Py_ssize_t*`` variable that will be filled with a pointer to an array of ``Py_ssize_t`` of length ``ndims`` (or NULL if ndims is 0). indicating the number of bytes to skip to get to @@ -314,7 +314,7 @@ indicated dimension is a pointer and the suboffset value dictates how many bytes to add to the pointer after de-referencing. A suboffset value that it negative indicates that no de-referencing - should occur (striding in a contiguous memory block). If all + should occur (striding in a contiguous memory block). If all suboffsets are negative (i.e. no de-referencing is needed, then this must be NULL. @@ -339,22 +339,22 @@ Thus slicing in the ith dimension would add to the suboffsets in the (i-1)st dimension. Slicing in the first dimension would change the location of the starting pointer directly (i.e. buf would - be modified). + be modified). itemsize This is a storage for the itemsize of each element of the shared memory. It can be obtained using PyBuffer_SizeFromFormat but an exporter may know it without making this call and thus storing it - is more convenient and faster. + is more convenient and faster. internal This is for use internally by the exporting object. For example, - this might be re-cast as an integer by the exporter and used to + this might be re-cast as an integer by the exporter and used to store flags about whether or not the shape, strides, and suboffsets arrays must be freed when the buffer is released. The consumer - should never touch this value. - + should never touch this value. + The exporter is responsible for making sure the memory pointed to by buf, format, shape, strides, and suboffsets is valid until releasebuffer is called. If the exporter wants to be able to change @@ -366,7 +366,7 @@ The same bufferinfo struct should be used in the release-buffer interface call. The caller is responsible for the memory of the -bufferinfo structure itself. +bufferinfo structure itself. ``typedef int (*releasebufferproc)(PyObject *obj, PyBuffer *view)`` Callers of getbufferproc must make sure that this function is @@ -378,8 +378,8 @@ Both of these routines are optional for a type object If the releasebuffer function is not provided then it does not ever - need to be called. - + need to be called. + Exporters will need to define a releasebuffer function if they can re-allocate their memory, strides, shape, suboffsets, or format variables which they might share through the struct bufferinfo. @@ -387,7 +387,7 @@ calls have been made and shared. Either a single variable could be used to keep track of how many "views" have been exported, or a linked-list of bufferinfo structures filled in could be maintained in -each object. +each object. All that is specifically required by the exporter, however, is to ensure that any memory shared through the bufferinfo structure remains @@ -405,8 +405,8 @@ :: - int PyObject_GetBuffer(PyObject *obj, PyBuffer *view, - int flags) + int PyObject_GetBuffer(PyObject *obj, PyBuffer *view, + int flags) This is a C-API version of the getbuffer function call. It checks to make sure object has the required function pointer and issues the @@ -414,6 +414,7 @@ success. :: + int PyObject_ReleaseBuffer(PyObject *obj, PyBuffer *view) This is a C-API version of the releasebuffer function call. It checks @@ -435,7 +436,7 @@ typedef struct { PyObject_HEAD - PyObject *base; + PyObject *base; int ndims; Py_ssize_t *starts; /* slice starts */ Py_ssize_t *stops; /* slice stops */ @@ -444,12 +445,12 @@ This is functionally similar to the current buffer object except only a reference to base is kept. The actual memory for base must be -re-grabbed using the buffer-protocol, whenever it is needed. +re-grabbed using the buffer-protocol, whenever it is needed. The getbuffer and releasebuffer for this object use the underlying base object (adjusted using the slice information). If the number of dimensions of the base object (or the strides or the size) has changed -when a new view is requested, then the getbuffer will trigger an error. +when a new view is requested, then the getbuffer will trigger an error. This memory-view object will support mult-dimensional slicing. Slices of the memory-view object are other memory-view objects. When an @@ -478,9 +479,9 @@ the fastest in the buffer. If fortran is 'C', then the last dimension will vary the fastest (C-style contiguous). If fortran is 'A', then it does not matter and you will get whatever the object decides is more -efficient. +efficient. -:: +:: int PyObject_CopyToObject(PyObject *obj, void *buf, Py_ssize_t len, char fortran) @@ -509,7 +510,7 @@ These last three C-API calls allow a standard way of getting data in and out of Python objects into contiguous memory areas no matter how it is actually stored. These calls use the extended buffer interface to perform -their work. +their work. :: @@ -521,7 +522,7 @@ :: void PyBuffer_FillContiguousStrides(int *ndims, Py_ssize_t *shape, - int itemsize, + int itemsize, Py_ssize_t *strides, char fortran) Fill the strides array with byte-strides of a contiguous (C-style if @@ -529,13 +530,14 @@ shape with the given number of bytes per element. :: - int PyBuffer_FillInfo(PyBuffer *view, void *buf, + + int PyBuffer_FillInfo(PyBuffer *view, void *buf, Py_ssize_t len, int readonly, int infoflags) Fills in a buffer-info structure correctly for an exporter that can only share a contiguous chunk of memory of "unsigned bytes" of the given length. Returns 0 on success and -1 (with raising an error) on -error. +error. Additions to the struct string-syntax @@ -543,7 +545,7 @@ The struct string-syntax is missing some characters to fully implement data-format descriptions already available elsewhere (in -ctypes and NumPy for example). The Python 2.5 specification is +ctypes and NumPy for example). The Python 2.5 specification is at http://docs.python.org/lib/module-struct.html Here are the proposed additions: @@ -554,19 +556,19 @@ ================ =========== 't' bit (number before states how many bits) '?' platform _Bool type -'g' long double -'c' ucs-1 (latin-1) encoding -'u' ucs-2 -'w' ucs-4 -'O' pointer to Python Object +'g' long double +'c' ucs-1 (latin-1) encoding +'u' ucs-2 +'w' ucs-4 +'O' pointer to Python Object 'Z' complex (whatever the next specifier is) -'&' specific pointer (prefix before another charater) -'T{}' structure (detailed layout inside {}) -'(k1,k2,...,kn)' multi-dimensional array of whatever follows -':name:' optional name of the preceeding element -'X{}' pointer to a function (optional function +'&' specific pointer (prefix before another charater) +'T{}' structure (detailed layout inside {}) +'(k1,k2,...,kn)' multi-dimensional array of whatever follows +':name:' optional name of the preceeding element +'X{}' pointer to a function (optional function signature inside {}) -' \n\t' ignored (allow better readability) +' \n\t' ignored (allow better readability) -- this may already be true ================ =========== @@ -588,7 +590,7 @@ previously-specified endian string is in force until changed. The default endian is '@' which means native data-types and alignment. If un-aligned, native data-types are requested, then the endian -specification is '^'. +specification is '^'. According to the struct-module, a number can preceed a character code to specify how many of that type there are. The @@ -603,7 +605,7 @@ ==================================== Here are some examples of C-structures and how they would be -represented using the struct-style syntax. +represented using the struct-style syntax. is the constructor for a named-tuple (not-specified yet). @@ -614,7 +616,7 @@ RGB Pixel data 'BBB' <--> (int, int, int) 'B:r: B:g: B:b:' <--> ((int, int, int), ('r','g','b')) - + Mixed endian (weird but possible) '>i:big: ((int, int), ('big', 'little')) @@ -629,10 +631,10 @@ unsigned char cval; } sub; } - """i:ival: + """i:ival: T{ - H:sval: - B:bval: + H:sval: + B:bval: B:cval: }:sub: """ @@ -643,7 +645,7 @@ int ival; double data[16*4]; } - """i:ival: + """i:ival: (16,4)d:data: """ @@ -662,7 +664,7 @@ * mmap module * ctypes module -Anything else using the buffer API. +Anything else using the buffer API. Issues and Details @@ -692,9 +694,9 @@ Memory management of the format string, the shape array, the strides array, and the suboffsets array in the bufferinfo structure is always the responsibility of the exporting object. The consumer should not -set these pointers to any other memory or try to free them. +set these pointers to any other memory or try to free them. -Several ideas were discussed and rejected: +Several ideas were discussed and rejected: Having a "releaser" object whose release-buffer was called. This was deemed unacceptable because it caused the protocol to be @@ -706,7 +708,7 @@ This had the advantage that it allowed one to set NULL to variables that were not of interest, but it also made the function call more difficult. The flags variable allows the same - ability of consumers to be "simple" in how they call the protocol. + ability of consumers to be "simple" in how they call the protocol. Code ======== @@ -723,7 +725,7 @@ Ex. 1 ----------- -This example shows how an image object that uses contiguous lines might expose its buffer.:: +This example shows how an image object that uses contiguous lines might expose its buffer. :: @@ -749,8 +751,6 @@ So what does ImageObject's getbuffer do? Leaving error checking out:: -:: - int Image_getbuffer(PyObject *self, PyBuffer *view, int flags) { static Py_ssize_t suboffsets[2] = { -1, 0 }; @@ -762,7 +762,7 @@ self->shape_array[0] = height; self->shape_array[1] = width; view->shape = &self->shape_array; - self->stride_array[0] = sizeof(struct rgba*); + self->stride_array[0] = sizeof(struct rgba*); self->stride_array[1] = sizeof(struct rgba); view->strides = &self->stride_array; view->suboffsets = suboffsets; @@ -770,7 +770,7 @@ self->view_count ++; return 0; - } + } int Image_releasebuffer(PyObject *self, PyBuffer *view) { @@ -793,17 +793,16 @@ void *buf; Py_ssize_t len; int readonly=0; - + buf = /* Point to buffer */ len = /* Set to size of buffer */ readonly = /* Set to 1 if readonly */ - - return PyObject_FillBufferInfo(view, buf, len, readonly, flags); + + return PyObject_FillBufferInfo(view, buf, len, readonly, flags); } -/* No releasebuffer is necessary because the memory will never -be re-allocated so the locking mechanism is not needed -*/ +No releasebuffer is necessary because the memory will never +be re-allocated so the locking mechanism is not needed. Ex. 3 ----------- @@ -815,7 +814,7 @@ PyBuffer view; int ret; - + if (PyObject_GetBuffer(obj, &view, Py_BUF_SIMPLE) < 0) { /* error return */ } @@ -824,15 +823,15 @@ view.len is the length view.readonly is whether or not the memory is read-only. */ - + /* After using the information and you don't need it anymore */ - + if (PyObject_ReleaseBuffer(obj, &view) < 0) { /* error return */ } - + Ex. 4 ----------- @@ -851,21 +850,20 @@ /* process memory pointed to by buffer if format is correct */ - /* Optional: - + /* Optional: + if, after processing, we want to copy data from buffer back - into the the object - + into the the object + we could do */ if (PyObject_CopyToObject(obj, buf, len, 0) < 0) { /* error return */ } - + Copyright ========= This PEP is placed in the public domain - Modified: branches/numpy.scons/numpy/doc/records.txt =================================================================== --- branches/numpy.scons/numpy/doc/records.txt 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/doc/records.txt 2007-11-13 13:51:35 UTC (rev 4451) @@ -1,86 +1,87 @@ -The ndarray supports records intrinsically. -None of the default descriptors have fields defined, but you can create new -descriptors easily. The ndarray even supports nested arrays of records inside -of a record. Any record that the array protocol can describe can be represented. -The ndarray also supports partial field descriptors. Not every byte has to be -accounted for. +The ndarray supports records intrinsically. None of the default +descriptors have fields defined, but you can create new descriptors +easily. The ndarray even supports nested arrays of records inside of +a record. Any record that the array protocol can describe can be +represented. The ndarray also supports partial field descriptors. +Not every byte has to be accounted for. -This was done by adding to the established PyArray_Descr * structure: +This was done by adding to the established ``PyArray_Descr *`` structure: -1) a PyObject *fields member which contains a dictionary of -"field name" : (PyArray_Descr *field-type, offset, [optional field title]). -If a title is given, then it is also inserted into the dictionary and used to -key the same entry. +1. A PyObject ``*fields`` member which contains a dictionary of "field + name" : (``PyArray_Descr`` ``*field-type``, ``offset``, [optional field + title]). If a title is given, then it is also inserted into the + dictionary and used to key the same entry. -2) A byteorder member. By default this is '=' (native), or '|' (not-applicable). +2. A byteorder member. By default this is '=' (native), or '|' + (not-applicable). -3) An additional PyArray_ArrDescr *member of the structure which -contains a simple representation of an array of another base-type. -types. The PyArray_ArrayDescr structure has members PyArray_Descr *, -PyObject *, for holding a reference to the base-type and the shape of -the sub-array. +3. An additional ``PyArray_ArrDescr`` ``*member`` of the structure which + contains a simple representation of an array of another base-type. + types. The ``PyArray_ArrayDescr`` structure has members + ``PyArray_Descr *``, ``PyObject *``, for holding a reference to + the base-type and the shape of the sub-array. -4) The PyArray_Descr * as official Python object that fully describes -a region of memory for the data +4. The ``PyArray_Descr *`` as official Python object that fully describes + a region of memory for the data - -Data type conversions: We can support additional data-type -conversions. The data-type passed in is converted to a PyArray_Descr* -object. +Data type conversions +--------------------- + +We can support additional data-type +conversions. The data-type passed in is converted to a +``PyArray_Descr *`` object. + New possibilities for the "data-type" +````````````````````````````````````` -List [data-type 1, data-type 2, ..., data-type n] -=============================== -Equivalent to {'names':['f1','f2',...,'fn'], +**List [data-type 1, data-type 2, ..., data-type n]** + Equivalent to {'names':['f1','f2',...,'fn'], 'formats': [data-type 1, data-type 2, ..., data-type n]} -This is a quick way to specify a record format with default field names. + This is a quick way to specify a record format with default field names. -Tuple (flexible type, itemsize) - (fixed type, shape) -=============================== +**Tuple (flexible type, itemsize) (fixed type, shape)** + Get converted to a new ``PyArray_Descr *`` object with a flexible + type. The latter structure also sets the ``PyArray_ArrayDescr`` field of the + returned ``PyArray_Descr *``. -Get converted to a new PyArray_Descr * object with a flexible -type. The latter structure also sets the PyArray_ArrayDescr field of the -returned PyArray_Descr *. +**Dictionary (keys "names", "titles", and "formats")** + This will be converted to a ``PyArray_VOID`` type with corresponding + fields parameter (the formats list will be converted to actual + ``PyArray_Descr *`` objects). -Dictionary (keys "names", "titles", and "formats") -=============================== -This will be converted to a PyArray_VOID type with corresponding -fields parameter (the formats list will be converted to actual -PyArray_Descr * objects). +**Objects (anything with an .itemsize and .fields attribute)** + If its an instance of (a sub-class of) void type, then a new + ``PyArray_Descr*`` structure is created corresponding to its + typeobject (and ``PyArray_VOID``) typenumber. If the type is + registered, then the registered type-number is used. + Otherwise a new ``PyArray_VOID PyArray_Descr*`` structure is created + and filled ->elsize and ->fields filled in appropriately. -Objects (anything with an .itemsize and .fields attribute) -=============================== + The itemsize attribute must return a number > 0. The fields + attribute must return a dictionary with at least "names" and + "formats" entries. The "formats" entry will be converted to a + "proper" descr->fields entry (all generic data-types converted to + ``PyArray_Descr *`` structure). -If its an instance of (a sub-class of) void type, then a new -PyArray_Descr* structure is created corresponding to its typeobject -(and PyArray_VOID) typenumber. If the type is registered, then the -registered type-number is used. -otherwise a new PyArray_VOID PyArray_Descr* structure is created and -filled ->elsize and ->fields filled in appropriately. +Reference counting for ``PyArray_Descr *`` objects. +``````````````````````````````````````````````````` -The itemsize attribute must return a number > 0 -The fields attribute must return a dictionary with at least -"names" and "formats" entries. The "formats" entry will be -converted to a "proper" descr->fields entry (all generic data-types -converted to PyArray_Descr * structure). +Most functions that take ``PyArary_Descr *`` as arguments and return a +``PyObject *`` steal the reference unless otherwise noted in the code: +Functions that return ``PyArray_Descr *`` objects return a new +reference. -Reference counting for PyArray_Descr * objects. +.. tip:: -Most functions that take PyArary_Descr * as arguments and return a PyObject * -steal the reference unless otherwise noted in the code: + There is a new function and a new method of array objects both labelled + dtypescr which can be used to try out the ``PyArray_DescrConverter``. -Functions that return PyArray_Descr * objects return a new reference. - -There is a new function and a new method of array objects both labelled -dtypescr which can be used to try out the PyArray_DescrConverter. - Modified: branches/numpy.scons/numpy/doc/ufuncs.txt =================================================================== --- branches/numpy.scons/numpy/doc/ufuncs.txt 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/doc/ufuncs.txt 2007-11-13 13:51:35 UTC (rev 4451) @@ -1,18 +1,20 @@ +BUFFERED General Ufunc explanation +================================== -BUFFERED General Ufunc explanation: +.. note:: -Note: This was implemented already, but the notes are kept here for historical - and explanatory purposes. + This was implemented already, but the notes are kept here for historical + and explanatory purposes. We need to optimize the section of ufunc code that handles mixed-type and misbehaved arrays. In particular, we need to fix it so that items -are not copied into the buffer if they don't have to be. +are not copied into the buffer if they don't have to be. Right now, all data is copied into the buffers (even scalars are copied -multiple times into the buffers even if they are not going to be cast). +multiple times into the buffers even if they are not going to be cast). -Some benchmarks show that this results in a significant slow-down -(factor of 4) over similar numarray code. +Some benchmarks show that this results in a significant slow-down +(factor of 4) over similar numarray code. The approach is therefore, to loop over the largest-dimension (just like the NO_BUFFER) portion of the code. All arrays will either have N or @@ -31,31 +33,31 @@ If N > B, then we have to do the above operation in a loop (with an extra loop at the end with a different buffer size). -Both of these cases are handled with the following code: +Both of these cases are handled with the following code:: -Compute N = quotient * B + remainder. - quotient = N / B # integer math - (store quotient + 1) as the number of innerloops + Compute N = quotient * B + remainder. + quotient = N / B # integer math + (store quotient + 1) as the number of innerloops remainder = N % B # integer remainder -On the inner-dimension we will have (quotient + 1) loops where +On the inner-dimension we will have (quotient + 1) loops where the size of the inner function is B for all but the last when the niter size is -remainder. +remainder. -So, the code looks very similar to NOBUFFER_LOOP except the inner loop is -replaced with... +So, the code looks very similar to NOBUFFER_LOOP except the inner loop is +replaced with:: -for(k=0; iobj gets set to 1. Then there are two cases: 1) The loop function is an object loop: - - Inputs: + + Inputs: - castbuf starts as NULL and then gets filled with new references. - function gets called and doesn't alter the reference count in castbuf - on the next iteration (next value of k), the casting function will DECREF what is present in castbuf already and place a new object. - + - At the end of the inner loop (for loop over k), the final new-references in castbuf must be DECREF'd. If its a scalar then a single DECREF suffices - Otherwise, "bufsize" DECREF's are needed (unless there was only one + Otherwise, "bufsize" DECREF's are needed (unless there was only one loop, then "remainder" DECREF's are needed). - Outputs: + Outputs: - castbuf contains a new reference as the result of the function call. This gets converted to the type of interest and. This new reference in castbuf will be DECREF'd by later calls to the function. Thus, only after the @@ -89,13 +91,13 @@ reference. This reference is then used but not altered by the cast call. Nothing needs to be done. - Outputs: - - - The buffer[i] memory receives the PyObject input after the cast. This is - a new reference which will be "stolen" as it is copied over into memory. + Outputs: + + - The buffer[i] memory receives the PyObject input after the cast. This is + a new reference which will be "stolen" as it is copied over into memory. The only problem is that what is presently in memory must be DECREF'd first. - - + + Modified: branches/numpy.scons/numpy/f2py/auxfuncs.py =================================================================== --- branches/numpy.scons/numpy/f2py/auxfuncs.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/f2py/auxfuncs.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -19,7 +19,10 @@ f2py_version = __version__.version import pprint -import sys,string,time,types,os +import sys +import time +import types +import os import cfuncs @@ -254,13 +257,13 @@ for i in range(len(f)): l='%s,f%d=f[%d]'%(l,i,i) l2.append('f%d(v)'%(i)) - return eval('%s:%s'%(l,string.join(l2,' and '))) + return eval('%s:%s'%(l,' and '.join(l2))) def l_or(*f): l,l2='lambda v',[] for i in range(len(f)): l='%s,f%d=f[%d]'%(l,i,i) l2.append('f%d(v)'%(i)) - return eval('%s:%s'%(l,string.join(l2,' or '))) + return eval('%s:%s'%(l,' or '.join(l2))) def l_not(f): return eval('lambda v,f=f:not f(v)') @@ -340,7 +343,7 @@ arg_types2.append('size_t') arg_types.append(ctype) - proto_args = string.join(arg_types+arg_types2,',') + proto_args = ','.join(arg_types+arg_types2) if not proto_args: proto_args = 'void' #print proto_args @@ -411,9 +414,9 @@ else: sep=defaultsep if type(dict[k])==types.ListType: - str=string.replace(str,'#%s#'%(k),string.join(flatlist(dict[k]),sep)) + str=str.replace('#%s#'%(k),sep.join(flatlist(dict[k]))) else: - str=string.replace(str,'#%s#'%(k),dict[k]) + str=str.replace('#%s#'%(k),dict[k]) return str def dictappend(rd,ar): Modified: branches/numpy.scons/numpy/f2py/capi_maps.py =================================================================== --- branches/numpy.scons/numpy/f2py/capi_maps.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/f2py/capi_maps.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -16,7 +16,9 @@ import __version__ f2py_version = __version__.version -import string,copy,re,os +import copy +import re +import os from auxfuncs import * from crackfortran import markoutercomma import cb_rules @@ -170,8 +172,8 @@ f.close() for k,d1 in d.items(): for k1 in d1.keys(): - d1[string.lower(k1)] = d1[k1] - d[string.lower(k)] = d[k] + d1[k1.lower()] = d1[k1] + d[k.lower()] = d[k] for k in d.keys(): if not f2cmap_all.has_key(k): f2cmap_all[k]={} for k1 in d[k].keys(): @@ -217,8 +219,8 @@ else: errmess('getctype: function %s has no return value?!\n'%a) elif issubroutine(var): return ctype - elif var.has_key('typespec') and f2cmap_all.has_key(string.lower(var['typespec'])): - typespec = string.lower(var['typespec']) + elif var.has_key('typespec') and f2cmap_all.has_key(var['typespec'].lower()): + typespec = var['typespec'].lower() f2cmap=f2cmap_all[typespec] ctype=f2cmap[''] # default type if var.has_key('kindselector'): @@ -279,10 +281,10 @@ # if not isintent_c(var): # var['dimension'].reverse() dim=copy.copy(var['dimension']) - ret['size']=string.join(dim,'*') + ret['size']='*'.join(dim) try: ret['size']=`eval(ret['size'])` except: pass - ret['dims']=string.join(dim,',') + ret['dims']=','.join(dim) ret['rank']=`len(dim)` ret['rank*[-1]']=`len(dim)*[-1]`[1:-1] for i in range(len(dim)): # solve dim for dependecies @@ -359,13 +361,13 @@ rank=`len(dim)` sig='%s :%s %s rank-%s array(\'%s\') with bounds (%s)'%(a,init,opt,rank, c2pycode_map[ctype], - string.join(dim,',')) + ','.join(dim)) if a==out_a: sigout='%s : rank-%s array(\'%s\') with bounds (%s)'\ - %(a,rank,c2pycode_map[ctype],string.join(dim,',')) + %(a,rank,c2pycode_map[ctype],','.join(dim)) else: sigout='%s : rank-%s array(\'%s\') with bounds (%s) and %s storage'\ - %(out_a,rank,c2pycode_map[ctype],string.join(dim,','),a) + %(out_a,rank,c2pycode_map[ctype],','.join(dim),a) elif isexternal(var): ua='' if lcb_map.has_key(a) and lcb2_map.has_key(lcb_map[a]) and lcb2_map[lcb_map[a]].has_key('argname'): @@ -389,7 +391,7 @@ rank=`len(dim)` sig='%s : rank-%s array(\'%s\') with bounds (%s)'%(a,rank, c2pycode_map[ctype], - string.join(dim,',')) + ','.join(dim)) return sig def getinit(a,var): @@ -404,7 +406,7 @@ try: v = var["="] if ',' in v: - ret['init.r'],ret['init.i']=string.split(markoutercomma(v[1:-1]),'@,@') + ret['init.r'],ret['init.i']=markoutercomma(v[1:-1]).split('@,@') else: v = eval(v,{},{}) ret['init.r'],ret['init.i']=str(v.real),str(v.imag) @@ -414,7 +416,7 @@ elif isstring(var): if not init: init,showinit='""',"''" if init[0]=="'": - init='"%s"'%(string.replace(init[1:-1],'"','\\"')) + init='"%s"'%(init[1:-1].replace('"','\\"')) if init[0]=='"': showinit="'%s'"%(init[1:-1]) return init,showinit @@ -440,7 +442,7 @@ if f(var): intent_flags.append('F2PY_%s'%s) if intent_flags: #XXX: Evaluate intent_flags here. - ret['intent'] = string.join(intent_flags,'|') + ret['intent'] = '|'.join(intent_flags) else: ret['intent'] = 'F2PY_INTENT_IN' if isarray(var): ret['varrformat']='N' @@ -449,7 +451,7 @@ else: ret['varrformat']='O' ret['init'],ret['showinit']=getinit(a,var) if hasinitvalue(var) and iscomplex(var) and not isarray(var): - ret['init.r'],ret['init.i'] = string.split(markoutercomma(ret['init'][1:-1]),'@,@') + ret['init.r'],ret['init.i'] = markoutercomma(ret['init'][1:-1]).split('@,@') if isexternal(var): ret['cbnamekey']=a if lcb_map.has_key(a): @@ -491,14 +493,14 @@ if isarray(var): # if not isintent_c(var): # var['dimension'].reverse() - ddim=string.join(map(lambda x,y:'%s|%s'%(x,y),var['dimension'],dim),',') + ddim=','.join(map(lambda x,y:'%s|%s'%(x,y),var['dimension'],dim)) rl.append('dims(%s)'%ddim) # if not isintent_c(var): # var['dimension'].reverse() if isexternal(var): - ret['vardebuginfo']='debug-capi:%s=>%s:%s'%(a,ret['cbname'],string.join(rl,',')) + ret['vardebuginfo']='debug-capi:%s=>%s:%s'%(a,ret['cbname'],','.join(rl)) else: - ret['vardebuginfo']='debug-capi:%s %s=%s:%s'%(ret['ctype'],a,ret['showinit'],string.join(rl,',')) + ret['vardebuginfo']='debug-capi:%s %s=%s:%s'%(ret['ctype'],a,ret['showinit'],','.join(rl)) if isscalar(var): if cformat_map.has_key(ret['ctype']): ret['vardebugshowvalue']='debug-capi:%s=%s'%(a,cformat_map[ret['ctype']]) @@ -526,13 +528,13 @@ name = rout['name'] fname = getfortranname(rout) ret={'name':name, - 'texname':string.replace(name,'_','\\_'), - 'name_lower':string.lower(name), - 'NAME':string.upper(name), + 'texname':name.replace('_','\\_'), + 'name_lower':name.lower(), + 'NAME':name.upper(), 'begintitle':gentitle(name), 'endtitle':gentitle('end of %s'%name), 'fortranname':fname, - 'FORTRANNAME':string.upper(fname), + 'FORTRANNAME':fname.upper(), 'callstatement':getcallstatement(rout) or '', 'usercode':getusercode(rout) or '', 'usercode1':getusercode1(rout) or '', @@ -595,12 +597,12 @@ """ if ismodule(m): ret={'f90modulename':m['name'], - 'F90MODULENAME':string.upper(m['name']), - 'texf90modulename':string.replace(m['name'],'_','\\_')} + 'F90MODULENAME':m['name'].upper(), + 'texf90modulename':m['name'].replace('_','\\_')} else: ret={'modulename':m['name'], - 'MODULENAME':string.upper(m['name']), - 'texmodulename':string.replace(m['name'],'_','\\_')} + 'MODULENAME':m['name'].upper(), + 'texmodulename':m['name'].replace('_','\\_')} ret['restdoc'] = getrestdoc(m) or [] if hasnote(m): ret['note']=m['note'] Modified: branches/numpy.scons/numpy/f2py/cb_rules.py =================================================================== --- branches/numpy.scons/numpy/f2py/cb_rules.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/f2py/cb_rules.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -20,7 +20,10 @@ import pprint -import sys,string,time,types,copy +import sys +import time +import types +import copy errmess=sys.stderr.write outmess=sys.stdout.write show=pprint.pprint @@ -290,7 +293,7 @@ }, 'strarglens':{isstring:',int #varname#_cb_len'}, # untested with multiple args 'strarglens_td':{isstring:',int'}, # untested with multiple args - 'strarglens_nm':{isstring:',#varname#_cb_len'}, # untested with multiple args + 'strarglens_nm':{isstring:',#varname#_cb_len'}, # untested with multiple args }, { # Scalars 'decl':{l_not(isintent_c):'\t#ctype# #varname#=(*#varname#_cb_capi);'}, @@ -484,8 +487,8 @@ {'docsign':rd['docsign'], 'docsignopt':optargs, }) - rd['latexdocsignature']=string.replace(rd['docsignature'],'_','\\_') - rd['latexdocsignature']=string.replace(rd['latexdocsignature'],',',', ') + rd['latexdocsignature']=rd['docsignature'].replace('_','\\_') + rd['latexdocsignature']=rd['latexdocsignature'].replace(',',', ') rd['docstrsigns']=[] rd['latexdocstrsigns']=[] for k in ['docstrreq','docstropt','docstrout','docstrcbs']: Modified: branches/numpy.scons/numpy/f2py/common_rules.py =================================================================== --- branches/numpy.scons/numpy/f2py/common_rules.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/f2py/common_rules.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -19,7 +19,10 @@ f2py_version = __version__.version import pprint -import sys,string,time,types,copy +import sys +import time +import types +import copy errmess=sys.stderr.write outmess=sys.stdout.write show=pprint.pprint @@ -63,24 +66,24 @@ doc = [''] def dadd(line,s=doc): s[0] = '%s\n%s'%(s[0],line) for (name,vnames,vars) in findcommonblocks(m): - lower_name = string.lower(name) + lower_name = name.lower() hnames,inames = [],[] for n in vnames: if isintent_hide(vars[n]): hnames.append(n) else: inames.append(n) if hnames: - outmess('\t\tConstructing COMMON block support for "%s"...\n\t\t %s\n\t\t Hidden: %s\n'%(name,string.join(inames,','),string.join(hnames,','))) + outmess('\t\tConstructing COMMON block support for "%s"...\n\t\t %s\n\t\t Hidden: %s\n'%(name,','.join(inames),','.join(hnames))) else: - outmess('\t\tConstructing COMMON block support for "%s"...\n\t\t %s\n'%(name,string.join(inames,','))) + outmess('\t\tConstructing COMMON block support for "%s"...\n\t\t %s\n'%(name,','.join(inames))) fadd('subroutine f2pyinit%s(setupfunc)'%name) fadd('external setupfunc') for n in vnames: fadd(func2subr.var2fixfortran(vars,n)) if name=='_BLNK_': - fadd('common %s'%(string.join(vnames,','))) + fadd('common %s'%(','.join(vnames))) else: - fadd('common /%s/ %s'%(name,string.join(vnames,','))) - fadd('call setupfunc(%s)'%(string.join(inames,','))) + fadd('common /%s/ %s'%(name,','.join(vnames))) + fadd('call setupfunc(%s)'%(','.join(inames))) fadd('end\n') cadd('static FortranDataDef f2py_%s_def[] = {'%(name)) idims=[] @@ -90,12 +93,12 @@ dm = capi_maps.getarrdims(n,vars[n]) if dm['dims']: idims.append('(%s)'%(dm['dims'])) else: idims.append('') - dms=string.strip(dm['dims']) + dms=dm['dims'].strip() if not dms: dms='-1' cadd('\t{\"%s\",%s,{{%s}},%s},'%(n,dm['rank'],dms,at)) cadd('\t{NULL}\n};') inames1 = rmbadname(inames) - inames1_tps = string.join(map(lambda s:'char *'+s,inames1),',') + inames1_tps = ','.join(map(lambda s:'char *'+s,inames1)) cadd('static void f2py_setup_%s(%s) {'%(name,inames1_tps)) cadd('\tint i_f2py=0;') for n in inames1: @@ -106,24 +109,24 @@ else: F_FUNC='F_FUNC' cadd('extern void %s(f2pyinit%s,F2PYINIT%s)(void(*)(%s));'\ - %(F_FUNC,lower_name,string.upper(name), - string.join(['char*']*len(inames1),','))) + %(F_FUNC,lower_name,name.upper(), + ','.join(['char*']*len(inames1)))) cadd('static void f2py_init_%s(void) {'%name) cadd('\t%s(f2pyinit%s,F2PYINIT%s)(f2py_setup_%s);'\ - %(F_FUNC,lower_name,string.upper(name),name)) + %(F_FUNC,lower_name,name.upper(),name)) cadd('}\n') iadd('\tF2PyDict_SetItemString(d, \"%s\", PyFortranObject_New(f2py_%s_def,f2py_init_%s));'%(name,name,name)) - tname = string.replace(name,'_','\\_') + tname = name.replace('_','\\_') dadd('\\subsection{Common block \\texttt{%s}}\n'%(tname)) dadd('\\begin{description}') for n in inames: dadd('\\item[]{{}\\verb@%s@{}}'%(capi_maps.getarrdocsign(n,vars[n]))) if hasnote(vars[n]): note = vars[n]['note'] - if type(note) is type([]): note=string.join(note,'\n') + if type(note) is type([]): note='\n'.join(note) dadd('--- %s'%(note)) dadd('\\end{description}') - ret['docs'].append('"\t/%s/ %s\\n"'%(name,string.join(map(lambda v,d:v+d,inames,idims),','))) + ret['docs'].append('"\t/%s/ %s\\n"'%(name,','.join(map(lambda v,d:v+d,inames,idims)))) ret['commonhooks']=chooks ret['initcommonhooks']=ihooks ret['latexdoc']=doc[0] Modified: branches/numpy.scons/numpy/f2py/crackfortran.py =================================================================== --- branches/numpy.scons/numpy/f2py/crackfortran.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/f2py/crackfortran.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -15,6 +15,7 @@ __version__ = "$Revision: 1.177 $"[10:-1] import __version__ +import string f2py_version = __version__.version """ @@ -143,7 +144,13 @@ The above may be solved by creating appropriate preprocessor program, for example. """ # -import sys,string,fileinput,re,pprint,os,copy +import sys +import string +import fileinput +import re +import pprint +import os +import copy from auxfuncs import * # Global flags: @@ -222,7 +229,7 @@ def undo_rmbadname(names): return map(undo_rmbadname1,names) def getextension(name): - i=string.rfind(name,'.') + i=name.rfind('.') if i==-1: return '' if '\\' in name[i:]: return '' if '/' in name[i:]: return '' @@ -307,7 +314,7 @@ %(`currentfilename`,sourcecodeform, strictf77 and ',strict' or '')) - l=string.expandtabs(l).replace('\xa0',' ') + l=l.expandtabs().replace('\xa0',' ') while not l=='': # Get rid of newline characters if l[-1] not in "\n\r\f": break l=l[:-1] @@ -316,17 +323,17 @@ if r: l=r.group('line')+' ' # Strip comments starting with `!' rl=r.group('rest') - if string.lower(rl[:4])=='f2py': # f2py directive + if rl[:4].lower()=='f2py': # f2py directive l = l + 4*' ' r=commentline.match(rl[4:]) if r: l=l+r('line') else: l = l + rl[4:] - if string.strip(l)=='': # Skip empty line + if l.strip()=='': # Skip empty line cont=0 continue if sourcecodeform=='fix': if l[0] in ['*','c','!','C','#']: - if string.lower(l[1:5])=='f2py': # f2py directive + if l[1:5].lower()=='f2py': # f2py directive l=' '+l[5:] else: # Skip comment line cont=0 @@ -352,14 +359,14 @@ origfinalline='' else: l=' '+l[5:] # clean up line beginning from possible digits. - if localdolowercase: finalline=string.lower(ll) + if localdolowercase: finalline=ll.lower() else: finalline=ll origfinalline=ll ll=l cont=(r is not None) else: l=' '+l[5:] # clean up line beginning from possible digits. - if localdolowercase: finalline=string.lower(ll) + if localdolowercase: finalline=ll.lower() else: finalline=ll origfinalline =ll ll=l @@ -383,7 +390,7 @@ finalline='' origfinalline='' else: - if localdolowercase: finalline=string.lower(ll) + if localdolowercase: finalline=ll.lower() else: finalline=ll origfinalline =ll ll=l @@ -411,7 +418,7 @@ dowithline(finalline) l1=ll if localdolowercase: - finalline=string.lower(ll) + finalline=ll.lower() else: finalline=ll origfinalline = ll filepositiontext='Line #%d in %s:"%s"\n\t' % (fin.filelineno()-1,currentfilename,l1) @@ -482,11 +489,11 @@ def _simplifyargs(argsline): a = [] - for n in string.split(markoutercomma(argsline),'@,@'): + for n in markoutercomma(argsline).split('@,@'): for r in '(),': - n = string.replace(n,r,'_') + n = n.replace(r,'_') a.append(n) - return string.join(a,',') + return ','.join(a) crackline_re_1 = re.compile(r'\s*(?P\b[a-z]+[\w]*\b)\s*[=].*',re.I) def crackline(line,reset=0): @@ -650,7 +657,7 @@ assert not f,`f,line,l,cc` return l def unmarkouterparen(line): - r = string.replace(string.replace(line,'@(@','('),'@)@',')') + r = line.replace('@(@','(').replace('@)@',')') return r def appenddecl(decl,decl2,force=1): if not decl: decl={} @@ -706,7 +713,7 @@ previous_context = None if expectbegin and case not in ['begin','call','callfun','type'] \ and not skipemptyends and groupcounter<1: - newname=string.split(os.path.basename(currentfilename),'.')[0] + newname=os.path.basename(currentfilename).split('.')[0] outmess('analyzeline: no group yet. Creating program group with name "%s".\n'%newname) gotnextfile=0 groupcounter=groupcounter+1 @@ -734,7 +741,7 @@ outmess('analyzeline: No name/args pattern found for line.\n') previous_context = (block,name,groupcounter) - if args: args=rmbadname(map(string.strip,string.split(markoutercomma(args),'@,@'))) + if args: args=rmbadname([x.strip() for x in markoutercomma(args).split('@,@')]) else: args=[] if '' in args: while '' in args: @@ -851,7 +858,7 @@ name,args,result=_resolvenameargspattern(m.group('after')) if name is not None: if args: - args=rmbadname(map(string.strip,string.split(markoutercomma(args),'@,@'))) + args=rmbadname([x.strip() for x in markoutercomma(args).strip('@,@')]) else: args=[] assert result is None,`result` groupcache[groupcounter]['entry'][name] = args @@ -864,22 +871,22 @@ elif case in ['dimension','intent','optional','required','external','public','private','intrisic']: edecl=groupcache[groupcounter]['vars'] ll=m.group('after').strip() - i=string.find(ll,'::') + i=ll.find('::') if i<0 and case=='intent': - i=string.find(markouterparen(ll),'@)@')-2 + i=markouterparen(ll).find('@)@')-2 ll=ll[:i+1]+'::'+ll[i+1:] - i=string.find(ll,'::') + i=ll.find('::') if ll[i:]=='::' and groupcache[groupcounter].has_key('args'): outmess('All arguments will have attribute %s%s\n'%(m.group('this'),ll[:i])) - ll = ll + string.join(groupcache[groupcounter]['args'],',') + ll = ll + ','.join(groupcache[groupcounter]['args']) if i<0:i=0;pl='' - else: pl=string.strip(ll[:i]);ll=ll[i+2:] - ch = string.split(markoutercomma(pl),'@,@') + else: pl=ll[:i].strip();ll=ll[i+2:] + ch = markoutercomma(pl).split('@,@') if len(ch)>1: pl = ch[0] outmess('analyzeline: cannot handle multiple attributes without type specification. Ignoring %r.\n' % (','.join(ch[1:]))) last_name = None - for e in map(string.strip,string.split(markoutercomma(ll),'@,@')): + for e in [x.strip() for x in markoutercomma(ll).split('@,@')]: m1=namepattern.match(e) if not m1: if case in ['public','private']: k='' @@ -896,8 +903,7 @@ if _intentcallbackpattern.match(ap): if k not in groupcache[groupcounter]['args']: if groupcounter>1 and \ - string.find(groupcache[groupcounter-2]['name'], - '__user__')==-1: + '__user__' in groupcache[groupcounter-2]['name']: outmess('analyzeline: appending intent(callback) %s'\ ' to %s arguments\n' % (k,groupcache[groupcounter]['name'])) groupcache[groupcounter]['args'].append(k) @@ -923,11 +929,11 @@ previous_context = ('variable',last_name,groupcounter) elif case=='parameter': edecl=groupcache[groupcounter]['vars'] - ll=string.strip(m.group('after'))[1:-1] + ll=m.group('after').strip()[1:-1] last_name = None - for e in string.split(markoutercomma(ll),'@,@'): + for e in markoutercomma(ll).split('@,@'): try: - k,initexpr=map(string.strip,string.split(e,'=')) + k,initexpr=[x.strip() for x in e.split('=')] except: outmess('analyzeline: could not extract name,expr in parameter statement "%s" of "%s"\n'%(e,ll));continue params = get_parameters(edecl) @@ -942,7 +948,7 @@ for m in real16pattern.finditer(initexpr): tt[m.start():m.end()] = list(\ initexpr[m.start():m.end()].lower().replace('d', 'e')) - initexpr = "".join(tt) + initexpr = ''.join(tt) elif t.get('typespec')=='complex': initexpr = initexpr[1:].lower().replace('d','e').\ replace(',','+1j*(') @@ -961,7 +967,7 @@ if last_name is not None: previous_context = ('variable',last_name,groupcounter) elif case=='implicit': - if string.lower(string.strip(m.group('after')))=='none': + if m.group('after').strip().lower()=='none': groupcache[groupcounter]['implicit']=None elif m.group('after'): if groupcache[groupcounter].has_key('implicit'): @@ -970,7 +976,7 @@ if impl is None: outmess('analyzeline: Overwriting earlier "implicit none" statement.\n') impl={} - for e in string.split(markoutercomma(m.group('after')),'@,@'): + for e in markoutercomma(m.group('after')).split('@,@'): decl={} m1=re.match(r'\s*(?P.*?)\s*(\(\s*(?P[a-z-, ]+)\s*\)\s*|)\Z',e,re.I) if not m1: @@ -986,12 +992,12 @@ decl['typename']=typename for k in decl.keys(): if not decl[k]: del decl[k] - for r in string.split(markoutercomma(m1.group('after')),'@,@'): + for r in markoutercomma(m1.group('after')).split('@,@'): if '-' in r: - try: begc,endc=map(string.strip,string.split(r,'-')) + try: begc,endc=[x.strip() for x in r.split('-')] except: outmess('analyzeline: expected "-" instead of "%s" in range list of implicit statement\n'%r);continue - else: begc=endc=string.strip(r) + else: begc=endc=r.strip() if not len(begc)==len(endc)==1: outmess('analyzeline: expected "-" instead of "%s" in range list of implicit statement (2)\n'%r);continue for o in range(ord(begc),ord(endc)+1): @@ -1024,7 +1030,7 @@ vars=groupcache[groupcounter]['vars'] last_name = None for l in ll: - l=map(string.strip,l) + l=[x.strip() for x in l] if l[0][0]==',':l[0]=l[0][1:] if l[0][0]=='(': outmess('analyzeline: implied-DO list "%s" is not supported. Skipping.\n'%l[0]) @@ -1033,7 +1039,7 @@ # #outmess('analyzeline: ignoring this data statement.\n') # continue i=0;j=0;llen=len(l[1]) - for v in rmbadname(map(string.strip,string.split(markoutercomma(l[0]),'@,@'))): + for v in rmbadname([x.strip() for x in markoutercomma(l[0]).split('@,@')]): if v[0]=='(': outmess('analyzeline: implied-DO list "%s" is not supported. Skipping.\n'%v) # XXX: subsequent init expressions may get wrong values. @@ -1056,20 +1062,20 @@ if last_name is not None: previous_context = ('variable',last_name,groupcounter) elif case=='common': - line=string.strip(m.group('after')) + line=m.group('after').strip() if not line[0]=='/':line='//'+line cl=[] f=0;bn='';ol='' for c in line: if c=='/':f=f+1;continue if f>=3: - bn = string.strip(bn) + bn = bn.strip() if not bn: bn='_BLNK_' cl.append([bn,ol]) f=f-2;bn='';ol='' if f%2: bn=bn+c else: ol=ol+c - bn = string.strip(bn) + bn = bn.strip() if not bn: bn='_BLNK_' cl.append([bn,ol]) commonkey={} @@ -1080,7 +1086,7 @@ outmess('analyzeline: previously defined common block encountered. Skipping.\n') continue commonkey[c[0]]=[] - for i in map(string.strip,string.split(markoutercomma(c[1]),'@,@')): + for i in [x.strip() for x in markoutercomma(c[1]).split('@,@')]: if i: commonkey[c[0]].append(i) groupcache[groupcounter]['common']=commonkey previous_context = ('common',bn,groupcounter) @@ -1095,12 +1101,12 @@ if mm.has_key('list') and mm['list'] is not None: if mm.has_key('notonly') and mm['notonly'] is None:isonly=1 groupcache[groupcounter]['use'][name]['only']=isonly - ll=map(string.strip,string.split(mm['list'],',')) + ll=[x.strip() for x in mm['list'].split(',')] rl={} for l in ll: if '=' in l: m2=re.match(r'\A\s*(?P\b[\w]+\b)\s*=\s*>\s*(?P\b[\w]+\b)\s*\Z',l,re.I) - if m2: rl[string.strip(m2.group('local'))]=string.strip(m2.group('use')) + if m2: rl[m2.group('local').strip()]=m2.group('use').strip() else: outmess('analyzeline: Not local=>use pattern found in %s\n'%`l`) else: @@ -1151,7 +1157,7 @@ attr=None if re.match(r'double\s*complex',typespec,re.I): typespec='double complex' elif re.match(r'double\s*precision',typespec,re.I): typespec='double precision' - else: typespec=string.lower(string.strip(typespec)) + else: typespec=typespec.strip().lower() m1=selectpattern.match(markouterparen(ll)) if not m1: outmess('cracktypespec0: no kind/char_selector pattern found for line.\n') @@ -1161,9 +1167,9 @@ if typespec in ['complex','integer','logical','real','character','type']: selector=d['this'] ll=d['after'] - i=string.find(ll,'::') + i=ll.find('::') if i>=0: - attr=string.strip(ll[:i]) + attr=ll[:i].strip() ll=ll[i+2:] return typespec,selector,attr,ll ##### @@ -1173,7 +1179,7 @@ lenkindpattern=re.compile(r'\s*(kind\s*=\s*(?P.*?)\s*(@,@\s*len\s*=\s*(?P.*)|)|(len\s*=\s*|)(?P.*?)\s*(@,@\s*(kind\s*=\s*|)(?P.*)|))\s*\Z',re.I) lenarraypattern=re.compile(r'\s*(@\(@\s*(?!/)\s*(?P.*?)\s*@\)@\s*[*]\s*(?P.*?)|([*]\s*(?P.*?)|)\s*(@\(@\s*(?!/)\s*(?P.*?)\s*@\)@|))\s*(=\s*(?P.*?)|(@\(@|)/\s*(?P.*?)\s*/(@\)@|)|)\s*\Z',re.I) def removespaces(expr): - expr=string.strip(expr) + expr=expr.strip() if len(expr)<=1: return expr expr2=expr[0] for i in range(1,len(expr)-1): @@ -1203,21 +1209,21 @@ last_name = None kindselect,charselect,typename=cracktypespec(typespec,selector) if attrspec: - attrspec=map(string.strip,string.split(markoutercomma(attrspec),'@,@')) + attrspec=[x.strip() for x in markoutercomma(attrspec).split('@,@')] l = [] c = re.compile(r'(?P[a-zA-Z]+)') for a in attrspec: m = c.match(a) if m: - s = string.lower(m.group('start')) + s = m.group('start').lower() a = s + a[len(s):] l.append(a) attrspec = l - el=map(string.strip,string.split(markoutercomma(entitydecl),'@,@')) + el=[x.strip() for x in markoutercomma(entitydecl).split('@,@')] el1=[] for e in el: - for e1 in map(string.strip,string.split(markoutercomma(removespaces(markinnerspaces(e)),comma=' '),'@ @')): - if e1: el1.append(string.replace(e1,'@_@',' ')) + for e1 in [x.strip() for x in markoutercomma(removespaces(markinnerspaces(e)),comma=' ').split('@ @')]: + if e1: el1.append(e1.replace('@_@',' ')) for e in el1: m=namepattern.match(e) if not m: @@ -1430,7 +1436,7 @@ if not usedict: return param_map for usename,mapping in usedict.items(): - usename = string.lower(usename) + usename = usename.lower() if not f90modulevars.has_key(usename): continue mvars = f90modulevars[usename] @@ -1494,7 +1500,7 @@ for g in block: setmesstext(g) g=postcrack(g,tab=tab+'\t') - if g.has_key('name') and string.find(g['name'],'__user__')>=0: # sort user routines to appear first + if g.has_key('name') and '__user__' in g['name']: # sort user routines to appear first uret.append(g) else: gret.append(g) @@ -1518,7 +1524,7 @@ if block.has_key('use'): useblock=block['use'] for k in useblock.keys(): - if string.find(k,'__user__')>=0: + if '__user__' in k: userisdefined.append(k) ## if useblock[k].has_key('map'): ## for n in useblock[k]['map'].values(): @@ -1594,7 +1600,7 @@ if i>n: errmess('sortvarnames: failed to compute dependencies because' ' of cyclic dependencies between ' - +string.join(dep,', ')+'\n') + +', '.join(dep)+'\n') indep = indep + dep break else: @@ -1615,16 +1621,16 @@ if m: dims=[] if m.group('dims'): - dims=map(string.strip,string.split(markoutercomma(m.group('dims')),'@,@')) - n=string.strip(m.group('name')) + dims=[x.strip() for x in markoutercomma(m.group('dims')).split('@,@')] + n=m.group('name').strip() if block['vars'].has_key(n): if block['vars'][n].has_key('attrspec'): - block['vars'][n]['attrspec'].append('dimension(%s)'%(string.join(dims,','))) + block['vars'][n]['attrspec'].append('dimension(%s)'%(','.join(dims))) else: - block['vars'][n]['attrspec']=['dimension(%s)'%(string.join(dims,','))] + block['vars'][n]['attrspec']=['dimension(%s)'%(','.join(dims))] else: if dims: - block['vars'][n]={'attrspec':['dimension(%s)'%(string.join(dims,','))]} + block['vars'][n]={'attrspec':['dimension(%s)'%(','.join(dims))]} else: block['vars'][n]={} if n not in commonvars: commonvars.append(n) else: @@ -1657,7 +1663,7 @@ if b['block']=='interface' and not b['body']: if not b.has_key('f2pyenhancements'): continue - if string.replace(b['block'],' ','')=='pythonmodule': + if b['block'].replace(' ','')=='pythonmodule': usermodules.append(b) else: if b['block']=='module': @@ -1926,7 +1932,7 @@ for m in real16pattern.finditer(v): tt[m.start():m.end()] = list(\ v[m.start():m.end()].lower().replace('d', 'e')) - v = string.join(tt,'') + v = ''.join(tt) if iscomplex(vars[n]): if v[0]=='(' and v[-1]==')': l = markoutercomma(v[1:-1]).split('@,@') @@ -1939,7 +1945,7 @@ outmess('get_parameters: got "%s" on %s\n' % (msg,`v`)) if isstring(vars[n]) and type(params[n]) is type(0): params[n] = chr(params[n]) - nl = string.lower(n) + nl = n.lower() if nl!=n: params[nl] = params[n] else: @@ -2011,7 +2017,7 @@ if not vars[n].has_key('typespec'): if not(vars[n].has_key('attrspec') and 'external' in vars[n]['attrspec']): if implicitrules: - ln0 = string.lower(n[0]) + ln0 = n[0].lower() for k in implicitrules[ln0].keys(): if k=='typespec' and implicitrules[ln0][k]=='undefined': continue @@ -2048,39 +2054,39 @@ vars[n]['attrspec']=[] dim,intent,depend,check,note=None,None,None,None,None for a in attr: - if a[:9]=='dimension': dim=(string.strip(a[9:]))[1:-1] - elif a[:6]=='intent': intent=(string.strip(a[6:]))[1:-1] - elif a[:6]=='depend': depend=(string.strip(a[6:]))[1:-1] - elif a[:5]=='check': check=(string.strip(a[5:]))[1:-1] - elif a[:4]=='note': note=(string.strip(a[4:]))[1:-1] + if a[:9]=='dimension': dim=(a[9:].strip())[1:-1] + elif a[:6]=='intent': intent=(a[6:].strip())[1:-1] + elif a[:6]=='depend': depend=(a[6:].strip())[1:-1] + elif a[:5]=='check': check=(a[5:].strip())[1:-1] + elif a[:4]=='note': note=(a[4:].strip())[1:-1] else: vars[n]=setattrspec(vars[n],a) if intent: if not vars[n].has_key('intent'): vars[n]['intent']=[] - for c in map(string.strip,string.split(markoutercomma(intent),'@,@')): + for c in [x.strip() for x in markoutercomma(intent).split('@,@')]: if not c in vars[n]['intent']: vars[n]['intent'].append(c) intent=None if note: - note=string.replace(note,'\\n\\n','\n\n') - note=string.replace(note,'\\n ','\n') + note=note.replace('\\n\\n','\n\n') + note=note.replace('\\n ','\n') if not vars[n].has_key('note'): vars[n]['note']=[note] else: vars[n]['note'].append(note) note=None if depend is not None: if not vars[n].has_key('depend'): vars[n]['depend']=[] - for c in rmbadname(map(string.strip,string.split(markoutercomma(depend),'@,@'))): + for c in rmbadname([x.strip() for x in markoutercomma(depend).split('@,@')]): if c not in vars[n]['depend']: vars[n]['depend'].append(c) depend=None if check is not None: if not vars[n].has_key('check'): vars[n]['check']=[] - for c in map(string.strip,string.split(markoutercomma(check),'@,@')): + for c in [x.strip() for x in markoutercomma(check).split('@,@')]: if not c in vars[n]['check']: vars[n]['check'].append(c) check=None if dim and not vars[n].has_key('dimension'): vars[n]['dimension']=[] - for d in rmbadname(map(string.strip,string.split(markoutercomma(dim),'@,@'))): + for d in rmbadname([x.strip() for x in markoutercomma(dim).split('@,@')]): star = '*' if d==':': star=':' if params.has_key(d): @@ -2093,7 +2099,7 @@ if d==star: dl = [star] else: - dl=string.split(markoutercomma(d,':'),'@:@') + dl=markoutercomma(d,':').split('@:@') if len(dl)==2 and '*' in dl: # e.g. dimension(5:*) dl = ['*'] d = '*' @@ -2153,7 +2159,7 @@ if vars[d].has_key('attrspec'): for aa in vars[d]['attrspec']: if aa[:6]=='depend': - ddeps=ddeps+string.split((string.strip(aa[6:]))[1:-1],',') + ddeps += aa[6:].strip()[1:-1].split(',') if vars[d].has_key('depend'): ddeps=ddeps+vars[d]['depend'] i=i+1 @@ -2223,9 +2229,9 @@ vars[n]=appenddecl(vars[n],vars[block['result']]) if block.has_key('prefix'): pr=block['prefix']; ispure=0; isrec=1 - pr1=string.replace(pr,'pure','') + pr1=pr.replace('pure','') ispure=(not pr==pr1) - pr=string.replace(pr1,'recursive','') + pr=pr1.replace('recursive','') isrec=(not pr==pr1) m=typespattern[0].match(pr) if m: @@ -2332,7 +2338,7 @@ def determineexprtype(expr,vars,rules={}): if vars.has_key(expr): return _ensure_exprdict(vars[expr]) - expr=string.strip(expr) + expr=expr.strip() if determineexprtype_re_1.match(expr): return {'typespec':'complex'} m=determineexprtype_re_2.match(expr) @@ -2346,7 +2352,7 @@ outmess('determineexprtype: selected kind types not supported (%s)\n'%`expr`) return {'typespec':'real'} for op in ['+','-','*','/']: - for e in map(string.strip,string.split(markoutercomma(expr,comma=op),'@'+op+'@')): + for e in [x.strip() for x in markoutercomma(expr,comma=op).split('@'+op+'@')]: if vars.has_key(e): return _ensure_exprdict(vars[e]) t={} @@ -2391,7 +2397,7 @@ vars = block['vars'] al = [a for a in block['args'] if not isintent_callback(vars[a])] if block['block']=='function' or al: - args='(%s)'%string.join(al,',') + args='(%s)'%','.join(al) f2pyenhancements = '' if block.has_key('f2pyenhancements'): for k in block['f2pyenhancements'].keys(): @@ -2402,7 +2408,7 @@ if intent_lst: f2pyenhancements = '%s%sintent(%s) %s'%\ (f2pyenhancements,tab+tabchar, - string.join(intent_lst,','),name) + ','.join(intent_lst),name) use='' if block.has_key('use'): use=use2fortran(block['use'],tab+tabchar) @@ -2425,7 +2431,7 @@ entry_stmts = '' for k,i in block['entry'].items(): entry_stmts = '%s%sentry %s(%s)' \ - % (entry_stmts,tab+tabchar,k,string.join(i,',')) + % (entry_stmts,tab+tabchar,k,','.join(i)) body = body + entry_stmts if blocktype=='block data' and name=='_BLOCK_DATA_': name = '' @@ -2435,9 +2441,9 @@ ret='' for k in common.keys(): if k=='_BLNK_': - ret='%s%scommon %s'%(ret,tab,string.join(common[k],',')) + ret='%s%scommon %s'%(ret,tab,','.join(common[k])) else: - ret='%s%scommon /%s/ %s'%(ret,tab,k,string.join(common[k],',')) + ret='%s%scommon /%s/ %s'%(ret,tab,k,','.join(common[k])) return ret def use2fortran(use,tab=''): ret='' @@ -2546,23 +2552,23 @@ if l not in ['external']: attr.append(l) if attr: - vardef='%s %s'%(vardef,string.join(attr,',')) + vardef='%s %s'%(vardef,','.join(attr)) c=',' if vars[a].has_key('dimension'): # if not isintent_c(vars[a]): # vars[a]['dimension'].reverse() - vardef='%s%sdimension(%s)'%(vardef,c,string.join(vars[a]['dimension'],',')) + vardef='%s%sdimension(%s)'%(vardef,c,','.join(vars[a]['dimension'])) c=',' if vars[a].has_key('intent'): lst = true_intent_list(vars[a]) if lst: - vardef='%s%sintent(%s)'%(vardef,c,string.join(lst,',')) + vardef='%s%sintent(%s)'%(vardef,c,','.join(lst)) c=',' if vars[a].has_key('check'): - vardef='%s%scheck(%s)'%(vardef,c,string.join(vars[a]['check'],',')) + vardef='%s%scheck(%s)'%(vardef,c,','.join(vars[a]['check'])) c=',' if vars[a].has_key('depend'): - vardef='%s%sdepend(%s)'%(vardef,c,string.join(vars[a]['depend'],',')) + vardef='%s%sdepend(%s)'%(vardef,c,','.join(vars[a]['depend'])) c=',' if vars[a].has_key('='): v = vars[a]['='] Modified: branches/numpy.scons/numpy/f2py/doc/collectinput.py =================================================================== --- branches/numpy.scons/numpy/f2py/doc/collectinput.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/f2py/doc/collectinput.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -22,7 +22,11 @@ __version__ = "0.0" stdoutflag=0 -import sys,os,string,fileinput,re,commands +import sys +import os +import fileinput +import re +import commands try: fn=sys.argv[2] except: @@ -46,7 +50,7 @@ l=l[:m.end()-1] m=input.match(l) if m: - l=string.strip(l) + l=l.strip() if l[-1]=='}': l=l[:-1] i=m.end()-2 sys.stderr.write('>>>>>>') Modified: branches/numpy.scons/numpy/f2py/f2py2e.py =================================================================== --- branches/numpy.scons/numpy/f2py/f2py2e.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/f2py/f2py2e.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -18,7 +18,12 @@ import __version__ f2py_version = __version__.version -import sys,os,string,pprint,shutil,types,re +import sys +import os +import pprint +import shutil +import types +import re errmess=sys.stderr.write #outmess=sys.stdout.write show=pprint.pprint @@ -289,7 +294,7 @@ outmess('Building modules...\n') modules,mnames,isusedby=[],[],{} for i in range(len(list)): - if string.find(list[i]['name'],'__user__')>=0: + if '__user__' in list[i]['name']: cb_rules.buildcallbacks(list[i]) else: if list[i].has_key('use'): @@ -301,7 +306,7 @@ ret = {} for i in range(len(mnames)): if isusedby.has_key(mnames[i]): - outmess('\tSkipping module "%s" which is used by %s.\n'%(mnames[i],string.join(map(lambda s:'"%s"'%s,isusedby[mnames[i]]),','))) + outmess('\tSkipping module "%s" which is used by %s.\n'%(mnames[i],','.join(map(lambda s:'"%s"'%s,isusedby[mnames[i]])))) else: um=[] if modules[i].has_key('use'): @@ -341,10 +346,10 @@ if not isusedby.has_key(u): isusedby[u]=[] isusedby[u].append(postlist[i]['name']) for i in range(len(postlist)): - if postlist[i]['block']=='python module' and string.find(postlist[i]['name'],'__user__')<0: + if postlist[i]['block']=='python module' and '__user__' in postlist[i]['name']: if isusedby.has_key(postlist[i]['name']): #if not quiet: - outmess('Skipping Makefile build for module "%s" which is used by %s\n'%(postlist[i]['name'],string.join(map(lambda s:'"%s"'%s,isusedby[postlist[i]['name']]),','))) + outmess('Skipping Makefile build for module "%s" which is used by %s\n'%(postlist[i]['name'],','.join(map(lambda s:'"%s"'%s,isusedby[postlist[i]['name']])))) if options.has_key('signsfile'): if options['verbose']>1: outmess('Stopping. Edit the signature file and then run f2py on the signature file: ') @@ -375,7 +380,7 @@ ind = len(prefix) else: ind = 0 - for file in map(string.strip,files): + for file in [x.strip() for x in files]: if match(file): filtered.append(file[ind:]) else: rest.append(file) return filtered,rest @@ -485,7 +490,7 @@ using_numarray = 0 using_numeric = 0 for i in range(len(define_macros)): - name_value = string.split(define_macros[i],'=',1) + name_value = define_macros[i].split('=',1) if len(name_value)==1: name_value.append(None) if len(name_value)==2: Modified: branches/numpy.scons/numpy/f2py/f90mod_rules.py =================================================================== --- branches/numpy.scons/numpy/f2py/f90mod_rules.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/f2py/f90mod_rules.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -18,7 +18,10 @@ f2py_version='See `f2py -v`' import pprint -import sys,string,time,types,copy +import sys +import time +import types +import copy errmess=sys.stderr.write outmess=sys.stdout.write show=pprint.pprint @@ -107,7 +110,7 @@ mfargs.append(n) outmess('\t\tConstructing F90 module support for "%s"...\n'%(m['name'])) if onlyvars: - outmess('\t\t Variables: %s\n'%(string.join(onlyvars))) + outmess('\t\t Variables: %s\n'%(' '.join(onlyvars))) chooks=[''] def cadd(line,s=chooks): s[0] = '%s\n%s'%(s[0],line) ihooks=[''] @@ -118,7 +121,7 @@ dadd('\\subsection{Fortran 90/95 module \\texttt{%s}}\n'%(m['name'])) if hasnote(m): note = m['note'] - if type(note) is type([]): note=string.join(note,'\n') + if type(note) is type([]): note='\n'.join(note) dadd(note) if onlyvars: dadd('\\begin{description}') @@ -128,8 +131,8 @@ ct = capi_maps.getctype(var) at = capi_maps.c2capi_map[ct] dm = capi_maps.getarrdims(n,var) - dms = string.strip(string.replace(dm['dims'],'*','-1')) - dms = string.strip(string.replace(dms,':','-1')) + dms = dm['dims'].replace('*','-1').strip() + dms = dms.replace(':','-1').strip() if not dms: dms='-1' use_fgetdims2 = fgetdims2 if isstringarray(var): @@ -144,7 +147,7 @@ dadd('\\item[]{{}\\verb@%s@{}}'%(capi_maps.getarrdocsign(n,var))) if hasnote(var): note = var['note'] - if type(note) is type([]): note=string.join(note,'\n') + if type(note) is type([]): note='\n'.join(note) dadd('--- %s'%(note)) if isallocatable(var): fargs.append('f2py_%s_getdims_%s'%(m['name'],n)) @@ -157,7 +160,7 @@ fadd('integer flag\n') fhooks[0]=fhooks[0]+fgetdims1 dms = eval('range(1,%s+1)'%(dm['rank'])) - fadd(' allocate(d(%s))\n'%(string.join(map(lambda i:'s(%s)'%i,dms),','))) + fadd(' allocate(d(%s))\n'%(','.join(map(lambda i:'s(%s)'%i,dms)))) fhooks[0]=fhooks[0]+use_fgetdims2 fadd('end subroutine %s'%(fargs[-1])) else: @@ -197,16 +200,16 @@ iadd('\tf2py_%s_def[i_f2py++].data = %s;'%(m['name'],b['name'])) cadd('\t{NULL}\n};\n') iadd('}') - ihooks[0]='static void f2py_setup_%s(%s) {\n\tint i_f2py=0;%s'%(m['name'],string.join(sargs,','),ihooks[0]) + ihooks[0]='static void f2py_setup_%s(%s) {\n\tint i_f2py=0;%s'%(m['name'],','.join(sargs),ihooks[0]) if '_' in m['name']: F_FUNC='F_FUNC_US' else: F_FUNC='F_FUNC' iadd('extern void %s(f2pyinit%s,F2PYINIT%s)(void (*)(%s));'\ - %(F_FUNC,m['name'],string.upper(m['name']),string.join(sargsp,','))) + %(F_FUNC,m['name'],m['name'].upper(),','.join(sargsp))) iadd('static void f2py_init_%s(void) {'%(m['name'])) iadd('\t%s(f2pyinit%s,F2PYINIT%s)(f2py_setup_%s);'\ - %(F_FUNC,m['name'],string.upper(m['name']),m['name'])) + %(F_FUNC,m['name'],m['name'].upper(),m['name'])) iadd('}\n') ret['f90modhooks']=ret['f90modhooks']+chooks+ihooks ret['initf90modhooks']=['\tPyDict_SetItemString(d, "%s", PyFortranObject_New(f2py_%s_def,f2py_init_%s));'%(m['name'],m['name'],m['name'])]+ret['initf90modhooks'] @@ -217,20 +220,20 @@ for a in undo_rmbadname(mfargs): fadd('use %s, only : %s'%(m['name'],a)) if ifargs: - fadd(string.join(['interface']+ifargs)) + fadd(' '.join(['interface']+ifargs)) fadd('end interface') fadd('external f2pysetupfunc') if efargs: for a in undo_rmbadname(efargs): fadd('external %s'%(a)) - fadd('call f2pysetupfunc(%s)'%(string.join(undo_rmbadname(fargs),','))) + fadd('call f2pysetupfunc(%s)'%(','.join(undo_rmbadname(fargs)))) fadd('end subroutine f2pyinit%s\n'%(m['name'])) - dadd(string.replace(string.join(ret['latexdoc'],'\n'),r'\subsection{',r'\subsubsection{')) + dadd('\n'.join(ret['latexdoc']).replace(r'\subsection{',r'\subsubsection{')) ret['latexdoc']=[] ret['docs'].append('"\t%s --- %s"'%(m['name'], - string.join(undo_rmbadname(modobjs),','))) + ','.join(undo_rmbadname(modobjs)))) ret['routine_defs']='' ret['doc']=[] Modified: branches/numpy.scons/numpy/f2py/func2subr.py =================================================================== --- branches/numpy.scons/numpy/f2py/func2subr.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/f2py/func2subr.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -17,8 +17,12 @@ f2py_version='See `f2py -v`' -import pprint,copy -import sys,string,time,types,copy +import pprint +import copy +import sys +import time +import types +import copy errmess=sys.stderr.write outmess=sys.stdout.write show=pprint.pprint @@ -69,7 +73,7 @@ vardef='%s %s'%(vardef,fa) if vars[a].has_key('dimension'): - vardef='%s(%s)'%(vardef,string.join(vars[a]['dimension'],',')) + vardef='%s(%s)'%(vardef,','.join(vars[a]['dimension'])) return vardef def createfuncwrapper(rout,signature=0): @@ -98,12 +102,12 @@ if charselect.get('*','')=='(*)': charselect['*'] = '10' if f90mode: - sargs = string.join(args,', ') + sargs = ', '.join(args) add('subroutine f2pywrap_%s_%s (%s)'%(rout['modulename'],name,sargs)) if not signature: add('use %s, only : %s'%(rout['modulename'],fortranname)) else: - add('subroutine f2pywrap%s (%s)'%(name,string.join(args,', '))) + add('subroutine f2pywrap%s (%s)'%(name,', '.join(args))) add('external %s'%(fortranname)) #if not return_char_star: l = l + ', '+fortranname @@ -126,9 +130,9 @@ if not signature: if islogicalfunction(rout): - add('%s = .not.(.not.%s(%s))'%(newname,fortranname,string.join(args,', '))) + add('%s = .not.(.not.%s(%s))'%(newname,fortranname,', '.join(args))) else: - add('%s = %s(%s)'%(newname,fortranname,string.join(args,', '))) + add('%s = %s(%s)'%(newname,fortranname,', '.join(args))) if f90mode: add('end subroutine f2pywrap_%s_%s'%(rout['modulename'],name)) else: Modified: branches/numpy.scons/numpy/f2py/lib/extgen/base.py =================================================================== --- branches/numpy.scons/numpy/f2py/lib/extgen/base.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/f2py/lib/extgen/base.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -53,7 +53,6 @@ obj = obj.initialize(*args, **kws) # initialize from constructor arguments return obj - @property def components(self): if Component._running_generate: try: @@ -65,7 +64,8 @@ self._generate_components[Component._running_generate_id] = l = list(self._components) return l return self._components - + components = property(components) + def initialize(self, *components, **options): """ Set additional attributes, add components to instance, etc. @@ -83,24 +83,25 @@ def __repr__(self): return '%s(%s)' % (self.__class__.__name__, ', '.join([repr(c) for (c,l) in self.components])) - @property def provides(self): """ Return a code idiom name that the current class defines. - + Used in avoiding redefinitions of functions and variables. """ if self._provides is None: return '%s_%s' % (self.__class__.__name__, id(self)) return self._provides + provides = property(provides) - @staticmethod def warning(message): #raise RuntimeError('extgen:' + message) print >> sys.stderr, 'extgen:',message - @staticmethod + warning = staticmethod(warning) + def info(message): print >> sys.stderr, message + info = staticmethod(info) def __getattr__(self, attr): if attr.startswith('container_'): # convenience feature @@ -114,7 +115,6 @@ return self __iadd__ = __add__ - @staticmethod def _get_class_names(cls): if not issubclass(cls, Component): return [cls] @@ -122,7 +122,8 @@ for b in cls.__bases__: r += Component._get_class_names(b) return r - + _get_class_names = staticmethod(_get_class_names) + def add(self, component, container_label=None): """ Append component and its target container label to components list. @@ -204,7 +205,7 @@ return evaluated template strings. """ #self.finalize() - + # clean up containers self.containers = {} for n in dir(self): @@ -248,7 +249,7 @@ container = component.get_container(k) container.add(r, component.provides) else: - + self.warning('%s: no container label specified for component providing %r'\ % (self.__class__.__name__,component.provides)) component.parent = old_parent @@ -283,7 +284,7 @@ def get_container(self, name): """ Return named container. - + Rules for returning containers: (1) return local container if exists (2) return parent container if exists @@ -294,7 +295,7 @@ return self.containers[name] except KeyError: pass - + # parent container parent = self.parent while parent is not None: @@ -349,7 +350,6 @@ _registered_components_map = {} - @staticmethod def register(*components): """ Register components so that component classes can use @@ -363,8 +363,8 @@ else: d[provides] = component return + register = staticmethod(register) - @staticmethod def get(provides): """ Return predefined component with given provides property.. @@ -374,13 +374,13 @@ except KeyError: pass raise KeyError('no registered component provides %r' % (provides)) + get = staticmethod(get) - @property def numpy_version(self): import numpy return numpy.__version__ + numpy_version = property(numpy_version) - class Container(object): """ Container of a list of named strings. @@ -401,7 +401,7 @@ >>> c += c2 >>> print c "hey, hoo, bar" - + """ __metaclass__ = ComponentMetaClass @@ -435,7 +435,7 @@ self.replace_map = replace_map self.ignore_empty_content = ignore_empty_content self.skip_prefix_suffix_when_single = skip_prefix_suffix_when_single - + def __nonzero__(self): return bool(self.list) @@ -452,7 +452,7 @@ for i,l in lst: self.add(other.list[i], l) else: - self.add(other) + self.add(other) return self __iadd__ = __add__ @@ -532,12 +532,12 @@ lst = [(i,l) for (l,i) in self.label_map.items()] lst.sort() for i,l in lst: - cpy.add(mapping(other.list[i]), l) + cpy.add(mapping(other.list[i]), l) return cpy def _test(): import doctest doctest.testmod() - + if __name__ == "__main__": _test() Modified: branches/numpy.scons/numpy/f2py/lib/extgen/c_support.py =================================================================== --- branches/numpy.scons/numpy/f2py/lib/extgen/c_support.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/f2py/lib/extgen/c_support.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -177,7 +177,7 @@ %(CDeclaration)s %(CBody)s }''' - + container_options = dict( CArgument = dict(separator=', ', default='void'), CDeclaration = dict(default='', use_indent=True, ignore_empty_content=True, @@ -215,7 +215,7 @@ >>> h = CHeader('noddy.h') >>> print h.generate() #include "noddy.h" - + """ template = '#include "%(line)s"' @@ -288,6 +288,6 @@ def _test(): import doctest doctest.testmod() - + if __name__ == "__main__": _test() Modified: branches/numpy.scons/numpy/f2py/lib/extgen/py_support.py =================================================================== --- branches/numpy.scons/numpy/f2py/lib/extgen/py_support.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/f2py/lib/extgen/py_support.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -80,7 +80,7 @@ self.cdecl = PyCModuleCDeclaration(pyname) self += self.cdecl - + self.main = PyCModuleInitFunction(pyname) self += self.main map(self.add, components) @@ -93,7 +93,7 @@ def update_SetupPy(self, parent): parent.setup_py += self.evaluate(' config.add_extension(%(pyname)r, sources = ["%(extmodulesrc)s"])', extmodulesrc = self.path) - parent.init_py += 'import %s' % (self.pyname) + parent.init_py += 'import %s' % (self.pyname) def finalize(self): if self.need_numpy_support: @@ -113,7 +113,7 @@ def build(self, build_dir=None, clean_at_exit=None): """ build(build_dir=None, clean_at_exit=None) - + A convenience function to build, import, an return an extension module object. """ @@ -123,7 +123,7 @@ packagename = 'extgen_' + str(hex(int(time.time()*10000000)))[2:] build_dir = os.path.join(tempfile.gettempdir(), packagename) clean_at_exit = True - + setup = Component.SetupPy(build_dir) setup += self s,o = setup.execute('build_ext','--inplace') @@ -185,7 +185,7 @@ ) default_component_class_name = 'Line' - + def initialize(self, pyname): self.pyname = pyname return self @@ -225,8 +225,8 @@ } return; } - """ - + """ + template = '''\ %(CSpecifier)s %(CTypeSpec)s @@ -320,7 +320,7 @@ map(self.add, components) return self def update_containers(self): - self.container_OptExtArg += self.container_OptArg + self.container_ExtArg + self.container_OptExtArg += self.container_OptArg + self.container_ExtArg class PyCFunction(CFunction): @@ -329,7 +329,7 @@ >>> f = PyCFunction('foo') >>> print f.generate() static - char pyc_function_foo_doc[] = + char pyc_function_foo_doc[] = \" foo() -> None\" \"\\n\\n:Returns:\\n None\" ; @@ -366,7 +366,7 @@ template = '''\ static -char %(name)s_doc[] = +char %(name)s_doc[] = " %(FunctionSignature)s" %(Title)s %(Description)s @@ -399,7 +399,7 @@ }''' container_options = CFunction.container_options.copy() - + container_options.update(\ TMP = dict(), @@ -429,13 +429,13 @@ ReqKWList = ReqKWList.parent_container_options, OptKWList = OptKWList.parent_container_options, ExtKWList = ExtKWList.parent_container_options, - + ReqArgFmt = ReqArgFmt.parent_container_options, OptArgFmt = OptArgFmt.parent_container_options, ExtArgFmt = ExtArgFmt.parent_container_options, OptExtArgFmt = OptExtArgFmt.ExtArgFmt.parent_container_options, RetArgFmt = ExtArgFmt.parent_container_options, - + ReqArgObj = ReqArgObj.parent_container_options, OptArgObj = OptArgObj.parent_container_options, ExtArgObj = ExtArgObj.parent_container_options, @@ -443,7 +443,7 @@ FromPyObj = CCode.parent_container_options, PyObjFrom = CCode.parent_container_options, - + CleanPyObjFrom = dict(default='', reverse=True, use_indent=True, ignore_empty_content=True), CleanCBody = dict(default='', reverse=True, use_indent=True, ignore_empty_content=True), CleanFromPyObj = dict(default='', reverse=True, use_indent=True, ignore_empty_content=True), @@ -457,7 +457,7 @@ PyCArgument = 'TMP', CCode = 'CBody', ) - + def initialize(self, pyname, *components, **options): self.pyname = pyname self.title = options.pop('title', None) @@ -483,7 +483,7 @@ t = ' {"%(pyname)s", (PyCFunction)%(name)s, METH_VARARGS | METH_KEYWORDS, %(name)s_doc}' parent.cdecl.add(self.evaluate(t),'PyMethodDef') parent.cdecl.add(self.signature,'FunctionSignature') - + def update_containers(self): self.container_OptExtArg += self.container_OptArg + self.container_ExtArg self.container_OptExtArgFmt += self.container_OptArgFmt + self.container_ExtArgFmt @@ -585,7 +585,7 @@ if self.output_description is None: self.output_description = description if options: self.warning('%s unused options: %s\n' % (self.__class__.__name__, options)) - + self.name = name self.ctype = ctype = PyCTypeSpec(ctype) self += ctype @@ -613,8 +613,8 @@ self.retpycvar = name + '_pyc_r' ctype.set_titles(self) - - map(self.add, components) + + map(self.add, components) return self def __repr__(self): @@ -668,7 +668,7 @@ pass else: raise NotImplementedError('input_intent=%r' % (self.input_intent)) - + if self.output_intent=='return': parent += RetArg(self.name) parent.signature += RetArg(self.name) @@ -679,11 +679,11 @@ elif self.output_intent=='hide': pass else: - raise NotImplementedError('output_intent=%r' % (self.output_intent)) + raise NotImplementedError('output_intent=%r' % (self.output_intent)) class PyCReturn(PyCArgument): - def initialize(self, name, ctype = object, *components, **options): + def initialize(self, name, ctype = object, *components, **options): return PyCArgument(name, ctype, input_intent='hide', output_intent='return', *components, **options) class PyCTypeSpec(CTypeSpec): @@ -898,7 +898,7 @@ c_long = (None,'long', 'l', 'l', '0'), c_unsigned_long = (None,'unsigned long', 'k', 'k', '0'), c_long_long = (None,'PY_LONG_LONG', 'L', 'L', '0'), - c_unsigned_long_long = (None,'unsigned PY_LONG_LONG', 'K', 'K', '0'), + c_unsigned_long_long = (None,'unsigned PY_LONG_LONG', 'K', 'K', '0'), c_Py_ssize_t = (None,'Py_ssize_t', 'n', 'n', '0'), c_char1 = (None,'char', 'c', 'c', '"\\0"'), c_float = (None,'float', 'f', 'f', '0.0'), @@ -911,7 +911,7 @@ def initialize(self, typeobj): if isinstance(typeobj, self.__class__): return typeobj - + m = self.typeinfo_map key = None @@ -955,7 +955,7 @@ #self.add(Component.get('import_array'), 'ModuleInit') if key.startswith('numeric_'): raise NotImplementedError(self.__class__.__name__ + ': Numeric support') - + return self def finalize(self): @@ -1099,6 +1099,6 @@ def _test(): import doctest doctest.testmod() - + if __name__ == "__main__": _test() Modified: branches/numpy.scons/numpy/f2py/lib/extgen/setup_py.py =================================================================== --- branches/numpy.scons/numpy/f2py/lib/extgen/setup_py.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/f2py/lib/extgen/setup_py.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -51,7 +51,7 @@ >>> import SetupPy_doctest as mypackage >>> print mypackage.foo.__doc__ #doctest: +ELLIPSIS This module 'foo' is generated with ExtGen from NumPy version... - + """ template_setup_py_start = '''\ def configuration(parent_package='', top_path = ''): @@ -88,7 +88,7 @@ self += init_py self += setup_py - + map(self.add, components) return self @@ -115,10 +115,10 @@ self.info('leaving %r directory' % (self.path)) return r - + def _test(): import doctest doctest.testmod() - + if __name__ == "__main__": _test() Modified: branches/numpy.scons/numpy/f2py/lib/extgen/utils.py =================================================================== --- branches/numpy.scons/numpy/f2py/lib/extgen/utils.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/f2py/lib/extgen/utils.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -104,7 +104,7 @@ Line = 'Content', Code = 'Content', ) - + def initialize(self, path, *components, **options): self.path = path map(self.add, components) @@ -121,6 +121,6 @@ def _test(): import doctest doctest.testmod() - + if __name__ == "__main__": _test() Modified: branches/numpy.scons/numpy/f2py/lib/main.py =================================================================== --- branches/numpy.scons/numpy/f2py/lib/main.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/f2py/lib/main.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -418,7 +418,7 @@ '--build-clib',build_dir_clib_clib, ] temp_dirs = [build_dir_ext_temp, build_dir_clib_temp, build_dir_clib_clib] - + if fc_flags: new_sys_argv += ['config_fc'] + fc_flags sys.argv[:] = new_sys_argv @@ -492,7 +492,7 @@ if source_ext is None: reader = get_reader(source) source_ext = {'free90':'.f90','fix90':'.f90','fix77':'.f','pyf':'.pyf'}[reader.mode] - + if modulenames is None: modulenames = jobname, if os.path.isdir(tmpdir): Modified: branches/numpy.scons/numpy/f2py/lib/parser/test_Fortran2003.py =================================================================== --- branches/numpy.scons/numpy/f2py/lib/parser/test_Fortran2003.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/f2py/lib/parser/test_Fortran2003.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -7,7 +7,7 @@ ############################### SECTION 2 #################################### ############################################################################### -class test_Program(NumpyTestCase): # R201 +class TestProgram(NumpyTestCase): # R201 def check_simple(self): reader = get_reader('''\ @@ -21,7 +21,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a), 'SUBROUTINE foo\nEND SUBROUTINE foo\nSUBROUTINE bar\nEND SUBROUTINE bar') -class test_Specification_Part(NumpyTestCase): # R204 +class TestSpecificationPart(NumpyTestCase): # R204 def check_simple(self): from api import get_reader @@ -37,7 +37,7 @@ ############################### SECTION 3 #################################### ############################################################################### -class test_Name(NumpyTestCase): # R304 +class TestName(NumpyTestCase): # R304 def check_name(self): a = Name('a') @@ -55,7 +55,7 @@ ############################### SECTION 4 #################################### ############################################################################### -class test_Type_Param_Value(NumpyTestCase): # 402 +class TestTypeParamValue(NumpyTestCase): # 402 def check_type_param_value(self): cls = Type_Param_Value @@ -72,7 +72,7 @@ assert isinstance(a,Level_2_Expr),`a` assert_equal(str(a),'1 + 2') -class test_Intrinsic_Type_Spec(NumpyTestCase): # R403 +class TestIntrinsicTypeSpec(NumpyTestCase): # R403 def check_intrinsic_type_spec(self): cls = Intrinsic_Type_Spec @@ -109,7 +109,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'DOUBLE PRECISION') -class test_Kind_Selector(NumpyTestCase): # R404 +class TestKindSelector(NumpyTestCase): # R404 def check_kind_selector(self): cls = Kind_Selector @@ -126,7 +126,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'*1') -class test_Signed_Int_Literal_Constant(NumpyTestCase): # R405 +class TestSignedIntLiteralConstant(NumpyTestCase): # R405 def check_int_literal_constant(self): cls = Signed_Int_Literal_Constant @@ -152,7 +152,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'+1976354279568241_8') -class test_Int_Literal_Constant(NumpyTestCase): # R406 +class TestIntLiteralConstant(NumpyTestCase): # R406 def check_int_literal_constant(self): cls = Int_Literal_Constant @@ -178,7 +178,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'1976354279568241_8') -class test_Binary_Constant(NumpyTestCase): # R412 +class TestBinaryConstant(NumpyTestCase): # R412 def check_boz_literal_constant(self): cls = Boz_Literal_Constant @@ -188,7 +188,7 @@ assert_equal(str(a),'B"01"') assert_equal(repr(a),"%s('B\"01\"')" % (bcls.__name__)) -class test_Octal_Constant(NumpyTestCase): # R413 +class TestOctalConstant(NumpyTestCase): # R413 def check_boz_literal_constant(self): cls = Boz_Literal_Constant @@ -198,7 +198,7 @@ assert_equal(str(a),'O"017"') assert_equal(repr(a),"%s('O\"017\"')" % (ocls.__name__)) -class test_Hex_Constant(NumpyTestCase): # R414 +class TestHexConstant(NumpyTestCase): # R414 def check_boz_literal_constant(self): cls = Boz_Literal_Constant @@ -208,7 +208,7 @@ assert_equal(str(a),'Z"01A"') assert_equal(repr(a),"%s('Z\"01A\"')" % (zcls.__name__)) -class test_Signed_Real_Literal_Constant(NumpyTestCase): # R416 +class TestSignedRealLiteralConstant(NumpyTestCase): # R416 def check_signed_real_literal_constant(self): cls = Signed_Real_Literal_Constant @@ -265,7 +265,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'-10.9E-17_quad') -class test_Real_Literal_Constant(NumpyTestCase): # R417 +class TestRealLiteralConstant(NumpyTestCase): # R417 def check_real_literal_constant(self): cls = Real_Literal_Constant @@ -326,7 +326,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'0.0D+0') -class test_Char_Selector(NumpyTestCase): # R424 +class TestCharSelector(NumpyTestCase): # R424 def check_char_selector(self): cls = Char_Selector @@ -352,7 +352,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'(LEN = 2, KIND = 8)') -class test_Complex_Literal_Constant(NumpyTestCase): # R421 +class TestComplexLiteralConstant(NumpyTestCase): # R421 def check_complex_literal_constant(self): cls = Complex_Literal_Constant @@ -374,7 +374,7 @@ assert_equal(str(a),'(0., PI)') -class test_Type_Name(NumpyTestCase): # C424 +class TestTypeName(NumpyTestCase): # C424 def check_simple(self): cls = Type_Name @@ -386,7 +386,7 @@ self.assertRaises(NoMatchError,cls,'integer') self.assertRaises(NoMatchError,cls,'doubleprecision') -class test_Length_Selector(NumpyTestCase): # R425 +class TestLengthSelector(NumpyTestCase): # R425 def check_length_selector(self): cls = Length_Selector @@ -399,7 +399,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'*2') -class test_Char_Length(NumpyTestCase): # R426 +class TestCharLength(NumpyTestCase): # R426 def check_char_length(self): cls = Char_Length @@ -420,7 +420,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'(:)') -class test_Char_Literal_Constant(NumpyTestCase): # R427 +class TestCharLiteralConstant(NumpyTestCase): # R427 def check_char_literal_constant(self): cls = Char_Literal_Constant @@ -454,7 +454,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'"hey ha(ada)\t"') -class test_Logical_Literal_Constant(NumpyTestCase): # R428 +class TestLogicalLiteralConstant(NumpyTestCase): # R428 def check_logical_literal_constant(self): cls = Logical_Literal_Constant @@ -475,7 +475,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'.TRUE._HA') -class test_Derived_Type_Stmt(NumpyTestCase): # R430 +class TestDerivedTypeStmt(NumpyTestCase): # R430 def check_simple(self): cls = Derived_Type_Stmt @@ -492,7 +492,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'TYPE, PRIVATE, ABSTRACT :: a(b, c)') -class test_Type_Name(NumpyTestCase): # C423 +class TestTypeName(NumpyTestCase): # C423 def check_simple(self): cls = Type_Name @@ -501,7 +501,7 @@ assert_equal(str(a),'a') assert_equal(repr(a),"Type_Name('a')") -class test_Type_Attr_Spec(NumpyTestCase): # R431 +class TestTypeAttrSpec(NumpyTestCase): # R431 def check_simple(self): cls = Type_Attr_Spec @@ -523,7 +523,7 @@ assert_equal(str(a),'PRIVATE') -class test_End_Type_Stmt(NumpyTestCase): # R433 +class TestEndTypeStmt(NumpyTestCase): # R433 def check_simple(self): cls = End_Type_Stmt @@ -536,7 +536,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'END TYPE a') -class test_Sequence_Stmt(NumpyTestCase): # R434 +class TestSequenceStmt(NumpyTestCase): # R434 def check_simple(self): cls = Sequence_Stmt @@ -545,7 +545,7 @@ assert_equal(str(a),'SEQUENCE') assert_equal(repr(a),"Sequence_Stmt('SEQUENCE')") -class test_Type_Param_Def_Stmt(NumpyTestCase): # R435 +class TestTypeParamDefStmt(NumpyTestCase): # R435 def check_simple(self): cls = Type_Param_Def_Stmt @@ -558,7 +558,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'INTEGER*2, LEN :: a = 3, b = 2 + c') -class test_Type_Param_Decl(NumpyTestCase): # R436 +class TestTypeParamDecl(NumpyTestCase): # R436 def check_simple(self): cls = Type_Param_Decl @@ -571,7 +571,7 @@ assert isinstance(a, Name),`a` assert_equal(str(a),'a') -class test_Type_Param_Attr_Spec(NumpyTestCase): # R437 +class TestTypeParamAttrSpec(NumpyTestCase): # R437 def check_simple(self): cls = Type_Param_Attr_Spec @@ -584,7 +584,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'LEN') -class test_Component_Attr_Spec(NumpyTestCase): # R441 +class TestComponentAttrSpec(NumpyTestCase): # R441 def check_simple(self): cls = Component_Attr_Spec @@ -605,7 +605,7 @@ assert isinstance(a, Access_Spec),`a` assert_equal(str(a),'PRIVATE') -class test_Component_Decl(NumpyTestCase): # R442 +class TestComponentDecl(NumpyTestCase): # R442 def check_simple(self): cls = Component_Decl @@ -626,7 +626,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'a(1) => NULL') -class test_Final_Binding(NumpyTestCase): # R454 +class TestFinalBinding(NumpyTestCase): # R454 def check_simple(self): cls = Final_Binding @@ -639,7 +639,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'FINAL :: a') -class test_Derived_Type_Spec(NumpyTestCase): # R455 +class TestDerivedTypeSpec(NumpyTestCase): # R455 def check_simple(self): cls = Derived_Type_Spec @@ -660,7 +660,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'a()') -class test_Type_Param_Spec(NumpyTestCase): # R456 +class TestTypeParamSpec(NumpyTestCase): # R456 def check_type_param_spec(self): cls = Type_Param_Spec @@ -677,7 +677,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'k = :') -class test_Type_Param_Spec_List(NumpyTestCase): # R456-list +class TestTypeParamSpecList(NumpyTestCase): # R456-list def check_type_param_spec_list(self): cls = Type_Param_Spec_List @@ -694,7 +694,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'k = a, c, g = 1') -class test_Structure_Constructor_2(NumpyTestCase): # R457.b +class TestStructureConstructor2(NumpyTestCase): # R457.b def check_simple(self): cls = Structure_Constructor_2 @@ -707,7 +707,7 @@ assert isinstance(a,Name),`a` assert_equal(str(a),'a') -class test_Structure_Constructor(NumpyTestCase): # R457 +class TestStructureConstructor(NumpyTestCase): # R457 def check_structure_constructor(self): cls = Structure_Constructor @@ -729,7 +729,7 @@ assert isinstance(a,Name),`a` assert_equal(str(a),'a') -class test_Component_Spec(NumpyTestCase): # R458 +class TestComponentSpec(NumpyTestCase): # R458 def check_simple(self): cls = Component_Spec @@ -750,7 +750,7 @@ assert isinstance(a, Component_Spec),`a` assert_equal(str(a),'s = a % b') -class test_Component_Spec_List(NumpyTestCase): # R458-list +class TestComponentSpecList(NumpyTestCase): # R458-list def check_simple(self): cls = Component_Spec_List @@ -763,7 +763,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'k = a, c') -class test_Array_Constructor(NumpyTestCase): # R465 +class TestArrayConstructor(NumpyTestCase): # R465 def check_simple(self): cls = Array_Constructor @@ -785,7 +785,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'[INTEGER :: a, b]') -class test_Ac_Spec(NumpyTestCase): # R466 +class TestAcSpec(NumpyTestCase): # R466 def check_ac_spec(self): cls = Ac_Spec @@ -806,7 +806,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'INTEGER :: a, (a, b, n = 1, 5)') -class test_Ac_Value_List(NumpyTestCase): # R469-list +class TestAcValueList(NumpyTestCase): # R469-list def check_ac_value_list(self): cls = Ac_Value_List @@ -819,7 +819,7 @@ assert isinstance(a,Name),`a` assert_equal(str(a),'a') -class test_Ac_Implied_Do(NumpyTestCase): # R470 +class TestAcImpliedDo(NumpyTestCase): # R470 def check_ac_implied_do(self): cls = Ac_Implied_Do @@ -828,7 +828,7 @@ assert_equal(str(a),'(a, b, n = 1, 5)') assert_equal(repr(a),"Ac_Implied_Do(Ac_Value_List(',', (Name('a'), Name('b'))), Ac_Implied_Do_Control(Name('n'), [Int_Literal_Constant('1', None), Int_Literal_Constant('5', None)]))") -class test_Ac_Implied_Do_Control(NumpyTestCase): # R471 +class TestAcImpliedDoControl(NumpyTestCase): # R471 def check_ac_implied_do_control(self): cls = Ac_Implied_Do_Control @@ -845,7 +845,7 @@ ############################### SECTION 5 #################################### ############################################################################### -class test_Type_Declaration_Stmt(NumpyTestCase): # R501 +class TestTypeDeclarationStmt(NumpyTestCase): # R501 def check_simple(self): cls = Type_Declaration_Stmt @@ -869,7 +869,7 @@ a = cls('DOUBLE PRECISION ALPHA, BETA') assert isinstance(a, cls),`a` -class test_Declaration_Type_Spec(NumpyTestCase): # R502 +class TestDeclarationTypeSpec(NumpyTestCase): # R502 def check_simple(self): cls = Declaration_Type_Spec @@ -882,7 +882,7 @@ assert_equal(str(a), 'TYPE(foo)') assert_equal(repr(a), "Declaration_Type_Spec('TYPE', Type_Name('foo'))") -class test_Attr_Spec(NumpyTestCase): # R503 +class TestAttrSpec(NumpyTestCase): # R503 def check_simple(self): cls = Attr_Spec @@ -894,7 +894,7 @@ assert isinstance(a, Dimension_Attr_Spec),`a` assert_equal(str(a),'DIMENSION(a)') -class test_Dimension_Attr_Spec(NumpyTestCase): # R503.d +class TestDimensionAttrSpec(NumpyTestCase): # R503.d def check_simple(self): cls = Dimension_Attr_Spec @@ -903,7 +903,7 @@ assert_equal(str(a),'DIMENSION(a)') assert_equal(repr(a),"Dimension_Attr_Spec('DIMENSION', Explicit_Shape_Spec(None, Name('a')))") -class test_Intent_Attr_Spec(NumpyTestCase): # R503.f +class TestIntentAttrSpec(NumpyTestCase): # R503.f def check_simple(self): cls = Intent_Attr_Spec @@ -912,7 +912,7 @@ assert_equal(str(a),'INTENT(IN)') assert_equal(repr(a),"Intent_Attr_Spec('INTENT', Intent_Spec('IN'))") -class test_Entity_Decl(NumpyTestCase): # 504 +class TestEntityDecl(NumpyTestCase): # 504 def check_simple(self): cls = Entity_Decl @@ -929,7 +929,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'a(1)*(3) = 2') -class test_Access_Spec(NumpyTestCase): # R508 +class TestAccessSpec(NumpyTestCase): # R508 def check_simple(self): cls = Access_Spec @@ -942,7 +942,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'PUBLIC') -class test_Language_Binding_Spec(NumpyTestCase): # R509 +class TestLanguageBindingSpec(NumpyTestCase): # R509 def check_simple(self): cls = Language_Binding_Spec @@ -955,7 +955,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'BIND(C, NAME = "hey")') -class test_Explicit_Shape_Spec(NumpyTestCase): # R511 +class TestExplicitShapeSpec(NumpyTestCase): # R511 def check_simple(self): cls = Explicit_Shape_Spec @@ -968,7 +968,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'a') -class test_Upper_Bound(NumpyTestCase): # R513 +class TestUpperBound(NumpyTestCase): # R513 def check_simple(self): cls = Upper_Bound @@ -978,7 +978,7 @@ self.assertRaises(NoMatchError,cls,'*') -class test_Assumed_Shape_Spec(NumpyTestCase): # R514 +class TestAssumedShapeSpec(NumpyTestCase): # R514 def check_simple(self): cls = Assumed_Shape_Spec @@ -991,7 +991,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'a :') -class test_Deferred_Shape_Spec(NumpyTestCase): # R515 +class TestDeferredShapeSpec(NumpyTestCase): # R515 def check_simple(self): cls = Deferred_Shape_Spec @@ -1001,7 +1001,7 @@ assert_equal(repr(a),'Deferred_Shape_Spec(None, None)') -class test_Assumed_Size_Spec(NumpyTestCase): # R516 +class TestAssumedSizeSpec(NumpyTestCase): # R516 def check_simple(self): cls = Assumed_Size_Spec @@ -1022,7 +1022,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'a : b, 1 : *') -class test_Access_Stmt(NumpyTestCase): # R518 +class TestAccessStmt(NumpyTestCase): # R518 def check_simple(self): cls = Access_Stmt @@ -1039,7 +1039,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'PUBLIC :: a') -class test_Parameter_Stmt(NumpyTestCase): # R538 +class TestParameterStmt(NumpyTestCase): # R538 def check_simple(self): cls = Parameter_Stmt @@ -1056,7 +1056,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'PARAMETER(ONE = 1.0D+0, ZERO = 0.0D+0)') -class test_Named_Constant_Def(NumpyTestCase): # R539 +class TestNamedConstantDef(NumpyTestCase): # R539 def check_simple(self): cls = Named_Constant_Def @@ -1065,7 +1065,7 @@ assert_equal(str(a),'a = 1') assert_equal(repr(a),"Named_Constant_Def(Name('a'), Int_Literal_Constant('1', None))") -class test_Pointer_Decl(NumpyTestCase): # R541 +class TestPointerDecl(NumpyTestCase): # R541 def check_simple(self): cls = Pointer_Decl @@ -1078,7 +1078,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'a(:, :)') -class test_Implicit_Stmt(NumpyTestCase): # R549 +class TestImplicitStmt(NumpyTestCase): # R549 def check_simple(self): cls = Implicit_Stmt @@ -1091,7 +1091,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'IMPLICIT REAL(A - D), DOUBLE PRECISION(R - T, X), TYPE(a)(Y - Z)') -class test_Implicit_Spec(NumpyTestCase): # R550 +class TestImplicitSpec(NumpyTestCase): # R550 def check_simple(self): cls = Implicit_Spec @@ -1104,7 +1104,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'DOUBLE COMPLEX(R, D - G)') -class test_Letter_Spec(NumpyTestCase): # R551 +class TestLetterSpec(NumpyTestCase): # R551 def check_simple(self): cls = Letter_Spec @@ -1117,7 +1117,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'D') -class test_Equivalence_Stmt(NumpyTestCase): # R554 +class TestEquivalenceStmt(NumpyTestCase): # R554 def check_simple(self): cls = Equivalence_Stmt @@ -1130,7 +1130,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'EQUIVALENCE(a, b, z), (b, l)') -class test_Common_Stmt(NumpyTestCase): # R557 +class TestCommonStmt(NumpyTestCase): # R557 def check_simple(self): cls = Common_Stmt @@ -1151,7 +1151,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'COMMON /name/ a, b(4, 5) // c /ljuks/ g(2)') -class test_Common_Block_Object(NumpyTestCase): # R558 +class TestCommonBlockObject(NumpyTestCase): # R558 def check_simple(self): cls = Common_Block_Object @@ -1169,7 +1169,7 @@ ############################### SECTION 6 #################################### ############################################################################### -class test_Substring(NumpyTestCase): # R609 +class TestSubstring(NumpyTestCase): # R609 def check_simple(self): cls = Substring @@ -1184,7 +1184,7 @@ assert_equal(repr(a),"Substring(Name('a'), Substring_Range(Int_Literal_Constant('1', None), Int_Literal_Constant('2', None)))") -class test_Substring_Range(NumpyTestCase): # R611 +class TestSubstringRange(NumpyTestCase): # R611 def check_simple(self): cls = Substring_Range @@ -1215,7 +1215,7 @@ assert_equal(str(a),': b') -class test_Data_Ref(NumpyTestCase): # R612 +class TestDataRef(NumpyTestCase): # R612 def check_data_ref(self): cls = Data_Ref @@ -1228,7 +1228,7 @@ assert isinstance(a,Name),`a` assert_equal(str(a),'a') -class test_Part_Ref(NumpyTestCase): # R613 +class TestPartRef(NumpyTestCase): # R613 def check_part_ref(self): cls = Part_Ref @@ -1236,7 +1236,7 @@ assert isinstance(a, Name),`a` assert_equal(str(a),'a') -class test_Type_Param_Inquiry(NumpyTestCase): # R615 +class TestTypeParamInquiry(NumpyTestCase): # R615 def check_simple(self): cls = Type_Param_Inquiry @@ -1246,7 +1246,7 @@ assert_equal(repr(a),"Type_Param_Inquiry(Name('a'), '%', Name('b'))") -class test_Array_Section(NumpyTestCase): # R617 +class TestArraySection(NumpyTestCase): # R617 def check_array_section(self): cls = Array_Section @@ -1260,7 +1260,7 @@ assert_equal(str(a),'a(2 :)') -class test_Section_Subscript(NumpyTestCase): # R619 +class TestSectionSubscript(NumpyTestCase): # R619 def check_simple(self): cls = Section_Subscript @@ -1273,7 +1273,7 @@ assert isinstance(a, Name),`a` assert_equal(str(a),'zzz') -class test_Section_Subscript_List(NumpyTestCase): # R619-list +class TestSectionSubscriptList(NumpyTestCase): # R619-list def check_simple(self): cls = Section_Subscript_List @@ -1290,7 +1290,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),': : 1, 3') -class test_Subscript_Triplet(NumpyTestCase): # R620 +class TestSubscriptTriplet(NumpyTestCase): # R620 def check_simple(self): cls = Subscript_Triplet @@ -1319,7 +1319,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'a + 1 :') -class test_Alloc_Opt(NumpyTestCase): # R624 +class TestAllocOpt(NumpyTestCase): # R624 def check_simple(self): cls = Alloc_Opt @@ -1328,7 +1328,7 @@ assert_equal(str(a),'STAT = a') assert_equal(repr(a),"Alloc_Opt('STAT', Name('a'))") -class test_Nullify_Stmt(NumpyTestCase): # R633 +class TestNullifyStmt(NumpyTestCase): # R633 def check_simple(self): cls = Nullify_Stmt @@ -1345,7 +1345,7 @@ ############################### SECTION 7 #################################### ############################################################################### -class test_Primary(NumpyTestCase): # R701 +class TestPrimary(NumpyTestCase): # R701 def check_simple(self): cls = Primary @@ -1401,7 +1401,7 @@ assert isinstance(a,Real_Literal_Constant),`a` assert_equal(str(a),'0.0E-1') -class test_Parenthesis(NumpyTestCase): # R701.h +class TestParenthesis(NumpyTestCase): # R701.h def check_simple(self): cls = Parenthesis @@ -1422,7 +1422,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'(a + (a + c))') -class test_Level_1_Expr(NumpyTestCase): # R702 +class TestLevel1Expr(NumpyTestCase): # R702 def check_simple(self): cls = Level_1_Expr @@ -1433,7 +1433,7 @@ self.assertRaises(NoMatchError,cls,'.not. a') -class test_Mult_Operand(NumpyTestCase): # R704 +class TestMultOperand(NumpyTestCase): # R704 def check_simple(self): cls = Mult_Operand @@ -1454,7 +1454,7 @@ assert isinstance(a,Real_Literal_Constant),`a` assert_equal(str(a),'0.0E-1') -class test_Add_Operand(NumpyTestCase): # R705 +class TestAddOperand(NumpyTestCase): # R705 def check_simple(self): cls = Add_Operand @@ -1475,7 +1475,7 @@ assert isinstance(a,Real_Literal_Constant),`a` assert_equal(str(a),'0.0E-1') -class test_Level_2_Expr(NumpyTestCase): # R706 +class TestLevel2Expr(NumpyTestCase): # R706 def check_simple(self): cls = Level_2_Expr @@ -1509,7 +1509,7 @@ assert_equal(str(a),'0.0E-1') -class test_Level_2_Unary_Expr(NumpyTestCase): +class TestLevel2UnaryExpr(NumpyTestCase): def check_simple(self): cls = Level_2_Unary_Expr @@ -1531,7 +1531,7 @@ assert_equal(str(a),'0.0E-1') -class test_Level_3_Expr(NumpyTestCase): # R710 +class TestLevel3Expr(NumpyTestCase): # R710 def check_simple(self): cls = Level_3_Expr @@ -1544,7 +1544,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'"a" // "b"') -class test_Level_4_Expr(NumpyTestCase): # R712 +class TestLevel4Expr(NumpyTestCase): # R712 def check_simple(self): cls = Level_4_Expr @@ -1593,7 +1593,7 @@ assert isinstance(a,cls),`a` assert_equal(str(a),'a > b') -class test_And_Operand(NumpyTestCase): # R714 +class TestAndOperand(NumpyTestCase): # R714 def check_simple(self): cls = And_Operand @@ -1602,7 +1602,7 @@ assert_equal(str(a),'.NOT. a') assert_equal(repr(a),"And_Operand('.NOT.', Name('a'))") -class test_Or_Operand(NumpyTestCase): # R715 +class TestOrOperand(NumpyTestCase): # R715 def check_simple(self): cls = Or_Operand @@ -1612,7 +1612,7 @@ assert_equal(repr(a),"Or_Operand(Name('a'), '.AND.', Name('b'))") -class test_Equiv_Operand(NumpyTestCase): # R716 +class TestEquivOperand(NumpyTestCase): # R716 def check_simple(self): cls = Equiv_Operand @@ -1622,7 +1622,7 @@ assert_equal(repr(a),"Equiv_Operand(Name('a'), '.OR.', Name('b'))") -class test_Level_5_Expr(NumpyTestCase): # R717 +class TestLevel5Expr(NumpyTestCase): # R717 def check_simple(self): cls = Level_5_Expr @@ -1639,7 +1639,7 @@ assert isinstance(a,Level_4_Expr),`a` assert_equal(str(a),'a .EQ. b') -class test_Expr(NumpyTestCase): # R722 +class TestExpr(NumpyTestCase): # R722 def check_simple(self): cls = Expr @@ -1661,7 +1661,7 @@ self.assertRaises(NoMatchError,Scalar_Int_Expr,'a,b') -class test_Assignment_Stmt(NumpyTestCase): # R734 +class TestAssignmentStmt(NumpyTestCase): # R734 def check_simple(self): cls = Assignment_Stmt @@ -1678,7 +1678,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'a % c = b + c') -class test_Proc_Component_Ref(NumpyTestCase): # R741 +class TestProcComponentRef(NumpyTestCase): # R741 def check_proc_component_ref(self): cls = Proc_Component_Ref @@ -1687,7 +1687,7 @@ assert_equal(str(a),'a % b') assert_equal(repr(a),"Proc_Component_Ref(Name('a'), '%', Name('b'))") -class test_Where_Stmt(NumpyTestCase): # R743 +class TestWhereStmt(NumpyTestCase): # R743 def check_simple(self): cls = Where_Stmt @@ -1696,7 +1696,7 @@ assert_equal(str(a),'WHERE (a) c = 2') assert_equal(repr(a),"Where_Stmt(Name('a'), Assignment_Stmt(Name('c'), '=', Int_Literal_Constant('2', None)))") -class test_Where_Construct_Stmt(NumpyTestCase): # R745 +class TestWhereConstructStmt(NumpyTestCase): # R745 def check_simple(self): cls = Where_Construct_Stmt @@ -1710,7 +1710,7 @@ ############################### SECTION 8 #################################### ############################################################################### -class test_Continue_Stmt(NumpyTestCase): # R848 +class TestContinueStmt(NumpyTestCase): # R848 def check_simple(self): cls = Continue_Stmt @@ -1723,7 +1723,7 @@ ############################### SECTION 9 #################################### ############################################################################### -class test_Io_Unit(NumpyTestCase): # R901 +class TestIoUnit(NumpyTestCase): # R901 def check_simple(self): cls = Io_Unit @@ -1735,7 +1735,7 @@ assert isinstance(a, Name),`a` assert_equal(str(a),'a') -class test_Write_Stmt(NumpyTestCase): # R911 +class TestWriteStmt(NumpyTestCase): # R911 def check_simple(self): cls = Write_Stmt @@ -1744,7 +1744,7 @@ assert_equal(str(a),'WRITE(UNIT = 123) "hey"') assert_equal(repr(a),'Write_Stmt(Io_Control_Spec_List(\',\', (Io_Control_Spec(\'UNIT\', Int_Literal_Constant(\'123\', None)),)), Char_Literal_Constant(\'"hey"\', None))') -class test_Print_Stmt(NumpyTestCase): # R912 +class TestPrintStmt(NumpyTestCase): # R912 def check_simple(self): cls = Print_Stmt @@ -1757,7 +1757,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'PRINT *, "a=", a') -class test_Io_Control_Spec(NumpyTestCase): # R913 +class TestIoControlSpec(NumpyTestCase): # R913 def check_simple(self): cls = Io_Control_Spec @@ -1766,7 +1766,7 @@ assert_equal(str(a),'END = 123') assert_equal(repr(a),"Io_Control_Spec('END', Label('123'))") -class test_Io_Control_Spec_List(NumpyTestCase): # R913-list +class TestIoControlSpecList(NumpyTestCase): # R913-list def check_simple(self): cls = Io_Control_Spec_List @@ -1793,7 +1793,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'UNIT = 123, NML = a') -class test_Format(NumpyTestCase): # R914 +class TestFormat(NumpyTestCase): # R914 def check_simple(self): cls = Format @@ -1810,7 +1810,7 @@ assert isinstance(a, Label),`a` assert_equal(str(a),'123') -class test_Wait_Stmt(NumpyTestCase): # R921 +class TestWaitStmt(NumpyTestCase): # R921 def check_simple(self): cls = Wait_Stmt @@ -1818,7 +1818,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'WAIT(UNIT = 123)') -class test_Wait_Spec(NumpyTestCase): # R922 +class TestWaitSpec(NumpyTestCase): # R922 def check_simple(self): cls = Wait_Spec @@ -1840,7 +1840,7 @@ ############################### SECTION 11 #################################### ############################################################################### -class test_Use_Stmt(NumpyTestCase): # R1109 +class TestUseStmt(NumpyTestCase): # R1109 def check_simple(self): cls = Use_Stmt @@ -1861,7 +1861,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'USE, INTRINSIC :: a, OPERATOR(.HEY.) => OPERATOR(.HOO.), c => g') -class test_Module_Nature(NumpyTestCase): # R1110 +class TestModuleNature(NumpyTestCase): # R1110 def check_simple(self): cls = Module_Nature @@ -1878,7 +1878,7 @@ ############################### SECTION 12 #################################### ############################################################################### -class test_Function_Reference(NumpyTestCase): # R1217 +class TestFunctionReference(NumpyTestCase): # R1217 def check_simple(self): cls = Function_Reference @@ -1892,7 +1892,7 @@ assert_equal(str(a),'f(2, k = 1, a)') -class test_Procedure_Designator(NumpyTestCase): # R1219 +class TestProcedureDesignator(NumpyTestCase): # R1219 def check_procedure_designator(self): cls = Procedure_Designator @@ -1901,7 +1901,7 @@ assert_equal(str(a),'a % b') assert_equal(repr(a),"Procedure_Designator(Name('a'), '%', Name('b'))") -class test_Actual_Arg_Spec(NumpyTestCase): # R1220 +class TestActualArgSpec(NumpyTestCase): # R1220 def check_simple(self): cls = Actual_Arg_Spec @@ -1914,7 +1914,7 @@ assert isinstance(a,Name),`a` assert_equal(str(a),'a') -class test_Actual_Arg_Spec_List(NumpyTestCase): +class TestActualArgSpecList(NumpyTestCase): def check_simple(self): cls = Actual_Arg_Spec_List @@ -1935,7 +1935,7 @@ assert isinstance(a,Name),`a` assert_equal(str(a),'a') -class test_Alt_Return_Spec(NumpyTestCase): # R1222 +class TestAltReturnSpec(NumpyTestCase): # R1222 def check_alt_return_spec(self): cls = Alt_Return_Spec @@ -1944,7 +1944,7 @@ assert_equal(str(a),'*123') assert_equal(repr(a),"Alt_Return_Spec(Label('123'))") -class test_Prefix(NumpyTestCase): # R1227 +class TestPrefix(NumpyTestCase): # R1227 def check_simple(self): cls = Prefix @@ -1957,7 +1957,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'INTEGER*2 PURE') -class test_Prefix_Spec(NumpyTestCase): # R1228 +class TestPrefixSpec(NumpyTestCase): # R1228 def check_simple(self): cls = Prefix_Spec @@ -1978,7 +1978,7 @@ assert isinstance(a, Intrinsic_Type_Spec),`a` assert_equal(str(a),'INTEGER*2') -class test_Subroutine_Subprogram(NumpyTestCase): # R1231 +class TestSubroutineSubprogram(NumpyTestCase): # R1231 def check_simple(self): from api import get_reader @@ -2000,7 +2000,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'SUBROUTINE foo\n INTEGER :: a\nEND SUBROUTINE foo') -class test_Subroutine_Stmt(NumpyTestCase): # R1232 +class TestSubroutineStmt(NumpyTestCase): # R1232 def check_simple(self): cls = Subroutine_Stmt @@ -2021,7 +2021,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'SUBROUTINE foo BIND(C)') -class test_End_Subroutine_Stmt(NumpyTestCase): # R1234 +class TestEndSubroutineStmt(NumpyTestCase): # R1234 def check_simple(self): cls = End_Subroutine_Stmt @@ -2038,7 +2038,7 @@ assert isinstance(a, cls),`a` assert_equal(str(a),'END SUBROUTINE') -class test_Return_Stmt(NumpyTestCase): # R1236 +class TestReturnStmt(NumpyTestCase): # R1236 def check_simple(self): cls = Return_Stmt @@ -2047,7 +2047,7 @@ assert_equal(str(a), 'RETURN') assert_equal(repr(a), 'Return_Stmt(None)') -class test_Contains(NumpyTestCase): # R1237 +class TestContains(NumpyTestCase): # R1237 def check_simple(self): cls = Contains_Stmt Modified: branches/numpy.scons/numpy/f2py/lib/parser/test_parser.py =================================================================== --- branches/numpy.scons/numpy/f2py/lib/parser/test_parser.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/f2py/lib/parser/test_parser.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -34,7 +34,7 @@ return r raise ValueError, 'parsing %r with %s pattern failed' % (line, cls.__name__) -class test_Statements(NumpyTestCase): +class TestStatements(NumpyTestCase): def check_assignment(self): assert_equal(parse(Assignment,'a=b'), 'a = b') Modified: branches/numpy.scons/numpy/f2py/lib/py_wrap_type.py =================================================================== --- branches/numpy.scons/numpy/f2py/lib/py_wrap_type.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/f2py/lib/py_wrap_type.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -453,12 +453,12 @@ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ "Fortran derived type %(name)s objects", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ %(otype)s_methods, /* tp_methods */ 0 /*%(otype)s_members*/, /* tp_members */ %(otype)s_getseters, /* tp_getset */ Modified: branches/numpy.scons/numpy/f2py/lib/tests/test_derived_scalar.py =================================================================== --- branches/numpy.scons/numpy/f2py/lib/tests/test_derived_scalar.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/f2py/lib/tests/test_derived_scalar.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -42,7 +42,7 @@ from numpy import * -class test_m(NumpyTestCase): +class TestM(NumpyTestCase): def check_foo_simple(self, level=1): a = m.myt(2) Modified: branches/numpy.scons/numpy/f2py/lib/tests/test_module_module.py =================================================================== --- branches/numpy.scons/numpy/f2py/lib/tests/test_module_module.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/f2py/lib/tests/test_module_module.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -42,7 +42,7 @@ type(rat) a print*,"In bar,a=",a end subroutine bar -end module test_module_module_ext +end module test_module_module_ext ''' m,m2 = compile(fortran_code, modulenames=['test_module_module_ext', @@ -51,7 +51,7 @@ from numpy import * -class test_m(NumpyTestCase): +class TestM(NumpyTestCase): def check_foo_simple(self, level=1): foo = m.foo Modified: branches/numpy.scons/numpy/f2py/lib/tests/test_module_scalar.py =================================================================== --- branches/numpy.scons/numpy/f2py/lib/tests/test_module_scalar.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/f2py/lib/tests/test_module_scalar.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -40,7 +40,7 @@ from numpy import * -class test_m(NumpyTestCase): +class TestM(NumpyTestCase): def check_foo_simple(self, level=1): foo = m.foo Modified: branches/numpy.scons/numpy/f2py/lib/tests/test_scalar_function_in.py =================================================================== --- branches/numpy.scons/numpy/f2py/lib/tests/test_scalar_function_in.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/f2py/lib/tests/test_scalar_function_in.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -107,7 +107,7 @@ from numpy import * -class test_m(NumpyTestCase): +class TestM(NumpyTestCase): def check_foo_integer1(self, level=1): i = int8(2) Modified: branches/numpy.scons/numpy/f2py/lib/tests/test_scalar_in_out.py =================================================================== --- branches/numpy.scons/numpy/f2py/lib/tests/test_scalar_in_out.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/f2py/lib/tests/test_scalar_in_out.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -104,7 +104,7 @@ from numpy import * -class test_m(NumpyTestCase): +class TestM(NumpyTestCase): def check_foo_integer1(self, level=1): i = int8(2) Modified: branches/numpy.scons/numpy/f2py/rules.py =================================================================== --- branches/numpy.scons/numpy/f2py/rules.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/f2py/rules.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -57,7 +57,10 @@ f2py_version = __version__.version import pprint -import sys,string,time,types,copy +import sys +import time +import types +import copy errmess=sys.stderr.write outmess=sys.stdout.write show=pprint.pprint @@ -1166,7 +1169,7 @@ fn = os.path.join(options['buildpath'],vrd['modulename']+'module.c') ret['csrc'] = fn f=open(fn,'w') - f.write(string.replace(ar['modulebody'],'\t',2*' ')) + f.write(ar['modulebody'].replace('\t',2*' ')) f.close() outmess('\tWrote C/API module "%s" to file "%s/%smodule.c"\n'%(m['name'],options['buildpath'],vrd['modulename'])) @@ -1174,7 +1177,7 @@ fn = os.path.join(options['buildpath'],vrd['modulename']+'module.rest') f=open(fn,'w') f.write('.. -*- rest -*-\n') - f.write(string.join(ar['restdoc'],'\n')) + f.write('\n'.join(ar['restdoc'])) f.close() outmess('\tReST Documentation is saved to file "%s/%smodule.rest"\n'%(options['buildpath'],vrd['modulename'])) if options['dolatexdoc']: @@ -1184,7 +1187,7 @@ f.write('%% This file is auto-generated with f2py (version:%s)\n'%(f2py_version)) if not options.has_key('shortlatex'): f.write('\\documentclass{article}\n\\usepackage{a4wide}\n\\begin{document}\n\\tableofcontents\n\n') - f.write(string.join(ar['latexdoc'],'\n')) + f.write('\n'.join(ar['latexdoc'])) if not options.has_key('shortlatex'): f.write('\\end{document}') f.close() @@ -1197,14 +1200,14 @@ f.write('C This file is autogenerated with f2py (version:%s)\n'%(f2py_version)) f.write('C It contains Fortran 77 wrappers to fortran functions.\n') lines = [] - for l in string.split(string.join(funcwrappers,'\n\n')+'\n','\n'): + for l in ('\n\n'.join(funcwrappers)+'\n').split('\n'): if l and l[0]==' ': while len(l)>=66: lines.append(l[:66]+'\n &') l = l[66:] lines.append(l+'\n') else: lines.append(l+'\n') - lines = string.join(lines,'').replace('\n &\n','\n') + lines = ''.join(lines).replace('\n &\n','\n') f.write(lines) f.close() outmess('\tFortran 77 wrappers are saved to "%s"\n'%(wn)) @@ -1216,7 +1219,7 @@ f.write('! This file is autogenerated with f2py (version:%s)\n'%(f2py_version)) f.write('! It contains Fortran 90 wrappers to fortran functions.\n') lines = [] - for l in string.split(string.join(funcwrappers2,'\n\n')+'\n','\n'): + for l in '\n\n'.join(funcwrappers2)+'\n'.split('\n'): if len(l)>72 and l[0]==' ': lines.append(l[:72]+'&\n &') l = l[72:] @@ -1225,7 +1228,7 @@ l = l[66:] lines.append(l+'\n') else: lines.append(l+'\n') - lines = string.join(lines,'').replace('\n &\n','\n') + lines = ''.join(lines).replace('\n &\n','\n') f.write(lines) f.close() outmess('\tFortran 90 wrappers are saved to "%s"\n'%(wn)) @@ -1313,8 +1316,8 @@ {'docsign':rd['docsign'], 'docsignopt':optargs, }) - rd['latexdocsignatureshort']=string.replace(rd['docsignatureshort'],'_','\\_') - rd['latexdocsignatureshort']=string.replace(rd['latexdocsignatureshort'],',',', ') + rd['latexdocsignatureshort']=rd['docsignatureshort'].replace('_','\\_') + rd['latexdocsignatureshort']=rd['latexdocsignatureshort'].replace(',',', ') cfs=stripcomma(replace('#callfortran##callfortranappend#',{'callfortran':rd['callfortran'],'callfortranappend':rd['callfortranappend']})) if len(rd['callfortranappend'])>1: rd['callcompaqfortran']=stripcomma(replace('#callfortran# 0,#callfortranappend#',{'callfortran':rd['callfortran'],'callfortranappend':rd['callfortranappend']})) Modified: branches/numpy.scons/numpy/f2py/tests/mixed/run.py =================================================================== --- branches/numpy.scons/numpy/f2py/tests/mixed/run.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/f2py/tests/mixed/run.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -8,7 +8,6 @@ import os import sys -import string import f2py2e from Numeric import array @@ -19,7 +18,7 @@ d,b=os.path.split(sys.argv[0]) files = ['foo.f','foo_fixed.f90','foo_free.f90'] files = [os.path.join(d,f) for f in files] - files = string.join(files) + files = ' '.join(files) args = ' -c -m mixed_f77_f90 %s %s'%(files,f2py_opts) c = '%s -c "import f2py2e;f2py2e.main()" %s' %(sys.executable,args) s = os.system(c) Modified: branches/numpy.scons/numpy/f2py/use_rules.py =================================================================== --- branches/numpy.scons/numpy/f2py/use_rules.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/f2py/use_rules.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -20,7 +20,10 @@ f2py_version='See `f2py -v`' import pprint -import sys,string,time,types,copy +import sys +import time +import types +import copy errmess=sys.stderr.write outmess=sys.stdout.write show=pprint.pprint @@ -88,10 +91,10 @@ ret={} vrd={'name':name, 'realname':realname, - 'REALNAME':string.upper(realname), + 'REALNAME':realname.upper(), 'usemodulename':usemodulename, - 'USEMODULENAME':string.upper(usemodulename), - 'texname':string.replace(name,'_','\\_'), + 'USEMODULENAME':usemodulename.upper(), + 'texname':name.replace('_','\\_'), 'begintitle':gentitle('%s=>%s'%(name,realname)), 'endtitle':gentitle('end of %s=>%s'%(name,realname)), 'apiname':'#modulename#_use_%s_from_%s'%(realname,usemodulename) @@ -99,7 +102,7 @@ nummap={0:'Ro',1:'Ri',2:'Rii',3:'Riii',4:'Riv',5:'Rv',6:'Rvi',7:'Rvii',8:'Rviii',9:'Rix'} vrd['texnamename']=name for i in nummap.keys(): - vrd['texnamename']=string.replace(vrd['texnamename'],`i`,nummap[i]) + vrd['texnamename']=vrd['texnamename'].replace(`i`,nummap[i]) if hasnote(vars[realname]): vrd['note']=vars[realname]['note'] rd=dictappend({},vrd) var=vars[realname] Modified: branches/numpy.scons/numpy/fft/tests/test_fftpack.py =================================================================== --- branches/numpy.scons/numpy/fft/tests/test_fftpack.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/fft/tests/test_fftpack.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -4,7 +4,7 @@ from numpy.fft import * restore_path() -class test_fftshift(NumpyTestCase): +class TestFFTShift(NumpyTestCase): def check_fft_n(self): self.failUnlessRaises(ValueError,fft,[1,2,3],0) Modified: branches/numpy.scons/numpy/fft/tests/test_helper.py =================================================================== --- branches/numpy.scons/numpy/fft/tests/test_helper.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/fft/tests/test_helper.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -14,7 +14,7 @@ def random(size): return rand(*size) -class test_fftshift(NumpyTestCase): +class TestFFTShift(NumpyTestCase): def check_definition(self): x = [0,1,2,3,4,-4,-3,-2,-1] @@ -31,7 +31,7 @@ x = random((n,)) assert_array_almost_equal(ifftshift(fftshift(x)),x) -class test_fftfreq(NumpyTestCase): +class TestFFTFreq(NumpyTestCase): def check_definition(self): x = [0,1,2,3,4,-4,-3,-2,-1] Modified: branches/numpy.scons/numpy/lib/function_base.py =================================================================== --- branches/numpy.scons/numpy/lib/function_base.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/lib/function_base.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -1,7 +1,7 @@ __docformat__ = "restructuredtext en" __all__ = ['logspace', 'linspace', 'select', 'piecewise', 'trim_zeros', - 'copy', 'iterable', #'base_repr', 'binary_repr', + 'copy', 'iterable', 'diff', 'gradient', 'angle', 'unwrap', 'sort_complex', 'disp', 'unique', 'extract', 'place', 'nansum', 'nanmax', 'nanargmax', 'nanargmin', 'nanmin', 'vectorize', 'asarray_chkfinite', 'average', @@ -35,7 +35,35 @@ Return num evenly spaced samples from start to stop. If endpoint is True, the last sample is stop. If retstep is - True then return the step value used. + True then return (seq, step_value), where step_value used. + + :Parameters: + start : {float} + The value the sequence starts at. + stop : {float} + The value the sequence stops at. If ``endpoint`` is false, then + this is not included in the sequence. Otherwise it is + guaranteed to be the last value. + num : {integer} + Number of samples to generate. Default is 50. + endpoint : {boolean} + If true, ``stop`` is the last sample. Otherwise, it is not + included. Default is true. + retstep : {boolean} + If true, return ``(samples, step)``, where ``step`` is the + spacing used in generating the samples. + + :Returns: + samples : {array} + ``num`` equally spaced samples from the range [start, stop] + or [start, stop). + step : {float} (Only if ``retstep`` is true) + Size of spacing between samples. + + :See Also: + `arange` : Similiar to linspace, however, when used with + a float endpoint, that endpoint may or may not be included. + `logspace` """ num = int(num) if num <= 0: @@ -108,6 +136,12 @@ """ a = asarray(a).ravel() + + if (range is not None): + mn, mx = range + if (mn > mx): + raise AttributeError, 'max must be larger than min in range parameter.' + if not iterable(bins): if range is None: range = (a.min(), a.max()) @@ -116,6 +150,9 @@ mn -= 0.5 mx += 0.5 bins = linspace(mn, mx, bins, endpoint=False) + else: + if(any(bins[1:]-bins[:-1] < 0)): + raise AttributeError, 'bins must increase monotonically.' # best block size probably depends on processor cache size block = 65536 @@ -914,6 +951,7 @@ raise ValueError, "mismatch between python function inputs"\ " and received arguments" + # we need a new ufunc if this is being called with more arguments. if (self.lastcallargs != nargs): self.lastcallargs = nargs self.ufunc = None @@ -935,14 +973,18 @@ otypes.append(asarray(theout[k]).dtype.char) self.otypes = ''.join(otypes) + # Create ufunc if not already created if (self.ufunc is None): self.ufunc = frompyfunc(self.thefunc, nargs, self.nout) + # Convert to object arrays first + newargs = [array(arg,copy=False,subok=True,dtype=object) for arg in args] if self.nout == 1: - _res = array(self.ufunc(*args),copy=False).astype(self.otypes[0]) + _res = array(self.ufunc(*newargs),copy=False, + subok=True,dtype=self.otypes[0]) else: - _res = tuple([array(x,copy=False).astype(c) \ - for x, c in zip(self.ufunc(*args), self.otypes)]) + _res = tuple([array(x,copy=False,subok=True,dtype=c) \ + for x, c in zip(self.ufunc(*newargs), self.otypes)]) return _res def cov(m, y=None, rowvar=1, bias=0): Modified: branches/numpy.scons/numpy/lib/index_tricks.py =================================================================== --- branches/numpy.scons/numpy/lib/index_tricks.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/lib/index_tricks.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -125,7 +125,7 @@ [2], [3], [4]]), array([[0, 1, 2, 3, 4]])] - + """ def __init__(self, sparse=False): self.sparse = sparse @@ -319,7 +319,7 @@ For example: >>> r_[array([1,2,3]), 0, 0, array([4,5,6])] array([1, 2, 3, 0, 0, 4, 5, 6]) - + """ def __init__(self): concatenator.__init__(self, 0) Modified: branches/numpy.scons/numpy/lib/shape_base.py =================================================================== --- branches/numpy.scons/numpy/lib/shape_base.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/lib/shape_base.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -299,7 +299,7 @@ [[2, 3]], [[3, 4]]]) - + """ return _nx.concatenate(map(atleast_3d,tup),2) Modified: branches/numpy.scons/numpy/lib/tests/test_arraysetops.py =================================================================== --- branches/numpy.scons/numpy/lib/tests/test_arraysetops.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/lib/tests/test_arraysetops.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -11,7 +11,7 @@ ################################################## -class test_aso(NumpyTestCase): +class TestAso(NumpyTestCase): ## # 03.11.2005, c def check_unique1d( self ): Modified: branches/numpy.scons/numpy/lib/tests/test_function_base.py =================================================================== --- branches/numpy.scons/numpy/lib/tests/test_function_base.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/lib/tests/test_function_base.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -7,7 +7,7 @@ from numpy.core import * del sys.path[0] -class test_any(NumpyTestCase): +class TestAny(NumpyTestCase): def check_basic(self): y1 = [0,0,1,0] y2 = [0,0,0,0] @@ -22,7 +22,7 @@ assert_array_equal(sometrue(y1,axis=0),[1,1,0]) assert_array_equal(sometrue(y1,axis=1),[0,1,1]) -class test_all(NumpyTestCase): +class TestAll(NumpyTestCase): def check_basic(self): y1 = [0,1,1,0] y2 = [0,0,0,0] @@ -38,7 +38,7 @@ assert_array_equal(alltrue(y1,axis=0),[0,0,1]) assert_array_equal(alltrue(y1,axis=1),[0,0,1]) -class test_average(NumpyTestCase): +class TestAverage(NumpyTestCase): def check_basic(self): y1 = array([1,2,3]) assert(average(y1,axis=0) == 2.) @@ -64,7 +64,7 @@ desired = array([3.,4.,5.]) assert_array_equal(actual, desired) -class test_select(NumpyTestCase): +class TestSelect(NumpyTestCase): def _select(self,cond,values,default=0): output = [] for m in range(len(cond)): @@ -84,7 +84,7 @@ assert_equal(len(choices),3) assert_equal(len(conditions),3) -class test_logspace(NumpyTestCase): +class TestLogspace(NumpyTestCase): def check_basic(self): y = logspace(0,6) assert(len(y)==50) @@ -95,7 +95,7 @@ y = logspace(0,6,num=7) assert_array_equal(y,[1,10,100,1e3,1e4,1e5,1e6]) -class test_linspace(NumpyTestCase): +class TestLinspace(NumpyTestCase): def check_basic(self): y = linspace(0,10) assert(len(y)==50) @@ -120,14 +120,14 @@ assert_equal(t1, t2) assert_equal(t2, t3) -class test_insert(NumpyTestCase): +class TestInsert(NumpyTestCase): def check_basic(self): a = [1,2,3] assert_equal(insert(a,0,1), [1,1,2,3]) assert_equal(insert(a,3,1), [1,2,3,1]) assert_equal(insert(a,[1,1,1],[1,2,3]), [1,1,2,3,2,3]) -class test_amax(NumpyTestCase): +class TestAmax(NumpyTestCase): def check_basic(self): a = [3,4,5,10,-3,-5,6.0] assert_equal(amax(a),10.0) @@ -137,7 +137,7 @@ assert_equal(amax(b,axis=0),[8.0,10.0,9.0]) assert_equal(amax(b,axis=1),[9.0,10.0,8.0]) -class test_amin(NumpyTestCase): +class TestAmin(NumpyTestCase): def check_basic(self): a = [3,4,5,10,-3,-5,6.0] assert_equal(amin(a),-5.0) @@ -147,7 +147,7 @@ assert_equal(amin(b,axis=0),[3.0,3.0,2.0]) assert_equal(amin(b,axis=1),[3.0,4.0,2.0]) -class test_ptp(NumpyTestCase): +class TestPtp(NumpyTestCase): def check_basic(self): a = [3,4,5,10,-3,-5,6.0] assert_equal(ptp(a,axis=0),15.0) @@ -157,7 +157,7 @@ assert_equal(ptp(b,axis=0),[5.0,7.0,7.0]) assert_equal(ptp(b,axis=-1),[6.0,6.0,6.0]) -class test_cumsum(NumpyTestCase): +class TestCumsum(NumpyTestCase): def check_basic(self): ba = [1,2,10,11,6,5,4] ba2 = [[1,2,3,4],[5,6,7,9],[10,3,4,5]] @@ -173,7 +173,7 @@ [5,11,18,27], [10,13,17,22]],ctype)) -class test_prod(NumpyTestCase): +class TestProd(NumpyTestCase): def check_basic(self): ba = [1,2,10,11,6,5,4] ba2 = [[1,2,3,4],[5,6,7,9],[10,3,4,5]] @@ -191,7 +191,7 @@ array([50,36,84,180],ctype)) assert_array_equal(prod(a2,axis=-1),array([24, 1890, 600],ctype)) -class test_cumprod(NumpyTestCase): +class TestCumprod(NumpyTestCase): def check_basic(self): ba = [1,2,10,11,6,5,4] ba2 = [[1,2,3,4],[5,6,7,9],[10,3,4,5]] @@ -216,7 +216,7 @@ [ 5, 30, 210, 1890], [10, 30, 120, 600]],ctype)) -class test_diff(NumpyTestCase): +class TestDiff(NumpyTestCase): def check_basic(self): x = [1,4,6,7,12] out = array([3,2,1,5]) @@ -237,7 +237,7 @@ assert_array_equal(diff(x,axis=0),out3) assert_array_equal(diff(x,n=2,axis=0),out4) -class test_angle(NumpyTestCase): +class TestAngle(NumpyTestCase): def check_basic(self): x = [1+3j,sqrt(2)/2.0+1j*sqrt(2)/2,1,1j,-1,-1j,1-3j,-1+3j] y = angle(x) @@ -248,7 +248,7 @@ assert_array_almost_equal(y,yo,11) assert_array_almost_equal(z,zo,11) -class test_trim_zeros(NumpyTestCase): +class TestTrimZeros(NumpyTestCase): """ only testing for integer splits. """ def check_basic(self): @@ -265,7 +265,7 @@ assert_array_equal(res,array([1,0,2,3,0,4])) -class test_extins(NumpyTestCase): +class TestExtins(NumpyTestCase): def check_basic(self): a = array([1,3,2,1,2,3,3]) b = extract(a>1,a) @@ -283,7 +283,7 @@ place(a,mask,c) assert_array_equal(a,ac) -class test_vectorize(NumpyTestCase): +class TestVectorize(NumpyTestCase): def check_simple(self): def addsubtract(a,b): if a > b: @@ -308,7 +308,7 @@ y = f(x) assert_array_equal(y, x) -class test_digitize(NumpyTestCase): +class TestDigitize(NumpyTestCase): def check_forward(self): x = arange(-6,5) bins = arange(-5,5) @@ -324,7 +324,7 @@ bin = linspace(x.min(), x.max(), 10) assert all(digitize(x,bin) != 0) -class test_unwrap(NumpyTestCase): +class TestUnwrap(NumpyTestCase): def check_simple(self): #check that unwrap removes jumps greather that 2*pi assert_array_equal(unwrap([1,1+2*pi]),[1,1]) @@ -332,7 +332,7 @@ assert(all(diff(unwrap(rand(10)*100)) H, xedges, yedges @@ -152,27 +151,27 @@ :Parameters: - `x,y` : Sample arrays (1D). - - `bins` : Number of bins -or- [nbin x, nbin y] -or- + - `bins` : Number of bins -or- [nbin x, nbin y] -or- [bin edges] -or- [x bin edges, y bin edges]. - `range` : A sequence of lower and upper bin edges (default: [min, max]). - `normed` : Boolean, if False, return the number of samples in each bin, if True, returns the density. - - `weights` : An array of weights. The weights are normed only if normed + - `weights` : An array of weights. The weights are normed only if normed is True. Should weights.sum() not equal N, the total bin count \ will not be equal to the number of samples. - + :Return: - `hist` : Histogram array. - - `xedges, yedges` : Arrays defining the bin edges. - + - `xedges, yedges` : Arrays defining the bin edges. + Example: >>> x = random.randn(100,2) >>> hist2d, xedges, yedges = histogram2d(x, bins = (6, 7)) - + :SeeAlso: histogramdd """ from numpy import histogramdd - + try: N = len(bins) except TypeError: Modified: branches/numpy.scons/numpy/lib/type_check.py =================================================================== --- branches/numpy.scons/numpy/lib/type_check.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/lib/type_check.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -7,7 +7,7 @@ import numpy.core.numeric as _nx from numpy.core.numeric import asarray, asanyarray, array, isnan, \ - obj2sctype, zeros + obj2sctype, zeros from ufunclike import isneginf, isposinf _typecodes_by_elsize = 'GDFgdfQqLlIiHhBb?' Modified: branches/numpy.scons/numpy/lib/utils.py =================================================================== --- branches/numpy.scons/numpy/lib/utils.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/lib/utils.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -118,7 +118,7 @@ high is just *past* the last byte If the array is not single-segment, then it may not actually - use every byte between these bounds. + use every byte between these bounds. The array provided must conform to the Python-side of the array interface """ @@ -140,8 +140,8 @@ a_high += (shape-1)*stride a_high += bytes_a return a_low, a_high - + def may_share_memory(a, b): """Determine if two arrays can share memory @@ -275,7 +275,7 @@ Example: >>> from numpy import * >>> info(polyval) # doctest: +SKIP - + polyval(p, x) Evaluate the polymnomial p at x. Modified: branches/numpy.scons/numpy/linalg/SConstruct =================================================================== --- branches/numpy.scons/numpy/linalg/SConstruct 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/linalg/SConstruct 2007-11-13 13:51:35 UTC (rev 4451) @@ -1,5 +1,7 @@ -# Last Change: Mon Oct 29 06:00 PM 2007 J +# Last Change: Tue Nov 13 10:00 PM 2007 J # vim:syntax=python +import os.path + from numpy.distutils.misc_util import get_numpy_include_dirs, get_mathlibs from numpy.distutils.scons import GetNumpyEnvironment, scons_get_paths from numpy.distutils.scons import CheckLAPACK @@ -14,12 +16,15 @@ use_lapack = config.CheckLAPACK() # XXX: this is ugly, better find the mathlibs with a checker -for i in scons_get_paths(env['include_bootstrap']): - try: - mlib = get_mathlibs(i) - break - except IOError: - pass +def custom_get_mathlib(): + for i in scons_get_paths(env['include_bootstrap']): + try: + mlib = get_mathlibs(i) + return mlib + except IOError: + pass + raise RuntimeError("FIXME: no mlib found ?") +mlib = custom_get_mathlib() env.AppendUnique(LIBS = mlib) config.Finish() Modified: branches/numpy.scons/numpy/linalg/lapack_lite/clapack_scrub.py =================================================================== --- branches/numpy.scons/numpy/linalg/lapack_lite/clapack_scrub.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/linalg/lapack_lite/clapack_scrub.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -273,4 +273,3 @@ writefo = open(outfilename, 'w') writefo.write(source) writefo.close() - Modified: branches/numpy.scons/numpy/linalg/lapack_lite/make_lite.py =================================================================== --- branches/numpy.scons/numpy/linalg/lapack_lite/make_lite.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/linalg/lapack_lite/make_lite.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -141,7 +141,7 @@ class LapackLibrary(FortranLibrary): def _newFortranRoutine(self, rname, filename): routine = FortranLibrary._newFortranRoutine(self, rname, filename) - if filename.find('BLAS') != -1: + if 'BLAS' in filename routine.type = 'blas' elif rname.startswith('z'): routine.type = 'zlapack' Modified: branches/numpy.scons/numpy/linalg/lapack_litemodule.c =================================================================== --- branches/numpy.scons/numpy/linalg/lapack_litemodule.c 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/linalg/lapack_litemodule.c 2007-11-13 13:51:35 UTC (rev 4451) @@ -765,7 +765,7 @@ lapack_lite_status__ = \ FNAME(zgeqrf)(&m, &n, ZDATA(a), &lda, ZDATA(tau), ZDATA(work), &lwork, &info); - return Py_BuildValue("{s:l,s:l,s:l,s:l,s:l,s:l}","zgeqrf_",lapack_lite_status__,"m",m,"n",n,"lda",lda,"lwork",lwork,"info",info); + return Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:i}","zgeqrf_",lapack_lite_status__,"m",m,"n",n,"lda",lda,"lwork",lwork,"info",info); } Modified: branches/numpy.scons/numpy/matlib.py =================================================================== --- branches/numpy.scons/numpy/matlib.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/matlib.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -40,12 +40,12 @@ def rand(*args): if isinstance(args[0], tuple): - args = args[0] + args = args[0] return asmatrix(N.random.rand(*args)) def randn(*args): if isinstance(args[0], tuple): - args = args[0] + args = args[0] return asmatrix(N.random.randn(*args)) def repmat(a, m, n): Modified: branches/numpy.scons/numpy/numarray/image.py =================================================================== --- branches/numpy.scons/numpy/numarray/image.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/numarray/image.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -12,4 +12,3 @@ installing all of SciPy from http://www.scipy.org. """ raise ImportError(msg) - Modified: branches/numpy.scons/numpy/numarray/matrix.py =================================================================== --- branches/numpy.scons/numpy/numarray/matrix.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/numarray/matrix.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -5,4 +5,3 @@ def Matrix(data, typecode=None, copy=1, savespace=0): return _matrix(data, typecode, copy=copy) - Modified: branches/numpy.scons/numpy/numarray/numerictypes.py =================================================================== --- branches/numpy.scons/numpy/numarray/numerictypes.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/numarray/numerictypes.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -472,22 +472,22 @@ Complex64 : Complex64 } else: - _MaximumType = { + _MaximumType = { Bool : Int64, - + Int8 : Int64, Int16 : Int64, Int32 : Int64, Int64 : Int64, - + UInt8 : Int64, UInt16 : Int64, UInt32 : Int64, UInt8 : Int64, - + Float32 : Float64, Float64 : Float64, - + Complex32 : Complex64, Complex64 : Complex64 } Modified: branches/numpy.scons/numpy/oldnumeric/arrayfns.py =================================================================== --- branches/numpy.scons/numpy/oldnumeric/arrayfns.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/oldnumeric/arrayfns.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -94,5 +94,3 @@ def construct3(mask, itype): raise NotImplementedError - - Modified: branches/numpy.scons/numpy/oldnumeric/ma.py =================================================================== --- branches/numpy.scons/numpy/oldnumeric/ma.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/oldnumeric/ma.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -12,4 +12,3 @@ def take(a, indices, axis=0): return nca.average(a, indices, axis=0) - Modified: branches/numpy.scons/numpy/oldnumeric/matrix.py =================================================================== --- branches/numpy.scons/numpy/oldnumeric/matrix.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/oldnumeric/matrix.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -2,7 +2,6 @@ __all__ = ['UserArray', 'squeeze', 'Matrix', 'asarray', 'dot', 'k', 'Numeric', 'LinearAlgebra', 'identity', 'multiply', 'types', 'string'] -import string import types from user_array import UserArray, asarray import numpy.oldnumeric as Numeric @@ -17,7 +16,7 @@ _table[k] = chr(k) _table = ''.join(_table) -_numchars = string.digits + ".-+jeEL" +_numchars = '0123456789.-+jeEL' _todelete = [] for k in _table: if k not in _numchars: Modified: branches/numpy.scons/numpy/oldnumeric/precision.py =================================================================== --- branches/numpy.scons/numpy/oldnumeric/precision.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/oldnumeric/precision.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -7,8 +7,8 @@ 'PrecisionError', 'PyObject', 'Int', 'UInt', 'UnsignedInteger', 'string', 'typecodes', 'zeros'] -import string from functions import zeros +import string # for backwards compatibility typecodes = {'Character':'c', 'Integer':'bhil', 'UnsignedInteger':'BHI', 'Float':'fd', 'Complex':'FD'} Modified: branches/numpy.scons/numpy/oldnumeric/random_array.py =================================================================== --- branches/numpy.scons/numpy/oldnumeric/random_array.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/oldnumeric/random_array.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -81,13 +81,13 @@ """multivariate_normal(mean, cov) or multivariate_normal(mean, cov, [m, n, ...]) returns an array containing multivariate normally distributed random numbers with specified mean and covariance. - + mean must be a 1 dimensional array. cov must be a square two dimensional array with the same number of rows and columns as mean has elements. - + The first form returns a single 1-D array containing a multivariate normal. - + The second form returns an array of shape (m, n, ..., cov.shape[0]). In this case, output[i,j,...,:] is a 1-D array containing a multivariate normal.""" @@ -117,7 +117,7 @@ def F(dfn, dfd, shape=[]): """F(dfn, dfd) or F(dfn, dfd, [n, m, ...]) returns array of F distributed random numbers with dfn degrees of freedom in the numerator and dfd degrees of freedom in the denominator.""" if shape == []: - shape == None + shape = None return mt.f(dfn, dfd, shape) def noncentral_F(dfn, dfd, nconc, shape=[]): Modified: branches/numpy.scons/numpy/random/tests/test_random.py =================================================================== --- branches/numpy.scons/numpy/random/tests/test_random.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/random/tests/test_random.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -2,7 +2,7 @@ from numpy import random import numpy as N -class test_multinomial(NumpyTestCase): +class TestMultinomial(NumpyTestCase): def test_basic(self): random.multinomial(100, [0.2, 0.8]) Modified: branches/numpy.scons/numpy/testing/numpytest.py =================================================================== --- branches/numpy.scons/numpy/testing/numpytest.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/testing/numpytest.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -257,7 +257,7 @@ Old-style test_suite(level=1) hooks are also supported. """ - _check_testcase_name = re.compile(r'test.*').match + _check_testcase_name = re.compile(r'test.*|Test.*').match def check_testcase_name(self, name): """ Return True if name matches TestCase class. """ @@ -296,10 +296,10 @@ def rename(self, **kws): """Apply renaming submodule test file test_.py to test_.py. - + Usage: self.rename(name='newname') before calling the self.test() method. - + If 'newname' is None, then no tests will be executed for a given module. """ Modified: branches/numpy.scons/numpy/tests/test_ctypeslib.py =================================================================== --- branches/numpy.scons/numpy/tests/test_ctypeslib.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/tests/test_ctypeslib.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -4,7 +4,7 @@ from numpy.ctypeslib import ndpointer restore_path() -class test_ndpointer(NumpyTestCase): +class TestNdpointer(NumpyTestCase): def check_dtype(self): dt = N.intc p = ndpointer(dtype=dt) Modified: branches/numpy.scons/numpy/version.py =================================================================== --- branches/numpy.scons/numpy/version.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/numpy/version.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -1,4 +1,4 @@ -version='1.0.4' +version='1.0.5' release=False if not release: Deleted: branches/numpy.scons/scipy_compatibility =================================================================== --- branches/numpy.scons/scipy_compatibility 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/scipy_compatibility 2007-11-13 13:51:35 UTC (rev 4451) @@ -1,4 +0,0 @@ -Changed names and behaviors in limits -Changed usage of types -Moved around some names -Moved scimath functions to numpy.math Deleted: branches/numpy.scons/setup.old.py =================================================================== --- branches/numpy.scons/setup.old.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/setup.old.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -1,90 +0,0 @@ -#!/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) - 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 at 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 at 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() Deleted: branches/numpy.scons/setup.py =================================================================== --- branches/numpy.scons/setup.py 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/setup.py 2007-11-13 13:51:35 UTC (rev 4451) @@ -1,90 +0,0 @@ -#!/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 at 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 at 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() Copied: branches/numpy.scons/setup.py (from rev 4450, branches/numpy.scons/setup.old.py) Copied: branches/numpy.scons/setupscons.py (from rev 4450, branches/numpy.scons/setup.py) Modified: branches/numpy.scons/test.sh =================================================================== --- branches/numpy.scons/test.sh 2007-11-13 13:10:59 UTC (rev 4450) +++ branches/numpy.scons/test.sh 2007-11-13 13:51:35 UTC (rev 4451) @@ -1,5 +1,5 @@ PREFIX=$PWD rm -rf $PREFIX/build rm -rf $PREFIX/tmp -DEBUG_SCONS_CHECK=0 python setup.py scons --jobs=1 install --prefix=$PREFIX/tmp -(cd $PREFIX/tmp && PYTHONPATH=$PREFIX/tmp/lib/python2.4/site-packages python -c "import numpy; print numpy; numpy.test(level = 9999); numpy.show_config()") +MKL=None python setup.py scons --jobs=4 install --prefix=$PREFIX/tmp +(cd $PREFIX/tmp && PYTHONPATH=$PREFIX/tmp/lib/python2.5/site-packages python -c "import numpy; print numpy; numpy.test(level = 9999); numpy.show_config()") From numpy-svn at scipy.org Tue Nov 13 09:37:36 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 13 Nov 2007 08:37:36 -0600 (CST) Subject: [Numpy-svn] r4452 - in branches/numpy.scons/numpy: distutils distutils/scons linalg random Message-ID: <20071113143736.DA7E139C308@new.scipy.org> Author: cdavid Date: 2007-11-13 08:37:25 -0600 (Tue, 13 Nov 2007) New Revision: 4452 Modified: branches/numpy.scons/numpy/distutils/misc_util.py branches/numpy.scons/numpy/distutils/scons/__init__.py branches/numpy.scons/numpy/linalg/SConstruct branches/numpy.scons/numpy/random/SConstruct Log: Fix get_mathlib for sconscripts (subpackage build finally work) Modified: branches/numpy.scons/numpy/distutils/misc_util.py =================================================================== --- branches/numpy.scons/numpy/distutils/misc_util.py 2007-11-13 13:51:35 UTC (rev 4451) +++ branches/numpy.scons/numpy/distutils/misc_util.py 2007-11-13 14:37:25 UTC (rev 4452) @@ -113,11 +113,11 @@ return minrelpath(joined) def get_mathlibs(path=None): - """Return the MATHLIB line from config.h + """Return the MATHLIB line from numpyconfig.h """ if path is None: path = os.path.join(get_numpy_include_dirs()[0], 'numpy') - config_file = os.path.join(path,'config.h') + config_file = os.path.join(path,'numpyconfig.h') fid = open(config_file) mathlibs = [] s = '#define MATHLIB' Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-11-13 13:51:35 UTC (rev 4451) +++ branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-11-13 14:37:25 UTC (rev 4452) @@ -7,6 +7,19 @@ from checkers import CheckCBLAS, CheckLAPACK from fortran_scons import CheckF77Verbose, CheckF77Clib, CheckF77Mangling +# XXX: this is ugly, better find the mathlibs with a checker +# XXX: this had nothing to do here, too... +def scons_get_mathlib(env): + from numpy.distutils.misc_util import get_mathlibs + path_list = scons_get_paths(env['include_bootstrap']) + [None] + for i in path_list: + try: + mlib = get_mathlibs(i) + return mlib + except IOError: + pass + raise RuntimeError("FIXME: no mlib found ?") + def test(level=1, verbosity=1): from numpy.testing import NumpyTest return NumpyTest().test(level, verbosity) Modified: branches/numpy.scons/numpy/linalg/SConstruct =================================================================== --- branches/numpy.scons/numpy/linalg/SConstruct 2007-11-13 13:51:35 UTC (rev 4451) +++ branches/numpy.scons/numpy/linalg/SConstruct 2007-11-13 14:37:25 UTC (rev 4452) @@ -1,9 +1,10 @@ -# Last Change: Tue Nov 13 10:00 PM 2007 J +# Last Change: Tue Nov 13 11:00 PM 2007 J # vim:syntax=python import os.path from numpy.distutils.misc_util import get_numpy_include_dirs, get_mathlibs -from numpy.distutils.scons import GetNumpyEnvironment, scons_get_paths +from numpy.distutils.scons import GetNumpyEnvironment, scons_get_paths, \ + scons_get_mathlib from numpy.distutils.scons import CheckLAPACK from numpy.distutils.scons.configuration import write_info @@ -15,16 +16,7 @@ use_lapack = config.CheckLAPACK() -# XXX: this is ugly, better find the mathlibs with a checker -def custom_get_mathlib(): - for i in scons_get_paths(env['include_bootstrap']): - try: - mlib = get_mathlibs(i) - return mlib - except IOError: - pass - raise RuntimeError("FIXME: no mlib found ?") -mlib = custom_get_mathlib() +mlib = scons_get_mathlib(env) env.AppendUnique(LIBS = mlib) config.Finish() Modified: branches/numpy.scons/numpy/random/SConstruct =================================================================== --- branches/numpy.scons/numpy/random/SConstruct 2007-11-13 13:51:35 UTC (rev 4451) +++ branches/numpy.scons/numpy/random/SConstruct 2007-11-13 14:37:25 UTC (rev 4452) @@ -1,9 +1,10 @@ -# Last Change: Sun Oct 21 10:00 PM 2007 J +# Last Change: Tue Nov 13 11:00 PM 2007 J # vim:syntax=python import os from numpy.distutils.misc_util import get_numpy_include_dirs, get_mathlibs -from numpy.distutils.scons import GetNumpyEnvironment, scons_get_paths +from numpy.distutils.scons import GetNumpyEnvironment, scons_get_paths, \ + scons_get_mathlib def CheckWincrypt(context): from copy import deepcopy @@ -30,13 +31,7 @@ env = GetNumpyEnvironment(ARGUMENTS) env.Append(CPPPATH = scons_get_paths(env['include_bootstrap'])) -# XXX: this is ugly, better find the mathlibs with a checker -for i in scons_get_paths(env['include_bootstrap']): - try: - mlib = get_mathlibs(i) - break - except IOError: - pass +mlib = scons_get_mathlib(env) env.AppendUnique(LIBS = mlib) # On windows, see if we should use Advapi32 From numpy-svn at scipy.org Tue Nov 13 11:16:03 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 13 Nov 2007 10:16:03 -0600 (CST) Subject: [Numpy-svn] r4453 - in branches/numpy.scons/numpy/distutils/scons: core doc Message-ID: <20071113161603.8FD2C39C046@new.scipy.org> Author: cdavid Date: 2007-11-13 10:15:56 -0600 (Tue, 13 Nov 2007) New Revision: 4453 Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py branches/numpy.scons/numpy/distutils/scons/doc/TODO Log: Update TODO, fix get_build_relative_src for subpackage build Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-13 14:37:25 UTC (rev 4452) +++ branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-13 16:15:56 UTC (rev 4453) @@ -231,7 +231,7 @@ # of occureant of the path separator in the src dir. def get_build_relative_src(srcdir, builddir): n = srcdir.count(os.sep) - if len(srcdir): + if len(srcdir) > 0 and not srcdir == '.': n += 1 return pjoin(os.sep.join([os.pardir for i in range(n)]), builddir) sconsign = pjoin(get_build_relative_src(env['src_dir'], Modified: branches/numpy.scons/numpy/distutils/scons/doc/TODO =================================================================== --- branches/numpy.scons/numpy/distutils/scons/doc/TODO 2007-11-13 14:37:25 UTC (rev 4452) +++ branches/numpy.scons/numpy/distutils/scons/doc/TODO 2007-11-13 16:15:56 UTC (rev 4453) @@ -1,19 +1,12 @@ -Before first beta: - - f2py and scipy interoperability: N hours ? +Things to implement / problems to solve: + - f2py interoperability ? + - fortran compiler optimization / option (underscore and so on) -Design questions: - - improve BrokenMathlib and Mathlib in core, and make them available to - everyone - - overriding compilation flags: env variables, site.cfg ? (autotools - convention ?) - Builder: - Get a PythonExtension builder independant of distutils for upstream integration - Get a CtypesExtension builder independant of distutils for upstream integration - - Generic Api builders (with dep tracking) - - Generic FromTemplate builder (with dep tracking) Tests: - What can be tested ? @@ -24,6 +17,11 @@ - improve Fortran mangling and dummy main detection for upstream integration +Not so important things: + - improve BrokenMathlib and Mathlib in core, and make them available to + everyone + - Generic Api builders (with dep tracking) + - Generic FromTemplate builder (with dep tracking) Documentation: - scons / distutils integration, global design (BuildDir, directories, etc...) From numpy-svn at scipy.org Wed Nov 14 01:46:14 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 14 Nov 2007 00:46:14 -0600 (CST) Subject: [Numpy-svn] r4454 - branches/numpy.scons/numpy/distutils/scons/core Message-ID: <20071114064614.3754639C040@new.scipy.org> Author: cdavid Date: 2007-11-14 00:46:09 -0600 (Wed, 14 Nov 2007) New Revision: 4454 Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py Log: Fix path handling in GetNumpyEnvironment Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-13 16:15:56 UTC (rev 4453) +++ branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-14 06:46:09 UTC (rev 4454) @@ -145,9 +145,10 @@ # =============================================== # Setting tools according to command line options - if not env['ENV'].has_key('PATH'): - env['ENV']['PATH'] = [] + # List of supplemental paths to take into account + path_list = [] + # XXX: how to handle tools which are not in standard location ? Is adding # the full path of the compiler enough ? (I am sure some compilers also # need LD_LIBRARY_SHARED and other variables to be set, too....) @@ -170,10 +171,7 @@ t = Tool(env['cc_opt']) t(env) customize_cc(t.name, env) - if sys.platform == 'win32': - env['ENV']['PATH'] += ';%s' % env['cc_opt_path'] - else: - env['ENV']['PATH'] += ':%s' % env['cc_opt_path'] + path_list.append(env['cc_opt_path']) else: # Do not care about PATH info because none given from scons # distutils command @@ -197,10 +195,7 @@ # PATH ? (may not work on windows). t = Tool(env['f77_opt'], toolpath = ['numpy/distutils/scons/tools']) t(env) - if sys.platform == 'win32': - env['ENV']['PATH'] += ';%s' % env['f77_opt_path'] - else: - env['ENV']['PATH'] += ':%s' % env['f77_opt_path'] + path_list.append(env['f77_opt_path']) except EnvironmentError, e: # scons could not understand cc_opt (bad name ?) raise AssertionError("SCONS: Could not initialize tool ? Error is %s" % \ @@ -215,6 +210,12 @@ else: print "========== NO FORTRAN COMPILER FOUND ===========" + if not env['ENV'].has_key('PATH'): + env['ENV']['PATH'] = os.pathsep.join(path_list) + else: + env['ENV']['PATH'] = os.pathsep.join(path_list + env['ENV']['PATH'].split(os.pathsep)) + + print env['ENV']['PATH'] # XXX: Really, we should use our own subclass of Environment, instead of # adding Numpy* functions ! From numpy-svn at scipy.org Wed Nov 14 02:34:16 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 14 Nov 2007 01:34:16 -0600 (CST) Subject: [Numpy-svn] r4455 - branches/numpy.scons/numpy/distutils/scons/core Message-ID: <20071114073416.82A2639C0D4@new.scipy.org> Author: cdavid Date: 2007-11-14 01:34:10 -0600 (Wed, 14 Nov 2007) New Revision: 4455 Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py Log: Clean up GetNumpyEnvironment Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-14 06:46:09 UTC (rev 4454) +++ branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-14 07:34:10 UTC (rev 4455) @@ -114,50 +114,18 @@ env.AppendUnique(LINKFLAGS = env['NUMPY_OPTIM_LDFLAGS']) return env -def _GetNumpyEnvironment(args): - """Call this with args = ARGUMENTS.""" - from SCons.Environment import Environment - from SCons.Tool import Tool, FindTool, FindAllTools - from SCons.Script import BuildDir, Help - from SCons.Errors import EnvironmentError - - # XXX: I would prefer subclassing Environment, because we really expect - # some different behaviour than just Environment instances... - opts = GetNumpyOptions(args) - - # Get the python extension suffix - # XXX this should be defined somewhere else. Is there a way to reliably get - # all the necessary informations specific to python extensions (linkflags, - # etc...) dynamically ? - pyextsuffix = get_config_vars('SO') - - # We set tools to an empty list, to be sure that the custom options are - # given first. We have to - env = Environment(options = opts, tools = [], PYEXTSUFFIX = pyextsuffix) - - # Add the file substitution tool - TOOL_SUBST(env) - - # Setting dirs according to command line options - env.AppendUnique(build_dir = pjoin(env['build_prefix'], env['src_dir'])) - env.AppendUnique(distutils_installdir = pjoin(env['distutils_libdir'], - env['pkg_name'])) - - # =============================================== - # Setting tools according to command line options - - # List of supplemental paths to take into account - path_list = [] - +def initialize_cc(env, path_list): # XXX: how to handle tools which are not in standard location ? Is adding # the full path of the compiler enough ? (I am sure some compilers also # need LD_LIBRARY_SHARED and other variables to be set, too....) + from SCons.Tool import Tool + if len(env['cc_opt']) > 0: try: if len(env['cc_opt_path']) > 0: if env['cc_opt'] == 'intelc': # Intel Compiler SCons.Tool has a special way to set the - # path, o we use this one instead of changing + # path, so we use this one instead of changing # env['ENV']['PATH']. t = Tool(env['cc_opt'], topdir = os.path.split(env['cc_opt_path'])[0]) @@ -166,8 +134,6 @@ else: if is_cc_suncc(pjoin(env['cc_opt_path'], env['cc_opt'])): env['cc_opt'] = 'suncc' - # XXX: what is the right way to add one directory in the - # PATH ? (may not work on windows). t = Tool(env['cc_opt']) t(env) customize_cc(t.name, env) @@ -187,12 +153,13 @@ t(env) customize_cc(t.name, env) +def initialize_f77(env, path_list): + from SCons.Tool import Tool + # F77 compiler if len(env['f77_opt']) > 0: try: if len(env['f77_opt_path']) > 0: - # XXX: what is the right way to add one directory in the - # PATH ? (may not work on windows). t = Tool(env['f77_opt'], toolpath = ['numpy/distutils/scons/tools']) t(env) path_list.append(env['f77_opt_path']) @@ -210,37 +177,48 @@ else: print "========== NO FORTRAN COMPILER FOUND ===========" - if not env['ENV'].has_key('PATH'): - env['ENV']['PATH'] = os.pathsep.join(path_list) - else: - env['ENV']['PATH'] = os.pathsep.join(path_list + env['ENV']['PATH'].split(os.pathsep)) +def _GetNumpyEnvironment(args): + """Call this with args = ARGUMENTS.""" + from SCons.Environment import Environment + from SCons.Tool import Tool, FindTool, FindAllTools + from SCons.Script import BuildDir, Help + from SCons.Errors import EnvironmentError - print env['ENV']['PATH'] - # XXX: Really, we should use our own subclass of Environment, instead of - # adding Numpy* functions ! + # XXX: I would prefer subclassing Environment, because we really expect + # some different behaviour than just Environment instances... + opts = GetNumpyOptions(args) - # Put config code and log in separate dir for each subpackage - from utils import curry - NumpyConfigure = curry(env.Configure, - conf_dir = pjoin(env['build_dir'], '.sconf'), - log_file = pjoin(env['build_dir'], 'config.log')) - env.NumpyConfigure = NumpyConfigure + # Get the python extension suffix + # XXX this should be defined somewhere else. Is there a way to reliably get + # all the necessary informations specific to python extensions (linkflags, + # etc...) dynamically ? + pyextsuffix = get_config_vars('SO') - # XXX: Huge, ugly hack ! SConsign needs an absolute path or a path - # relative to where the SConstruct file is. We have to find the path of - # the build dir relative to the src_dir: we add n .., where n is the number - # of occureant of the path separator in the src dir. - def get_build_relative_src(srcdir, builddir): - n = srcdir.count(os.sep) - if len(srcdir) > 0 and not srcdir == '.': - n += 1 - return pjoin(os.sep.join([os.pardir for i in range(n)]), builddir) - sconsign = pjoin(get_build_relative_src(env['src_dir'], - env['build_dir']), - '.sconsign.dblite') - env.SConsignFile(sconsign) + # We set tools to an empty list, to be sure that the custom options are + # given first. We have to + env = Environment(options = opts, tools = [], PYEXTSUFFIX = pyextsuffix) - # ======================================================================== + # Add the file substitution tool + TOOL_SUBST(env) + + # Setting dirs according to command line options + env.AppendUnique(build_dir = pjoin(env['build_prefix'], env['src_dir'])) + env.AppendUnique(distutils_installdir = pjoin(env['distutils_libdir'], + env['pkg_name'])) + + #------------------------------------------------ + # Setting tools according to command line options + #------------------------------------------------ + + # List of supplemental paths to take into account + path_list = [] + + # Initialize CC tool from distutils info + initialize_cc(env, path_list) + + # Initialize F77 tool from distutils info + initialize_f77(env, path_list) + # Adding default tools for the one we do not customize: mingw is special # according to scons, don't ask me why, but this does not work as expected # for this tool. @@ -263,6 +241,43 @@ finalize_env(env) + # Add the tool paths in the environment + if not env['ENV'].has_key('PATH'): + env['ENV']['PATH'] = os.pathsep.join(path_list) + else: + env['ENV']['PATH'] = os.pathsep.join(path_list + env['ENV']['PATH'].split(os.pathsep)) + + # XXX: Really, we should use our own subclass of Environment, instead of + # adding Numpy* functions ! + + #--------------- + # Misc + #--------------- + + # Put config code and log in separate dir for each subpackage + from utils import curry + NumpyConfigure = curry(env.Configure, + conf_dir = pjoin(env['build_dir'], '.sconf'), + log_file = pjoin(env['build_dir'], 'config.log')) + env.NumpyConfigure = NumpyConfigure + + # XXX: Huge, ugly hack ! SConsign needs an absolute path or a path relative + # to where the SConstruct file is. We have to find the path of the build + # dir relative to the src_dir: we add n .., where n is the number of + # occurances of the path separator in the src dir. + def get_build_relative_src(srcdir, builddir): + n = srcdir.count(os.sep) + if len(srcdir) > 0 and not srcdir == '.': + n += 1 + return pjoin(os.sep.join([os.pardir for i in range(n)]), builddir) + + sconsign = pjoin(get_build_relative_src(env['src_dir'], + env['build_dir']), + '.sconsign.dblite') + env.SConsignFile(sconsign) + + # Add HOME in the environment: some tools seem to require it (Intel + # compiler, for licenses stuff) try: env['ENV']['HOME'] = os.environ['HOME'] except KeyError: From numpy-svn at scipy.org Thu Nov 15 00:58:15 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 14 Nov 2007 23:58:15 -0600 (CST) Subject: [Numpy-svn] r4456 - in branches/numpy.scons: . numpy/distutils/scons/core numpy/distutils/scons/tools Message-ID: <20071115055815.B6F5639C064@new.scipy.org> Author: cdavid Date: 2007-11-14 23:57:42 -0600 (Wed, 14 Nov 2007) New Revision: 4456 Added: branches/numpy.scons/numpy/distutils/scons/tools/f2py.py Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py branches/numpy.scons/test.sh Log: Add f2py tool for scons, to build source from .pyf files Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-14 07:34:10 UTC (rev 4455) +++ branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-15 05:57:42 UTC (rev 4456) @@ -14,8 +14,11 @@ from libinfo import get_config from extension_scons import PythonExtension, built_with_mstools +import numpy.distutils.scons.tools from numpy.distutils.scons.tools.substinfile import TOOL_SUBST +__all__ = ['GetNumpyEnvironment'] + def pyplat2sconsplat(): # XXX: should see how env['PLATFORM'] is defined, make this a dictionary if sys.platform[:5] == 'linux': @@ -118,7 +121,7 @@ # XXX: how to handle tools which are not in standard location ? Is adding # the full path of the compiler enough ? (I am sure some compilers also # need LD_LIBRARY_SHARED and other variables to be set, too....) - from SCons.Tool import Tool + from SCons.Tool import Tool, FindTool if len(env['cc_opt']) > 0: try: @@ -149,14 +152,13 @@ raise AssertionError("SCONS: Could not initialize tool ? Error is %s" % \ str(e)) else: - t = Tool(FindTool(DEF_C_COMPILERS)) + t = Tool(FindTool(DEF_C_COMPILERS, env)) t(env) customize_cc(t.name, env) def initialize_f77(env, path_list): - from SCons.Tool import Tool + from SCons.Tool import Tool, FindTool - # F77 compiler if len(env['f77_opt']) > 0: try: if len(env['f77_opt_path']) > 0: @@ -239,6 +241,9 @@ for t in FindAllTools(DEF_OTHER_TOOLS, env): Tool(t)(env) + t = Tool('f2py', toolpath = [os.path.dirname(numpy.distutils.scons.tools.__file__)]) + t(env) + finalize_env(env) # Add the tool paths in the environment Added: branches/numpy.scons/numpy/distutils/scons/tools/f2py.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/tools/f2py.py 2007-11-14 07:34:10 UTC (rev 4455) +++ branches/numpy.scons/numpy/distutils/scons/tools/f2py.py 2007-11-15 05:57:42 UTC (rev 4456) @@ -0,0 +1,86 @@ +"""f2py Tool + +Tool-specific initialization for f2py. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +import os.path +import re + +import SCons.Action +import SCons.Defaults +import SCons.Scanner +import SCons.Tool +import SCons.Util +import SCons.Node + +def _f2pySuffixEmitter(env, source): + return '$F2PYCFILESUFFIX' + +#_reModule = re.compile(r'%module\s+(.+)') + +def _f2pyEmitter(target, source, env): + build_dir = os.path.dirname(str(target[0])) + target.append(SCons.Node.FS.default_fs.Entry(os.path.join(build_dir, 'fortranobject.c'))) + target.append(SCons.Node.FS.default_fs.Entry(os.path.join(build_dir, 'fortranobject.h'))) + return (target, source) + +def _pyf2c(target, source, env): + import numpy.f2py + import shutil + + # We need filenames from source/target for path handling + target_file_names = [str(i) for i in target] + source_file_names = [str(i) for i in source] + + # Get source files necessary for f2py generated modules + d = os.path.dirname(numpy.f2py.__file__) + source_c = os.path.join(d,'src','fortranobject.c') + source_h = os.path.join(d,'src','fortranobject.h') + + # XXX: scons has a way to force buidler to only use one source file + if len(source_file_names) > 1: + raise "YATA" + + # Copy source files for f2py generated modules in the build dir + build_dir = os.path.dirname(target_file_names[0]) + shutil.copy(source_c, build_dir) + shutil.copy(source_h, build_dir) + + # Generate the source file from pyf description + haha = numpy.f2py.run_main(['--build-dir', build_dir, + source_file_names[0]]) + return 0 + +def generate(env): + """Add Builders and construction variables for swig to an Environment.""" + c_file, cxx_file = SCons.Tool.createCFileBuilders(env) + + c_file.suffix['.pyf'] = _f2pySuffixEmitter + + c_file.add_action('.pyf', SCons.Action.Action(_pyf2c)) + c_file.add_emitter('.pyf', _f2pyEmitter) + + env['F2PYOPTIONS'] = SCons.Util.CLVar('') + env['F2PYBUILDDIR'] = '' + env['F2PYCFILESUFFIX'] = 'module$CFILESUFFIX' + + # XXX: scanner ? + + #expr = '^[ \t]*%[ \t]*(?:include|import|extern)[ \t]*(<|"?)([^>\s"]+)(?:>|"?)' + #scanner = SCons.Scanner.ClassicCPP("SWIGScan", ".i", "SWIGPATH", expr) + #env.Append(SCANNERS = scanner) + +def exists(env): + try: + import numpy.f2py + st = 1 + except ImportError, e: + print "Warning : f2py tool not found, error was %s" % e + st = 0 + + return st Modified: branches/numpy.scons/test.sh =================================================================== --- branches/numpy.scons/test.sh 2007-11-14 07:34:10 UTC (rev 4455) +++ branches/numpy.scons/test.sh 2007-11-15 05:57:42 UTC (rev 4456) @@ -1,5 +1,12 @@ +# PREFIX=$PWD +# rm -rf $PREFIX/build +# rm -rf $PREFIX/tmp +# MKL=None python setupscons.py scons --jobs=4 install --prefix=$PREFIX/tmp +# (cd $PREFIX/tmp && PYTHONPATH=$PREFIX/tmp/lib/python2.5/site-packages python -c "import numpy; print numpy; numpy.test(level = 9999); numpy.show_config()") + PREFIX=$PWD -rm -rf $PREFIX/build -rm -rf $PREFIX/tmp -MKL=None python setup.py scons --jobs=4 install --prefix=$PREFIX/tmp -(cd $PREFIX/tmp && PYTHONPATH=$PREFIX/tmp/lib/python2.5/site-packages python -c "import numpy; print numpy; numpy.test(level = 9999); numpy.show_config()") +#rm -rf $PREFIX/build +#rm -rf $PREFIX/tmp +MKL=None python setupscons.py scons --jobs=4 --silent=2 install --prefix=$PREFIX/tmp +(cd $PREFIX/tmp/lib/python2.5/site-packages/numpy/distutils/scons/tests/f2pyext/ && \ + PYTHONPATH=$PREFIX/tmp/lib/python2.5/site-packages python setup.py scons) From numpy-svn at scipy.org Thu Nov 15 01:00:50 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 15 Nov 2007 00:00:50 -0600 (CST) Subject: [Numpy-svn] r4457 - in branches/numpy.scons/numpy/distutils/scons/tests: . f2pyext Message-ID: <20071115060050.01CA039C09F@new.scipy.org> Author: cdavid Date: 2007-11-15 00:00:42 -0600 (Thu, 15 Nov 2007) New Revision: 4457 Added: branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/ branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/SConstruct branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/setup.py branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/spam.pyf Log: Add a basic test for f2py Added: branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/SConstruct =================================================================== --- branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/SConstruct 2007-11-15 05:57:42 UTC (rev 4456) +++ branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/SConstruct 2007-11-15 06:00:42 UTC (rev 4457) @@ -0,0 +1,8 @@ +# vim:syntax=python +from numpy.distutils.scons import GetNumpyEnvironment +from numpy.distutils.misc_util import get_numpy_include_dirs + +env = GetNumpyEnvironment(ARGUMENTS) + +env.Append(CPPPATH = get_numpy_include_dirs()) +env.NumpyPythonExtension('spam', source = ['spam.pyf']) Added: branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/setup.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/setup.py 2007-11-15 05:57:42 UTC (rev 4456) +++ branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/setup.py 2007-11-15 06:00:42 UTC (rev 4457) @@ -0,0 +1,13 @@ +import os +import os.path + +def configuration(parent_package='',top_path=None): + from numpy.distutils.misc_util import Configuration + config = Configuration('f2pyext',parent_package,top_path) + + config.add_sconscript('SConstruct', source_files = ['spam.pyf.c']) + return config + +if __name__ == '__main__': + from numpy.distutils.core import setup + setup(configuration=configuration) Added: branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/spam.pyf =================================================================== --- branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/spam.pyf 2007-11-15 05:57:42 UTC (rev 4456) +++ branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/spam.pyf 2007-11-15 06:00:42 UTC (rev 4457) @@ -0,0 +1,19 @@ +! -*- f90 -*- +python module spam + usercode ''' + static char doc_spam_system[] = "Execute a shell command."; + static PyObject *spam_system(PyObject *self, PyObject *args) + { + char *command; + int sts; + + if (!PyArg_ParseTuple(args, "s", &command)) + return NULL; + sts = system(command); + return Py_BuildValue("i", sts); + } + ''' + pymethoddef ''' + {"system", spam_system, METH_VARARGS, doc_spam_system}, + ''' +end python module spam From numpy-svn at scipy.org Thu Nov 15 05:06:33 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 15 Nov 2007 04:06:33 -0600 (CST) Subject: [Numpy-svn] r4458 - branches/numpy.scons/numpy/distutils Message-ID: <20071115100633.E49F5C7C041@new.scipy.org> Author: cdavid Date: 2007-11-15 04:06:28 -0600 (Thu, 15 Nov 2007) New Revision: 4458 Modified: branches/numpy.scons/numpy/distutils/misc_util.py Log: hack to correctly initialize scons command Modified: branches/numpy.scons/numpy/distutils/misc_util.py =================================================================== --- branches/numpy.scons/numpy/distutils/misc_util.py 2007-11-15 06:00:42 UTC (rev 4457) +++ branches/numpy.scons/numpy/distutils/misc_util.py 2007-11-15 10:06:28 UTC (rev 4458) @@ -1203,11 +1203,17 @@ full_source_files)) self.warn('distutils distribution has been initialized,'\ ' it may be too late to add a subpackage '+ subpackage_name) + # XXX: we add a fake extension, to correctly initialize some + # options in distutils command. + dist.add_extension('', sources = []) else: self.scons_data.append((fullsconsname, pre_hook, post_hook, full_source_files)) + # XXX: we add a fake extension, to correctly initialize some + # options in distutils command. + self.add_extension('', sources = []) def add_scripts(self,*files): """Add scripts to configuration. From numpy-svn at scipy.org Thu Nov 15 05:21:51 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 15 Nov 2007 04:21:51 -0600 (CST) Subject: [Numpy-svn] r4459 - in branches/numpy.scons/numpy: core distutils Message-ID: <20071115102151.8D69939C1E9@new.scipy.org> Author: cdavid Date: 2007-11-15 04:21:46 -0600 (Thu, 15 Nov 2007) New Revision: 4459 Modified: branches/numpy.scons/numpy/core/setup.py branches/numpy.scons/numpy/distutils/setup.py Log: Correctly add numpyconfig.h to the public header list for distutils build Modified: branches/numpy.scons/numpy/core/setup.py =================================================================== --- branches/numpy.scons/numpy/core/setup.py 2007-11-15 10:06:28 UTC (rev 4458) +++ branches/numpy.scons/numpy/core/setup.py 2007-11-15 10:21:46 UTC (rev 4459) @@ -156,7 +156,7 @@ 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((header_dir,target)) return target def generate_numpyconfig_h(ext, build_dir): @@ -190,6 +190,7 @@ print target_f.read() target_f.close() print 'EOF' + config.add_data_files((header_dir,target)) return target def generate_api_func(module_name): Modified: branches/numpy.scons/numpy/distutils/setup.py =================================================================== --- branches/numpy.scons/numpy/distutils/setup.py 2007-11-15 10:06:28 UTC (rev 4458) +++ branches/numpy.scons/numpy/distutils/setup.py 2007-11-15 10:21:46 UTC (rev 4459) @@ -7,6 +7,7 @@ config.add_subpackage('scons') config.add_subpackage('fcompiler') config.add_data_dir('tests') + config.add_data_dir('scons-local') config.add_data_files('site.cfg') config.make_config_py() return config From numpy-svn at scipy.org Thu Nov 15 05:42:55 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 15 Nov 2007 04:42:55 -0600 (CST) Subject: [Numpy-svn] r4460 - in branches/numpy.scons/numpy/distutils: . command scons/core Message-ID: <20071115104255.8A11139C2E5@new.scipy.org> Author: cdavid Date: 2007-11-15 04:42:48 -0600 (Thu, 15 Nov 2007) New Revision: 4460 Modified: branches/numpy.scons/numpy/distutils/command/scons.py branches/numpy.scons/numpy/distutils/misc_util.py branches/numpy.scons/numpy/distutils/numpy_distribution.py branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py Log: Add pkg_name in scons data in distutils distribution, for correct installation in sub package only build Modified: branches/numpy.scons/numpy/distutils/command/scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/scons.py 2007-11-15 10:21:46 UTC (rev 4459) +++ branches/numpy.scons/numpy/distutils/command/scons.py 2007-11-15 10:42:48 UTC (rev 4460) @@ -150,10 +150,12 @@ self.sconscripts = self.distribution.get_scons_scripts() self.pre_hooks = self.distribution.get_scons_pre_hooks() self.post_hooks = self.distribution.get_scons_post_hooks() + self.pkg_names = self.distribution.get_scons_parent_names() else: self.sconscripts = [] self.pre_hooks = [] self.post_hooks = [] + self.pkg_names = [] # Try to get the same compiler than the ones used by distutils: this is # non trivial because distutils and scons have totally different @@ -207,8 +209,9 @@ scons_exec = get_python_exec_invoc() scons_exec += ' ' + protect_path(pjoin(get_scons_local_path(), 'scons.py')) - for sconscript, pre_hook, post_hook in zip(self.sconscripts, - self.pre_hooks, self.post_hooks): + for sconscript, pre_hook, post_hook, pkg_name in zip(self.sconscripts, + self.pre_hooks, self.post_hooks, + self.pkg_names): if pre_hook: pre_hook() @@ -216,6 +219,7 @@ if self.jobs: cmd.append(" --jobs=%d" % int(self.jobs)) cmd.append('src_dir="%s"' % pdirname(sconscript)) + cmd.append('pkg_name="%s"' % pkg_name) cmd.append('distutils_libdir=%s' % protect_path(pjoin(self.build_lib, pdirname(sconscript)))) Modified: branches/numpy.scons/numpy/distutils/misc_util.py =================================================================== --- branches/numpy.scons/numpy/distutils/misc_util.py 2007-11-15 10:21:46 UTC (rev 4459) +++ branches/numpy.scons/numpy/distutils/misc_util.py 2007-11-15 10:42:48 UTC (rev 4460) @@ -1200,7 +1200,8 @@ dist.scons_data.append((fullsconsname, pre_hook, post_hook, - full_source_files)) + full_source_files, + parent_name)) self.warn('distutils distribution has been initialized,'\ ' it may be too late to add a subpackage '+ subpackage_name) # XXX: we add a fake extension, to correctly initialize some @@ -1210,7 +1211,8 @@ self.scons_data.append((fullsconsname, pre_hook, post_hook, - full_source_files)) + full_source_files, + parent_name)) # XXX: we add a fake extension, to correctly initialize some # options in distutils command. self.add_extension('', sources = []) Modified: branches/numpy.scons/numpy/distutils/numpy_distribution.py =================================================================== --- branches/numpy.scons/numpy/distutils/numpy_distribution.py 2007-11-15 10:21:46 UTC (rev 4459) +++ branches/numpy.scons/numpy/distutils/numpy_distribution.py 2007-11-15 10:42:48 UTC (rev 4460) @@ -24,3 +24,5 @@ def get_scons_sources(self): return [i[3] for i in self.scons_data] + def get_scons_parent_names(self): + return [i[4] for i in self.scons_data] Modified: branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py 2007-11-15 10:21:46 UTC (rev 4459) +++ branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py 2007-11-15 10:42:48 UTC (rev 4460) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Mon Nov 12 07:00 PM 2007 J +# Last Change: Thu Nov 15 07:00 PM 2007 J # Module for support to build python extension. scons specific code goes here. import sys @@ -87,7 +87,7 @@ # XXX: When those should be used ? (which version of Mac OS X ?) LINKFLAGS += ' -undefined dynamic_lookup ' else: - pass + pass # Use LoadableModule because of Mac OS X # ... but scons has a bug (#issue 1669) with mingw and Loadable From numpy-svn at scipy.org Thu Nov 15 23:35:51 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 15 Nov 2007 22:35:51 -0600 (CST) Subject: [Numpy-svn] r4461 - in branches/numpy.scons/numpy/distutils: command scons/core Message-ID: <20071116043551.3C46D39C12D@new.scipy.org> Author: cdavid Date: 2007-11-15 22:35:30 -0600 (Thu, 15 Nov 2007) New Revision: 4461 Modified: branches/numpy.scons/numpy/distutils/command/scons.py branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py branches/numpy.scons/numpy/distutils/scons/core/utils.py Log: Correctly set path to install scons-built libraries into distutils path Modified: branches/numpy.scons/numpy/distutils/command/scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/command/scons.py 2007-11-15 10:42:48 UTC (rev 4460) +++ branches/numpy.scons/numpy/distutils/command/scons.py 2007-11-16 04:35:30 UTC (rev 4461) @@ -220,8 +220,9 @@ cmd.append(" --jobs=%d" % int(self.jobs)) cmd.append('src_dir="%s"' % pdirname(sconscript)) cmd.append('pkg_name="%s"' % pkg_name) - cmd.append('distutils_libdir=%s' % protect_path(pjoin(self.build_lib, - pdirname(sconscript)))) + #cmd.append('distutils_libdir=%s' % protect_path(pjoin(self.build_lib, + # pdirname(sconscript)))) + cmd.append('distutils_libdir=%s' % protect_path(pjoin(self.build_lib))) if not self._bypass_distutils_cc: cmd.append('cc_opt=%s' % self.scons_compiler) Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-15 10:42:48 UTC (rev 4460) +++ branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-16 04:35:30 UTC (rev 4461) @@ -13,6 +13,7 @@ from custom_builders import NumpySharedLibrary, NumpyCtypes, NumpyPythonExtension from libinfo import get_config from extension_scons import PythonExtension, built_with_mstools +from utils import pkg_to_path import numpy.distutils.scons.tools from numpy.distutils.scons.tools.substinfile import TOOL_SUBST @@ -206,7 +207,7 @@ # Setting dirs according to command line options env.AppendUnique(build_dir = pjoin(env['build_prefix'], env['src_dir'])) env.AppendUnique(distutils_installdir = pjoin(env['distutils_libdir'], - env['pkg_name'])) + pkg_to_path(env['pkg_name']))) #------------------------------------------------ # Setting tools according to command line options Modified: branches/numpy.scons/numpy/distutils/scons/core/utils.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/utils.py 2007-11-15 10:42:48 UTC (rev 4460) +++ branches/numpy.scons/numpy/distutils/scons/core/utils.py 2007-11-16 04:35:30 UTC (rev 4461) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Mon Oct 29 07:00 PM 2007 J +# Last Change: Fri Nov 16 01:00 PM 2007 J # This module defines various utilities used throughout the scons support # library. @@ -39,6 +39,12 @@ return status, out +def pkg_to_path(pkg_name): + """Given a python package name, returns its path from the root. + + Example: numpy.core becomes numpy/core.""" + return os.sep.join(pkg_name.split('.')) + def get_empty(dict, key): """Assuming dict is a dictionary with lists as values, returns an empty list if key is not found, or a (deep) copy of the existing value if it From numpy-svn at scipy.org Fri Nov 16 04:08:49 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 16 Nov 2007 03:08:49 -0600 (CST) Subject: [Numpy-svn] r4462 - in branches/numpy.scons/numpy: distutils/scons distutils/scons/checkers linalg scons_fake/checkers Message-ID: <20071116090849.86C1B39C31E@new.scipy.org> Author: cdavid Date: 2007-11-16 03:08:18 -0600 (Fri, 16 Nov 2007) New Revision: 4462 Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py branches/numpy.scons/numpy/distutils/scons/checkers/__init__.py branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py branches/numpy.scons/numpy/distutils/scons/checkers/support.py branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py branches/numpy.scons/numpy/linalg/SConstruct branches/numpy.scons/numpy/scons_fake/checkers/SConstruct Log: Improve lapack and blas checkers, make the difference between C and F77 blas/lapack Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-11-16 04:35:30 UTC (rev 4461) +++ branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-11-16 09:08:18 UTC (rev 4462) @@ -4,7 +4,7 @@ from core.extension import get_python_inc, get_pythonlib_dir from core.utils import isstring, rsplit -from checkers import CheckCBLAS, CheckLAPACK +from checkers import CheckCBLAS, CheckCLAPACK, CheckF77BLAS, CheckF77LAPACK from fortran_scons import CheckF77Verbose, CheckF77Clib, CheckF77Mangling # XXX: this is ugly, better find the mathlibs with a checker Modified: branches/numpy.scons/numpy/distutils/scons/checkers/__init__.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/__init__.py 2007-11-16 04:35:30 UTC (rev 4461) +++ branches/numpy.scons/numpy/distutils/scons/checkers/__init__.py 2007-11-16 09:08:18 UTC (rev 4462) @@ -1 +1 @@ -from custom_checkers import CheckLAPACK, CheckCBLAS +from custom_checkers import CheckCLAPACK, CheckCBLAS, CheckF77BLAS, CheckF77LAPACK Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-16 04:35:30 UTC (rev 4461) +++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-16 09:08:18 UTC (rev 4462) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Mon Nov 12 07:00 PM 2007 J +# Last Change: Fri Nov 16 05:00 PM 2007 J # Module for custom, common checkers for numpy (and scipy) import sys @@ -9,7 +9,7 @@ from numpy.distutils.scons.core.libinfo import get_config_from_section, get_config from numpy.distutils.scons.testcode_snippets import cblas_sgemm as cblas_src, \ - c_sgemm as sunperf_src, lapack_sgesv + c_sgemm as sunperf_src, lapack_sgesv, blas_sgemm, c_sgemm2 from numpy.distutils.scons.fortran_scons import CheckF77Mangling, CheckF77Clib from numpy.distutils.scons.configuration import add_info from numpy.distutils.scons.core.utils import rsplit @@ -34,6 +34,17 @@ # XXX: rpath vs LD_LIBRARY_PATH ? env = context.env + def check(func, name, suplibs): + st, res = func(context, autoadd) + if st: + for lib in suplibs: + res.cfgopts['libs'].insert(0, lib) + st = check_include_and_run(context, 'CBLAS (%s)' % name, + res.cfgopts, [], cblas_src, autoadd) + if st: + add_info(env, 'cblas', res) + return st + # If section cblas is in site.cfg, use those options. Otherwise, use default section = "cblas" siteconfig, cfgfiles = get_config() @@ -48,20 +59,13 @@ return st else: if sys.platform == 'darwin': - st, res = CheckAccelerate(context, autoadd) + # Check Accelerate + st = check(CheckAccelerate, 'Accelerate Framework', []) if st: - st = check_include_and_run(context, 'CBLAS (Accelerate Framework)', - res.cfgopts, [], cblas_src, autoadd) - if st: - add_info(env, 'cblas', res) return st - st, res = CheckVeclib(context, autoadd) + st = check(CheckVeclib, 'vecLib Framework', []) if st: - st = check_include_and_run(context, 'CBLAS (vecLib Framework)', - res.cfgopts, [], cblas_src, autoadd) - if st: - add_info(env, 'cblas', res) return st add_info(env, 'cblas', 'Def numpy implementation used') @@ -69,38 +73,178 @@ else: # XXX: think about how to share headers info between checkers ? + # Check MKL - st, res = CheckMKL(context, autoadd) + st = check(CheckMKL, 'MKL', []) if st: - st = check_include_and_run(context, 'CBLAS (MKL)', res.cfgopts, - [], cblas_src, autoadd) - if st: - add_info(env, 'cblas', res) return st # Check ATLAS - st, res = CheckATLAS(context, autoadd) + st = check(CheckATLAS, 'ATLAS', ['blas']) if st: - res.cfgopts['libs'].insert(0, 'blas') - st = check_include_and_run(context, 'CBLAS (ATLAS)', res.cfgopts, - [], cblas_src, autoadd) - if st: - add_info(env, 'cblas', res) return st # Check Sunperf - st, res = CheckSunperf(context, autoadd) + st = check(CheckSunperf, 'Sunperf', []) if st: - st = check_include_and_run(context, 'CBLAS (Sunperf)', res.cfgopts, - [], cblas_src, autoadd) - if st: - add_info(env, 'cblas', res) return st add_info(env, 'cblas', 'Def numpy implementation used') return 0 -def CheckLAPACK(context, autoadd = 1): +def CheckF77BLAS(context, autoadd = 1): + """This checker tries to find optimized library for blas (fortran F77). + + This test is pretty strong: it first detects an optimized library, and then + tests that a simple blas program (in C) can be run using this (F77) lib. + + It looks for the following libs: + - Mac OS X: Accelerate, and then vecLib. + - Others: MKL, then ATLAS, then Sunperf.""" + # XXX: rpath vs LD_LIBRARY_PATH ? + env = context.env + + + # Get Fortran things we need + if not env.has_key('F77_NAME_MANGLER'): + if not CheckF77Mangling(context): + return 0 + func_name = env['F77_NAME_MANGLER']('sgemm') + test_src = c_sgemm2 % {'func' : func_name} + + #if not env.has_key('F77_LDFLAGS'): + # if not CheckF77Clib(context): + # return 0 + + + def check(func, name, suplibs): + st, res = func(context, autoadd) + if st: + for lib in suplibs: + res.cfgopts['libs'].insert(0, lib) + st = check_include_and_run(context, 'BLAS (%s)' % name, res.cfgopts, + [], test_src, autoadd) + if st: + add_info(env, 'blas', res) + return st + + # If section blas is in site.cfg, use those options. Otherwise, use default + section = "blas" + siteconfig, cfgfiles = get_config() + (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) + if found: + cfg = ConfigOpts(cpppath = cpppath, libs = libs, libpath = libpath, + rpath = libpath) + st = check_include_and_run(context, 'BLAS (from site.cfg) ', cfg, + [], test_src, autoadd) + if st: + add_info(env, 'blas', ConfigRes('blas', cfg, found)) + return st + else: + if sys.platform == 'darwin': + return 0 + else: + # Check MKL + st = check(CheckMKL, 'MKL', []) + if st: + return st + + # Check ATLAS + st = check(CheckATLAS, 'ATLAS', ['f77blas']) + if st: + return st + + # Check Sunperf + st = check(CheckSunperf, 'Sunperf', []) + if st: + return st + + return 0 + +def CheckF77LAPACK(context, autoadd = 1): + """This checker tries to find optimized library for F77 lapack. + + This test is pretty strong: it first detects an optimized library, and then + tests that a simple (C) program can be run using this (F77) lib. + + It looks for the following libs: + - Mac OS X: Accelerate, and then vecLib. + - Others: MKL, then ATLAS.""" + env = context.env + + if not env.has_key('F77_NAME_MANGLER'): + if not CheckF77Mangling(context): + add_info(env, 'lapack', 'Def numpy implementation used') + return 0 + + # Get the mangled name of our test function + sgesv_string = env['F77_NAME_MANGLER']('sgesv') + test_src = lapack_sgesv % sgesv_string + + def check(func, name, suplibs): + st, res = func(context, autoadd) + if st: + for lib in suplibs: + res.cfgopts['libs'].insert(0, lib) + st = check_include_and_run(context, 'LAPACK (%s)' % name, res.cfgopts, + [], test_src, autoadd) + if st: + add_info(env, 'lapack', res) + return st + + # If section lapack is in site.cfg, use those options. Otherwise, use default + section = "lapack" + siteconfig, cfgfiles = get_config() + (cpppath, libs, libpath), found = get_config_from_section(siteconfig, section) + if found: + # XXX: handle def library names correctly + if len(libs) == 1 and len(libs[0]) == 0: + libs = ['lapack', 'blas'] + cfg = ConfigOpts(cpppath = cpppath, libs = libs, libpath = libpath, + rpath = deepcopy(libpath)) + + # fortrancfg is used to merge info from fortran checks and site.cfg + fortrancfg = deepcopy(cfg) + fortrancfg['linkflags'].extend(env['F77_LDFLAGS']) + + st = check_include_and_run(context, 'LAPACK (from site.cfg) ', fortrancfg, + [], test_src, autoadd) + if st: + add_info(env, 'lapack', ConfigRes('lapack', cfg, found)) + return st + else: + if sys.platform == 'darwin': + st = check(CheckAccelerate, 'Accelerate Framework', []) + if st: + return st + + st = check(CheckVeclib, 'vecLib Framework', []) + if st: + return st + + add_info(env, 'lapack: def numpy implementation', opts) + return 0 + else: + # Check MKL + # XXX: handle different versions of mkl (with different names) + st = check(CheckMKL, 'MKL', ['lapack']) + if st: + return st + + # Check ATLAS + st = check(CheckMKL, 'ATLAS', ['lapack']) + if st: + return st + + # Check Sunperf + st = check(CheckMKL, 'Sunperf', ['lapack']) + if st: + return st + + add_info(env, 'lapack', 'Def numpy implementation used') + return 0 + +def CheckCLAPACK(context, autoadd = 1): """This checker tries to find optimized library for lapack. This test is pretty strong: it first detects an optimized library, and then @@ -109,6 +253,9 @@ It looks for the following libs: - Mac OS X: Accelerate, and then vecLib. - Others: MKL, then ATLAS.""" + context.Message('Checking CLAPACK ...') + context.Result('FIXME: not implemented yet') + return 0 env = context.env # If section lapack is in site.cfg, use those options. Otherwise, use default @@ -122,8 +269,8 @@ cfg = ConfigOpts(cpppath = cpppath, libs = libs, libpath = libpath, rpath = deepcopy(libpath)) - # XXX: How to know whether we need fortran or not - # ? + # XXX: How to know whether we need fortran or not + # ? if not env.has_key('F77_NAME_MANGLER'): if not CheckF77Mangling(context): return 0 Modified: branches/numpy.scons/numpy/distutils/scons/checkers/support.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/support.py 2007-11-16 04:35:30 UTC (rev 4461) +++ branches/numpy.scons/numpy/distutils/scons/checkers/support.py 2007-11-16 09:08:18 UTC (rev 4462) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Tue Nov 06 01:00 PM 2007 J +# Last Change: Fri Nov 16 04:00 PM 2007 J # This module defines some helper functions, to be used by high level checkers @@ -216,3 +216,37 @@ context.Result(ret) return ret + +def check_run_f77(context, name, opts, run_src, autoadd = 1): + """This is a basic implementation for generic "run" testers. + + For example, for library foo, which implements function do_foo + - test that the given source code can be compiled. The source code + should contain a simple program with the function. + + Arguments: + - name: name of the library.""" + + context.Message('Checking for %s ... ' % name) + env = context.env + + #------------------------------ + # Check a simple example works + #------------------------------ + saved = save_and_set(env, opts) + try: + # HACK: we add libpath and libs at the end of the source as a comment, to + # add dependency of the check on those. + src = '\n'.join([run_src] + [r'* %s' % s for s in str(opts).split('\n')]) + ret, out = context.TryRun(src, '.f') + finally: + if (not ret or not autoadd): + # If test failed or autoadd is disabled, restore everything + restore(env, saved) + + if not ret: + context.Result('Failed: %s test could not be linked and run' % name) + return 0 + + context.Result(ret) + return ret Modified: branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py 2007-11-16 04:35:30 UTC (rev 4461) +++ branches/numpy.scons/numpy/distutils/scons/testcode_snippets.py 2007-11-16 09:08:18 UTC (rev 4462) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Tue Nov 06 04:00 PM 2007 J +# Last Change: Fri Nov 16 04:00 PM 2007 J # This module should contains useful test code (as strings). They are mainly # useful for checkers who need to run the tests (to check the mere presence of @@ -110,3 +110,66 @@ return compare(B, X, 4); } """ + +# Simple test of blas (pure F77 program) +blas_sgemm = """ + program dot_main + real x(2, 2), y(2, 2), z(2, 2) + real sgemm, res, alpha + integer n, m, k, incx, incy, i + external sgemm + n = 2 + m = 2 + k = 2 + alpha = 1 + + x(1, 1) = 1 + x(2, 1) = 2 + x(1, 2) = 3 + x(2, 2) = 4 + + y(1, 1) = 1 + y(2, 1) = -2 + y(1, 2) = -1 + y(2, 2) = 2 + res = sgemm('n', 'n', n, m, k, alpha, x, n, y, n, 0, z, n) +c z should be ((-5, 5), (-6, 6)) +c print*, 'sgemm = ', z(1, 1), z(1, 2) +c print*, ' ', z(2, 1), z(2, 2) + end +""" + +# Check whether calling sgemm from C works (FOLLOW FORTRAN CONVENTION !). +c_sgemm2 = r""" +#include + +int +main (void) +{ + char transa = 'N', transb = 'N'; + int lda = 2; + int ldb = 3; + int n = 2, m = 2, k = 3; + float alpha = 1.0, beta = 0.0; + + float A[] = {1, 4, + 2, 5, + 3, 6}; + + float B[] = {1, 3, 5, + 2, 4, 6}; + int ldc = 2; + float C[] = { 0.00, 0.00, + 0.00, 0.00 }; + + /* Compute C = A B */ + %(func)s(&transa, &transb, &n, &m, &k, + &alpha, A, &lda, B, &ldb, &beta, C, &ldc); + + printf("C = {%%f, %%f; %%f, %%f}\n", C[0], C[2], C[1], C[3]); + return 0; +} +""" + +if __name__ == '__main__': + pass Modified: branches/numpy.scons/numpy/linalg/SConstruct =================================================================== --- branches/numpy.scons/numpy/linalg/SConstruct 2007-11-16 04:35:30 UTC (rev 4461) +++ branches/numpy.scons/numpy/linalg/SConstruct 2007-11-16 09:08:18 UTC (rev 4462) @@ -1,18 +1,18 @@ -# Last Change: Tue Nov 13 11:00 PM 2007 J +# Last Change: Fri Nov 16 05:00 PM 2007 J # vim:syntax=python import os.path from numpy.distutils.misc_util import get_numpy_include_dirs, get_mathlibs from numpy.distutils.scons import GetNumpyEnvironment, scons_get_paths, \ scons_get_mathlib -from numpy.distutils.scons import CheckLAPACK +from numpy.distutils.scons import CheckF77LAPACK from numpy.distutils.scons.configuration import write_info env = GetNumpyEnvironment(ARGUMENTS) env.Append(CPPPATH = scons_get_paths(env['include_bootstrap'])) config = env.NumpyConfigure(custom_tests = - {'CheckLAPACK' : CheckLAPACK}) + {'CheckLAPACK' : CheckF77LAPACK}) use_lapack = config.CheckLAPACK() Modified: branches/numpy.scons/numpy/scons_fake/checkers/SConstruct =================================================================== --- branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-11-16 04:35:30 UTC (rev 4461) +++ branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-11-16 09:08:18 UTC (rev 4462) @@ -2,7 +2,8 @@ from numpy.distutils.scons import GetNumpyEnvironment from numpy.distutils.scons.checkers.perflib import \ CheckATLAS, CheckAccelerate, CheckMKL, CheckSunperf -from numpy.distutils.scons.checkers.custom_checkers import CheckCBLAS, CheckLAPACK +from numpy.distutils.scons.checkers.custom_checkers import CheckCBLAS, \ + CheckCLAPACK, CheckF77BLAS, CheckF77LAPACK from numpy.distutils.scons import CheckF77Mangling env = GetNumpyEnvironment(ARGUMENTS) @@ -20,8 +21,10 @@ 'CheckMKL' : CheckMKL, 'CheckAccelerate' : CheckAccelerate, 'CheckCBLAS' : CheckCBLAS, - 'CheckLAPACK' : CheckLAPACK, 'CheckF77Mangling' : CheckF77Mangling, + 'CheckF77BLAS' : CheckF77BLAS, + 'CheckF77LAPACK' : CheckF77LAPACK, + 'CheckCLAPACK' : CheckCLAPACK, 'CheckSunperf' : CheckSunperf}) if do_check == 1: @@ -29,8 +32,10 @@ st, opts = config.CheckMKL(autoadd = 0) st, opts = config.CheckAccelerate(autoadd = 0) st, opts = config.CheckSunperf(autoadd = 0) + st = config.CheckF77BLAS(autoadd = 0) st = config.CheckCBLAS(autoadd = 0) - st = config.CheckLAPACK(autoadd = 0) + st = config.CheckF77LAPACK(autoadd = 0) + st = config.CheckCLAPACK(autoadd = 0) st = config.CheckF77Mangling() if env.has_key('LIBS'): From numpy-svn at scipy.org Fri Nov 16 06:28:10 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 16 Nov 2007 05:28:10 -0600 (CST) Subject: [Numpy-svn] r4463 - branches/numpy.scons/numpy/distutils/scons/checkers Message-ID: <20071116112810.B623339C350@new.scipy.org> Author: cdavid Date: 2007-11-16 05:28:06 -0600 (Fri, 16 Nov 2007) New Revision: 4463 Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py Log: Correct perflib calls in CheckLAPACK Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-16 09:08:18 UTC (rev 4462) +++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-16 11:28:06 UTC (rev 4463) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Fri Nov 16 05:00 PM 2007 J +# Last Change: Fri Nov 16 06:00 PM 2007 J # Module for custom, common checkers for numpy (and scipy) import sys @@ -104,7 +104,6 @@ # XXX: rpath vs LD_LIBRARY_PATH ? env = context.env - # Get Fortran things we need if not env.has_key('F77_NAME_MANGLER'): if not CheckF77Mangling(context): @@ -112,11 +111,6 @@ func_name = env['F77_NAME_MANGLER']('sgemm') test_src = c_sgemm2 % {'func' : func_name} - #if not env.has_key('F77_LDFLAGS'): - # if not CheckF77Clib(context): - # return 0 - - def check(func, name, suplibs): st, res = func(context, autoadd) if st: @@ -142,7 +136,14 @@ return st else: if sys.platform == 'darwin': - return 0 + # Check Accelerate + st = check(CheckAccelerate, 'Accelerate Framework', []) + if st: + return st + + st = check(CheckVeclib, 'vecLib Framework', []) + if st: + return st else: # Check MKL st = check(CheckMKL, 'MKL', []) @@ -159,8 +160,10 @@ if st: return st - return 0 + # XXX: Use default values for blas + return 0 + def CheckF77LAPACK(context, autoadd = 1): """This checker tries to find optimized library for F77 lapack. @@ -232,12 +235,12 @@ return st # Check ATLAS - st = check(CheckMKL, 'ATLAS', ['lapack']) + st = check(CheckATLAS, 'ATLAS', ['lapack']) if st: return st # Check Sunperf - st = check(CheckMKL, 'Sunperf', ['lapack']) + st = check(CheckSunperf, 'Sunperf', ['lapack']) if st: return st From numpy-svn at scipy.org Fri Nov 16 06:35:15 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Fri, 16 Nov 2007 05:35:15 -0600 (CST) Subject: [Numpy-svn] r4464 - branches/numpy.scons/numpy/distutils/scons/tools Message-ID: <20071116113515.9A64A39C350@new.scipy.org> Author: cdavid Date: 2007-11-16 05:35:11 -0600 (Fri, 16 Nov 2007) New Revision: 4464 Modified: branches/numpy.scons/numpy/distutils/scons/tools/f2py.py Log: Handle copying errors of fortran source files in f2py tool Modified: branches/numpy.scons/numpy/distutils/scons/tools/f2py.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/tools/f2py.py 2007-11-16 11:28:06 UTC (rev 4463) +++ branches/numpy.scons/numpy/distutils/scons/tools/f2py.py 2007-11-16 11:35:11 UTC (rev 4464) @@ -48,9 +48,18 @@ # Copy source files for f2py generated modules in the build dir build_dir = os.path.dirname(target_file_names[0]) - shutil.copy(source_c, build_dir) - shutil.copy(source_h, build_dir) + # XXX: blah + if build_dir == '': + build_dir = '.' + + try: + shutil.copy(source_c, build_dir) + shutil.copy(source_h, build_dir) + except IOError, e: + msg = "Error while copying fortran source files (error was %s)" % str(e) + raise IOError(msg) + # Generate the source file from pyf description haha = numpy.f2py.run_main(['--build-dir', build_dir, source_file_names[0]]) From numpy-svn at scipy.org Sat Nov 17 19:02:22 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sat, 17 Nov 2007 18:02:22 -0600 (CST) Subject: [Numpy-svn] r4465 - in trunk/numpy/core: src tests Message-ID: <20071118000222.A11EB39C282@new.scipy.org> Author: stefan Date: 2007-11-17 18:00:37 -0600 (Sat, 17 Nov 2007) New Revision: 4465 Modified: trunk/numpy/core/src/multiarraymodule.c trunk/numpy/core/tests/test_regression.py Log: Fix arange output byteorder. Closes ticket #616. Modified: trunk/numpy/core/src/multiarraymodule.c =================================================================== --- trunk/numpy/core/src/multiarraymodule.c 2007-11-16 11:35:11 UTC (rev 4464) +++ trunk/numpy/core/src/multiarraymodule.c 2007-11-18 00:00:37 UTC (rev 4465) @@ -6806,6 +6806,7 @@ funcs->fill(PyArray_DATA(range), length, (PyArrayObject *)range); if (PyErr_Occurred()) goto fail; + finish: if (swap) { PyObject *new; new = PyArray_Byteswap((PyArrayObject *)range, 1); @@ -6814,7 +6815,6 @@ PyArray_DESCR(range) = dtype; /* steals the reference */ } - finish: Py_DECREF(start); Py_DECREF(step); Py_DECREF(next); Modified: trunk/numpy/core/tests/test_regression.py =================================================================== --- trunk/numpy/core/tests/test_regression.py 2007-11-16 11:35:11 UTC (rev 4464) +++ trunk/numpy/core/tests/test_regression.py 2007-11-18 00:00:37 UTC (rev 4465) @@ -748,5 +748,13 @@ new = cPickle.loads(cPickle.dumps(el)) assert_equal(new, el) + def check_arange_non_native_dtype(self, level=rlevel): + """Ticket #616""" + for T in ('>f4',' Author: stefan Date: 2007-11-18 14:49:47 -0600 (Sun, 18 Nov 2007) New Revision: 4466 Modified: trunk/numpy/core/src/arrayobject.c trunk/numpy/core/tests/test_regression.py Log: Fix indexing with booleans (patch by Achim Gaedke). Closes #614. Modified: trunk/numpy/core/src/arrayobject.c =================================================================== --- trunk/numpy/core/src/arrayobject.c 2007-11-18 00:00:37 UTC (rev 4465) +++ trunk/numpy/core/src/arrayobject.c 2007-11-18 20:49:47 UTC (rev 4466) @@ -9336,7 +9336,14 @@ "boolean index array should have 1 dimension"); return -1; } + index = ind->dimensions[0]; + if (index > self->size) { + PyErr_SetString(PyExc_ValueError, + "boolean index array has too many values"); + return -1; + } + strides = ind->strides[0]; dptr = ind->data; PyArray_ITER_RESET(self); Modified: trunk/numpy/core/tests/test_regression.py =================================================================== --- trunk/numpy/core/tests/test_regression.py 2007-11-18 00:00:37 UTC (rev 4465) +++ trunk/numpy/core/tests/test_regression.py 2007-11-18 20:49:47 UTC (rev 4466) @@ -756,5 +756,12 @@ assert_equal(N.arange(0.5,dtype=dt).dtype,dt) assert_equal(N.arange(5,dtype=dt).dtype,dt) + def check_bool_indexing_invalid_nr_elements(self, level=rlevel): + s = N.ones(10,dtype=float) + x = N.array((15,),dtype=float) + def ia(x,s): x[(s>0)]=1.0 + self.failUnlessRaises(ValueError,ia,x,s) + + if __name__ == "__main__": NumpyTest().run() From numpy-svn at scipy.org Sun Nov 18 17:44:32 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 18 Nov 2007 16:44:32 -0600 (CST) Subject: [Numpy-svn] r4467 - in trunk/numpy/core: src tests Message-ID: <20071118224432.B790539C017@new.scipy.org> Author: stefan Date: 2007-11-18 16:44:06 -0600 (Sun, 18 Nov 2007) New Revision: 4467 Modified: trunk/numpy/core/src/arrayobject.c trunk/numpy/core/tests/test_regression.py Log: Fix indexing with array scalar. Closes #603. Modified: trunk/numpy/core/src/arrayobject.c =================================================================== --- trunk/numpy/core/src/arrayobject.c 2007-11-18 20:49:47 UTC (rev 4466) +++ trunk/numpy/core/src/arrayobject.c 2007-11-18 22:44:06 UTC (rev 4467) @@ -3045,8 +3045,7 @@ if ((op == Py_Ellipsis) || PyString_Check(op) || PyUnicode_Check(op)) noellipses = FALSE; else if (PyBool_Check(op) || PyArray_IsScalar(op, Bool) || - (PyArray_Check(op) && (PyArray_DIMS(op)==0) && - PyArray_ISBOOL(op))) + (PyArray_Check(op) && (PyArray_DIMS(op)==0))) noellipses = FALSE; else if (PySequence_Check(op)) { int n, i; Modified: trunk/numpy/core/tests/test_regression.py =================================================================== --- trunk/numpy/core/tests/test_regression.py 2007-11-18 20:49:47 UTC (rev 4466) +++ trunk/numpy/core/tests/test_regression.py 2007-11-18 22:44:06 UTC (rev 4467) @@ -762,6 +762,12 @@ def ia(x,s): x[(s>0)]=1.0 self.failUnlessRaises(ValueError,ia,x,s) + def check_mem_scalar_indexing(self, level=rlevel): + """Ticket #603""" + x = N.array([0],dtype=float) + index = N.array(0,dtype=N.int32) + x[index] + if __name__ == "__main__": NumpyTest().run() From numpy-svn at scipy.org Sun Nov 18 23:17:41 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Sun, 18 Nov 2007 22:17:41 -0600 (CST) Subject: [Numpy-svn] r4468 - in trunk: benchmarks numpy/numarray Message-ID: <20071119041741.A2D5339C22D@new.scipy.org> Author: jarrod.millman Date: 2007-11-18 22:17:36 -0600 (Sun, 18 Nov 2007) New Revision: 4468 Modified: trunk/benchmarks/simpleindex.py trunk/numpy/numarray/numerictypes.py Log: ran reindent.py to cleanup whitespaces Modified: trunk/benchmarks/simpleindex.py =================================================================== --- trunk/benchmarks/simpleindex.py 2007-11-18 22:44:06 UTC (rev 4467) +++ trunk/benchmarks/simpleindex.py 2007-11-19 04:17:36 UTC (rev 4468) @@ -2,7 +2,7 @@ # This is to show that NumPy is a poorer choice than nested Python lists # if you are writing nested for loops. # This is slower than Numeric was but Numeric was slower than Python lists were -# in the first place. +# in the first place. N = 30 code2 = r""" Modified: trunk/numpy/numarray/numerictypes.py =================================================================== --- trunk/numpy/numarray/numerictypes.py 2007-11-18 22:44:06 UTC (rev 4467) +++ trunk/numpy/numarray/numerictypes.py 2007-11-19 04:17:36 UTC (rev 4468) @@ -474,20 +474,20 @@ else: _MaximumType = { Bool : Int64, - + Int8 : Int64, Int16 : Int64, Int32 : Int64, Int64 : Int64, - + UInt8 : Int64, UInt16 : Int64, UInt32 : Int64, UInt8 : Int64, - + Float32 : Float64, Float64 : Float64, - + Complex32 : Complex64, Complex64 : Complex64 } From numpy-svn at scipy.org Mon Nov 19 05:31:09 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 19 Nov 2007 04:31:09 -0600 (CST) Subject: [Numpy-svn] r4469 - in branches/numpy.scons/numpy/distutils/scons: core tests/f2pyext tools Message-ID: <20071119103109.F0BA139C04B@new.scipy.org> Author: cdavid Date: 2007-11-19 04:30:54 -0600 (Mon, 19 Nov 2007) New Revision: 4469 Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/SConstruct branches/numpy.scons/numpy/distutils/scons/tools/f2py.py Log: Some improvements for f2py (scanner for include_file) Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-19 04:17:36 UTC (rev 4468) +++ branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-19 10:30:54 UTC (rev 4469) @@ -243,7 +243,11 @@ Tool(t)(env) t = Tool('f2py', toolpath = [os.path.dirname(numpy.distutils.scons.tools.__file__)]) - t(env) + try: + t(env) + except Exception, e: + pass + #print "===== BOOTSTRAPPING, f2py scons tool not available (%s) =====" % e finalize_env(env) Modified: branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/SConstruct =================================================================== --- branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/SConstruct 2007-11-19 04:17:36 UTC (rev 4468) +++ branches/numpy.scons/numpy/distutils/scons/tests/f2pyext/SConstruct 2007-11-19 10:30:54 UTC (rev 4469) @@ -4,5 +4,5 @@ env = GetNumpyEnvironment(ARGUMENTS) -env.Append(CPPPATH = get_numpy_include_dirs()) +env.Append(CPPPATH = [get_numpy_include_dirs(), env['F2PYINCLUDEDIR']]) env.NumpyPythonExtension('spam', source = ['spam.pyf']) Modified: branches/numpy.scons/numpy/distutils/scons/tools/f2py.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/tools/f2py.py 2007-11-19 04:17:36 UTC (rev 4468) +++ branches/numpy.scons/numpy/distutils/scons/tools/f2py.py 2007-11-19 10:30:54 UTC (rev 4469) @@ -18,18 +18,31 @@ import SCons.Util import SCons.Node +# XXX: this whole thing needs cleaning ! + def _f2pySuffixEmitter(env, source): return '$F2PYCFILESUFFIX' #_reModule = re.compile(r'%module\s+(.+)') +def _mangle_fortranobject(targetname, filename): + basename = os.path.splitext(os.path.basename(targetname))[0] + return '%s_%s' % (basename, filename) + def _f2pyEmitter(target, source, env): build_dir = os.path.dirname(str(target[0])) - target.append(SCons.Node.FS.default_fs.Entry(os.path.join(build_dir, 'fortranobject.c'))) - target.append(SCons.Node.FS.default_fs.Entry(os.path.join(build_dir, 'fortranobject.h'))) + target.append(SCons.Node.FS.default_fs.Entry( + os.path.join(build_dir, _mangle_fortranobject(str(target[0]), 'fortranobject.c')))) + basename = os.path.splitext(os.path.basename(str(target[0]))) + basename = basename[0] + basename = basename.split('module')[0] + target.append(SCons.Node.FS.default_fs.Entry( + os.path.join(build_dir, '%s-f2pywrappers.f' % basename))) return (target, source) def _pyf2c(target, source, env): + from SCons.Script import Touch + from threading import Lock import numpy.f2py import shutil @@ -40,11 +53,10 @@ # Get source files necessary for f2py generated modules d = os.path.dirname(numpy.f2py.__file__) source_c = os.path.join(d,'src','fortranobject.c') - source_h = os.path.join(d,'src','fortranobject.h') # XXX: scons has a way to force buidler to only use one source file if len(source_file_names) > 1: - raise "YATA" + raise NotImplementedError("FIXME: multiple source files") # Copy source files for f2py generated modules in the build dir build_dir = os.path.dirname(target_file_names[0]) @@ -54,19 +66,42 @@ build_dir = '.' try: - shutil.copy(source_c, build_dir) - shutil.copy(source_h, build_dir) + shutil.copy(source_c, os.path.join(build_dir, + _mangle_fortranobject(target_file_names[0], 'fortranobject.c'))) except IOError, e: msg = "Error while copying fortran source files (error was %s)" % str(e) raise IOError(msg) + basename = os.path.basename(str(target[0]).split('module')[0]) + wrapper = os.path.join(build_dir, '%s-f2pywrappers.f' % basename) + # Generate the source file from pyf description - haha = numpy.f2py.run_main(['--build-dir', build_dir, - source_file_names[0]]) + # XXX: lock does not work... + #l = Lock() + #st = l.acquire() + #print "ST is %s" % st + try: + #print " STARTING %s" % basename + st = numpy.f2py.run_main([source_file_names[0], '--build-dir', build_dir]) + if not os.path.exists(wrapper): + #print "++++++++++++++++++++++++++++++++" + f = open(wrapper, 'w') + f.close() + else: + pass + #print "--------------------------------" + #print " FINISHED %s" % basename + finally: + #l.release() + pass + return 0 def generate(env): """Add Builders and construction variables for swig to an Environment.""" + import numpy.f2py + d = os.path.dirname(numpy.f2py.__file__) + c_file, cxx_file = SCons.Tool.createCFileBuilders(env) c_file.suffix['.pyf'] = _f2pySuffixEmitter @@ -74,16 +109,31 @@ c_file.add_action('.pyf', SCons.Action.Action(_pyf2c)) c_file.add_emitter('.pyf', _f2pyEmitter) - env['F2PYOPTIONS'] = SCons.Util.CLVar('') - env['F2PYBUILDDIR'] = '' - env['F2PYCFILESUFFIX'] = 'module$CFILESUFFIX' + env['F2PYOPTIONS'] = SCons.Util.CLVar('') + env['F2PYBUILDDIR'] = '' + env['F2PYCFILESUFFIX'] = 'module$CFILESUFFIX' + env['F2PYINCLUDEDIR'] = os.path.join(d, 'src') - # XXX: scanner ? + # XXX: adding a scanner using c_file.add_scanner does not work... + expr = '(<)include_file=(\S+)>' + scanner = SCons.Scanner.ClassicCPP("F2PYScan", ".pyf", "F2PYPATH", expr) + env.Append(SCANNERS = scanner) - #expr = '^[ \t]*%[ \t]*(?:include|import|extern)[ \t]*(<|"?)([^>\s"]+)(?:>|"?)' - #scanner = SCons.Scanner.ClassicCPP("SWIGScan", ".i", "SWIGPATH", expr) - #env.Append(SCANNERS = scanner) +_MINC = re.compile(r'') +def _pyf_scanner(node, env, path): + print "================== SCANNING ====================" + cnt = node.get_contents() + return _parse(cnt) +def _parse(lines): + """Return list of included files in .pyf from include_file directive.""" + dep = [] + for line in lines: + m = _MINC.search(line) + if m: + dep.append(m.group(1)) + return dep + def exists(env): try: import numpy.f2py From numpy-svn at scipy.org Mon Nov 19 23:54:18 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 19 Nov 2007 22:54:18 -0600 (CST) Subject: [Numpy-svn] r4470 - branches/numpy.scons/numpy/distutils/scons/tools Message-ID: <20071120045418.9AE9C39C016@new.scipy.org> Author: cdavid Date: 2007-11-19 22:54:13 -0600 (Mon, 19 Nov 2007) New Revision: 4470 Modified: branches/numpy.scons/numpy/distutils/scons/tools/f2py.py Log: Support f2py options in f2py tool Modified: branches/numpy.scons/numpy/distutils/scons/tools/f2py.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/tools/f2py.py 2007-11-19 10:30:54 UTC (rev 4469) +++ branches/numpy.scons/numpy/distutils/scons/tools/f2py.py 2007-11-20 04:54:13 UTC (rev 4470) @@ -82,7 +82,7 @@ #print "ST is %s" % st try: #print " STARTING %s" % basename - st = numpy.f2py.run_main([source_file_names[0], '--build-dir', build_dir]) + st = numpy.f2py.run_main(env['F2PYOPTIONS'] + [source_file_names[0], '--build-dir', build_dir]) if not os.path.exists(wrapper): #print "++++++++++++++++++++++++++++++++" f = open(wrapper, 'w') From numpy-svn at scipy.org Tue Nov 20 00:26:56 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 19 Nov 2007 23:26:56 -0600 (CST) Subject: [Numpy-svn] r4471 - in branches/numpy.scons/numpy/distutils/scons: core tools Message-ID: <20071120052656.5030C39C016@new.scipy.org> Author: cdavid Date: 2007-11-19 23:26:50 -0600 (Mon, 19 Nov 2007) New Revision: 4471 Added: branches/numpy.scons/numpy/distutils/scons/tools/npytpl.py Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py Log: Add a npytpl tool to generate .c from .c.src files Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-20 04:54:13 UTC (rev 4470) +++ branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-20 05:26:50 UTC (rev 4471) @@ -248,6 +248,13 @@ except Exception, e: pass #print "===== BOOTSTRAPPING, f2py scons tool not available (%s) =====" % e + t = Tool('npytpl', + toolpath = [os.path.dirname(numpy.distutils.scons.tools.__file__)]) + try: + t(env) + except Exception, e: + pass + #print "===== BOOTSTRAPPING, f2py scons tool not available (%s) =====" % e finalize_env(env) Added: branches/numpy.scons/numpy/distutils/scons/tools/npytpl.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/tools/npytpl.py 2007-11-20 04:54:13 UTC (rev 4470) +++ branches/numpy.scons/numpy/distutils/scons/tools/npytpl.py 2007-11-20 05:26:50 UTC (rev 4471) @@ -0,0 +1,70 @@ +"""npytpl Tool + +Tool-specific initialization for npyctpl, a tool to generate C source file from +.c.src files. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +from os.path import basename as pbasename, splitext, join as pjoin, dirname as pdirname +#import re + +import SCons.Action +#import SCons.Defaults +import SCons.Scanner +import SCons.Tool + +from numpy.distutils.conv_template import process_str + +# XXX: this is general and can be used outside numpy.core. +def _do_generate_from_template(targetfile, sourcefile, env): + t = open(targetfile, 'w') + s = open(sourcefile, 'r') + allstr = s.read() + s.close() + writestr = process_str(allstr) + t.write(writestr) + t.close() + return 0 + +def _generate_from_template(target, source, env): + for t, s in zip(target, source): + _do_generate_from_template(str(t), str(s), env) + return 0 + +def _generate_from_template_emitter(target, source, env): + base, ext = splitext(pbasename(str(source[0]))) + t = pjoin(pdirname(str(target[0])), base) + return ([t], source) + +def generate(env): + """Add Builders and construction variables for npytpl to an Environment.""" + c_file, cxx_file = SCons.Tool.createCFileBuilders(env) + + #c_file.suffix['.src'] = _generate_from_template_emitter + + c_file.add_action('.c.src', SCons.Action.Action(_generate_from_template)) + c_file.add_emitter('.c.src', _generate_from_template_emitter) + + env['NPYTPLOPTIONS'] = SCons.Util.CLVar('') + #env['NPYTPLBUILDDIR'] = '' + #env['NPYTPLCFILESUFFIX'] = 'module$CFILESUFFIX' + #env['NPYTPLINCLUDEDIR'] = os.path.join(d, 'src') + + # # XXX: adding a scanner using c_file.add_scanner does not work... + # expr = '(<)include_file=(\S+)>' + # scanner = SCons.Scanner.ClassicCPP("F2PYScan", ".pyf", "F2PYPATH", expr) + # env.Append(SCANNERS = scanner) + +def exists(env): + try: + import numpy.distutils.conv_template + st = 1 + except ImportError, e: + print "Warning : npytpl tool not found, error was %s" % e + st = 0 + + return st From numpy-svn at scipy.org Tue Nov 20 00:28:57 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Mon, 19 Nov 2007 23:28:57 -0600 (CST) Subject: [Numpy-svn] r4472 - in branches/numpy.scons: . numpy/distutils/scons/core numpy/distutils/scons/tools Message-ID: <20071120052857.08C6C39C016@new.scipy.org> Author: cdavid Date: 2007-11-19 23:28:48 -0600 (Mon, 19 Nov 2007) New Revision: 4472 Added: branches/numpy.scons/numpy/distutils/scons/tools/npyctpl.py Removed: branches/numpy.scons/numpy/distutils/scons/tools/npytpl.py Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py branches/numpy.scons/test.sh Log: Change name of npytpl to npyctpl in scons/tools Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-20 05:26:50 UTC (rev 4471) +++ branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-20 05:28:48 UTC (rev 4472) @@ -242,20 +242,28 @@ for t in FindAllTools(DEF_OTHER_TOOLS, env): Tool(t)(env) + # Add our own, custom tools (f2py, from_template, etc...) t = Tool('f2py', toolpath = [os.path.dirname(numpy.distutils.scons.tools.__file__)]) try: t(env) except Exception, e: pass #print "===== BOOTSTRAPPING, f2py scons tool not available (%s) =====" % e - t = Tool('npytpl', + + t = Tool('npyctpl', toolpath = [os.path.dirname(numpy.distutils.scons.tools.__file__)]) try: t(env) except Exception, e: pass - #print "===== BOOTSTRAPPING, f2py scons tool not available (%s) =====" % e + t = Tool('npyftpl', + toolpath = [os.path.dirname(numpy.distutils.scons.tools.__file__)]) + try: + t(env) + except Exception, e: + pass + finalize_env(env) # Add the tool paths in the environment Copied: branches/numpy.scons/numpy/distutils/scons/tools/npyctpl.py (from rev 4471, branches/numpy.scons/numpy/distutils/scons/tools/npytpl.py) Deleted: branches/numpy.scons/numpy/distutils/scons/tools/npytpl.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/tools/npytpl.py 2007-11-20 05:26:50 UTC (rev 4471) +++ branches/numpy.scons/numpy/distutils/scons/tools/npytpl.py 2007-11-20 05:28:48 UTC (rev 4472) @@ -1,70 +0,0 @@ -"""npytpl Tool - -Tool-specific initialization for npyctpl, a tool to generate C source file from -.c.src files. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -from os.path import basename as pbasename, splitext, join as pjoin, dirname as pdirname -#import re - -import SCons.Action -#import SCons.Defaults -import SCons.Scanner -import SCons.Tool - -from numpy.distutils.conv_template import process_str - -# XXX: this is general and can be used outside numpy.core. -def _do_generate_from_template(targetfile, sourcefile, env): - t = open(targetfile, 'w') - s = open(sourcefile, 'r') - allstr = s.read() - s.close() - writestr = process_str(allstr) - t.write(writestr) - t.close() - return 0 - -def _generate_from_template(target, source, env): - for t, s in zip(target, source): - _do_generate_from_template(str(t), str(s), env) - return 0 - -def _generate_from_template_emitter(target, source, env): - base, ext = splitext(pbasename(str(source[0]))) - t = pjoin(pdirname(str(target[0])), base) - return ([t], source) - -def generate(env): - """Add Builders and construction variables for npytpl to an Environment.""" - c_file, cxx_file = SCons.Tool.createCFileBuilders(env) - - #c_file.suffix['.src'] = _generate_from_template_emitter - - c_file.add_action('.c.src', SCons.Action.Action(_generate_from_template)) - c_file.add_emitter('.c.src', _generate_from_template_emitter) - - env['NPYTPLOPTIONS'] = SCons.Util.CLVar('') - #env['NPYTPLBUILDDIR'] = '' - #env['NPYTPLCFILESUFFIX'] = 'module$CFILESUFFIX' - #env['NPYTPLINCLUDEDIR'] = os.path.join(d, 'src') - - # # XXX: adding a scanner using c_file.add_scanner does not work... - # expr = '(<)include_file=(\S+)>' - # scanner = SCons.Scanner.ClassicCPP("F2PYScan", ".pyf", "F2PYPATH", expr) - # env.Append(SCANNERS = scanner) - -def exists(env): - try: - import numpy.distutils.conv_template - st = 1 - except ImportError, e: - print "Warning : npytpl tool not found, error was %s" % e - st = 0 - - return st Modified: branches/numpy.scons/test.sh =================================================================== --- branches/numpy.scons/test.sh 2007-11-20 05:26:50 UTC (rev 4471) +++ branches/numpy.scons/test.sh 2007-11-20 05:28:48 UTC (rev 4472) @@ -4,6 +4,12 @@ # MKL=None python setupscons.py scons --jobs=4 install --prefix=$PREFIX/tmp # (cd $PREFIX/tmp && PYTHONPATH=$PREFIX/tmp/lib/python2.5/site-packages python -c "import numpy; print numpy; numpy.test(level = 9999); numpy.show_config()") +# PREFIX=$PWD +# rm -rf $PREFIX/build +# rm -rf $PREFIX/tmp +# python setupscons.py scons --jobs=4 install --prefix=$PREFIX/tmp +# (cd $PREFIX/tmp && PYTHONPATH=$PREFIX/tmp/lib/python2.5/site-packages python -c "import numpy; print numpy; numpy.test(level = 9999); numpy.show_config()") + PREFIX=$PWD #rm -rf $PREFIX/build #rm -rf $PREFIX/tmp From numpy-svn at scipy.org Tue Nov 20 03:12:41 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 20 Nov 2007 02:12:41 -0600 (CST) Subject: [Numpy-svn] r4473 - in branches/numpy.scons/numpy/distutils/scons: core tools Message-ID: <20071120081241.822DC39C164@new.scipy.org> Author: cdavid Date: 2007-11-20 02:12:09 -0600 (Tue, 20 Nov 2007) New Revision: 4473 Added: branches/numpy.scons/numpy/distutils/scons/core/template_generators.py branches/numpy.scons/numpy/distutils/scons/tools/npyftpl.py Modified: branches/numpy.scons/numpy/distutils/scons/core/custom_builders.py branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py branches/numpy.scons/numpy/distutils/scons/tools/npyctpl.py Log: Adding from_template scons builders Modified: branches/numpy.scons/numpy/distutils/scons/core/custom_builders.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/custom_builders.py 2007-11-20 05:28:48 UTC (rev 4472) +++ branches/numpy.scons/numpy/distutils/scons/core/custom_builders.py 2007-11-20 08:12:09 UTC (rev 4473) @@ -35,6 +35,7 @@ In particular, it does not install .exp/.lib files on windows. """ source = [pjoin(env['build_dir'], i) for i in source] + # XXX: why target is a list ? It is always true ? # XXX: handle cases where SHLIBPREFIX is in args lib = env.SharedLibrary("$build_dir/%s" % target[0], @@ -46,3 +47,26 @@ inst_lib = env.Install("$distutils_installdir", lib) return lib, inst_lib +def NumpyFromCTemplate(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 ? + # XXX: handle cases where SHLIBPREFIX is in args + src = env.FromCTemplate("$build_dir/%s" % target[0], + source, *args, **kw) + + #inst_src = env.Install("$distutils_installdir", src) + #return src, inst_src + return src + +def NumpyFromFTemplate(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 ? + # XXX: handle cases where SHLIBPREFIX is in args + src = env.FromFTemplate("$build_dir/%s" % target[0], + source, *args, **kw) + + #inst_src = env.Install("$distutils_installdir", src) + #return src, inst_src + return src Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-20 05:28:48 UTC (rev 4472) +++ branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-20 08:12:09 UTC (rev 4473) @@ -186,6 +186,7 @@ from SCons.Tool import Tool, FindTool, FindAllTools from SCons.Script import BuildDir, Help from SCons.Errors import EnvironmentError + from SCons.Builder import Builder # XXX: I would prefer subclassing Environment, because we really expect # some different behaviour than just Environment instances... @@ -250,20 +251,22 @@ pass #print "===== BOOTSTRAPPING, f2py scons tool not available (%s) =====" % e - t = Tool('npyctpl', - toolpath = [os.path.dirname(numpy.distutils.scons.tools.__file__)]) - try: - t(env) - except Exception, e: - pass + # XXX: understand how registration of source files work before reenabling those - t = Tool('npyftpl', - toolpath = [os.path.dirname(numpy.distutils.scons.tools.__file__)]) - try: - t(env) - except Exception, e: - pass + # t = Tool('npyctpl', + # toolpath = [os.path.dirname(numpy.distutils.scons.tools.__file__)]) + # try: + # t(env) + # except Exception, e: + # pass + # t = Tool('npyftpl', + # toolpath = [os.path.dirname(numpy.distutils.scons.tools.__file__)]) + # try: + # t(env) + # except Exception, e: + # pass + finalize_env(env) # Add the tool paths in the environment @@ -309,12 +312,29 @@ pass # Adding custom builder + # XXX: Put them into tools ? env['BUILDERS']['NumpySharedLibrary'] = NumpySharedLibrary env['BUILDERS']['NumpyCtypes'] = NumpyCtypes env['BUILDERS']['PythonExtension'] = PythonExtension env['BUILDERS']['NumpyPythonExtension'] = NumpyPythonExtension + from template_generators import generate_from_c_template, \ + generate_from_f_template, \ + generate_from_template_emitter + + env['BUILDERS']['FromCTemplate'] = Builder( + action = generate_from_c_template, + emitter = generate_from_template_emitter) + + env['BUILDERS']['FromFTemplate'] = Builder( + action = generate_from_f_template, + emitter = generate_from_template_emitter) + + from custom_builders import NumpyFromCTemplate, NumpyFromFTemplate + env['BUILDERS']['NumpyFromCTemplate'] = NumpyFromCTemplate + env['BUILDERS']['NumpyFromFTemplate'] = NumpyFromFTemplate + # Setting build directory according to command line option if len(env['src_dir']) > 0: BuildDir(env['build_dir'], env['src_dir']) Added: branches/numpy.scons/numpy/distutils/scons/core/template_generators.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/template_generators.py 2007-11-20 05:28:48 UTC (rev 4472) +++ branches/numpy.scons/numpy/distutils/scons/core/template_generators.py 2007-11-20 08:12:09 UTC (rev 4473) @@ -0,0 +1,40 @@ +from os.path import basename as pbasename, splitext, join as pjoin, dirname as pdirname + +from numpy.distutils.conv_template import process_str as c_process_str +from numpy.distutils.from_template import process_str as f_process_str + +def do_generate_from_c_template(targetfile, sourcefile, env): + t = open(targetfile, 'w') + s = open(sourcefile, 'r') + allstr = s.read() + s.close() + writestr = c_process_str(allstr) + t.write(writestr) + t.close() + return 0 + +def do_generate_from_f_template(targetfile, sourcefile, env): + t = open(targetfile, 'w') + s = open(sourcefile, 'r') + allstr = s.read() + s.close() + writestr = f_process_str(allstr) + t.write(writestr) + t.close() + return 0 + +def generate_from_c_template(target, source, env): + for t, s in zip(target, source): + do_generate_from_c_template(str(t), str(s), env) + return 0 + +def generate_from_f_template(target, source, env): + for t, s in zip(target, source): + do_generate_from_f_template(str(t), str(s), env) + return 0 + +def generate_from_template_emitter(target, source, env): + base, ext = splitext(pbasename(str(source[0]))) + t = pjoin(pdirname(str(target[0])), base) + return ([t], source) + Modified: branches/numpy.scons/numpy/distutils/scons/tools/npyctpl.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/tools/npyctpl.py 2007-11-20 05:28:48 UTC (rev 4472) +++ branches/numpy.scons/numpy/distutils/scons/tools/npyctpl.py 2007-11-20 08:12:09 UTC (rev 4473) @@ -1,4 +1,4 @@ -"""npytpl Tool +"""npyctpl Tool Tool-specific initialization for npyctpl, a tool to generate C source file from .c.src files. @@ -44,27 +44,17 @@ """Add Builders and construction variables for npytpl to an Environment.""" c_file, cxx_file = SCons.Tool.createCFileBuilders(env) - #c_file.suffix['.src'] = _generate_from_template_emitter - c_file.add_action('.c.src', SCons.Action.Action(_generate_from_template)) c_file.add_emitter('.c.src', _generate_from_template_emitter) - env['NPYTPLOPTIONS'] = SCons.Util.CLVar('') - #env['NPYTPLBUILDDIR'] = '' - #env['NPYTPLCFILESUFFIX'] = 'module$CFILESUFFIX' - #env['NPYTPLINCLUDEDIR'] = os.path.join(d, 'src') + env['NPYCTPLOPTIONS'] = SCons.Util.CLVar('') - # # XXX: adding a scanner using c_file.add_scanner does not work... - # expr = '(<)include_file=(\S+)>' - # scanner = SCons.Scanner.ClassicCPP("F2PYScan", ".pyf", "F2PYPATH", expr) - # env.Append(SCANNERS = scanner) - def exists(env): try: import numpy.distutils.conv_template st = 1 except ImportError, e: - print "Warning : npytpl tool not found, error was %s" % e + print "Warning : npyctpl tool not found, error was %s" % e st = 0 return st Copied: branches/numpy.scons/numpy/distutils/scons/tools/npyftpl.py (from rev 4472, branches/numpy.scons/numpy/distutils/scons/tools/npyctpl.py) =================================================================== --- branches/numpy.scons/numpy/distutils/scons/tools/npyctpl.py 2007-11-20 05:28:48 UTC (rev 4472) +++ branches/numpy.scons/numpy/distutils/scons/tools/npyftpl.py 2007-11-20 08:12:09 UTC (rev 4473) @@ -0,0 +1,60 @@ +"""npyftpl Tool + +Tool-specific initialization for npyftpl, a tool to generate fortran/f2py +source file from .xxx.src where xxx is f, f90 or pyf. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + +from os.path import basename as pbasename, splitext, join as pjoin, \ + dirname as pdirname + +import SCons.Action +#import SCons.Defaults +import SCons.Scanner +import SCons.Tool + +from numpy.distutils.from_template import process_str + +# XXX: this is general and can be used outside numpy.core. +def _do_generate_from_template(targetfile, sourcefile, env): + t = open(targetfile, 'w') + s = open(sourcefile, 'r') + allstr = s.read() + s.close() + writestr = process_str(allstr) + t.write(writestr) + t.close() + return 0 + +def _generate_from_template(target, source, env): + for t, s in zip(target, source): + _do_generate_from_template(str(t), str(s), env) + return 0 + +def _generate_from_template_emitter(target, source, env): + base, ext = splitext(pbasename(str(source[0]))) + t = pjoin(pdirname(str(target[0])), base) + return ([t], source) + +def generate(env): + """Add Builders and construction variables for npytpl to an Environment.""" + f_file = SCons.Builder.Builder(action = {}, emitter = {}, suffix = {None: ['.f']}) + + f_file.add_action('.f.src', SCons.Action.Action(_generate_from_template)) + f_file.add_emitter('.f.src', _generate_from_template_emitter) + + env['NPYFTPLOPTIONS'] = SCons.Util.CLVar('') + +def exists(env): + try: + import numpy.distutils.from_template + st = 1 + except ImportError, e: + print "Warning : npyftpl tool not found, error was %s" % e + st = 0 + + return st From numpy-svn at scipy.org Tue Nov 20 04:56:45 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 20 Nov 2007 03:56:45 -0600 (CST) Subject: [Numpy-svn] r4474 - branches/numpy.scons/numpy/distutils/scons/tools Message-ID: <20071120095645.936CF39C0DF@new.scipy.org> Author: cdavid Date: 2007-11-20 03:56:30 -0600 (Tue, 20 Nov 2007) New Revision: 4474 Modified: branches/numpy.scons/numpy/distutils/scons/tools/f2py.py Log: Clean up f2py tool, add a F2PY builer in it Modified: branches/numpy.scons/numpy/distutils/scons/tools/f2py.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/tools/f2py.py 2007-11-20 08:12:09 UTC (rev 4473) +++ branches/numpy.scons/numpy/distutils/scons/tools/f2py.py 2007-11-20 09:56:30 UTC (rev 4474) @@ -33,13 +33,17 @@ build_dir = os.path.dirname(str(target[0])) target.append(SCons.Node.FS.default_fs.Entry( os.path.join(build_dir, _mangle_fortranobject(str(target[0]), 'fortranobject.c')))) - basename = os.path.splitext(os.path.basename(str(target[0]))) - basename = basename[0] - basename = basename.split('module')[0] - target.append(SCons.Node.FS.default_fs.Entry( - os.path.join(build_dir, '%s-f2pywrappers.f' % basename))) + if _is_pyf(str(source[0])): + basename = os.path.splitext(os.path.basename(str(target[0]))) + basename = basename[0] + basename = basename.split('module')[0] + target.append(SCons.Node.FS.default_fs.Entry( + os.path.join(build_dir, '%s-f2pywrappers.f' % basename))) return (target, source) +def _is_pyf(source_file): + return os.path.splitext(source_file)[1] == '.pyf' + def _pyf2c(target, source, env): from SCons.Script import Touch from threading import Lock @@ -54,10 +58,6 @@ d = os.path.dirname(numpy.f2py.__file__) source_c = os.path.join(d,'src','fortranobject.c') - # XXX: scons has a way to force buidler to only use one source file - if len(source_file_names) > 1: - raise NotImplementedError("FIXME: multiple source files") - # Copy source files for f2py generated modules in the build dir build_dir = os.path.dirname(target_file_names[0]) @@ -73,30 +73,29 @@ raise IOError(msg) basename = os.path.basename(str(target[0]).split('module')[0]) - wrapper = os.path.join(build_dir, '%s-f2pywrappers.f' % basename) - # Generate the source file from pyf description - # XXX: lock does not work... - #l = Lock() - #st = l.acquire() - #print "ST is %s" % st - try: - #print " STARTING %s" % basename - st = numpy.f2py.run_main(env['F2PYOPTIONS'] + [source_file_names[0], '--build-dir', build_dir]) + if _is_pyf(source_file_names[0]): + # XXX: scons has a way to force buidler to only use one source file + if len(source_file_names) > 1: + raise NotImplementedError("FIXME: multiple source files") + + wrapper = os.path.join(build_dir, '%s-f2pywrappers.f' % basename) + + cmd = env['F2PYOPTIONS'] + [source_file_names[0], '--build-dir', build_dir] + st = numpy.f2py.run_main(cmd) + if not os.path.exists(wrapper): - #print "++++++++++++++++++++++++++++++++" f = open(wrapper, 'w') f.close() - else: - pass - #print "--------------------------------" - #print " FINISHED %s" % basename - finally: - #l.release() - pass + else: + cmd = env['F2PYOPTIONS'] + source_file_names + ['--build-dir', build_dir] + # fortran files, we need to give the module name + cmd.extend(['--lower', '-m', basename]) + st = numpy.f2py.run_main(cmd) return 0 + def generate(env): """Add Builders and construction variables for swig to an Environment.""" import numpy.f2py @@ -119,6 +118,10 @@ scanner = SCons.Scanner.ClassicCPP("F2PYScan", ".pyf", "F2PYPATH", expr) env.Append(SCANNERS = scanner) + env['BUILDERS']['F2PY'] = SCons.Builder.Builder(action = _pyf2c, + emitter = _f2pyEmitter, + suffix = _f2pySuffixEmitter) + _MINC = re.compile(r'') def _pyf_scanner(node, env, path): print "================== SCANNING ====================" From numpy-svn at scipy.org Tue Nov 20 06:22:50 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 20 Nov 2007 05:22:50 -0600 (CST) Subject: [Numpy-svn] r4475 - branches/numpy.scons/numpy/distutils/scons/core Message-ID: <20071120112250.0B4E5C7C00F@new.scipy.org> Author: cdavid Date: 2007-11-20 05:22:45 -0600 (Tue, 20 Nov 2007) New Revision: 4475 Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py Log: Add -fno-second-underscore flag for g77 in scons to keep ABI with distutils Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-20 09:56:30 UTC (rev 4474) +++ branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-20 11:22:45 UTC (rev 4475) @@ -1,6 +1,6 @@ # Last Changed: . import os.path -from os.path import join as pjoin, dirname as pdirname +from os.path import join as pjoin, dirname as pdirname, basename as pbasename import sys import re @@ -49,6 +49,10 @@ return suncc.search(cnt) +def is_f77_gnu(fullpath): + # XXX + return pbasename(fullpath) == 'g77' or pbasename(fullpath) == 'gfortran' + def get_vs_version(env): try: version = env['MSVS']['VERSION'] @@ -170,8 +174,6 @@ # scons could not understand cc_opt (bad name ?) raise AssertionError("SCONS: Could not initialize tool ? Error is %s" % \ str(e)) - # XXX: really have to understand how fortran compilers work in scons... - env['F77'] = env['_FORTRAND'] else: def_fcompiler = FindTool(DEF_FORTRAN_COMPILERS, env) if def_fcompiler: @@ -180,6 +182,12 @@ else: print "========== NO FORTRAN COMPILER FOUND ===========" + # XXX: really have to understand how fortran compilers work in scons... + env['F77'] = env['_FORTRAND'] + + if is_f77_gnu(env['F77']): + env.AppendUnique(SHF77FLAGS = '-fno-second-underscore') + def _GetNumpyEnvironment(args): """Call this with args = ARGUMENTS.""" from SCons.Environment import Environment From numpy-svn at scipy.org Tue Nov 20 08:58:51 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 20 Nov 2007 07:58:51 -0600 (CST) Subject: [Numpy-svn] r4476 - trunk/numpy/doc/swig/doc Message-ID: <20071120135851.E03F639C063@new.scipy.org> Author: wfspotz at sandia.gov Date: 2007-11-20 07:58:47 -0600 (Tue, 20 Nov 2007) New Revision: 4476 Modified: trunk/numpy/doc/swig/doc/numpy_swig.html trunk/numpy/doc/swig/doc/numpy_swig.pdf trunk/numpy/doc/swig/doc/numpy_swig.txt trunk/numpy/doc/swig/doc/testing.pdf Log: Added Eric Jones to the list of acknowledgements Modified: trunk/numpy/doc/swig/doc/numpy_swig.html =================================================================== --- trunk/numpy/doc/swig/doc/numpy_swig.html 2007-11-20 11:22:45 UTC (rev 4475) +++ trunk/numpy/doc/swig/doc/numpy_swig.html 2007-11-20 13:58:47 UTC (rev 4476) @@ -1055,15 +1055,15 @@ The effort to standardize this work into numpy.i began at the 2005 SciPy Conference with a conversation between Fernando Perez and myself. Fernando collected helper functions and -typemaps from Michael Hunter, Anna Omelchenko and Michael Sanner. -Sebastian Hasse has also provided additional error checking and use -cases. The work of these contributors has made this end result -possible.

+typemaps from Eric Jones, Michael Hunter, Anna Omelchenko and Michael +Sanner. Sebastian Hasse has also provided additional error checking +and use cases. The work of these contributors has made this end +result possible.

Modified: trunk/numpy/doc/swig/doc/numpy_swig.pdf =================================================================== --- trunk/numpy/doc/swig/doc/numpy_swig.pdf 2007-11-20 11:22:45 UTC (rev 4475) +++ trunk/numpy/doc/swig/doc/numpy_swig.pdf 2007-11-20 13:58:47 UTC (rev 4476) @@ -1396,23 +1396,20 @@ /ProcSet [ /PDF /Text ] >> endobj 305 0 obj << -/Length 2526 +/Length 2537 /Filter /FlateDecode >> stream -x??ZYo?~???K -??N??~?8???]? -??M?d?ip??z??SU}L??p?0??Q]_uUu]$?j??_Y?T???u??????E{u?????F)??6nf?6?u#,s^?9*??Z??P?;~?]?=????5?Y?-R????wo???F????+?9?d???n??r{???????? -7LhXU2?`3U??JX?R?1???k??>]7J??n{? ??p??????$t-7??@?Exw ??????t?k?6O?m?????),z?W_?????????6???5?{?ao(_?????h?e?$=|N?S?_m??D>/g?,?2pC???? -B??+???Sz+j ?c:?M?>Z??S???uF????>.??????DC????"???t=;k?k%+?(??????? ??Q???c??!?g:G|??f?_???L???_nw??K???u|?d,?>&??MA?vA??A??? ?%%'?%/?J???*??|GzA/lvGP????&????????E|i>DC???$O??g?G$q1"?btT??u???????5???qX 4/{??????u?4o!?NI ??????22??CD~?????"F?b?z?Z^O)pP?w??C???lMO(v??p?9?c???EJ??Y`????h9:?q?8ME_(l ?0i?p~F?;?X???W???R+ ????????-?/?%?l?.Y???K*???d?}I$Th?O0???>??mS"? -z????????Vbpo???? -???s?????]p?F????)???&w ???5=?????5>???m??g?D?dkR? ????/? } ??2 ?:S???RF???k)??l??C???r? ?P?R???2"?b?\???^*=??,??p? -I{:???????8?E?wI?Ec? ?jj?:?u,????J??^????)h?-d?+??*f?d??\P?`???WR?O?:S9?g??1??\ Z??? ?g?????Mmi?W??Q???Z????B? ?5D?G??&%??????"[??r@???????l3??aJX??K?????V??"??+???=?}?$?fV??/??!??? -J?3?B?H??(u3*??p^?}?u4???x?k]P?_??.\??9~.????7? < =1n?=? ?????}????!P???H????D????a??.?(BY?d%???g?lh??z >??F??3e??x??~E???J???W???OD???? {?4y?}?O?)?X?=?Qt??????s?P?]??L?"t?v?awL9m?????fg???????x?(E?]??t????:?+)??? ???D????????eV*1?b?L?2x?,L???0Q?.%?]x:'&t?DU??bI????"??? -<g??W?????2??K???$?!??v7???????R?c??z?_,?!????H/???n??! a?????>???9?v????????b?????i?????????????" t???R???(??.8?6?=(??!~?)b0\??cq??}??l%?Jo_???????5?QCF?)T?1ua(?w P???q??J?+????F?????7?u ?=,Q|?@?$?jM# E??????V??N2?r}?:??_????Z8=SD -74?????NI??SU?j?Z????2??p???uN????ON??c?2?wLh;??m? -?????mN???O??T??f?????J?m??????o=%~????????t?+???~???{d??q?^|???W??o?h??)j?x#5? ???|?@+ ????????s???-SB???? ??Z?????l?h????!?#qC??? +i9 Yk????t+Y??[???M?? '???ry)? ?_3??/????>???%??q??-??-???<r:B4???3???W7?k@?c ?z>?t#?NH?k???x8{|????>??O ???>?e??????&?????vW]???n?2? ?+*U3?@j?C??I???p?G|???n?(P??q&j???"]????z?pu??9????????????O???????w1????L at vl \ ?-y???#y????`???e???????V??80??1??{??)??????+"lW"????\?$Z???fX??????t3N??R?????????}!h???C?w??????e?Q?1??]VX?ZW??Cz?=????t?Ev]??? Z???L?? B:.???"y??RLWL???Y??D?i0?T??%3?1?l?!??v????_EU?k ) ?LJ?X??*?L? ^?r??8?,>z?x???t?#?IG%?q???`?Ge/?IM???????l?[E]?????j+/?????5E?x?(??5(8y??D?2'$?et??j(>G??)o????J??b????q????tzC~???# ?Q?C/??~??p??CnLG????s??o??r}H?b?????5??%???1?S??~d???C%??RW?zFu?b?%U?]????'?????????"??G???D????~U?}?Tt???oQ~?3y?}??????c????????? +?2?j.??@!0*?2rg???"????#???????2????C?.?@J???t at O??m??0?j??S???]??e??_`????I????????n????U?C{3tA ?+???B??6??-??o???>?????6Lsg6JrV?z??fb[??rrrFP?;????X???v???X!??j?2?F+p??X????7vV???> endobj 316 0 obj << -/Length1 1213 -/Length2 5760 +/Length1 1231 +/Length2 5968 /Length3 532 -/Length 6525 +/Length 6749 /Filter /FlateDecode >> stream -x???g\?k??? ??{I@????tP???????AAD??;D:z?M:??.?{D??9????????i?|?f?k?{?~??3T?G?A5n(AQ!QY???? @TH???K ?`750 -* ??(? ???????? )@????9:?P{= -?p?=???n??4??_???M???????_)=0? e?????????/?? ?X????b ?????G+u7?????0 ?%?? ,I?E07{????+,??@a`Gp@ I?\??@???? ??g?_!I??;vI?_!i?????#????@??+/!?e'$?? -l#O??o}$??n??E?] 8?W?$?D?a?j?????IZ l??????E???? -?V??a???DE???? ???! ??b??~C?0?7?*??BQ???o?UF??X???????????~C?y???? ??b?}???~CUT>??b2Av?"b?) ???RA#?P7?_/?????`?? -??BHg&?P????? ???B>\??X??c?d???p?}?IN???S?JH???2????n&??v?ug?;?t??!?N????O?Yu??L?&u???A?m???Mf?K.I???U1~'???7"?????!????5??1?z&[c?)?}@'????|??%??&?1???Wt???\?,?d??? >??YU?c'y??U1??0K????F@?\C???d?? ???????.K???5?"???d??S?/???g -(?Jq?3???:???4???? d??m>t?????????b??dh?i??$^??????|??u?D2{?? :?M???????]?#w?H?,8|?? !?S?]?US???[?f?U??T21??J2'Q???'????L????f??f?????7??T????[Wqr ??M\P????? -????+(0 B??_?Z?` ????[?II ? - -???9a?s??ts?K????A.??Owk=???h??Q??????-?5??\?{@n??IZ ??M??7??j??WL????~k?=??v???x??W?$Yy?????i?xX?S??"\A?E????'R? ?3???hF?n?qW???-?I[??:P????(F??????V???g???vv??r???p?#??4 ???C?.??Y?%???Z=?Z#?)?XMn??3?-????????1z?????_?????????T??0X ??7R=0?t????}?q ?]k?D??0qz??0?????{"??)?p?;~????>=d?\?|?Yt??h$????#xD? ????NL?)?A?M?l???dn???E?_,?????D? z??????pZW??A`????O)Q???????wr??;1?{??q>????}?????{w??S -$?N?;???@??R?o???z,???K,X ?w?Y??63???@!??U?? `)+Y???0? ??R'????E?f5e4) -JL??O/????????t4EM???>~2w;??????I?5A??^p??`q???Ad????4?w?????"x? ?M yKW??D??U?2?+ M&????E???%???>?+f?U??????.??$?CQ@?? -k??,?4??? ?>a.Gh?w????&n -??.Z????k??,????9???zK~?? -?[???g?<+?3???$??S:??.?b?%5Y???W????2??{???1??x a???{V ?.??g??,zn?tv???? ?b?b?y???`?]x7????1 ?I?b?e2 8?:?????????;?1Nj??R????LY?lNF??m???A?y?"C?*???~ ?^??y????????4????????)?48dc .?/?eBO??R?$Y????Az?"m????Dd-2f8c?>??)???\? ???R???????? @l???6?_?[;?^:|???+??IL??S???????,??g]??>???_?O???W? $Z3e??nK?t?3??\????2??j?I??? ]? -?P??????1???[?Q5? ?????1?5][????}???e???? ????f??.???>?????e???iH??3+??????7!/??h?%??"'??k5X??ki?SU_?$a??ka?L?-?????????vK?~???\iS??.???8??? ]??H?P^?p ???A??% ?? -???%&?d?t?#?WFo???????????/?k;?~??;/e???+?B?????s? \L??6??>???p?cs4mZ<[??.?3?TW??I?? ??'??9??$??_??????V????nV?[?d0????G?????J[?? h?]???f?O&????{+??V? ?M??+S????fyvmA?i??"??+?'6T??A 9?(v???m?r????q3:?i?? ?? ?lr??3??+?g?@?$??,?Dq??j??\?}?U?^??f>??I???+???d??j^?;??8??#K????? }?QS???e?{?b?H'??^??S???L?YZ\??>?i????=-???hs???+???S Lx??W??F?????d?Yv??\'? -?CoS?{i???2}P?p?B???{??0(T??&=b?zwLl?Y>dW'P?L?&"??aP ???Ka?},u??L?3\ ?????\??????4c;?0A??9w7??B?? ???;w??6?]d???>Y?wrf;?8?\#????W?}????]#?? -g??i?~???[?Ig/????????:N ??t9??IyRktZ?f}?_2AK?a?y??#?????q ????N?L???vA???? F??g???????3???&??? ?,????Tm{?O??????????!?c??B[k??x%?T??^Q?O ???r??8d?'???I???V?Q[f?3?SK????6??????????.???)Z??U??YW?? Q?asQ???J?3???xD -&@#?V?a????????Y???l???>>?1?3?n-?pId???|???????Q?>??? ???Zj?{????I??H??DI';??r?"#??0?"n?jX??S????~?+??,???B? ??f?6pszV???j???_?l?G???YL?cy????C?Y?m&??????Ilz?%3???C?}? ???"????e+?#?????{_?t2?3M>?[??????%&a?#??????;???Y#G???Z??Bd??F?V6??kMe????U??U|{??I???l]??1??}De????x?{C?????i???*:)F g??y?{??I?????]??_????0?V??kj??O??J??|?G?NObq5??w?N???????}??c?X?w?'?t4???~?????Q????99k??? [?Z?F?????? )??w?iW][??S8?J2{???????? ???????? `b??\z???&L??f?.??$?l???d???????G3i^ E?{y?th????E??0????q,???????????{??[@?8-6]??n???U???????.oV??????e???%_??????6}? ????9?YwF.sqa^0??{?Y??H???d????????[U?? ?=?g????p???u??U?b$?t????????T????>?? ?L??6???SO??x-2? ???pV@??|i{??@i?&e?I??tCy?Ua???_o??T2??fh?:?,???nh6cDU?????????Q?>{?M?V<|?v?E?H?e??BK???&ys????_;,?????S.?(_Z?{^?AP.???G?n?5?g???N??p??m??j)??=??x9ww?5?(u%????^?vO4~?G.??n?x?i?????+:??? +?????]e?(??]???>??+?Do??p?, 4E8u;??c??v?>??+???o?y??v??SjXQ??????????I#?=?D? 40???8??????h{??p??s%????@I?Ui?????6????U?SII??(x?xrq2=??? w:??#????D??[p?8?S???q?????7???"?7??@?0??????????????JW??z?K??2+?(?v???tfZ???>ZZ"?F???f??O?H(??}Ua??_#??(8???h?U?y???my&R?p?W??9;RKk????K????=??????k?L????a?Hm?K??;R?j??/??o????w/??%?l?Ff?Ff??6?F???=B??x??Y?*?v$?? LF?k???"?I, ?u????-?,=\????i=??b?^f?[7eu??,??0r-????H??W?|B??t???{?zkt?\???H??F?s^ j?$?W???7???? ?Dc?|?2??P|?HZ??gNe ?h?,?9?H??0??^?mn????=?Y???N?B????~???Z?n???o?? ????$???7t????4XU?????????crG?v?= ?S^?r?zB?i?c`4??"-???n]?b~m???EU??\z?qp5oH???J??F0??;8W1??u"v?A??w?E=?m??n?u???JO???b j?N.dn??S? V?]^?????W?#???????Kr1M?????0??l$ ?a?.???5w??|Q:6??lg?????#??ft??1?FkH?=x????_?????p??)?%??O?c??r?[???1????=??,??????~&q?????l?"??L?????|??8?Z?? ???h?s_*?SJss?;~????%>?-?M??n??E??=??+~h???)??????? ???????????>v?`JFbV?6??y?|????MR??Sf??? ????o?m1?XP]]^????T??U/??2??,?i?o%d?y?G?d??H?D?\???L|?f?w?kQ??r?Dw????6??6??{????&?????3???? M,Y?? +"??8? ???c????=?&?F??4[?Re??Zo??D??Z??3???i???{??????kD??I??Ij??d?.? +?N???4,8+? |?U?W ?SW?GS???Y??oP??m?V?????Y?(l???SPa??T??z???3S?tA???1?9???)_E%;????Y?x??|?;>???>?g???n?K??\?WG????3i47?\,??j???/}??m ?_K??3y?J?u??jZ??"0-ZOx??Dj8??????{,-:?$TH#?"??otDE?~??|'?KkE3?C??jNw?H?? ?@4d?@???dd????7?/??8wC?K??@!AyOk8`?hW?E??Z?g5??W?t? +?(|^:??9?????4?F??[?3jG?????U???/;%??8??????V?????????j?l`??]?????Plh+?P?*?\? ?????.w ??]????lNI?m????N??z4A??a?j/X| ???-.??9?? ????4?V??NS0?Ng?r???q?}n ???z????? ?0.?Z????UE???.ys??;j?i??d?w?B. +D??????u+]c?yP??o9Esk???d????M???T?y?LQYf ????????n??f? ?VX*?r"?(??????Y????U???6??L?b/?'`tb?mdn???F??!P?\? +n?Y?{?W???????J???Z ?aO????,??I'Ea?n{?M????U??'??xz?]????C}s?w?l??7??;?{IX????Z?????/? o?t6?8{?? ?????? ?N[D?5-??s?/????n??uM????cTk???t?ex&Of??J!hz=??.? ?M?y?????V?c??z???A7?S?p??BG3g? ?\pHAr9??? :?Y@??4????@s??pT?????????????}rmD???\?_?e[???3??????T???}??????????B?9?]???|rendstream endobj 317 0 obj << /Type /Font @@ -1539,28 +1529,28 @@ /FirstChar 45 /LastChar 121 /Widths 321 0 R -/BaseFont /TMVDMX+CMR9 +/BaseFont /FAUKUN+CMR9 /FontDescriptor 315 0 R >> endobj 315 0 obj << /Ascent 694 /CapHeight 683 /Descent -194 -/FontName /TMVDMX+CMR9 +/FontName /FAUKUN+CMR9 /ItalicAngle 0 /StemV 74 /XHeight 431 /FontBBox [-39 -250 1036 750] /Flags 4 -/CharSet (/hyphen/period/zero/one/two/three/seven/nine/colon/C/D/G/S/T/U/a/b/c/d/e/f/i/l/m/n/o/r/s/t/u/x/y) +/CharSet (/hyphen/period/zero/one/two/three/five/seven/eight/colon/C/D/G/S/T/U/a/b/c/d/e/f/i/l/m/n/o/r/s/t/u/x/y) /FontFile 316 0 R >> endobj 321 0 obj -[343 285 0 514 514 514 514 0 0 0 514 0 514 285 0 0 0 0 0 0 0 0 742 785 0 0 806 0 0 0 0 0 0 0 0 0 0 0 571 742 771 0 0 0 0 0 0 0 0 0 0 0 514 571 457 571 457 314 0 0 285 0 0 285 856 571 514 0 0 402 405 400 571 0 0 542 542 ] +[343 285 0 514 514 514 514 0 514 0 514 514 0 285 0 0 0 0 0 0 0 0 742 785 0 0 806 0 0 0 0 0 0 0 0 0 0 0 571 742 771 0 0 0 0 0 0 0 0 0 0 0 514 571 457 571 457 314 0 0 285 0 0 285 856 571 514 0 0 402 405 400 571 0 0 542 542 ] endobj 320 0 obj << /Type /Encoding -/Differences [ 0 /.notdef 45/hyphen/period 47/.notdef 48/zero/one/two/three 52/.notdef 55/seven 56/.notdef 57/nine/colon 59/.notdef 67/C/D 69/.notdef 71/G 72/.notdef 83/S/T/U 86/.notdef 97/a/b/c/d/e/f 103/.notdef 105/i 106/.notdef 108/l/m/n/o 112/.notdef 114/r/s/t/u 118/.notdef 120/x/y 122/.notdef] +/Differences [ 0 /.notdef 45/hyphen/period 47/.notdef 48/zero/one/two/three 52/.notdef 53/five 54/.notdef 55/seven/eight 57/.notdef 58/colon 59/.notdef 67/C/D 69/.notdef 71/G 72/.notdef 83/S/T/U 86/.notdef 97/a/b/c/d/e/f 103/.notdef 105/i 106/.notdef 108/l/m/n/o 112/.notdef 114/r/s/t/u 118/.notdef 120/x/y 122/.notdef] >> endobj 192 0 obj << /Length1 750 @@ -1572,11 +1562,11 @@ stream x?SU ?uL?OJu??+?5?3?Rp? ?44P0?3?RUu.JM,???sI,I?R0??4Tp,MW04U00?22?25?RUp?/?,?L?(Q?p?)2Wp?M-?LN?S?M,?H??????????ZR???????Q??Z?ZT????eh????\????????r?g^Z??9D8??&U?ZT t????? @'????T*???q????J???B7??4'?/1d<8?0?s3s*?*?s JKR?|?SR??????B????Y??.?Y???????????kh?g`l -??,v??HM ?,I?PHK?)N?????;|`????GEhC?,???WRY??`?P ?"??P*??P?6?300*B+?2???????t#S3?????J.` +??,v??HM ?,I?PHK?)N?????;|`????xy?hC?,???WRY??`?P ?"??P*??P?6?300*B+?2???????t#S3?????J.` ?L? 2?RR+R+?.????/jQM?BZ~(Z??I? ??% q.L?89?WT?Y*?Z? 644S077?EQ?\ZT??WN+?????2?A??Z???u?Z~?uK??mm+?\_X????????7?D?????Rl:/P1?d????????(??l=U?h?d?_O??E?k?v-X1??t???`????i????_y. ?1?????????:?un~Q???3/??S??}??]?? ???$e~s?]F1????/??Q???m????|<?????/??q'}I???+6???E??g???xT.??G??gt???v??G??U|?????~??]?R????_k?9???:?{?p??G?? ??d}dN<6??-uB?o?H??=c?M?vH??z?q?a???RK?~,K???}????????m??????yo??~?????v? ?_????s>???.#????????{?/?????k????\m?|??r???X???????ad?j|?????R/?,2?p?0, H?IM,*??M,???r?endstream +??-??????W???d?????_?~?+ ????i?s?s?`??C???u?I^>??\m?|??r???X???????ad?j|?????R/?,2?p?0, H?IM,*??M,??f?r?endstream endobj 193 0 obj << /Type /Font @@ -1585,14 +1575,14 @@ /FirstChar 15 /LastChar 15 /Widths 323 0 R -/BaseFont /QEOZRX+CMSY10 +/BaseFont /VUPJIT+CMSY10 /FontDescriptor 191 0 R >> endobj 191 0 obj << /Ascent 750 /CapHeight 683 /Descent -194 -/FontName /QEOZRX+CMSY10 +/FontName /VUPJIT+CMSY10 /ItalicAngle -14.035 /StemV 85 /XHeight 431 @@ -1616,25 +1606,20 @@ /Filter /FlateDecode >> stream -x???WXS???)?E)K??iH??J??7U ? -??@])RA:(????*?("]?&A?l at B?p???o{=??>?????o??????S??????j??(?T????H??!?ii4?P$?y T??? -?6?@??5??R " ?I?~d??8?>?C? ?s?,?b(N?=? -??????????Vx??'H?q0 ?X -?:??O?D< P?+??r?{?${?M?~?<?M?HDW??!p#}7??????????\]?0n???????c??~?R????( 0$?@2?w??_? A????Y] -???=Gtt(R?P?+N??&??8c??1????8H????^??>?6f&???????????b????????D&??z??t!??{d??fZD, G : -(%C&c? ?CD'?D? ??t?p?D?/????Id????[???$$?q? ????I?? ?8???!?? *p?/H{??J?? ?mx??/??&?7?T: @P???U%?k?K??"?A"??y?w?o??MA_ ????????7?\????g9?)????*?,U63?~??\?a?-???9??&?????????sW??a?|?\???????3v????????9Iw????\?~?Rh0?T~(<????????.??#T???D??~?A"h95??I?@?&Q5?K[??? -????2???z??!so??mv?q_?h;y?E?j????WT6?s???g??o?????Q?+??????s???f???4?5/????w?X?A?.bc?vAh??????4?j?? a?j?55c??a???.???7or??,>(g????;hA-\???????t?6?W-"$?uQ???F2??'?B(???#]O?{@D?%s2?j.?$?r???pc?c?#|?^??e?????????u??CX??????b??'?g??uL??>&?&????NQ?4d?*W&?t?\?gZ??kx??C8?N???2?Cf?LX?1?C? -???} ?6?U???K????c????)Aiw???? er???????rf?G???QM???=?5?0.z} ?[? -???? -?uwEM??TN}?Y??wI?*????l+?O?C7%H?:???,???/?7?g?#?Pc?? ?_]?l?0??}?<j????b=_??/??u??(??F??J&B[w?\>?????JI=8]????9q 5Z??fZ????!?Uu?p(-???In~?*?*|]?????D":???&?)??.????k?????|?O|??S??Y+? )]??{9y?72????N ????????~???V???u?????m9??#%????E^*?`[????f*?ny.!_a?!&:0H?^???m?I?X_??<2*???mN?B?&????jm???;?jAuOc??iN???,\_??FV??N:-]???+??'?C?c?as???rU ?8??}??(??k?"+L?L??P?h?R???et?x????4?????J5??????????91??H#????_"}?:????l?G????j?~|?c|?;?????6UA?6??{?6???% -f??]???m???????B?:S1z???O??????_39YR:?l????gfF?w?!?*??x?o?h?t?P?*>y???+???????%y>?%?B|W?????I?l??}?6>?e!?w??'??o???$?? ???Z???W???:????V?r?i??9>?/k?F??s?P?1F????,l?[m???$g??6? 6????????3?OKB>????G??? MY/A???Q:??l?Wdd?0w??W&??m???]=e?QQ1??_??%??Uv???=,?:(?? U?H??????_To?M???4?iVr_Y?zf3?h???v?.???b???+?? ai??[??%???cPS???y????cS????W???j?21qJ??&??P??vT39h?Q?'??y!4?Rkh?g?????v??b?tt??$u?v?S??????w?cL0n1A?/??5?E?V?R?Q?1?=2H??j)7?8{$?I,Y:4?d????b??*i xqNl?<:\H?%:?Oz????iZ???"?c?????.?r???r??1?;??Nl? ?#u9????????'????bk -kqH??`???`G????????????u??nv?L-f7???????FRv|7???v?8?nf?h? l5??(?*??ylM?i?q?9?.ncV??S????[??f?}?^???EW??n?????6?????e?g?`??U??*v%?bi6?W??To?????c? - vWSD ?{??) |)?????X?^ *?}>d??6X?M??J?????!\%???}%#Q?v????'E?(?????T?e???H?Qf?????s?x???kW?????'???b??k?pIN????L=?????57?/?5c??h+>?K!;?*??%?1x???i???P??????6 "%??????????#???#?x6Wp??N}???U?$??j??4? ;???$?};? ??{?????}\>?s2?m?Vb??%??"??r???>?M???? -b??????)? endstream +x???yV#?9?????????,?g?S??Y??p5"\q?jc?9??$??,?????????O????:?RFN?l/?pNH??j????}?.?????`???JK??a??_??? +_W;a?3/????e?? ?Jk?K?6K?Wc#??D'???Q?/?]??M*??Y5???`T0???>R???1r?P??$??????+M??=?^331?[5?????E????^??6!??1???r??t??G??]?>??eL??? +??k.iU?l??)P??2:oL l ???8/??*Q?)?}ZvIN???b???? + ?L????B>??*?????dI??r?EGg???9M??????2?}???5??Ri L???!????{W?v????l?? ?]?C?v'U????????????E??H?b??I>?"?A?:3???d%?u???????G t|?P?????????+b??ZONY??????3M?n?kdl?U7?!]/?g4 ???|n??i?\????Y??-??tm9????a?? +?L.?-??y?z?$?+??b????3&?K(???L?y{h?M`[A???h???Q?_?h?M???4?i??_Y?zf3?h???v????b???+?V ?i??[??%???cP3???y??RJcS????W???j?01uJ??&??P??vT+9p?Q?'??y!4?R{h?g?????v??b]?tt??u?v?S??????w?cLn1A?/??5?E?V???Q?1?="P??j%??8{$?I?X:4v?I,?????E?Z?lg?????EP^???W&i?????m??????'[????Q?7?????k????\???du?????O???? ?s_Y6tK=q?!????? ?&w??c?,???:?p?W at Z? ??iw????U??gL??6y?p9?i?'?w?I+??t?zj???fJ???4???Nn?"???cV???c???? ?e$????8trQ?,B??Sf?t' z??????,??]kr????!????????????U????*?5O w???}??u?7?>????6?d_7,?y??y???c_ ?;a":???vU???7M;???;?Wjd?k???'???g??W?-?$7t&_Z???;?l]???]????????np-?????m?I????P???x)?(?????????731?~7??zsZ$7^??Z[?cU?>????W??????t? ??%??F?L??&?#k?S?p??|???(P???=?%?Yv8?T +z?ysm?unv?y??;??5M??51?N?Wc?????&?~|c??e??w??"6r????*Sy?8?a?>?5|yZy??C?W?`I'_?&?u???S4TY[??sb??????B?m?i? ?'?N??4???|?vw ?;?? ?)??4??>dRlz8?9.?????FCo???~??f?z???)???????{b??v+j{8c?4F?z ?? x??6H?M??j?????\5???}%#Q6*}M?Y??"g????Bj?r2?S$?(3???z?9> endobj 152 0 obj << /Ascent 694 /CapHeight 683 /Descent -194 -/FontName /ZSQYKA+CMTI10 +/FontName /HIIQJN+CMTI10 /ItalicAngle -14.04 /StemV 68 /XHeight 431 @@ -1676,7 +1661,7 @@ stream x???UX???p $?Cpk??????6??????%w??\?k??????s??sh.???9j????&'VR?6?7J????330?D?????? LL"p???N@#K{;1# ???? ??`?03????~?????N??.*Q?&q?m?N?&Fvy# ?-h #????%??? lcP?? g? ???4e?cf?Z??????vp??8I???8?+l????Cn@'g???_????????'?h??`????????p??Q0??g?U??7?????????.@'???)???O???? bx3,?L??H??????T_?????ee0??m?l???W? ???j?45??d0?????ys??a????????'???d?s??0????F?j?O?? 4?? hg4?3??????uv?f-? ?????? H??????O?i??`?????/!K??2??m??-?D@?^@'??n??????uq?3??t?p?5dhf???????Y??5?? ???$? t???CF????jg????{????!??????(H??j??? A?.?G?????C????W??r???8A???C????U??j"??@???(???S?C?|??&.P>??????@T???j?[??????@?5?(?????#c'#k???Un?????r???????M????t2?9????!PF?3h?????? ?9k!???/m??/?X???m[?? ?????.`][?v!H??/i8?? ??????s??B???_*??_?r? AV??d????? ??y???\qnk?"Y?x0?r??@?JL?z??O???/+??SK"?F=.??????8??/?&j??n??~?g??j{]?'???.?1?$???? ???t????3??jyk?_??B?X??o???/???:?i????^??S??M(??X?3??A-f?q??~??M???b} +?L???r?2`??P?U?????kP????E??????3?_???A?q???2??? ????_??+????????9???`??d? :> bx3,?L??H??????T_?????ee0??m?l???W? ???j?45??d0?????ys??a????????'???d?s??0????F?j?O?? 4?? hg4?3??????uv?f-? ?????? H??????O?i??`?????/!K??2??m??-?D@?^@'??n??????uq?3??t?p?5dhf???????Y??5?? ???$? t???CF????jg????{????!??????(H??j??? A?.?G?????C????W??r???8A???C????U??j"??@???(???S?C?|??&.P>??????@T???j?[??????@?5?(?????#c'#k???Un?????r???????M????t2?9????!PF?3h?????? ?9k!???/m??/?X???m[?? ?????.`][?v!H??/i8?? ??????s??B???_*??_?r? AV??d????? ??y???\qnk?"Y?x0?r??@?JL?z??O???/+??SK"?F=.??????8??/?&j??n??~?g??j{]?'???.?1?$???? ???t????3??jyk?_??B?X??o???/???:?i????^??S??M(??X?3??A-f?q??~??M???b} ?H:>2?????"?oh?XozN`?Q??>?/?;??_S??????b??QM????X? ?Z!?l?P???|?7p????????Oo???j2??JrW??f?????m"?m-?? ???n??tR??????%?"I???|'h??if(????6?C?p???}?*???c????????`?5??l?>?%????'kY "????7,?`???J??I[}v???V???H/^Z??sZd??H???????c4??gM?P??!J???9I[I????????j?????????M?Or?V???M??w??!I?5P?z???4?n?!9???gNZ?c?a,??????`9|?[??:?=???d???? ?? ?&k???=t????RR?E6 UI?Z?16 ?bN2G1?^?X?]??&? ?Z??i; :???8p???8O?%??M??Y??????_?? ????\?m??????j??endstream +g??}??f?^c?Me?u?C?P??:??7??}??W??Q????_?1? ?s?>d???? ?? ?&k???=t????RR?E6 UI?Z?16 ?bN2G1?^?X?]??&? ?Z??i; :???8p???8O?%??M??Y??????_?? ????\?m?????????endstream endobj 126 0 obj << /Type /Font @@ -1741,14 +1726,14 @@ /FirstChar 33 /LastChar 125 /Widths 327 0 R -/BaseFont /ZVFNGF+CMTT10 +/BaseFont /XVNWCP+CMTT10 /FontDescriptor 124 0 R >> endobj 124 0 obj << /Ascent 611 /CapHeight 611 /Descent -222 -/FontName /ZVFNGF+CMTT10 +/FontName /XVNWCP+CMTT10 /ItalicAngle 0 /StemV 69 /XHeight 431 @@ -1772,54 +1757,39 @@ /Filter /FlateDecode >> stream -x???e\????A???????A???s?.?????A$?AE?????g??|?u???~k??&:?W?N?P9'G7nNna????7??? ??I??89?????n!!n????? ??/? ?a2????a6V?ni????P? ?P?YC??=?????? ???h?5?? u??^7\?W ?????5B?a0????7 ?0??-m?G -??B0?'? "?m???d ???!JY5&?~?m? -?z?h_???M???":m?????????Vk3? ???O????E???/?????d`3p3?????d?2>??U -?N?????|K??X??e+??&???^?q|=?Cq????`??Th/&??uQ????????,A?]??r?d|U?e?5????d???/?E?i?b?,???m???????8\?????Y???x?????t??69?- {'_|??}6$???p?!?N?h?????h?S??X5KUk(DI5+??????Z??v?{?.??/oq!?g+k?????;?r2??YgU:?+??-?r?%? ?A??hb??????q????i,P^?b;???.??????^??fl%???`?X?\?{?+?????;??????KW:}R?????????d?? -??nZ????_???N??8j????82?????p?q?????????-???mY? ?q?? kp!? ?a??s?du?Io??`????x?0????E?_?d????? -?Y"??v?b_'??-kN??nb1R??!?????F???E?H?ve???G? ??g?Ua_?T?/??"?b???w???KO????x?_?????y?? r??????f??Ju,??????nm?}J??5o?]?*???Z?y???k???/%?????]?S????q???7??+??*???Z???~???y?,{???e??"???=?*?Y?????? 2*?`^???>???????V?wa????????w?Q??)??$????????#?8yj?i?1??\??)? -? ?????DJY???<2F -\E?-|o?4?%??F?X???| n?o???#? ?*P????% 7Pc???g?v??m??(??L?? >???87w -1??WW??B?T'q????,??_e?{W??%?1???????+*x??LF??? -?k?5`?;OB??@?Fm68D?b?Y}?)??YN????K?@O{???2$?2?6)????? )??]?>*O??.???V????????Og?????nA??????u?P??o???#=???h??r8eR??z??9?f?#??KXwO?Rh?!+???w"?g???d????=/89?hh?LP[???$???$ 1E??/?;?w+?_???%p????Cd?xhB??8??@P?U+??????GG???-??U?={?JC????x6?S ??z?K.??G.?@i????2=???_j??{?]?6???????~????h??1???@z -?Q??c |=w?5?? ????JZJ? ?p??''?N}?s??}??v?????<4s??2;??}?g?????+?l?]??,???%?=?[d?2b??L:??gl?:?|???i?CdA?????/4????}?Y?I+??$x at AJ?{???UrfM?????!?\C?><%[???QcZ???6?3G?@W?B?a??!{U????H:?????M'/%HR???p????WO?eb?r?>uu??C - jU?U???9??y]??K[???\??? \? -d???9? ??7?h??X????F ?mL ?[?a?????+?????hI?Qi??11??G???U???=e???z?0?UWe??(uD@???K?,D\????!f/?;?????I???>? -\s#.W??A??i???u???I????o?b??c0lX???????{??%K??x??n???4? ?F6???h??r0???Td?hT???:Y????{m??????$C??Dq?B??? ??~??n?????\?zP???2?[?aq???????2)???>?+????qoNe??GJ 2)Bjl??K)???`?? ?-???(?}K??(?r/??x?? ???w??? ?????~X 0???/_x? ???? ????>F$L?r C[?:?? .>9???m?? A??u??\36????t^i??--????r?e,?_?6^ir??X{[F/?B??? B??????g??m ???(m???,S+#?W??T1?a?[??;??]?h??????j%o`X?? -?,)????? v??? Y??*??/?Dyy??'s&? -?A????F??t??9?C????nN??&????????# I?ixsX???!????_ at Q9sMb??????D[]???a???? [\O}?????/7??ut?/J?zvft???'B1.?Md=???????????[??U??S+??O??4? -1??????????1???????E9?q?B??O?%??t???????U$?ba.?`K???R????do????4m~`?????v[?\??????Q???O"i?&?? -kG?????xS?qB ??|? -a??A!??xL?E?q??2??d??Y???K???S?K???{ _???k ??|???F?&?oiQ?*Q?!??????h ;??4??a?zr?X?@???e??l??c??[?????fY??0-??A(????????.?h1?gH??????Ow?+?qK}??zw?ap%E??4?x????$z????M???3 ?I?????????5????X??E"?iz?SV?5&7B???^2?U?!?+?$??Z?7i??j?1h%?}??????^?a?}? ??"P#??~??a?y?|u?? -?!???6?.? ?sU(2??R}w????$$?/?n?????)H??q????Yo??xL?????NP A??xY??+^:?????-=?R??-c?|G?????>?[y? ??????????????^?????y$ ??Gb#?|%L????iq?^????G"?hZ? -??n???#?Nv?[?"c.x?{?????????????I2?AW??O?/m:?????hq?jG2&??J???o ?!u?C?/?????u?????'??????+??t????N&?M????????[? -L,Q?? ->?r$'?*???X??P?A??? ???dF??????,?eb?5???|lF?n????i?7????G"(??l?:??y6v?;???? ?NN?'a? -? ???L?S??????zN????/.0???rT????? ?NR??l?(:(??0d??-G??????K?????O?'?????=?G?B? -`?? ?bU5\??%9 ~n???a9?|?97????=?TyC??9+3????U?d?w8i??H?????G?V ??+AW\?p1? 7??jF???N??2??????w?E|oB?????2#?n~?3)??QK???q?#P?Y?ln???z??4?EB??J??:Wn??????H??D?&???????? ?(??C??K?'????@?L?s? =_?3?l??lN?OpZgb???/?a?Q??_??*#%%n=??O?2~7???Y??????;???j??7???????2?H??[[??\??G??.??/???q)?J??Pg???|????H? ??#p?pY?Z?#!??;?A?T??r?n?????#??^E?7??r?O;*!(A?P?K9?????u?yH?+]???????05????O(?? Q??v1?n?YI??[??d2?????W=???h%?r?Ec?Q.??p????~????n????????Rs?6??z?b???H?E???????oQSK?>f?X??#  ??????????bSe?2?\L4 ?,?{???BT?C???9??`{6M???4> -?PN???????? r??!Z[??y?;?-S?U6S??]a?????/??-"??q -???$> $?????"??~??sE?? ??9D????qg?jk??,??????W\0Y????t???!??"e?w?J)??.?,?)???j?^q?u??i????@RT??Vde???z?N?m?R?????Yb v?^m?n/ >?Y?2??p??pmm?>&???????????'??????????y ????q????z????Lv??a?N?At(Pve[?????$??@?????r?n???!w???1???i????L??????B????0v????>?0X?bP??s?u7_?EF{m??????+?5???\??NDX3/?~?kY$(b? ?% y~(4?.??}????????]????]?K??4?U???????A&????T??W?Y??fs9??f?=;}?n????e?z,???Z?T.?$?c????N?6??9p?q?????P???{??Se??O??"?K?????;? ?????5,Y???J??a? a??U??oi?kq?????DZu??k0???s(.|??L?? +????)Jt????]5??%????X.????L??*?_aL????_4?V*???S]/???<;_??????ZY???Y???X??Q_/:j?????w?????gCR????zb?T?f?J???8?9L????Q??A?T???^])?jU??ag????O?????p???& Jao[?s?&????uWQ??????(?\??????&fL{M?(G? ???,???k????O*?n? [\a&????? f!y??zG~????WqGwq??z??J?o@ + ?????\?\??L?w?????? ?????K??????'???CXuGf??S_Wn{N???|7v?g??Er?C??A?X?????n?{?)TZ8??K??V43?3??SA@??c?1?????TC????????>?5?????O?@T??M??^?w?G??#?>9t??u???????x?sCV%'?k~?o?R/\??uJ?W?i ???1????<[? (?O??c?:?]{??l?P!?? ?????????,??|mms?I?X?ZZ??|???????@?????>K???Q????7"?' ?=???@?W.I3ou??? ?a.???????JH???Ac^V??D??O?H?A?v1 +???5?#?]-?b`?k???R!l?2?}????????>?&,M???T????E.???>??X =??????g??B??BZ@??Zi?C??S!??p?&W???h?-%S???ewy~???"}>?lA?E??K+V?p#rl???gy? ?z??rQng~?_?_?$?????W9W@??p?'@?=?>& 1?+?>%?B??`I???6??H)?Y???@?H????????u?&`???(k???o?????gy?=?rJ}???`??jl[6?l??[? ???iU??G?7??!???5?G??>?I?$ ?>Ke?W???Uaf?@ m~vl\??BV&#?qG?3?? ???'!nO |?>"u1???????"'pfR??e??=c?E]??Ld???fD???? +???}y?kd?D?K'?O??.???V??????)??n=/????{u??E??2????J)??7Fz??????p????~1sv?AW,?????h??0CV>}-?L?? ?x|s?o1??r\[pi?:\???ma???9?????ma??O???? +?????|!??~|?#?z^pr?????2?To?I$I=Ib??]_n=vH?V2??=K?}?#??????8FCq0?????V\?`?????I?[j???{???????Z?l??@????\?p?\???n'= +HeznF???D???1?bm~?UW%z???*A?2.?Z}c ????J??!^??z?jkJ???)???? ?8?ON???F??{?4??t?`}=7|h?8?cv9#?$$6? L?9??W???5?Y??KP>???0e???!?t???u8:??\= ?????."? ?q?_h?)$????*???V!?I?????? ?W?????{?GC???J}2xJ(?Q???????m?g?|??????1??t?-N?9??B?G?5??GP9??X???._?;?|.??????TQ?s6f??6??S??:?Q??v???? +??s??vo??T_?2745?&??v??????e???WL??+??????cb$F???s1??0? z?^????a????XhS????W?RY????0C?_?t?{q???.$?} +??F\? +X?/?fs??M??'P#??g?????? ?`???I?e9%??!K?4x'?d???} iF ??l*%A??#?h??W???x????W*??????? +e???t?K?-??A?!5?u!???????Y?K0??n????7???? ??ry&;?7???-??????g '??!n?:???kq???2?]?lw??z?\?S????8I?l???9??$/ +E/?Y?-BvY? ?????\?n??;?kT??~??3???c?????D\?>???????9?<3????3??}?4??u? +??o}?????[??I? Q??>???????z????????6????e?????P??-?  2RT??}7?C?I ?????6??? dR????7?Rx*???u??j????4?t?;??Dh?h? ???,??q?h.?+???~Hd9???>AdU?@?|$????v[??Q|???[Q ????x?? ???w{?? ?????~X 0???/_x? ?8?? ????>F$L?r C[?:?? .>9???m?? A??u??\36????t^i??--????rR)?/x?<9?s??-?z??\??? ???x?TN???3X?.????G?6??????????? ???0?-e??r??i??]??U??zVrU5???U~?9UK???n??="T????-?[????v2????ZD?v at q ??B?G?i?X*??7?A3>?Y?6T??????l??O* +s?\fr<:??q?? b??i +\&?/z?+?8.???Me????&eD?;?V?q8[?'???????g???7?G????b???'???BJQ???????? m?3?>`X?? +?,)????? v??? Y??*??/?Dey??'s&? +?Q????F??l??9?C??Ry7'r`??]M??F_???$?,?9?i?????T???????&?V +|o??G??????0s?K??-??>??????C?:??%C=;3:???P?+aY???dg?ff!r???poU;???????6???B ?3dvb?#?bL l??6??AQ?W?8_!_??? p?vX?????~ ?X??6O???h??8?&O???????nI?(`F-??$????????? ?}R?v`|1C?z ?????wa?-d3f?D??v!dYC??????~?T9???&?oH+~?????c?????i??E;???V0??2??1GJH?B???%??0?57?{??QY?r???Fo?????6J?S?????T?o??T??GH?-?X~|??#?/_????h,Q?!W??A???QVH??y?XF????? +?u?[&R? * ?1???Y?????/BH.h??\?I?????uO??df?B5#??????K??N?h??s]?????-Im???????0???}??d????D?????rE??l?H??jQ??a-??3 |?????^???g??A?M? ?? ? `??T?%?i{?DW?xb?+?H??e?O?????? +?????S2?<??n?Ny???{?r"'?*???X??P?A??? ???dN4?????*?cb?5???|lF?n????i?7????G"(??l?:??y6v?;???? ?MN?'a? +? ???L?S??????zN????/?0???rT?????-?NR??l?(:(??0d??-G??????k?????O?'?????=?G?B? +`V? ~bU5\~?%9 ?????a9?|?C9w????=?Ty#??9ks????U?d?w8i??H?????G?V??;AO\?p1? 7??zF???^??2???Wv??G??;???????A_? ?l????x?DG-?Z?1?@ydI?[??MK?q??? ?7*A???\? >????"???/C?[7??b.????????x????3@.????}-?t??~?9???i???/o?8??DA???"??????k?8=\w?59C? Z9?G???>??GB??wT?~?? ????k???g?k??Xoh??;f?y????????"??G[Y_??]???= ?^??????S{???R??M? y??o????z;\??w4?)????7?) +"?{???~???g??B???m?X??4???E>????b3?2?\L4K?,?{???BT?C??????`{5M???4> +?PN??k????? r??!?X??y?;??R?U 6S???`?z???/??-#??q +;??$> $??????i?^q?u???????@RT??Qde???z?N?m??sDPA?,??l??I???,Fbq??{??6? H????????X?p???d???n`b???e???}??9;?>>,?3??????3?Z~[UT?Mu??7?:??????B?????0{??fVm?endstream endobj 119 0 obj << /Type /Font @@ -1828,14 +1798,14 @@ /FirstChar 45 /LastChar 121 /Widths 329 0 R -/BaseFont /VNZSRA+CMBX12 +/BaseFont /JJZPJQ+CMBX12 /FontDescriptor 117 0 R >> endobj 117 0 obj << /Ascent 694 /CapHeight 686 /Descent -194 -/FontName /VNZSRA+CMBX12 +/FontName /JJZPJQ+CMBX12 /ItalicAngle 0 /StemV 109 /XHeight 444 @@ -1852,59 +1822,61 @@ /Differences [ 0 /.notdef 45/hyphen/period 47/.notdef 58/colon 59/.notdef 65/A/B/C 68/.notdef 69/E/F 71/.notdef 72/H/I 74/.notdef 77/M/N/O/P 81/.notdef 82/R/S/T/U 86/.notdef 97/a/b/c/d/e 102/.notdef 103/g/h/i 106/.notdef 107/k/l/m/n/o/p 113/.notdef 114/r/s/t/u/v/w/x/y 122/.notdef] >> endobj 94 0 obj << -/Length1 1823 -/Length2 13445 +/Length1 1837 +/Length2 13578 /Length3 532 -/Length 14470 +/Length 14607 /Filter /FlateDecode >> stream -x???eT\????[?{???]????qw??????? ??$Xpr???|;9??????f0??5W????UtS?*?1????%?A.??L?|1UV+ ?(%??????$n??????$?&?7?_>N>N6$J????????? ?F???$n??????P0v????05????Z]?j{???'????x?7?????C?r?i?????I!z??z??sqkK??j???Q?????8??s?m??}???? -??Ch?_???p?x?G?Ix?????n?A???K??z$tVR??Z?{`?Z8`??8?]EP? ?? ???? a8?wR"\?????C?????`?h??????@v???g|?}E ?#???) ??7?C.??b;??5?%7FS?V????Ww0-}???6C???????????i"?E?HV{hO???/~J&?P??O?p????Tq???c??vDc=????u???U?^f??|?)16??aL7?U?+??D????y|??4'????B? }?m?????? -?EQ??????.???C?f?????D??w??N]??c ?N?|y?7 ????Z??M?|??? ?8q????l??qU1??%v??`?'e?[??q?-?O?v?P? ???vE??^???C?TY???p'^?a??l????????7???4%??????|H}y??tlY?MTn;??j???H???H???????=!/?Y ????B??s?9?{??? ??')?~???b???i?? ??????Y?Z???7???pn???>K??????A?6K?q?0E??????T?oC8e?y?? ??????p?]D??+? g????'iP?????=at??G??q |r??[????/???_????Y??J??rto7?C??Q?o??m??S?E?R?????=> -6??N\?????w?Q??Cm*??`8f??_?F?/?1?#???WU??LB?f????5oS?S???d????y;?-?????#?4?? V"??_?;???[???wiA?F???F6??????Oj-{?h?(? ?5v?d??bj???'CMX?6??[h3?P?????#L?et?T5y;}c)&????y?fIP???xu???i??K*+?'?zf??0{&?m.E\&?1????kz -? ??? ??D????5???C'??R?>5????U????k2?G^Y?9?{??b???6?5???w5?????o\?.???_?"???????G????9??=?B= ?T?P?????H?85&p?????S:?p?C._?? 'p???B?6Z?24?{?? -V?????O?? ??|?1?$}?Iy????x?Q??9???W)!?)?????<9???A???g ?H^?1??2|?+??F/?? T|??? ??=????? ????uv????%?]I?C"?94????6????IkdE5??5?U??h?`tv,]11??-?FH|???N?u?\? -?????:?O?f??N???(??'S??M?-??}????? ????????B???HD???{??r?w -???!?S??6????R.0?? ?D?? -??F??m??T?W?1*????c_???4????d$x]Le ` ?n?ey?? w?q????t?u)vT? )Q?r#??K?7?.????Zg~??? ??zv???????????7????rxo???{m???r?o$??S?*????e?Jv;?{?????>????[a1??????7,qG??|~*b?V?T??Es 8tC?_}Y?Q?-|??w????F?k?d?s ???#??????L9mV???@??L~???X[ ?+U0,f?`_?V?????1??n??e???1}?????D?;]U?Z?K?3r?^??L?cJ??o?????OP#?T??]??1?;?5*N??#?`?#6G??H ???Ym?J??'FFr?3??GD???? Y?c?j9? A?@?????@?D^z???l?t?? -,?I??????x??E??^?yN??7???$R(???4???6sC??X?(JV?V?sK7???s ?J=??o?h_ 7??o????6B??N.u????D???/z???????2?3??+????C?H?Wq?J ?Q?*??%??g$W?-.?.?????q?{o9f??+)???#?` ??&?6h?ue?-Z?_??w???h]???-?t}?6\?????o|u%n?Z?????>????1????????3?v?Ec?????B?????4?J4??-Y[??#?H??2?t??4+??;??D?l?9????W8??WK`?9?w1????n'???%????i???36c???2s^%BA}??O?X?j?6A?#?,#?N?5?@8??sR?-?}????????& ???6???md??7?d??????g ???5??.???Qi??? ?????hI??tR?}???? ???2??E+????V???L???X??_?=??Eu??}SUU0XW/\8y M?jB??????G?? ?? D[d?\??u[~?? ??3?2??+?0??Z+w?Z_Q????NoM????????H?D??H?u??????G}??-E???u????}"????????n?Nq?q?vm?CR ?HH?-F????????)G???|?F??????}????=^I ??5?$Jm???K???]J????????z?r+?a?*?gT????'??????d{?zm??[???o??????o?????P?5U8_?J?o???wz??a??Q|oV?."?Mre??jE?? ??]S[J??????X????? )k??????T?????' t?'?]?3??@?CWd?? D~????P?????:MG????I?g?Y0N%??E?K$k?????+%o??U ?#????? ???R'7????F?T}??z{s?k?x??????????)????*R???O9c -?-4<0????N?$?%??d9uJ?z???????R?Z3?F`?y]?6@??,????,JR????{O???? ?? ??y r???/????MB?"?????@?x?0?EU?n ?%v5gc?T?sE ?'? =W ?H,?Q?N5/?ts???????????e??.??8XX????*I7Y??$c?I}?????HAU?????nbq????=???????????~f??#(B?~d?P\??i,?|??N????36X??i??y ??Nx??h??? ?'?^M45?Y?>?? hV????x??jP??Mf????;|iT?6 -?[???#??C???2?????[??????d?I???y?Q8#???21<q?????@Y????s?&s T"?[A??? ????5????=?'?3???z4I0"???k8??i?BD???p??&?4?^?W?~??hlE??.?-?,j??$???\?E?Ja?w-s?P?0:)00?-?V???K"???]?I at H\<5?????I??F-?????-?4p??3???g???????SZ??v??a?Qn???wxEY?/??A? ???#_ T???DteJ??? -???c)?Gv]q4?]#Z?3`Z?1?f{'?????,?&?0)?????>f}?Ga???[?N?W?M?$???`%%?,H????6^kJN?+?????h?4? gxE?????>?X?????}??????+ k#K]v?MV???no?e?Qo`?? ???%?j??????????8???`)?q?a?Ke?H?N1???????f??ce?s?%?]?ZX??m??}??????? -?6QO?{t&????5??????F?8d2???ar^?????[??E?????>?f??b?#???,H)!???&?????N a?h???[z\i?????!??P?????#?b?????w???z?E?r%u0?n??\???q??6?"??u???$d ???l???z?#?-:?PX?H~?_ ??????%?&??5?Ht???.?yL?F????T??(??B???v??(?[??%?jj)????]?????~:??fK8?????|4?=???+?? ??=t?{?e?Lc"HdL???2????t."?"???w?Pv??????p?e -/??T???dr}?????!???=?K?XH????Y?????+5?b?%????s-??b^?i??{??O??} -?D?Qy?T?g???d? ????zv??t?????Q????)?@???? /:d????V7]B?S ;1?)~??*g??? ?!??z????z#??H?.R`?R??? ?^??? ?!??.?J?_rb5-?c?p~???s?G?? ?7???f????I?#?FWy ?Arz?9"?e????~????? ??*?6(/y????4Eb???*}8vL?"??N?  ?"?n??i?? -" ?;??V??D??C?? 1O???????Of?!?l?????d5N??HQnw?=?q?~|?v;???@??:~ t?!???F}D??g???$?"?E??uul??K?????|??(?=??????H?d???2%9??K?1???s'?j???1q?r?By??[?$v9?$??n?????:?W??o?! -#?>~DJD?????_?c+(o?nf?#@le?e&?o?G??K?k????????7??5G?W?R?+??loS&)>??cd?.??^-??_%6M?m?L8????*/?e?? }'?IG-?"?m???\tmL???|`??3??????t??M??FIC??E???"??n?g??q??????|^?!??O3?X???vG?? X%?!?8??-?^k?Mt??*???0?????A?>?=?????0?9[???????0???m#?_"?N??!??????????j????[ kU?T?O_?`??;p????????H?|???A???U???^{(?Q????EZe2??q+???KL:4[?????/??Y2?*wqI?BM?, ???_?d??Y???I???? ?R#}?wNW~????2?????a$o??1???Q????G?????*mCn?L ???m9??r??u??vK?????c?&????Mp?N?o|?R?R?&??}???sxf(???6f???( ??O$?J-a?0Mw2????`??b?j?I?X??e?wT????C??xg????Y???} ??A!?s??x?Sx?|$ie?PzI?1????a???8?[K?t?k$?dZ8?K??}Y_???b??????[n???????yx?????g?)?????qKW??:????y??#?{E;j???op????w?~??f?????1M]+Q #?????5?!???.???of?????!7PX???-???3*??a?n?????L??????Yl,????9??[C ?????A??4Ck??S2u??h??^Kx?3v???? %V????/-?8DF?,??????ci??E?WK??#??????????&~Cvq?9???????Qg#??Z[$?????!???"??I{7v???%???`? ?_S0U????$?%?$???x???\??Csi??????PL??X????+D cC;xk????????o*b?]J??iT??B?u??????"??q?a?g???~?????o??~????{????V?=*?|??O[?? m???2E6z???p`???db??D????[y?)?J?  Z>??^D??FHC0=h[?"?????p5??"???%i??y`?%??M?N#/???????3t???kZ??'??BD?]?s??V?zR?f???FEJ??1 -??~????F6???}idC??l????6H4?afY?y?T+-,??w???????GC???BT??e???d ??gv?3?m?b??????????????^^![Yw? ?4??gyK^n)??mni? ? _?pY?^?#?'??\?? ?'????S?O?[?Dx?e?8????@?3y?b????{???????P?:T???D?????o"?qT????y??.?u[????? ll??vV??/?8??9q?Q#?9?0L??(??#y?t??O/?? l???g?94FQ%??!?g?$ ?GBPh[????L(Yx?U? = SC??:?6?G?????????x?? Q)??K??s4 -)@{f#nt?3\?>?UD"??mp??E????je??Y(??f ?J?Y:S?C????? &??L?v?c?h???!=44?j!?:??????F?8,???Q???l?>2??BA>?8??w??S??^??R???M?L?????M_/m=????OMcIn???"6??Jd?/?N???V??)?'???+?F???? ???l?????F>???a?:|Dj?r?Y?y??0?1????lo?8MYN ?"??????Qc{mN`?C[??a?u?O??P?5i?2???H??e????aa??~T??!H?k?+~BdB????}??HuG?tZ3S???f1?? ?B??rj???c?*??????M?07~?????P????XC???y????"??.?%a? ??D????G?:???????8??H???c ?O2????5???x??k??Jz[??h???KD????????(????-t????7{{% ?W????? ???p?G???V?dL??h?HU?3M?"??|??????|??9/{2?z??+???m^r"[tN(o=_a?3?~)?0 at A?Psy"+r??p??sT?87BTy?2???zT at C ??+??T? ??)??M??K???oz?????^4?I?<_4?????e???j"J??~?tGvP????????j?????}q????n?e*??Q??? ?!T??]v??Enn???w?op?n~???%S[>j?)?N'?aGYL???? ds???d?,?%?sn7????+??Wu?? y?-?????F3??R~?QX??B5???gH???v/????u?-w?-?? >+??w=?+?2???6~g]????N?(???9F7?H+??EI?i?-)T?[~?????o? w?%??.-?????%??n?Z?q|??c ?T?[??eNC?1?Av,?Y?RB?-?r5v??t?a?$??? 'OU!???4??Eb???@??????P -??>?y?K? N}?8??^???)?????p?????&?'???MZl??????*l????cs:?V?yy?????p0??????Ou;$?=???#?+???p?=d??/?4?%oc~?#??J???k,^??Ax?????? ?2?3&1???*?c,]B?K\?/\"uh???O?@???`????6nMC????<=TE3?Q???????0????0W????}????;???Et??k*??O??#??????=N?'C???oPz????-?KI???t-?r?l}??8???QYH?"RR??_?PH??F???p ????a?Ok??'??R?=???SZJj\?V???.?P?+3B?|?/t ?1h???d?qY?u??sx?"?V$T?=m???g{ ??F??^???p?=[c[?w?????%????F[???!=?IB??z????=??D(?????II???3Xb?u?xE7??C?sI?? ??????eLj'??em??(???????? -?tv?\????%?? ?_;?.j? v???*-????????kT=??~!??:X?_K?;? *?0???M?`v?u@?.|?*?,?`??|???RO?Q?F???,?s#????E_?N????}gW???C?????r&??%:O?????2????4]??y???,O2?![???H???hn??x ?p?????.?x~???L???r??????????Z?S?D???VQ?V?u?T???x???????????+???$???q[?ox???/???x????E??~c??\???z+6{???????PM?R?Io?F?Ub??ZI???u??s?JL?">VX~?????k?????? ?Yx'7?-????????_|o??????d(R???a?[???`??=?????????7???????l???6? ???G????Fd?_??Q*p??^??o??P??Sjb??j?F?):?=????????????F??????N?SA?Q%%? 1??????K]?kd???I?Yd???DH?Z~GB{?n#u:????P??YU????(wf??D?M??n?72G&????\?r &??F*6?+.????t?9<>???????BM????-???_???{i?#??2l??g7?iD?????:;-?K[?????V5?????? ???????4??TR?-?t??? ? ???`B;????Wn\?T?)O9 =!????????wOc??????t? ???K7??????=??E???'?f???l????????jQ4?!N?S??Mx??y_ %?Q??%?>???g????????u3?0A?w???????/\)C?h??@*Y????????U???k?ap?p??]???l} -?\\P?D??????K?~&?C?4=??????Ox:}k? ?????^???R'p???????V[??3~?????pop |??]??5&Ti?2?A???z??C??Y?w?|?T}>h*??`Q??2T??A??hFi&???\V??|Nu?o&a??H? -?S`/?{ }?oh??E???_???vZ??#}e?HSp?|\i??E?K?~ -??SxtA?9???h???2;rR??????? ?:G9/??+?k??~^????'=?|\5?????? ?Qd?????????{?UZ?'???&l?KU;m?\o?????p???`????@%+&???????OL`j 4vr??3v?A?_???endstream +x???eT\???????8??????qh?5?????????-hp???w????????_w??G?~f?U??YkUCE???(j2J??]Y?X???j?,V&1**q'????^???`??eHM?????89?8??? O'+ K??????v@'+Sc{????%??}Sc[?:?? +???????s?3@ ? tr?1!????L]&@ +{??d??A???\?g? ???.??????????`4G`V?W????????K???*??3?????????l=?w?????P????;U?o7E?????????Z???[?,?Y9KYy?T?\L-????????f?-???)0?+h?????{O?5?ble??????Y?I??????8Yy?Y?????????? ?????)???????0vr2?Dx?{???? +??7z????L? ??K?=????????=g6?W?????V??m? ?????y??????????`0;;?m??EY?w????K8??:? ?1????p?-=,??B\?W???? q??m??-?Dx?^@'????/???|uq?3????b??+??~?\???????_????{?~?u?????/???c?????V????f[??????i-???g?O?}n???>??z?S??O(????-??~_??z_??z_??z???C?+??C????{u???^]??WW???WW?C?????{=???^O???]?????C?t?C?? ?????????g????Y?e????^??6?/|??? ??,??w?????X???N6???_?????|?*????w+?_?n???s????VN??w?_?n???[????Vn????_'????_?n???[y? ???PL ??????t????u^/????i???~6??????D?6?z??@?)??????:??k??d?T)4??ES?R]?lb??wp??yG??Z???TL?}?}R?gB??v?q??@?????}7??T?B??TE?=???c?????Np?????x???????Z ??52?}????`.n?T[?o_j??????KB8??????B?O?Y?k?_???b)????Z???\%??Pw?C?????eb~???"?4????? Qt;ghi?!{??2?(?5d?7???[*`????G??????? +??c???V?n?????0O???=R?;???+K?xa3?L?hj?I?9???d???(????q??6??~h??^]??N??Pw??SJ??"S?_Y?.O???zi??9???1L???y??7????!????6???3?5????w??,?Pf?Z??X????????bm^$6??% ?O?????f?=?L^?^Y???z?????, K???/??s?l????I??????eM??&K??<$???rM?C???'R??7B?? +???2[?? ???`???K?7?5??????;??\??WNv?????H?@?? ?X5.???mh??)??+W???R ?w?P??Q?~?`?p??????}m?#?i??_?)????y?}???????SK?i +?? ?N???|j???QKZ???L + ???>U??????`?? ? i????&???T????3?W??*$0??? ?(x=??*??5Q??y?? r?????S??1??&s) +@??RS? +???B?E??l\{?4?+?aH6}??5??Iv??i?^V ?h?iQ?/\ ?13???????m%,1]?v+???B? +????????J;??u+U?n?q??3C??M?-????????0 ??1??z???k?!?x\!???*G?g??#?8E??z?i??j???8?h+q????,d??Y???{???????g???\?=??Ir?X???????8????!??F\?G????.S?Za???J????T??(?2???K0z????"u??_>???'sb?*?=??&???S ?,??u?.?/U???{>??|0}???T?j?w??????????/(???3???&??_S?K?/???(?^0??A7????? ?h??s??W!?6????>?i????"Z?CKm5???I ???;?jR???D?8Oy??????????f?*g+?_?c?s?[?qY0!lH[9)0?'??,^Mr?uF???}?MwLE??}?????S??1 L? ?&????UZe???$F??i???9?e?a?????PT?\????j ??g9???=-DI?pz? ??![??J'??yk?X*?D?K$????iX?Y?L??X???????-_d???r???~D????&0*N???w?]l?}???Xp_e???e{????D?JE?"s@C;???r"???r???u1?$?h?C"????h?f?2e????Nf? 9?l5H?$??p$???bA=?? l???|?u?8?g?????G?+?AnS???#"A!?"???u[T????gW????!???%+2jJ-??t?L???sw5??m1?G??/??*??5 at CC2W?5? ??q}? c?? ??? '??]0 _???I!? ???H????d?e???????`??E at 5??@F????z?)??v???b??K?0U?a????*?a?W???Bt??3??B??~9`??z???????@?J?????^????jJ?a?]??w??????????|?n???}??$?~ +p^o??|??????U???3e2?? ??UsT????????; l?????(?T?g??*??;??6??P??3? f=w8?O???EIT????????k???"?_?'?aV???????=?i???dd;Dm?? ??$??mII6???????B??z???U??9?|?Iz???#b7ye??4????'??oO6??M?[j???+vN??{6?n??.?\H&'rL?+~?1?qL5N??r>??}?^?zQM}??o?7^R?3?%h???%g??[??Y?~t???w?????=gC??!M???KIB??????"????????^?? xM???aC%?????s1v?g??/??~???e&?`??J???????h?{?G ???+????l[%FVoe?ki?w?>Q???{???-GS??D???{K?j?E?@-;?????r?%(?qw?6?y?l????27?`6????x??S +???B?p?iFN?vX? ????Lx??Tk???o?|?L????im @n????Z?d?Q?S.?a??? R?J|???A???z??G?k?KO??@5??Y??\?~&z???z?G?Ie??B1??3W??o?nO885??}G??T?\[?? >?W?&??@'????3??2??????yd??n??:??AHuRV???[eQZ?Wr??O?'-??mJC???|???qc??|?J?? ?d +?b??t?M?:4????Lf? ???H??T??????$?X?n???O'BJszMe]qv???;?3^0Y???%X??S???9?T?:-????Y??>??!??}?c0?? ?Fm^G?!??>??'=?*????7t?**K?~?{????l[8 +? ??\?fN??6 n????????????x?r[??2????VZkx?b??QeK?Oq??uS?]L?Mp???#!??3?.^?h]G???]???Ch^?v?N???????S?V??LW?t?6??c??Y:???]??287L?.?K????-?:??Fs#?? + _???`??w???'???!???J???F?`??????<?$n????w%k??y??AU????? ?????????T?ePgR?Fy??B?sQ?Ld(???=0???m???L??M35?>dVuO??+??;?:?,??0?4??H9?????a?D??~^ ?]???=n73?????a?nd??????i???m?P?3?;9??????7d??$?F?B'@z@????E????X??WS?KQ?Lc?-??? ?y?-a????+,?[N?K?????2?8 {x,<$?1?U 0??? ??A??L?+??M1?"|G?um??px???6? 2O??T*?q)mF???]N/G=??wW???/?uR??? +c?_d;??4??)?z0R ???#???a 6[P?&!???f?H??l?????,? sL?????]????????6-~??LG??ZB ?o@?R??IL?J??E??PBY??a(??\Q???Pzc?????D??G???'???qQ^??txF#pT??=?!?f]????"h????XK??,??(#?????b2??c?X?:a???s?fz???x7ywJ?? ??????K?????5U??#MM?:?Q???|?pk??????#{?}?'????Mt??"P? !{G??-["5?^5?N?{??(Z?????????Xp1?????R?????lz???\d??[??Bmi?]`YMO?_?A\\1,? ???9?8,=Z$?/?p???5C?1????5?g~???d?Y?~?DU???K;??.?x?C|z??Q:J[z??????? ??????N? 9dZ\??;Ps?p???)?????????%?j?L"???x??Y??@%}?[???0m?k4?2'k?^]?Ka?Vp?????2?g@????G?? el??O??C??2{?x??:h?c? ?X??t +Vo_v???? ???????????/?~?G?]???Q?;U???+(?V'9Y???2?Rz*?#???? +?O????=*$?`?L???fBT?C??MNq +?f(???.yF?7~?????'???????/??:D'?R? +????a?:F??F?}e?????#a???6?n??v??L??Rs???n?W?c?"E]?????? [??(s?J??;Q?.???W3?o?6JSq?L*?,?> ?s??U?????y??^?S0????? ?j???Y?????%?#???%?4??m?;??xvF????l?#??(??????Oib?????JD(3~d?=_?=??FRh?Xmg??c?0?#?-v>??{(?~?Z????oaS????;?{?8?Q?s??g? ?AGh??&FQ;f?W??69????2??U.??@,E?}g?A|?1;8??M?>?gr ???R?SB? dG??f????iA'?#uo3?]??????[?VsK?P6??"??f?q&~???t????]?}ReX=?K?r?? ??IJ??G?L?$?;?3???? fn?U??????\?cbq?Z?]??/F?????$AA???????y??,n-?|(v?g?RwV?8?????? ??? ??U?A6o?bfUD?EaD????'?????\ma04[?5???R6g??n?r?Y ??h??"? ???O?"i$????G???0?n??C?RM=??)?5??oK??C8G???aV?~???}??U?? +?l???k???DN!???6? ????????{?r????F?????????<-??M???????????}s?b9???Z?I???q?Z1???T9vB^kp?V ??????P???x=L7?A??C???R??????86?R????Z?,.m??Wl?_????????<,????K'??O??2??wW?X??z??>OoY?AQ@??qe???v ?t&???Z)?????fz?^?{?`(?S2M9?/??^???? ????K0{^?g?0o\-???Bd??H??????8?$?R??'t??o?u?d????M&.7?M*o??n?Lq????????r?[L3 _???????O?Asr?zd??>}??? +?,?? K1??]??9?a?TcV?`????2 ?G?V?{x.O ?+N?p?????m??tx?k????L?P??j??f3V??KTg?????9????eY/?O6J???|h ????qH??sg???????D??,????~?*z?B???)????WG???$?t5???7^%N ?ec,%??B????W????D?+???7???????2?0z0?)?q'I???r??{~??XZ?Qj??8%?nm?]?kr?O?????0??J??_U??T?\w??"? ??????V?N?T????Mt??????y?N?????v?? +??????rl???DB?R?.qH9??H?I??:'?6??l?-??_t?l???K??Z_?[??A??????Bfxn?UEn?6??49??\??)???^?>??X???&?G??`?3?*?V????:????)??%??$N?2:%???l????B"?I?5q? 6???1??y?G?u/%??Q??7I???+g*r:T?? ?O?E???7?-X????;?|????b{??? +X*?? +Z??^?????>}??qPA??1.?%?????HK??.??'z?C?2r8??E?8q?H?????Mw??I??7X& +??H??;??K|?????d?]\???"???^???_?S??c?a &????????]?(??g??-W???(4*U:?$????a??*I#:???y?p*?(?????PH)?JM??lU?sj??Cp? ????W}??@?s5?????q?t??m?kQ`?Gvr?h???????5&?~?T+?5?8??i/???J?????FH?e???????????^8?}??g?}ucv?T?b????G??&1v ?N 5 ??????J?~?-?~?I&j^???j?2=?]?53mK?M???W?Sf] ??&??Z?8?(?"?i3????d~?#'???+v?j0gg?????????Rv???c????????R?PO?W?=?h????>a%??P?? ??4f???g??1G??/?s?? m?9? ?$?6???Y?s???(??`{CDE)???UC?~Rz????M???VA??????"A ??[$YkK?5G??x_E7 ?WpW?/l7?M.??y??iA:l@#?~?Sqv?I?e?3M?(?K???4?????/? ???(????+w?n8O?(?a??rNy>?FH{C?? +n#ub????\?s;NO????@Z??'r??9q?==????v??f????? +f???????K ^??o????2??????{I?.LAf?F??X?{??@??1??Iu?#?{?@?sJ??A?????WC?-?:]]???4/L[?B?6??[?????=??]Wy?E???d=??Gx9*d????SJ?W??I?jO6???V6???Y#a?m???F???U?????'??pr???DE?????S1?? ???9q?Z}pL?S{?x??3?Yb?;??a#???????uM?n?}? ?H?o?*g?G??5?<)??3?~X?Dh=?cT?V? +'?]uU?w"?????? UM?r??pD~24{uQ?_?*??y??z???? ur?M?;@4?&?_%???ra????q?0?m??9????aBg:??a????!Q???????1~<??? ?%]CB???^1?_????v?GXYh??l? uoi?????????4??(?? ????}|????|?????????=??$???p,`?? IC?u z5????????&@??????\]????????? ?{6?g/cC?d??rG??[+ .? ??YwV?#c??~??X?Pk??????j.]????%j?????7c?y?XpFY?1>$=iw="*H?????_O???M=be???*????t?:8ay?:???( ZI=2+??j???;I??w=??wULg?????4??n??Pp?? ??Thv???????Nh ????c?y???vY???|???7??????a;?}}???v`??E???hg?< _??L?!K?\{lSG6???JW??/???0L? +,H?N ?Q?I?K4??}??s?7ld???? ??XZ??pt?_e"2???\????5?k????A??S????j??MI?.GA?i?&Y?Q??????????&???9?Z??????I?????u??'?XU??`???????i?? n?o A??;??m?[s?Z??????X?-W?????(?????S"?#Z?Ra"?0??X?d ???+???&y`\xk?Gn??q?X???l???W??? ?}0?r?I?.7?]D??$v?M????fAEb{? ?????0?????l"3W&?+??z????|?BdO at 4??.5Z??A?S ! +=??hq?!Q?????????3?C???v?{????RR?z1}???DR_?????H?#??,?v??? 9j?m)??vM???0?*?o?5,jN?d_k??{??g?N???e??fE&????I?1?>??=R??P??,'d?~??9?'A??m?Bm??????~Y? ??/??/N.?b??==Pz????? ?;??q??t????jt?[?|?So??????G???O??B+J+?? ??T?d? Q?????e?J33????X?9V?-3????s?? ????????y#O)uTb??F??4???MS? ??}+b-?????????y>?W?????????;????????\?????Eq.)?x?????K??p?z?????????b?5Q??#qb?56? ?r??/?Sz ??M???]?G?3? ??J??Uz?(?????^S#?SYK?????h?VG?1BBJ????bS??H?3'??}??)????JpO???????? %vTJ??D?3?G?0`3??TC??????fB????h?lv?>E?j??Fl?7???S???i0l?s??8??L\??d???? ??\ ??????w?LJ??o???? +?????%???Q?jM??l????zx?u???l??L????JI???5???_f?P ?6|%?:?? +??a,~?????95Z?rV???*I??????[?v??SXb:?idJ;?^U???S??F????S??????F?)#M??E Zh?)?1??<'???m??i b???e@??W????????x?%Z?i???ooE#??1p??h???a?????RoX?-%,???<{ky" +??v???#?1???????*.??K>e ???uZ??m??5Vz?4?;??%LV??g??????K?/?H???)???n6???7?r????"??is&?^?????5(??????d??*?7??{??*?????:????2Q??s?'D?'?B 8T??B??n+'?????????:s?gF?a???dd?0#?H?X???d0??????? Vr ??U???B1???????a??7Wz??O???h???*??DO??,l??p??A??7?2&????lH?4 )?1???[t??a????QFi????1??????Lj??~???????qu,?9oV?{[q?`?6????????9J??kZ+81? X??W?ux???d??B???;?7Q`?P??)?]???chy?????,?[?L???=?q?P???(?4???a ??xd??dfsu`i??6v?????\L?@&h?-??$?????t?~?A&O?5a ,?P|?L????1~?LX~ ?#qo?*???&`?:?D??9/?LO?? ??$????H i?6g??ke????UZ????X?j???"?Q????n?f:????????\?p?Z.?pb?4e????Y?#???o,e?xs"?h????M?=O"O&?hb-x?A 4??N?p*G ????x?GQQzG???e~??T??w?? [??&????_?????????8AN???????4?????D_ at 4M ?6??5?N??H?b?fy)%x???????oqm??dA3w??Vv#???r???5*?Z??\???????1?*???S4?a$W???> endobj 93 0 obj << /Ascent 694 /CapHeight 683 /Descent -194 -/FontName /VEHZDH+CMR10 +/FontName /CLTIKZ+CMR10 /ItalicAngle 0 /StemV 69 /XHeight 431 /FontBBox [-251 -250 1009 969] /Flags 4 -/CharSet (/ff/fi/fl/ffi/quoteright/parenleft/parenright/plus/comma/hyphen/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon/question/A/B/C/D/E/F/G/H/I/L/M/N/O/P/R/S/T/U/W/Y/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z) +/CharSet (/ff/fi/fl/ffi/quoteright/parenleft/parenright/plus/comma/hyphen/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon/question/A/B/C/D/E/F/G/H/I/J/L/M/N/O/P/R/S/T/U/W/Y/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z) /FontFile 94 0 R >> endobj 331 0 obj -[583 556 556 833 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 278 389 389 0 778 278 333 278 500 500 500 500 500 500 500 500 500 500 500 278 0 0 0 0 472 0 750 708 722 764 681 653 785 750 361 0 0 625 917 750 778 681 0 736 556 722 750 0 1028 0 750 0 0 0 0 0 0 0 500 556 444 556 444 306 500 556 278 306 528 278 833 556 500 556 528 392 394 389 556 528 722 528 528 444 ] +[583 556 556 833 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 278 389 389 0 778 278 333 278 500 500 500 500 500 500 500 500 500 500 500 278 0 0 0 0 472 0 750 708 722 764 681 653 785 750 361 514 0 625 917 750 778 681 0 736 556 722 750 0 1028 0 750 0 0 0 0 0 0 0 500 556 444 556 444 306 500 556 278 306 528 278 833 556 500 556 528 392 394 389 556 528 722 528 528 444 ] endobj 330 0 obj << /Type /Encoding -/Differences [ 0 /.notdef 11/ff/fi/fl/ffi 15/.notdef 39/quoteright/parenleft/parenright 42/.notdef 43/plus/comma/hyphen/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon 59/.notdef 63/question 64/.notdef 65/A/B/C/D/E/F/G/H/I 74/.notdef 76/L/M/N/O/P 81/.notdef 82/R/S/T/U 86/.notdef 87/W 88/.notdef 89/Y 90/.notdef 97/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z 123/.notdef] +/Differences [ 0 /.notdef 11/ff/fi/fl/ffi 15/.notdef 39/quoteright/parenleft/parenright 42/.notdef 43/plus/comma/hyphen/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon 59/.notdef 63/question 64/.notdef 65/A/B/C/D/E/F/G/H/I/J 75/.notdef 76/L/M/N/O/P 81/.notdef 82/R/S/T/U 86/.notdef 87/W 88/.notdef 89/Y 90/.notdef 97/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z 123/.notdef] >> endobj 91 0 obj << /Length1 1242 @@ -1944,25 +1916,38 @@ /Filter /FlateDecode >> stream -x???eX[???q Z??b??!??w? $@ A??VAJ?Phq???)^??R?X?B?????9??|???u????s?1?g????1?aUG???A i????HRpp? ?` ?? -FA?? ))a?:?s??K??J ?8?*4???r?p??$Tr?"a`w?.? u??p????*??@????A??H(D!0??s??????J??x{?{????H????b$!w8?:??????Z?]\????Y??N??u? ??W???Eu(???S???)#??c-sPrw?C?B?`^?0?(??rp:??^???Pw?+`?????????>?????E0?e???O????b?????????I?\??????????PXLF"?hfz0$ a????1pG?0?1-ytD ??P?????????????????? -: ??????I??cF??q1????$T??0???! ???3?????d??CR?]?C !?3?7??BCLY?????b?`??8P??7?H??? ?o??p?1'*??b4??0???!???7?X!C???o??B??+??c??b?|?Aa??7?h??? ?????n???[ee?_?????bB???D???o??H?l???*`???a?? -??:??2./????????`+;5$??t|n% ?M??j{?,U[\?d?%???b??f??m 4V? ?L~9?k???V????L]???E?Es???71l???O??- z^???p??|%????i?S??!.a?? 7????a5?|??>F4z??2=oq4?B????Z ~)??Q?9_K_????,g???Z??VW??m:???????j]uq??A?S8,yV???r???':?????!?D???[????????? ?h>M?p????2?}?a?????a??u???x??% ??f???B???7??R??htzRq????@?????????maC?S?}?5???u"?????t??7?h??? ????K???0??s????;X?"?O???Y}F ???R????*e????? 3(???Q????r???X??????BG? ?/??t??d???V"V??cb3?l ??YA?(?9??e?????YbDHmv???1?~{??r?????A9??? }?!o?}???vg??{j?UV??Q??z?)iAJsN???%??3?E?????.???e???S??W???k???x?A?W??2???w??_N? ?Z??9~f??]????|???Z7???.8"?}T??S??=u????4*T5)?????f??U?????C_??? ?>Z?_?7?;??o??z?M?????? ???Z|?+r01?]???:?,?3??????5?????P?????G?^4*>h?'S[???;??dpU???-g!5????X?dC2r,????}3??? -F??? X -???f.??a?????ur?>J?????`????'>?R????n? -???{??!Jo?????[?# ????g???o"???\L????^??????m?mFJ6???J??s??????????}nV~?w???|?1?Z???J?=T??? ???*?? ! H at HH??????Q0??*???????P{? ?/-&*-$?? ?O?,?yu???g??j??? +V??OmgV????z&?4:??S?????????E_??T???? ?h?F??cD?7?U>Qn??GX?qq^?bfP$d?? +aO??k%???>F??|-}]??nDW???c?j??Z]?????????Z??u????O???Y?>????_???+?3^|?L?"?o????"2?w????4??)?FZeH?*\??cI??????m?~>K???>?%??? do ?]??????? /5F9??W?)C????????:?Js6/??D ? ??%D?xKoD???5?,??????gan5?*"I?!w?Eb?&????: +H?????G/U?n -??fP?G????Y}??}??"??a????x???'=ro at qyQ?=???? ?*?@???T_?$???V??9?W;?B????Oq?? ^f???Y???????~??Uuv?"?w?g??Rh??.???Xj%?????g??????:?O?9?r??lr:si????e +?h?1?k??F?? y???? +?2?lF +s?,1"?6;_U??[???|?t`?Q???????>??7?>?@M;???? ????uHt?H?[??_uk?n?}6^??8??#???&?+???f???bB?;XMFr?)??k?.s)?  ???j?-?G?g??( ?8???n?f?*V??g8??f}???EY???_?z?P?:[??_O#???.>??y?????ET????@Dc????????J?_/8%-Hi??????|??????C??e?h?@????6fE???{4^b???t? ?n??q'???/?F?n??Yx?m???Gx;????? {f????Ha_??r???zO?g;%? +UM?!?!???/bA??$o???P???2Au8?????W?????E?????Cr??c???}?e??????LLhWv>?N' ?L#b?%~?~MA??+?>????????????????v???1\3?g?YHMhh{2$????,r?p??f #C??av9??????kesO??7?]y;???Ns?l,?$?]uJK??H?=??*#Yx?!{P^{?? Q#?eU ??? ?????V?Z#xq +???":4l??????NN?Gisp?Lu????JEe????/????(MYX%bh?????`?@!+pYO;KH?G??N?7D?x???P??'?2 /????h??G*)??%?%;N?lY?i?sf?B?+F?d??:?!?_V??|??{h????G??/??????o?z17?????????l???????? ??l'??????????wR?o?O,?^`?d????Ckb??7?T??Y???)IZb?9??Ng???W?8@i?E2()??*~????????~-?+????W??F?>kq'?5?o????4"e?????$8?g?@???4-n8>(?]??M???6k?P]l?8????? ??GG\??6????tWl?9??1?????????I4?K?p??VB?`X?i??a??#oK3??%y??pG ?>:???9ah???b?*?w???e??QcaC?M?'???f4?^h\??L1??d????P??4DHW-0x?'f?jk???D}?tJ???[d??????DSw???|? ?)?0?r?cb??O?e?r?Tw??Q]x?)?4??? b ???Mv]#Xg?`???"?????????????^{?????|??????nfQ?7,???F?qK?A??U? ,???0???&?l[????|?c???? ?5?????E??_???.?YIzp?%NA\??o?B?pFe?R?3c?&+??|?"W7?E?o???U?|GvLw?/???$UgH?n???x???????O\??s UI%???rD=? ???E'???O;?}Wz^e?]?c ?????"6Y9?,RA????Wx??????"??;9???R+?G?>Y?2?SL|??_??"???N+?]?F~6????r???(R??????????????[h??Q????w?=???u???a]????yw????z7L%??B??N?,]?m????e- n?Tb?t??D??g=U!??NCq??h?4????0f?????o??)^r?R??G???[\???|1^C ? ????#?qS[??.???+j?TB???r?#2?{"G??!?&?G?J#??????Y?C???&?m?? ???&???{?F?? ??k?G?Y??????r??S??ZNr?u????X?#?N?l???x???:?? 4?9ys?DN?V??6,???>:??? sg?? ???????T?*"TV?}z????%?? ->?x?C/?X?? ???{Hw?e9???vw?r???????>????????r?/??w????z???Jv??i???p?A??2c???h??{? 8?M1}M??:"??????c??n?Y?Q8[?U???8?n?v? L?? ?|u?????????l??&?p5??\T\z.u?\'?????6??? ?W????+F?|? ???d?S?S?l??'g~_P??y?0?w??f??q??????:?O ??(??;}8?T/=cc?nf????y????(??/?y?? ? ??*6?+?+)8?F??.]???N?N"??o???%???\]??3?'7???$P6?(?PN?N?????W@??_??qb?????iL?M??3{mZl-?-Z?J?G?8???P??O???}?P2B+??^=?;4 ?i:?R!??b??k 1= V ??P??_6%?L?B?????@^C?S?nW???&,K?k?~???Ny?ql?n4?????#?T????u? ?Y?`]"??=?N?,??l?]%K?1~\s?'?Jlr???-??!UF??????@??n??3?*??????_?????:p??lR?~FU?E??J?'???C?S??P?D?)???a@?c?*?df%?x????M???????"???)4,???f?R?5??J???c{d??*??{%??q??E????V?x??? ??h???z^w?J(^?5?<|???r?? ??????G?G??B?G??ID???????k??Exq?????+??r?Y?2???f??EL&R5B?G?EFK??X??Y?????A?E???=?i????X|?O??s????j????;]??<T??W=KMiu??L1?7??????:??f?O?V?%?f?x]S x???"?]?[?vz!???L?Q?vE?(?f???mrR?.?f?P?wvj???a) ??:??jQ?J?L??fh?$ \??????? ,?|f0?A???+,?*}??G?(? >I??%?L??KV^w?~L??P?2z??R/?U?z??X???QC$???:?C?u+z%????h??R???/??@5A?jy??U ??Xs7_?r?7??,R???R??a(? [H???t??oA?????S?x???b??b??AK?R+??f???? r?(??Dr???? 8V? d??AfzFi?}? ???U????y???Q??a??p?*^Q[ +]???T?I{u?E???K???G??,?????nr?{???Fo?????KOa/,?F7?$E??*?J?? -??#a|R? ?xI???9????#'v%?N?xVh.? g2?n?3?/2su?????????????erX-v6S?? -E[???}??X???(Zv?? ?l??!????u?m?[8????s??T?? ??c?(??d?,??e?Te??_??:??HT??nf?(-%????J?}H?6D!?-????y#'????--uTw^?????>r76U[Q??)?`???B ???Q-?;?t?>WG ????????:h?L??,???p?6?5:M?T7?}?{i>?$<9?y??????O?Z???D??????;?HYuut?! ???'Psi0M?? +tW?q?9???Z2T?%???.??d????Mz?#o]?mN?b ??_??mpw}<"q a??)?l??P'}Z2b?7hjy?5??G?X???9?????.z4?z???????H??g?;?a????v?6b2???N??"????A???DO??@?t?&DT:?????^C??q?B_c?????6r????L??WF8'{?y?"?q????~?$\P???0???o?7m?[?k/?????`?3??)~?e\?`??,%MIRk??b???6[?[?'^="R???a????My????6Jl5????ky?M?U???V?&t0??q??p?9?d???R?????8?hdQ1-?????????.?????.bQ?56?~a?0?????(????j??^*????y?~?1qq???????0???%)??*EqtR??l|n??j??Y?;??](?\???????u???/x??;J????5~^'??s +q2??zGtW????c0?9??4?j?N?W4???;?[??? +???=?? ?[ r ?????Kd?? ?? ?|I^??)?????*?eNZ=????J??u?eY6v?X?m??.v?M??W?;S '!Y}?11?6 ?U ^???????Y?>H:%?s?-2??????O?Pw???|? ?)?0?r?cb??O?e?r?Tw??Q]x?)?4??? b ???Mv]#Xg?`???"?????????????^{?????|??????nfQ?7,???F?qK?A??U? ,???0???&?l[????|?c???? ?5?????E??_???.?YIzp?%NA\??o?B?pFe?R?3c?&+??|?"W7?E?o???U?|GvLw?/???$UgH?n???x???????O\??w???*???jkq? 9??f???????????+? ?2?.?1?r??OR??v? n???+?\?b?}u?N????R???\?,D??)&????acMpi???.b#?r?_Z?|?d)?Kd??YSq`p?gb|?-?Z?(]?????????K???MQ????N???; ???j??????G!?D?f????Y?Q???7W*1v??M?C??3??????@???RY4M?????F3Q??Y?????/9Q)?s??+l??9s4_???-H:??? sg?? ???????T?*"TV?}z????%?? +>?x?C/?X?? ???{Hw?e9???vw?r???????>????????r?/??w????z???Jv??i???p?A??2c???&h??{? 8?M1}M??:"??????cMk????(???*n?F?z?[?[&F?????:?lym?`~s??r?_?Se??B???#O?6????c~]?}?z%??H`b????????I??B????:B=????? ? ?vf????z????? ? ?zR? +h??Kx6Nl?4\U7? ???|f??C?m?i?E _ ?H':? +[?i??/JFhe???????`6M?[*?tT,5}?!?? +?JU???D?)ZH?/?_|?k?y +????Pz?????o0?S?o????fr??;U)????u,X??i?S4 ?7&?wW?Rs????x%69oz?????*#@??qQn iq???G?SQ?o??bt? ?E?Hm6) +b???*??eW%??xa?!??)Tv??D?)???a@?c?*?df%?x????M???????"???)6X??)???4^kh6*?J?????8?U? -? J|#?f??5??]?4?T?????.???????P?.8&j?!x???=+?~? ??}?:p??t???1(?t???/???a????????????L#?????f???<+???1????J?A?q?7~?G??????Tl ?[??]?|md??2?+xtm?b}?O?3???}Gq??&5h????Z?]?8[uQ3?1?@?}??U????~? [?~?i!&??#]??(l???-??B????`mM???V;????G~????&?S?{??h??c??F??k????#o?j???`?%!???#??H??9M]????l?2???? ?-??l??M{.????C~????pN/w(PC???&T??2??q?z???YjJ???&g???Y,pN?????L5~z???,?5????Z????_????????? ?]\e"???+?G?7??m?? +w?4??????S[mE Kaxp??I|?P????fe?45C?'Y???u?u&??h`??3?? 6]a?T???<D1?IB,?e2?^???s?cj???????z?????#????s?q??}3?S?EW??,????U&X????sy7???P?$??kZ??4?Q?P?=?:BP!????????a?;6-???c???9??~M'F?7?K?????3tI?w??N???!????bw?hGT?Y(S?>{8GxL??0???,Wy?L????? ??Yt>=?kG????Wn?t?K???S?????^?K?:?=? ???????y???/????G? rZ??O"~??O?{???y???' ?&?;?>\??r??taN?Uw??f?L???R???@??#?.?Z????? ?????6??f??y`??`?????v ???b??1????dQ?^??? ????Cf??uR?!????T +L?S???8rbW?D?g??R?{r&S?v93?"3?Q????(?1PN?]??Y&??bg3E??P?????W??????e]*?6?oZ??m???),?`??c???=HnP}#PGYU&?gi?/;?*?U??????D???w3?Fi)?/?UVb?C??! +?m???h??????????Q?y??jk;????TmEY?????3?z??sr|l???X???4?R???!WP?????p??????????DiS?-t^???6??2v?-???R4?x?Y????? w??0%0AG?????$?m?oI???Mri?G?????_???p(?B???????=??endstream endobj 92 0 obj << /Type /Font @@ -1971,14 +1956,14 @@ /FirstChar 40 /LastChar 123 /Widths 333 0 R -/BaseFont /DCHZFO+CMBX10 +/BaseFont /XXJDVD+CMBX10 /FontDescriptor 90 0 R >> endobj 90 0 obj << /Ascent 694 /CapHeight 686 /Descent -194 -/FontName /DCHZFO+CMBX10 +/FontName /XXJDVD+CMBX10 /ItalicAngle 0 /StemV 114 /XHeight 444 @@ -2002,7 +1987,7 @@ /Filter /FlateDecode >> stream -x???e\T{??I?A?8(?0? !?)?? ?#0?P????? %?C????H?t?????;z?^??/w_?g?ys?O???????F???_?n??fn??p8 46??I=L?x??U???%???????,k?\G8??!?C??g???8/??r?x???)???Zo?n?????C??n??I????&ix.9?8 \????????????d??l\???R??B2???????????b?JI!?????????P??)w?????@??!?U?;?ZW??L????$??3@??7??S?X?J?/2{????? <??B?\?Q?@v????}_?#??b??dR????? f????\Z?R0??j???????!W;?:I???~??]??P???7??=2?S??jU???????X?^Rn????$VuEVG?)??zc???? )?"o???{h????"??a??*??^I????!???*???????9Hez r??????!?.J?f at O??M?:????????????c???r&??U?????M???U?#?? .#????_???XR??*?BY??F?|3}?#DF?????5C?7?????????2P?[??????? M?????>S??|#$?VK?-?L[sW????????a(f????>l?????.?@????????>?ZO]??0???J8????#?SQ????\????0J??f???m??!O?u ?P???Uhv???a?F??????uP?????,u????yLU?F?t??????0/.`~??#?z ??VV ?{?'?H?`$?e >?|L?w?P|$?? _l???a?&+f?dGH?U?%?????????????????aj?c?]????F????b?W???Y'5#???rK??+??4??[;??S?fJ???G`? K??AM?A??????w`?~??LK?_?*m?v??'\?b'?_??q33@???r??S?g?7??k?sw|?x]???? ?V?S??????`?}????;EX??M??e?4H??y???_??8/?????Eg-??R?/?i2?h????)?? ~???`??????2???????.?y??3?y???v??^Sy?N????????????a)?)?v?"a???????k?????qHR????6)]???}?=?j?>]??S?{?W?"S????E?<: M?{U?G2D {?[????!%????Y?@??kj#???.??1?9??? V-Qq??$?4?*K?$????{?ui<;????????P?k??g?" ??9?R???????????????XUH?G?)b@@9T?^)?"???????? ?;?4 ?M??Q?.?1???g1??O??6??^??????d%(??w??????U?61???0?mO??J?}KK???y?,C?"?????p?2?xl`? H* ??t????^/?tocp$|??????3v) %??1?????C?-?d???????l??????9??^y5]?q4??a????FG? [????8???Duc????g?i_?l?Y??g??R????AajJTk5[??#??&?N,`@?8???% ??w???]R?E??/}??????,?>?{?8Rf?W?\i?E???[??<=l???v??w??????.??????$???O?6?nQ?d6?????? ??68?LJ'?J-??q#.G??????-g}3?????????????'?*??R??16>????i?Hg??>??$???s?O'???????z? ??????]?P???I????4??m??? ?n???o???????1??? ??eI?dF? ???S? ??9P,t??m??Ei?u??gi??!5{Az_???=?U?9???????????5~?d?)??_?????E$?x? ?????n?????????k??}????h??8?*??2T?3??CF??|t?)???????+{???aL ?AK??G? ?=k[:?Z??&?????[IL H~??6??f?C?p???~}(?;????FF??? T?B?nL?Nn?=??Z1?^E??1??]_5?`/??98??J?? ??Y&?d?l?L-?]?Z???HF? ??????????E?????&v?m??=???V?????goe??_???$??????$r??"g???F?u?????????R@?k???2`-??s? ??b;PG? ?f??????dd>??1s????a?????????????w????I??N'nq(W?^???+??i\?,????oxM[YLG?i?X0~G>??DHq???e~!R??EQ??=?6m??$c?D???}??},9?t??\Oa???V?W???_-??v??&???Lgt??t#f"????????O??P4?E???e?5?endstream +?l<K)X???????M&?nL?Nn?=??Z1?^E??1??]_5?`/??98??J?? ??Y&?d?l?L-?]?Z???HF? ??????????E?????&v?m??=???V?????goe??_???$??????$r??"g???F?u?????????R@?k???2`-??s? ??b;PG? ?f??????dd>??1s????a?????????????w????I??N'nq(W?^???+??i\?,????oxM[YLG?i?X0~G>??DHq???e~!R??EQ??=?6m??$c?D???}??},9?t??\Oa???V?W???_-??v??&???Lgt??t#f"????????O??P4?E???=z5?endstream endobj 89 0 obj << /Type /Font @@ -2023,14 +2008,14 @@ /FirstChar 46 /LastChar 121 /Widths 335 0 R -/BaseFont /RZEXOU+CMR17 +/BaseFont /OVIIKE+CMR17 /FontDescriptor 87 0 R >> endobj 87 0 obj << /Ascent 694 /CapHeight 683 /Descent -195 -/FontName /RZEXOU+CMR17 +/FontName /OVIIKE+CMR17 /ItalicAngle 0 /StemV 53 /XHeight 430 @@ -2223,7 +2208,7 @@ >> endobj 342 0 obj << /Author(Bill Spotz)/Title(numpy.i: a SWIG Interface File for NumPy)/Subject()/Creator(LaTeX with hyperref package)/Producer(pdfeTeX-1.21a)/Keywords() -/CreationDate (D:20070913152304-06'00') +/CreationDate (D:20071120065847-07'00') /PTEX.Fullbanner (This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4) kpathsea version 3.5.6) >> endobj xref @@ -2235,79 +2220,79 @@ 0000000000 00000 f 0000000009 00000 n 0000007634 00000 n -0000140903 00000 n +0000141309 00000 n 0000000055 00000 n 0000000081 00000 n 0000007817 00000 n -0000140817 00000 n +0000141223 00000 n 0000000131 00000 n 0000000162 00000 n 0000024629 00000 n -0000140729 00000 n +0000141135 00000 n 0000000214 00000 n 0000000246 00000 n 0000024816 00000 n -0000140604 00000 n +0000141010 00000 n 0000000303 00000 n 0000000340 00000 n 0000028601 00000 n -0000140530 00000 n +0000140936 00000 n 0000000391 00000 n 0000000422 00000 n 0000028788 00000 n -0000140443 00000 n +0000140849 00000 n 0000000476 00000 n 0000000510 00000 n 0000028976 00000 n -0000140356 00000 n +0000140762 00000 n 0000000562 00000 n 0000000594 00000 n 0000034600 00000 n -0000140269 00000 n +0000140675 00000 n 0000000646 00000 n 0000000678 00000 n 0000034788 00000 n -0000140182 00000 n +0000140588 00000 n 0000000740 00000 n 0000000783 00000 n 0000034976 00000 n -0000140108 00000 n +0000140514 00000 n 0000000848 00000 n 0000000894 00000 n 0000041045 00000 n -0000139983 00000 n +0000140389 00000 n 0000000949 00000 n 0000000984 00000 n 0000041233 00000 n -0000139909 00000 n +0000140315 00000 n 0000001029 00000 n 0000001054 00000 n 0000041421 00000 n -0000139835 00000 n +0000140241 00000 n 0000001101 00000 n 0000001128 00000 n 0000056494 00000 n -0000139710 00000 n +0000140116 00000 n 0000001195 00000 n 0000001242 00000 n 0000056682 00000 n -0000139636 00000 n +0000140042 00000 n 0000001297 00000 n 0000001332 00000 n 0000064004 00000 n -0000139549 00000 n +0000139955 00000 n 0000001387 00000 n 0000001422 00000 n 0000064192 00000 n -0000139475 00000 n +0000139881 00000 n 0000001473 00000 n 0000001504 00000 n 0000064380 00000 n -0000139387 00000 n +0000139793 00000 n 0000001550 00000 n 0000001576 00000 n -0000069139 00000 n -0000139312 00000 n +0000069150 00000 n +0000139718 00000 n 0000001631 00000 n 0000001666 00000 n 0000003736 00000 n @@ -2315,15 +2300,15 @@ 0000001716 00000 n 0000007451 00000 n 0000007512 00000 n -0000138112 00000 n -0000132806 00000 n -0000137953 00000 n -0000131967 00000 n -0000124200 00000 n -0000131807 00000 n -0000122948 00000 n -0000108198 00000 n -0000122789 00000 n +0000138518 00000 n +0000133212 00000 n +0000138359 00000 n +0000132373 00000 n +0000124606 00000 n +0000132213 00000 n +0000123348 00000 n +0000108461 00000 n +0000123189 00000 n 0000007573 00000 n 0000007694 00000 n 0000004033 00000 n @@ -2345,17 +2330,17 @@ 0000006625 00000 n 0000006778 00000 n 0000007755 00000 n -0000107331 00000 n -0000099381 00000 n -0000107169 00000 n +0000107594 00000 n +0000099644 00000 n +0000107432 00000 n 0000007878 00000 n 0000006940 00000 n 0000007110 00000 n 0000007280 00000 n -0000097890 00000 n -0000083292 00000 n -0000097728 00000 n -0000138935 00000 n +0000098153 00000 n +0000083555 00000 n +0000097991 00000 n +0000139341 00000 n 0000024567 00000 n 0000024753 00000 n 0000028539 00000 n @@ -2372,7 +2357,7 @@ 0000063941 00000 n 0000064129 00000 n 0000064317 00000 n -0000069076 00000 n +0000069087 00000 n 0000014690 00000 n 0000012151 00000 n 0000008059 00000 n @@ -2380,9 +2365,9 @@ 0000012389 00000 n 0000012560 00000 n 0000012730 00000 n -0000082808 00000 n -0000078781 00000 n -0000082646 00000 n +0000083071 00000 n +0000079044 00000 n +0000082909 00000 n 0000012903 00000 n 0000013077 00000 n 0000013250 00000 n @@ -2419,9 +2404,9 @@ 0000024160 00000 n 0000024878 00000 n 0000024331 00000 n -0000078461 00000 n -0000077071 00000 n -0000078300 00000 n +0000078724 00000 n +0000077334 00000 n +0000078563 00000 n 0000029038 00000 n 0000027620 00000 n 0000025050 00000 n @@ -2465,7 +2450,7 @@ 0000040682 00000 n 0000041107 00000 n 0000041295 00000 n -0000139051 00000 n +0000139457 00000 n 0000047379 00000 n 0000044583 00000 n 0000041591 00000 n @@ -2531,53 +2516,53 @@ 0000063534 00000 n 0000064442 00000 n 0000063705 00000 n -0000069264 00000 n -0000067232 00000 n +0000069275 00000 n +0000067243 00000 n 0000064626 00000 n -0000069013 00000 n -0000067438 00000 n -0000067609 00000 n -0000069201 00000 n -0000067782 00000 n -0000067953 00000 n -0000068127 00000 n -0000068298 00000 n -0000068470 00000 n -0000076204 00000 n -0000069398 00000 n -0000076044 00000 n -0000068637 00000 n -0000068821 00000 n -0000076732 00000 n -0000076494 00000 n -0000078694 00000 n -0000078670 00000 n -0000083112 00000 n -0000083030 00000 n -0000098789 00000 n -0000098425 00000 n -0000107877 00000 n -0000107622 00000 n -0000123760 00000 n -0000123375 00000 n -0000132513 00000 n -0000132259 00000 n -0000138577 00000 n -0000138359 00000 n -0000139168 00000 n -0000139238 00000 n -0000140975 00000 n -0000142671 00000 n -0000142710 00000 n -0000142748 00000 n -0000142877 00000 n +0000069024 00000 n +0000067449 00000 n +0000067620 00000 n +0000069212 00000 n +0000067793 00000 n +0000067964 00000 n +0000068138 00000 n +0000068309 00000 n +0000068481 00000 n +0000076439 00000 n +0000069409 00000 n +0000076279 00000 n +0000068648 00000 n +0000068832 00000 n +0000076975 00000 n +0000076735 00000 n +0000078957 00000 n +0000078933 00000 n +0000083375 00000 n +0000083293 00000 n +0000099052 00000 n +0000098688 00000 n +0000108140 00000 n +0000107885 00000 n +0000124164 00000 n +0000123777 00000 n +0000132919 00000 n +0000132665 00000 n +0000138983 00000 n +0000138765 00000 n +0000139574 00000 n +0000139644 00000 n +0000141381 00000 n +0000143077 00000 n +0000143116 00000 n +0000143154 00000 n +0000143283 00000 n trailer << /Size 343 /Root 341 0 R /Info 342 0 R -/ID [<72E223D8C368EB4F95EC46C06235A1BE> <72E223D8C368EB4F95EC46C06235A1BE>] +/ID [<81DF4E4ECCEE68CF767ADC4E558B3965> <81DF4E4ECCEE68CF767ADC4E558B3965>] >> startxref -143190 +143596 %%EOF Modified: trunk/numpy/doc/swig/doc/numpy_swig.txt =================================================================== --- trunk/numpy/doc/swig/doc/numpy_swig.txt 2007-11-20 11:22:45 UTC (rev 4475) +++ trunk/numpy/doc/swig/doc/numpy_swig.txt 2007-11-20 13:58:47 UTC (rev 4476) @@ -779,7 +779,7 @@ The effort to standardize this work into ``numpy.i`` began at the 2005 `SciPy `_ Conference with a conversation between Fernando Perez and myself. Fernando collected helper functions and -typemaps from Michael Hunter, Anna Omelchenko and Michael Sanner. -Sebastian Hasse has also provided additional error checking and use -cases. The work of these contributors has made this end result -possible. +typemaps from Eric Jones, Michael Hunter, Anna Omelchenko and Michael +Sanner. Sebastian Hasse has also provided additional error checking +and use cases. The work of these contributors has made this end +result possible. Modified: trunk/numpy/doc/swig/doc/testing.pdf =================================================================== --- trunk/numpy/doc/swig/doc/testing.pdf 2007-11-20 11:22:45 UTC (rev 4475) +++ trunk/numpy/doc/swig/doc/testing.pdf 2007-11-20 13:58:47 UTC (rev 4476) @@ -242,20 +242,24 @@ /ProcSet [ /PDF /Text ] >> endobj 88 0 obj << -/Length 3303 +/Length 3305 /Filter /FlateDecode >> stream -x??ko???{~???5?e????!M?4E{8\???!Pve{Q{?X?/w???!?%Q??\?+QCr?/*?????VLUN???1c4???>??????'?`?2LiS?C??Z??Yc??:_??O??n?bR????~/?Ym\}v??quq?????????_??e?W?????7?o?????K?o??????? L???o??9s?ap??l-8???~?????.p?:??????6???5R?sw?????3?>yu?H??0a+???????W?+??!?T?_?L?=?o??????r?5hf????r??Wr&??4????0???@ Rv??=???'????J7Po?e??D T J_B?D:???K:wW?j??^e?F????f?,?4?>??,H??ZSF?? >u???[??i?X}?????????@???d7L\BF,H?%[5?U?:3?=-yJ?D??z0?? a??x??k"g?~#OLA_J??X{?d?????:??R?'}??67??H -~?GX>?G??Fz?ccf?I?\????z!?WN?G (?y1{I?????B???8??@ x?])? -? -g:?z4?t??S?0?`?*+???[N2??o?t?}???(,3 Da4Y8?????BO??kaM???W??? ug???]?8??ppd????d??"+????X??(?'??7'DzjN????,???N???EN3]91?? }????U???|*?1?\q??$??????????????q??\????J??B_3?+>bI?|5?8?i ?Cr? -?2???x????e??(U?Q?b??: ?????/w???"A-4??4????????}1:???e?3z??Hq??;?ga?- 'c$???????%?t??tL??2?fh'_???3?i?4 ???????y??nLa?d?a??G???p?!=??`"????U8???b?6|??E???a<}J -??'??????m5????J???r&????w?.;j;?I'?6???Z}?N1??EF??????W[?T\??4???i??> ~?LZ1????e???#)??r??????[??9????vq?JT?/?h -???<` ?1??6??#-???>??i????1?rUDML2i?]?,$?N?? ?&?p*????&??>?????6}???@??U?T?????cn??????6+?*;?? ?%e?H?9??a???-??????)??56????qn????????N? ?{=??1N???*????h2??P?3?hD??l?2????jqR-9c??W?5???cY?@q???SQ????'B=?wm???n~?x?;???Z8R?o????uC??9??wd??h???q?nj%k?kf?rC????*?wx?a5??%?%?p v5P??I??&"/??p???)?d?????m^Z???????Z?O+???????l?_??&;YvY?dm???#?JPl~???7?????M??U?9?[[/j???B??]??Ud??_E1?_????, I??Q??BJ??|?.??_E$G~?B?rT????r?>*i??t???6L ZS???b?sr1? i?u!??\?, zuqM t???O??:Q@?????????Z??6???4?3??>;?&$]??p~s???6????j"?. w??zq?p$??]-??V???L +?? ??? d???"????}??7??qS@?:fDJm?9)=?G????C ?VO?vY ??"_9?x??,I????j2? ?QL??? ?/ 7?k? ?j??e??c?F????x?Y??m?5??2?RZU5%,+?T ???v??D? @y??SfW?E?1???? ??bE?=+?????>??u??????3?J@?'?W?4???c??1K?R? ?d??A?~?Oa??&.!#?$???Z??t?????<%Z"_K=???? a??x??k"g?~#OLA_J?X{?d????y??U??S?????_\? ??#???#?M#=??1???E??{????y??????? ???????K +??8??@xXa?R*R-???\????"#mp? ??????*.?Y?A?4?Q}???@??????s???? ?m?S$:???(?J6?5???????????M???x2??A?'?????? Rl??? v??H????:G???"??????&??:x????+ ???????$???????!?3 ?qa??h+/?;-?[S????P? >??X[Z9`????z??5????HO}Jq?M????@N???a?q?t at h>?????C?xSn? ?HD???Gk???6E??,Xz??^???0???;???W?"Z?n?;?r?????Q??2??1i????:??3????DR?????????Q????Pendstream endobj 87 0 obj << /Type /Page @@ -333,35 +337,37 @@ /ProcSet [ /PDF /Text ] >> endobj 99 0 obj << -/Length1 1213 -/Length2 5760 +/Length1 1231 +/Length2 5968 /Length3 532 -/Length 6527 +/Length 6749 /Filter /FlateDecode >> stream -x???w? 0?y?P^0{ar11?=????n?"??ts@??????;?Cy?Lxq&?8??H7?/??@.????????o?????????)????B\????#]?1h -???????Yj -??5m?=????&??C??0???BpO ??^??: O?_q????M???? #c#-????WJwC???-?g?_,??q?A?}?????b?B???????J? ?????????BA|?q?G?1?????????!??G???(???)! q?uw????WH - ??[??WH ?C!???o?????%?p????V?k? ?????4@? ??? ?@?*?????"\^?o?????7??D ?@???Z?M?;(?E8M?_?;?o????7?u??? ???o??? q?????? ?p?n?!N????~??G????? q???B?????o?S?? ?? UQA?? ??B ???D?????????A?`n??^~?=?7;?qo ???OO ?r???5a?A???%???*???:U??5S??Y?ao3???mF??#??? -?7?/???? -Vl?l???^????#?k|??.>??]|??g?5????tr_??I?gJY??'lr?d??????Q?[??q??87"$B?=???s?g?4????_ur?4???2?+???%"?&l???&w#??Q??ba?6?4L?/???????{ ?P???m??e???iJ????$????^???D???|?s?n?VF?x?2?'l?t?"??QQ??]?5??9g??2?{?Cp??? ???k?E??5??<(6f??u???&???"g &eJ*4V2????f????jJ?d??!????{.&L???r?3???[?r??H?????o??????/???gN??C?_3.?W?MW?wY?????(????&+???I,?+????????6v?3Y????????)??????j/>?????qL????h??m? -nr-L????!????????Uj????e{?????u?? ?7?9?|???@?eT??G*b ?/?) ? #|Ks??Z?tu ?t?5??I?r ??? -j??????_?P?Y?vM?????5P?? ?^?Y??e?x?G-:????q?W? "?u??5??j???"????:???b- O??????Hg-?}??1?m???*??.?En?l{?-h?v????P?}#?}??? M????B9?6?????Hr?????W?? 5?????K)?? ??????E?U?ym5????=??R ?t|?? ??^?B}[???#????Dxb?B P?C?j????l@?U ??GeK?(????I?[?:?/= /24?)?KQPb??|r?U??5?<.??)j??~????????????$Ml ?P-???o?c?(2kVg??? ??S??u??'o?oJ?W???w;? ? -??,4??[H ?Dr?;????-?`?T?g?fr?$????E??*?]????L??g3H?D?a1?E??xT|??8???c???????b??W???-?1?3(???JE4?8?n????>c]?v2??s;??2?\J?-?x???,???=????Q6%h??)???{?i???????9?Lw?7? ?_ ?32?Ih?7}.?[ -Q?&?B ??T?tC??ug?J+M?3??XC?}????E?:??j:?Q/d??B????U?& h???P+%?x????s4???????gR??"?<%ws+~?K25?????>:_f?h??[ ??Y??3?????"???????TN??O?)????d????$??81ta????yL??-???C????s??Y -unq?m3??7> ~|j??k+??y???e????????!??e??Ss?W?&??'prw???6*?E??H'???u"??2???????Kr]? ???_?(??9a???I?fO????????Xq?Z???mj?1i??q?k?'?-5o?+???????:??\b?Hx?]=?O?n?ce)r?vH;?i????*???F?)???d???????v7?#?w?????D?NG8GH???wf_?s?????OL0/??[y??ro??aX>o???U?\?E?s?M'(,??s??m?*????? ????F?????0,p:???qtG?ik}??%'I?/DJ?>??)cx??~?????. ?dL?/\8?????wR??C?4??? @?Q??K?7^?-? }?#g]????5???>????????W?e?AZ?9?!.?N??d?rU8???9?>#?-?j??m??????h??????E?T?U??n????AW?RIS??m7???t2?]^I?c???r?F?-?S5????F?3&Sr??2??? ????t???D???>??? ??Y?????????????N? E???J???,&??#pl??????ul?Jt?M??V-O?@???m???8???L??????*m???~?w??6k)w`???????:???,???L??R???7?"?q(K'Q????x:?po????h?Y??78???t?_3?,_?GD\`?'?sh??bi??v??O$j?Y#??W<&??qv?????+??????????H???u?;?\?!??R???G????????????|??L? ????d_?t??M?1/???SA?O????Ju/u&?j?????/?1?l?OG??%???,??I?2??"vf???xKO???3??47?????>t?g????0???,L#?2g??g^??;???=??AC]KKt?S{i1!Q?o^V?,??@?\?S?ae??Y% ? ??~?_????|y?#??p?P???!?????an??hsW,??^???M?????5??Q??W\??7?E??g?:?m\z???????1MW8?)?bk?A???P ???l?m$6R?????a???m?? ?Q(!?I????,`??6>????]?????^?d?p[???C???=???4U#h6 Q~?y? -M????["H??'L{????~?S=m?l{?YK?R? -TX??&t??,?W??j???o?3????????????=?i??q??"v?I??R????^y?po??gSJ??????VJ?????^??w?w7?s?*?z?9y???C7YJ???????\o????????0???c???3]?h? ???L/??}]??h7?e?]? ?E?5s?0;?}t?^?pp?{ H???K*?M?^??>t?f??????j???????w??????W???$6????5K?O?e.?? Epzo9?t)??? 3??tw>??w???????P?????T?JW?d???????????i??W?A??????Ry??'s?R????n?1"???W???`{?[? ??.?rrv?[??F????@????????;???v???Pa?????o????8?Z?s?X??Hi?Z?HO??y???c?]+?CPe????R???S?G?F?k?0d~?d??1?QHBTW?7T6*?c???-???%????/??46W\?A? ??bZ at 3?$B????T}??%??%???u>???Q??K]?? f??x????"zM?\+?>??^???8???+f???GETV??u? ???I5??????? ????5 ?1QjJ?"W???_)9X??W??C???? X????h1???)??j?!???%?J_?R?Fi3????r?????{Qgl't?e B56=p?| M???????m????? ???"`? -A????0?endstream +x???W\S]???%4?M0(?&t??"]?(???BK@@z?"????4i??"???&(Up?}???z?}y??????????s???x???T?(G? +?%???*?? ?:??G!5?`7?`0P??( ?eoJ)??Q??Q?X4??? (?.?W?P? ??C?@C/?^???? p?V??@M???h +???}`Pq ??!^@G?3 ????.? ??W????? ??7???-BQH?9$?P?^0?????S\??0rp?K????up?#??'?rs??????(( ??????Y3?A??n????r@?!?Hg ?W??????p/? ??? ?;CB??~l[?????0??{7?N;??^?X?D???????4???@`|!??????h?????p$?8???h,.?$??H( ?a?~%??(/?-@?H?N(4?????J?`?]`???? +?%???????%?`h???P????2 ?????? ?.h?R@ '??|gO???? ???????????5?r@ ????k?Cr???????x-2? ???pV@??|i{??@i?&e?I??tCy?Ua???_o??T2??fh?:?,???nh6cDU?????????Q?>{?M?V<|?v?E?H?e??BK???&ys????_;,?????S.?(_Z?{^?AP.???G?n?5?g???N??p??m??j)??=??x9ww?5?(u%????^?vO4~?G.??n?x?i?????+:??? +?????]e?(??]???>??+?Do??p?, 4E8u;??c??v?>??+???o?y??v??SjXQ??????????I#?=?D? 40???8??????h{??p??s%????@I?Ui?????6????U?SII??(x?xrq2=??? w:??#????D??[p?8?S???q?????7???"?7??@?0??????????????JW??z?K??2+?(?v???tfZ???>ZZ"?F???f??O?H(??}Ua??_#??(8???h?U?y???my&R?p?W??9;RKk????K????=??????k?L????a?Hm?K??;R?j??/??o????w/??%?l?Ff?Ff??6?F???=B??x??Y?*?v$?? LF?k???"?I, ?u????-?,=\????i=??b?^f?[7eu??,??0r-????H??W?|B??t???{?zkt?\???H??F?s^ j?$?W???7???? ?Dc?|?2??P|?HZ??gNe ?h?,?9?H??0??^?mn????=?Y???N?B????~???Z?n???o?? ????$???7t????4XU?????????crG?v?= ?S^?r?zB?i?c`4??"-???n]?b~m???EU??\z?qp5oH???J??F0??;8W1??u"v?A??w?E=?m??n?u???JO???b j?N.dn??S? V?]^?????W?#???????Kr1M?????0??l$ ?a?.???5w??|Q:6??lg?????#??ft??1?FkH?=x????_?????p??)?%??O?c??r?[???1????=??,??????~&q?????l?"??L?????|??8?Z?? ???h?s_*?SJss?;~????%>?-?M??n??E??=??+~h???)??????? ???????????>v?`JFbV?6??y?|????MR??Sf??? ????o?m1?XP]]^????T??U/??2??,?i?o%d?y?G?d??H?D?\???L|?f?w?kQ??r?Dw????6??6??{????&?????3???? M,Y?? +"??8? ???c????=?&?F??4[?Re??Zo??D??Z??3???i???{??????kD??I??Ij??d?.? +?N???4,8+? |?U?W ?SW?GS???Y??oP??m?V?????Y?(l???SPa??T??z???3S?tA???1?9???)_E%;????Y?x??|?;>???>?g???n?K??\?WG????3i47?\,??j???/}??m ?_K??3y?J?u??jZ??"0-ZOx??Dj8??????{,-:?$TH#?"??otDE?~??|'?KkE3?C??jNw?H?? ?@4d?@???dd????7?/??8wC?K??@!AyOk8`?hW?E??Z?g5??W?t? +?(|^:??9?????4?F??[?3jG?????U???/;%??8??????V?????????j?l`??]?????Plh+?P?*?\? ?????.w ??]????lNI?m????N??z4A??a?j/X| ???-.??9?? ????4?V??NS0?Ng?r???q?}n ???z????? ?0.?Z????UE???.ys??;j?i??d?w?B. +D??????u+]c?yP??o9Esk???d????M???T?y?LQYf ????????n??f? ?VX*?r"?(??????Y????U???6??L?b/?'`tb?mdn???F??!P?\? +n?Y?{?W???????J???Z ?aO????,??I'Ea?n{?M????U??'??xz?]????C}s?w?l??7??;?{IX????Z?????/? o?t6?8{?? ?????? ?N[D?5-??s?/????n??uM????cTk???t?ex&Of??J!hz=??.? ?M?y?????V?c??z???A7?S?p??BG3g? ?\pHAr9??? :?Y@??4????@s??pT?????????????}rmD???\?_?e[???3??????T???}??????????B?9?]?G?|endstream endobj 100 0 obj << /Type /Font @@ -370,28 +376,28 @@ /FirstChar 45 /LastChar 121 /Widths 104 0 R -/BaseFont /FFTUTL+CMR9 +/BaseFont /UGKUQJ+CMR9 /FontDescriptor 98 0 R >> endobj 98 0 obj << /Ascent 694 /CapHeight 683 /Descent -194 -/FontName /FFTUTL+CMR9 +/FontName /UGKUQJ+CMR9 /ItalicAngle 0 /StemV 74 /XHeight 431 /FontBBox [-39 -250 1036 750] /Flags 4 -/CharSet (/hyphen/period/zero/one/two/three/seven/nine/colon/C/D/G/S/T/U/a/b/c/d/e/f/i/l/m/n/o/r/s/t/u/x/y) +/CharSet (/hyphen/period/zero/one/two/three/five/seven/eight/colon/C/D/G/S/T/U/a/b/c/d/e/f/i/l/m/n/o/r/s/t/u/x/y) /FontFile 99 0 R >> endobj 104 0 obj -[343 285 0 514 514 514 514 0 0 0 514 0 514 285 0 0 0 0 0 0 0 0 742 785 0 0 806 0 0 0 0 0 0 0 0 0 0 0 571 742 771 0 0 0 0 0 0 0 0 0 0 0 514 571 457 571 457 314 0 0 285 0 0 285 856 571 514 0 0 402 405 400 571 0 0 542 542 ] +[343 285 0 514 514 514 514 0 514 0 514 514 0 285 0 0 0 0 0 0 0 0 742 785 0 0 806 0 0 0 0 0 0 0 0 0 0 0 571 742 771 0 0 0 0 0 0 0 0 0 0 0 514 571 457 571 457 314 0 0 285 0 0 285 856 571 514 0 0 402 405 400 571 0 0 542 542 ] endobj 103 0 obj << /Type /Encoding -/Differences [ 0 /.notdef 45/hyphen/period 47/.notdef 48/zero/one/two/three 52/.notdef 55/seven 56/.notdef 57/nine/colon 59/.notdef 67/C/D 69/.notdef 71/G 72/.notdef 83/S/T/U 86/.notdef 97/a/b/c/d/e/f 103/.notdef 105/i 106/.notdef 108/l/m/n/o 112/.notdef 114/r/s/t/u 118/.notdef 120/x/y 122/.notdef] +/Differences [ 0 /.notdef 45/hyphen/period 47/.notdef 48/zero/one/two/three 52/.notdef 53/five 54/.notdef 55/seven/eight 57/.notdef 58/colon 59/.notdef 67/C/D 69/.notdef 71/G 72/.notdef 83/S/T/U 86/.notdef 97/a/b/c/d/e/f 103/.notdef 105/i 106/.notdef 108/l/m/n/o 112/.notdef 114/r/s/t/u 118/.notdef 120/x/y 122/.notdef] >> endobj 83 0 obj << /Length1 750 @@ -403,11 +409,11 @@ stream x?SU ?uL?OJu??+?5?3?Rp? ?44P0?3?RUu.JM,???sI,I?R0??4Tp,MW04U00?22?25?RUp?/?,?L?(Q?p?)2Wp?M-?LN?S?M,?H??????????ZR???????Q??Z?ZT????eh????\????????r?g^Z??9D8??&U?ZT t????? @'????T*???q????J???B7??4'?/1d<8?0?s3s*?*?s JKR?|?SR??????B????Y??.?Y???????????kh?g`l -??,v??HM ?,I?PHK?)N?????;|`??????ykC?,???WRY??`?P ?"??P*??P?6?300*B+?2???????t#S3?????J.` +??,v??HM ?,I?PHK?)N?????;|`??G8?8?kC?,???WRY??`?P ?"??P*??P?6?300*B+?2???????t#S3?????J.` ?L? 2?RR+R+?.????/jQM?BZ~(Z??I? ??% q.L?89?WT?Y*?Z? 644S077?EQ?\ZT??WN+?????2?A??Z???u?Z~?uK??mm+?\_X????????7?D?????Rl:/P1?d????????(??l=U?h?d?_O??E?k?v-X1??t???`????i????_y. ?1?????????:?un~Q???3/??S??}??]?? ???$e~s?]F1????/??Q???m????|<?????/??q'}I???+6???E??g???xT.??G??gt???v??G??U|?????~??]?R????_k?9???:?{?p??G?? ??d}dN<6??-uB?o?H??=c?M?vH??z?q?a???RK?~,K???}????????m??????yo??~?????v? ?_????s>???.#????????{?/?????k????\m?|??r???X???????ad?j|?????R/?,2?p?0, H?IM,*??M,??\r?endstream +??-??????W???d?????_?~?+ ????i?s?s?`??C???u?I^>??\m?|??r???X???????ad?j|?????R/?,2?p?0, H?IM,*??M,????rzendstream endobj 84 0 obj << /Type /Font @@ -416,14 +422,14 @@ /FirstChar 15 /LastChar 15 /Widths 106 0 R -/BaseFont /MLVPVK+CMSY10 +/BaseFont /ZPBDAW+CMSY10 /FontDescriptor 82 0 R >> endobj 82 0 obj << /Ascent 750 /CapHeight 683 /Descent -194 -/FontName /MLVPVK+CMSY10 +/FontName /ZPBDAW+CMSY10 /ItalicAngle -14.035 /StemV 85 /XHeight 431 @@ -449,47 +455,50 @@ stream x???eX?????"???R,???Cq/?5@?@???)????Hq+N???E{???g?g???~??M?!?w?9?;??>??P?d???e?PVA????;????]??F 4?????P? ?C@? ?p?8??9a4?????????????B@??eS?5????? 6?? ;;??_'?@g ?h??????Cf at +??_??,???.???? -?8?L???????;?y,??hl*`X6 ??? [?\???N?????w??????h?&?O?????7?2??C?? ???@??????????,? l?gs0?[???{???~,?????+????? ?H???????i?????@? ???????????????????0? ,/???u?a ???0. ,??o???u?ay=?????KJ????pX8?x|\??????f??=#???Q?}??l ?].@?;?mal.h??\?-?7Q??/i?9F???[;z?|,?]????J????T???r :?B??s????VT?upw&?????ud*?bvB?pF?a??o??N,?g??Y?LP?w? -?f?pf?W=p????????/_??Ry???>?i?FX??????Tk?/???? ?N???>???G4cg??f|\??Ru5???="?v?U????tL~7???E'U?01?????-6?)gs8?uOZq*?~d???BC? ????)R???JY??? ??I9??U?????w???;??????f5??+??/?_????3z ??!{]4???????????jt%c???Z?p????[????a -io~u?-eR"~?l?u?_???=??????W??????L??tX???59???? ?\p{?=d!? ???0? ?D??>t$3ns%Z????E?????E? ?[???q?$? 'gbK?u??????U?[?q -??????(????l?O??? s@?;????):N??H?_??E?????K?]~??9?md??D?4?4????k??!?K??X4?U?#{xY?r?+@?[??f#Sl??????.@?/?=???k???E -?T?N/?????2?a2t;k???A??Xd:#???M?e$]!?s?????*????9 ?"-?q?E]??$???VRs??{^????v0??F??-':G??Q;??-A|??>???h???S1^re?P?????Z[???+???)?0H?$~?{??????(TU???sX?%@{?t??8]H j?-??_F#??KF?????V?LAv??1?h?%?(?I* ??WS??P?$bp??}??y3???B??????????x ?????3??C?L??yk'?B???Uco???_?Y???????w??f??57???E?|%*????G????|?}?????"?????yK7??/?K?\????=?]??}?nd]???x??x6 ?>?y?j?b?T?wMje??????????????]|*?Pc5i?|?&E?XI4K?,,????????b ??Z?^N???"??????????p????pI??!3??:R5?o??Y??z??B??%V03^r?????m??kt?-h(e???w??*??;?????Z??)?T????v?H;$?M??????i????Ty??(i???????P?S?C?W????+m?,?????,??????j?????>vy??d ?m??{?]%s???? -????[??'?????z7B?Cd_S?m?VF???3?N$y??????"?q????z??L???]??lV????W?r?? ?+?? ^?n)?'?????? ?????z?=$_?????i&???XJ??8????????????j?lI?qr?eEA?V?;??? ?MK??W?(?????u?3k#te&??S}?b=?]?^???????MH???}???5?V????f ?L??<:??7???r?7?=?V??V??O?? -!R?,p?jr=??r?????d?'2#? >F*U??u?????v?"??U?????3????N?tD?kH???L?w?k7?n?U -d?Kwm?G?V]????P???{?'?R???????`??N??????W????;??e?Xa?Rs?P@`U??????f=7??R??A??YX?????'`p]?? ??o?(?51?C?e?d??Q??&??u? -??v$?f?y|Y?6+M???rF? ?_?.?*?A??\J??z?x??\??%DZ@????n???Q??=)[B?V?g?}???????????^O???????rg?d???m???G/LT????G"< "???X??6?D?f??}[q}=??t?F??\?c=d?$Z_??e????`e@kx"???VY????DN@?-???????m???EZG???#[?m#*:??YuS????c??l?d???? JS???01?[{W???????[?3??'?????uTE??>?H?7?z?*?I??a????~?1?v???$?&?s??R?CL5#!?z)EJ:]?v??q^??-Hh??;Zr2??\e?_??n?(RP??.?X???Pb????????6?0??`E?w???S?r?| n??Zr0A???p??&??OK7?'?'???R?j????c?{0?~x?0??%k??1j.)??;? ???4???F,% d>?`,??X?]?r???u23V?9?????V? ?*??O???f5???o~a?R!V?m*Mo??8"%??h?wY ~?d?????0&?&?X?:*???'?;?9@?/s??k?*?-F?Cg?????|!`?e????\?UA??????? ZiR)eW??????? ???rB#u+?,?????f?{?3{ -8??67??nm)?6 ??x?U?c?q6 T$???o?(*?d!?? ???v -!?B$U???B/??'M?+?n?M??^???+???????0???2??F??X?&?????j?????6p?????DC m_S ???|?5B|o`?? ?i# X????H???o'?>v?????:?|???????+'???m?6w???nGy??A?J]N?e2?[?0????f:?J??S??l???!???, Ij>i,QD?D? ?y?=?PxoF???g?????t";????k -??.K??*??>???^?K?\? F??y? -???yRL?=?p??`w??W???=dop?????? 2?????????8pjH?? (??b?bQ???a~81??6?J?S?$??H?=???.X@?K?s??5^??Fr?????u"?+?D?~L?cY)+xsU???????i|?l?(Hz{w"??v??'rf??yXW??N??? f{?-SX?e?vd??????}?i.?Ik\?uiS???[?b?????r?"????]#QH?d??Y?e??c=????gQ????? ???L??}??????_T[E?]?-?~?????v?$???L:\33o9??q?a???ZU????-g at mm????|{?? ??_?{??? ?????yF???f????? ?a?u#?? c?>?+????7?F????G???@?????s????l??e]Xr?_v>???MZ????????f9?Q2??i?4'?r?v?& -?:????Shq{??-???????i?0??fi8?c?H???B??i???J?V}?K bU??R ?_?A?{!&??0???????t)|EdS?M???6? ?V'???XNT=?wUd7??????#???+Q???0??/Zz???qi??A{S?L*u?p???U?}?5:1??# ?GomXd?y?wx??\?#Z?2?Yx??(#??????t??W%U}/?Uq{??H?Z??????v*?@??????P?\99??k6????????*?O????6??x?~h????Tf???p?????s????\????o???c?8>S?????"?KR?y???0??}???9?^3cgi?0nB???V7? /J?\?xN?{?5? 5y?q?T?FY]T??B[NQm????;S?~Uj?,lF1 ;?pC??;?aW??E???_6`_?????????c/$W???3`9b}t????zn?????[?|????U?D:v?TN???L?y????/???Y??F^ ~K??Z=8?M??Z?g{??????;?B%?? $?O?B~?&}8#.?v?+?j<%?Q?????.iM???)?_CU???N?C5P??? - y? -?Z????`}??-?Klu???Jh??@???(???2g%b????O~?g???|?/??2t??r??l2??P?p?"?!K???[?2"???????????Qh???????????J??F???\??zS???Z?/??]??L?D??N?u ????"?T(T!?WU?MY?????s??-??^??D4S?Y???RQ??.?S????*a?????????]?X>??j9]??; ?????"- -??'????K???? ?????& ??WrV9????'x9?????y??? -?4X????l?Z?L?F??j??E??jU???Y?r?Y?????b?3??UR???[???*?^;??(?/>S????]h[?J?L????q??QY???$#RZlD?;?-E?>8?$??[v?N j ????????;T?!A?}?^?A?3? _;?B??????^n {??*B&???H?? ?x?o???/i6 z?]?C??BIH?b -]?cbNX???w?J?x?Y??:???L??RY??|?6??A??O?? -?(?p[N??? m?I?????a???:????? q??0??2I???vmn?M/L"?`?z4???t7???XG?????T.*????6?V`(bQI({O?#??y?F????H???9cD??Dr??????CZ"?"R8Q?q|???h?n???b?^|?v-v? ?0k??:j?ey???? ab?(K??E?H???a??*?????????C?v?/????M????HX?Ft???K?U? K%k??t????m?b???>?R`?H????~??5?u??m????v??!???h????K??=?F????)r-???5_???!n?????? ??? ???"?????Bl?? K_9/endstream +?8?L???????;?y,??hl*`X6 ??? [?\???N?????w??????.?????l3w??????(???o??. ?h??0 6 +?Ij .????(Eb?????R???=`>??pH??q???]Y*?6?6???sx??Q???????mW??T?f?w???[??7X?????G??R?[=??T?8Yd?%?7???-dL???F??1???[???R???S????? D?9t-0?4?w?#-?)x??g??xU?W?????^?=???:?ce?]?4? C??0???]P*??QP}?0%e&?W?????????'?Y7????h????D???W???KQ3?0 n[?U?=X???? ??u9?"/^?Q??~-??7$???h)y?????f?e??_!x??i??a@+*?:?;\o^k?:2i1;!S8#?????7? i'??3q?,P&(?;q|?W83????K??c????/mq?.?@??????? ?B;??K???H:&??k????*G??t?YW????9???'?8??2}`u? ?!~?lBg??^? w?,?Xdz}R?w^|???. o&????[!?1^???g?q?]p?? +?h??B?i???Yq1??z???E?)??C?g??]?????Xm???;CW?y??????3??g`? G? ??N0?????????(i?B????}5dY j?2?????6? ?????'?/??J??{kQ???|?r?7?l?m?soBwk5????hpB.)??????f????W?+p;T?[|??? ?}?p2??}???[Y^?3|0s'o?XC? ?c}??L?v??~a?|7???,??? ?a??1O????? ?Q???? "ny????5????2?????d????T?J?n????H^?a??=,9?wh?????>?c???F?I?>V???9z>?t??f??2??h ?'?ovZ(~??p?????%o"??pxr4??eh???Jy?P\???<)?}?? G?F1?$???????g????????Cw]G?????\??/^?D?=????=?.???????b?????5??1v]S-{?????????0??7?????2)???:??/\e?h??~?l?+BL??~A??y?,??????\??p.??????????C]???\??Y:???-p?L?"???????????????????3?%?:?kY?N?*???8???cMAi?Z???J? ?'??t +??9 ??? c???ZU??/D?"PNC????.????6? ?X"?lxU???zL?????_,?????=?,T9??? ???f]??)6~?f??DB l???mV?5Ui?"?N?v?`??P?_?K?0???p?? ?\,2???????? ???9f??tQl????Y???????Eg?k?i+??9e?=/??hg;??|#}????#r????g?? >?K???k4????/??V(zx?LW??QC?r????G$^??=e??J??Q??*xN?9???=n: +?l?.?????\?/#??D?%?o????o?~? ;???y4??G??$?????)?F(C1?\ ??J????D?J??}Q?????vP??L????{??A????<xC? m~?Fg,?@??q_???TpfJ9#?q?dW}??>}c.??SY?Le?1??g?W??6?:???e??z???q??T?_x5p?P?6??+?+?J???j??'??--mK +;W?E4?????tnT:????R??No??m?(?y;T??xX??] +?F?L?g2??w?4e?????"*??e???U?:/W??}?z?Y&??NX?????6D?LR4?y?BD?u+?2?)??))?i:'???????$???z?????H?}?????l?[?????????Q???7?1P???????????????z ?NwWF????? +?R??56?b F??.????TiNO}???J T19?????$?????k??{??  ?+.?c??L??,????+l?5?DxQQ?S!?d?z????? ???x????????d??/???KrU?o?;Cq?r?????vQ??j?A???c???K +??>?????? ??BGE????U??)?q?N?????,?H&?<??A#????Dl#5L?a??E??7B%=??? ????????????91}??????:h??g??8@?n??4A????v'id?x??X ??e???x?H Z?????3*D? ??d[???!???H??hrq??N?!5w????@%?g?dV????Ja??l??n3??%\o?ou?"r??V??R? +)/? ??R??}??u?H???@??5h?M7???"!?L?Z7????bD??K????4b>{?"X ??$?%?w??_R?Gf? Y1?k ?i/???iN?TN???Z?v??? +Oz8?$??????|???? +x???@?jF????+?/??DR???@?5:?4?2?eH????zC??FR? -J??k*?J?\?W??&???m???_m?s????W?4?bI???YO??)?????y??6\}??M?U[`]?w??dhuA??r`a?z?h?jtX?'?s?sgc|?3[?gwa?6????&*??~?#??????? R?mv ?x?H3P??????M:@???h.???u?/@?2{??]0???I?Qj ????[?w h??v\@?\!o[?2?5<??F??F?Z[?? "' ??gy?qP??????"???oS??-?????????)Z?c?1?c6}????\????b?????^??? ????-??L?????I??:?"???O???G=q???m????f?V???U;?}ZQ?9Oc)?!?????M???"%??d;X??8/N?$4~?-9????? O????sx7o)??wq?vt(?\JG +????Mb??N????tP?)D9O???yf-9? g?b8i?i???v?????)G?sI???=j???g???t????pz?6?W?;??I???e? c?.??2????]S??c3?m%}?)?i?IP??e ? ?$5?4?(?k?_????B( ?7#M???M???P:7??>-*???=se??H?W?lN?????$?8Y??D????v?C?a???@Wdc???2?q??n x K?X?????h?Q +/?? y?? ??????3k?O??$P??9B??}?39???g?g?5??O?%?^?R?i?l??%g?N#??3???? G^?.???????'?????NI??}????:?F?L????????*?????? ???4?j6t? ??;??????93????4??5.?????{??]?]?r?x?]?c????(?G?F???2????@???????[F?????&??>????x~??/???? ?.?J??y??h;Z?F?V&??????8???Fc?*^??r ??3??6?FN?Y?=w????/?????m??\??h??<#v]j3c{G???????K~?? K???C??N ??i?cJ[??r?x??`^L?9?W?W??????.,9?/;fS?&?NJ@??Y?Ln??(m??G +??R?j?]r?V??)??????????Hl???cbl3?4??D? Hnj!q????dd%??.Xf?[????'?yv????U??y6???(W?w???????K?^ ~&??]*C???-Q?{? z3???Z>???xuH???H?f???{????'@?d?^zO?k?g??Q???Z2G??? ?/E???h\?\?n?CK????2?Q??se???h??QU??wG?,????q??"5?*???q????XJ*??[I??G;?t}s?D??JP???S??c??Ro???n?U??????D?T??'???b*?or![ +KR|?>f???%?*?z?????? ???N?I?l?gYu|:????)??&c at w?N?k???kr??'??T??*??WYCF????V???(??B???-?????4????)B&??j?a????>???o?????6,????;?mt.?-e??,:?iSh=?|r?V??u>??A??*J";I*'?^{??????????,?x#/?%TJ?????h????=?J????n?W???'^!?m?>??t? ;??F5???g???h????M??????!???D{???(KFT?4?~z?`(?'????K]????F?:De9?c6??(L?X???%B??-?{k?l????]?H?g?(4????n??Y?[R?nC#J?|.? +t?)?|f?K?T?.Le&b?I???:???[?? L*????k???o????9?[?j-??OB? ++?p%t???J?@?1??? s?_???r??&?W-n????% ??HB?x@"????v?F???y?)?F??m??? DT{]f??.h,??V??????amX??????HO???m????~n??M??????+9?rZ????yzi??f??\????KYM??B???_+? +ZdZ?u?{???!M(6?+????"??/?"-E?O??? ?????FLfJ?? ???m #???F?H??B???0"x??K???}?v????WB?*l?,k9?,Ab?|U??p?*?cV??^?x?a????}?????J?.??%& ??oJ?8????S?H?)-6????"[?e?U?-;|'??????F?z??????>j???n?_???^??buLFf/7??n?e?!u?p?????X????????4=????]F!?$??1?.?11'?????;r%o?op4j7? XU1l/>?~A?n?f?m??p%???'7?BPCSw??l.??? ???YJ???!p +w?E?c????N??l?????M???'????0@?????t?I??N??Q?6??M}??^??Q?YO|yU3?????h?N???i?\?N?H????"$???+Z?d9??+???T??9"?g????!?x ???????u+&=???A??x&l???G??/%???P?]8 Q ;:??Pl???;?t(5???{??s?K?;????????l6/ji ?^??t?PJO1??????~7?,??_??IR{B _???s a?N?????9??z?do*??? ????I?;????s??O~5??> endobj 61 0 obj << /Ascent 611 /CapHeight 611 /Descent -222 -/FontName /RPRATX+CMTT10 +/FontName /RZSZOY+CMTT10 /ItalicAngle 0 /StemV 69 /XHeight 431 @@ -525,36 +534,29 @@ /Length1 1117 /Length2 4847 /Length3 532 -/Length 5563 +/Length 5564 /Filter /FlateDecode >> stream -x???y?/?"(???e?????G]? &+ ?I?? B????????????``(??W?0??f8?0?0?/??jj?t5?-?!?$H??})??9u??G?Z?H+u?d?9??^}/????Ge?VHW???px?? 4??? -?z?6v?????????r'????????u????? ?s????J?? -????Y?3?4[%??!j???k? ??????0??x. ?c???U-5w?!)???`X?[E???6?%???????S{?~ ?????E??G}L5!v?1??'7???+Nmf???6;?????W????m????9?????dJu????E?4????1 ~Ka_??>??Y??U<8~??2??T??e???@D?G?ZL??v????Gk???y????h%qc??!???:u q? !O??"??-??~???{ kq??oz?s???`?S??????|?v??7O???23?A??+?{??i??w'?}U????????)U)|N ?z?!??*?z2??7?E????1.? -?N??r??u???N?j ???f?w?d????6?y??;?IZ??/?y?8|*F>???1??d?,??up???\??B??V?R:???-???y?y???????^Y?q??kB????{E(??p!}?????\??@???j????F-uDX??[*)???b{?cE????D???g?? -??!BR????D??|?w?Ig?/r#J??> ??@Z){????^t`??c?d;????^g?0D(?H????? -d??t??????S????![? -?u[!???*?j??D??`??9?z????.????Qa?.?Y?????"? ?i1??!???CQ:?nE?CN????c?6e"E????"1t???'E??a???b?5ry??sGz?lxl ??ZW;?h?H????????=X=s\ ?4?7E?b??$????????u?x?a????{m?X?????F ??k???&??N???o#????H?Px?o?-??n?5;?$??,??xT8???)?????^?? q???'?B????5? U?c`4\????????t8??O?M??????i??| 0??.?\????~7???p??m?????????ZV??s|??? ? -?x?x?O???.*??S ??8??????X?? }?`{???'??z ??G??????? -3??|V?P???\?!???U???>???T?U\&[??~a??( 9G?:?)??N???????=Yw?????|??IC????[E????9o?|?S???{????;n???@TL?z??)????????olD?-~v?\?hN??7r???u????E????}??I? ??????????!.?????"??vkv+??|????I?????P)\9??0????T r?cF?9? \i??X? ?S|?i?-?u???96?L}??? -o??\g???w?0?s?8???f???F?g5?YqWq??Z???<?Y???\?*M?l?????g?K????m?e??}S?=;y?M?e????????Y)??M?I??, -??C??R@ ? ?7Y ? ???S??o?'??9?H??+?????5???-?n,_??????B/????$?5??p?=?y*:=?.??p -&Np???xi?Kr??????#????G?[?9???K?W+?W3?0?{z?V?u?)????~?6?$???? ??>IS??F??D?????L9??OVB[??t?r?}?mb'Y?|?3$m`??U?n?]???????v?7$???ghT?_?R?\???; ? ???i??q??2^].?kn???? P=?-???v? ??j?????u?5"^-?o?'???,?T?mc??=? -w&20??^?n??|p2?o ?H{??S?w???{???tO?h??'}? ??V???GC?;?D)?*? ???????7[wd?v??D???h??P??H???????%}:#91?+Z????????>??N?.W0?,??E? ??1 ? ????%?,?o?????#?(?p?h?{??B??iR4?@?F?]^n?O+ ???2??s??:?????????m??I? S??r?g? -s??c?wT???|?&Ne??_%!??? ?????=Sb9/?E??????5?=!???b?[??4?w;t?v?s?f:??7???yC????????R?????p??t??????\/??????zZ?????)D??+d?L?U?7???9??????Th&?o?????tw?T?8k?EQ?????????8??ml@ -gX???b?? ?c??l??L????|O??9?6}J?????fO.????m??8IBw???^|p?????:O?W???G?+?]?M??F??T?q?h??Uo?????y?J???=?*EU????_&${w )?????oG?T??Kyd?MM???????Q?????F?50z]K?Yy??????????? M?t- ???:??I?R????{?.??/?s?F7???(??2??H?? 8??a?? -???Xn??VDR?M???:???&?????N?????h'?.?J?1??i??W?y%?a!JM#*????{qDD? ;=pQ]?h?L?[?j??{???? -33r?dNkFiC?_??D$ ??""k??R?l?S?S???8M??????o(?i2?m????N,???|????" F??????????p?????gUi?*]?X???k?m);????1????7?????%?.?=ut???c??g??Vs?H???i?????? ~r?7??9???sv???C3J?yb?Z????3??????;n?.C??Cf??\`D?:? ??$?;nm??j?Vs????Yl?2??:$k????\???\?-??]?????&{?_?z$???????M??L?????I?F\^"???+?}y??z????z?E??%???_?|???p????C??f9m??*??Px0?"??4hz????T??`?j??QqD?Nsl??V?I????=i[Fl}`aDc?jg????k????GIVi&H???}[Ix????x7?Zo??{??hMvz? ??????$y]@N?? ????g?fF?? G??j?\R9????.?+KQg??[?.??y???kY??x)???Yi?%[?? 9c+??8???'ynR'????o#???M?i??d?4<: -eV??2+ ??$+5?T???TMO???bl?? ???ON??U ???*?? ???p???C?|?? ?  ???c??=79?[??X:?/???r?<e??W `k[w??Qjo????I??'??g??%??????~?Y???:?>u?,w5 ?3W?????w?????[S??g:o??q??f?*??|?z|? -k??\???s?????????g?????n?|???ZQ-?Uy1?/?Q(???dB?If????E??.>. ??W>T?Kj??s?n{?ITN???RU<]@o?]??Un???????.?j???????$?L??R??fK? -?b????z?d?eE??V??? ?"S????J?'R???????B?. ??I?????!???b?h$?N?_L?2eendstream +x???y??2R??? ? $???H??o??8 ???y5 S?o?#3 ????&?????\S?#?5???? +?Ssnx ???P?N??s/????{aqT?~?v?t??? ?W???>????????????~/?-v?o?.y\9]?k????9g04??8???3????\CA ??n?6k????0Y9 ?tw????R??????Q???w?????FR4?Lo?_???)?>9?#q?3??????{a???q?cu?mQ????4?????L???NL????U?MZE??T?Hv????e??7?. ??Z +????W? 4???r????s????\???????m~???kz ?????Y?i+3?x?nJ??O> ??Y^??????v?U?YeO??wt)BTw?nb?}??Zh'???K?cO s?oJ ??? ?n???'??-|sS??x????l?~?n?n??,??G?J3?? ??$???T???*$??6f???????????7jJ??h??????O??M?=??????B????L?????U???%zC?-:????)?O??r?'?b???3???0i?????z??? d??O???=s$?O-?????t?aa?n ??? ??sZ????? ??)+?r?r\??uVZ?nxdw?'(????7?{?????? 2?L?E?G?:?L??f????U??3<5 zGaW??6??&??2?=oF? ?na*?D??q? ?r??}M??4v?s?????\< ??p|?[6{X?&Z???K??? +i? 9??)??????"????O4? ?#?<?Z\e???X6$/??V???r+u?3??>KE?%??#?K????rD????y???i5???uHD?U?Y???JdR??{|vp???l?>?????Y%g0???l??r??K??m????2???n9ws0???n??^?!?-)y??L??e??p#??b??-?V?m?d?l????i?????{??z?(JQL??(?a?N???6}?S??j:????!m??@E?z'?????m??=\???>?E$??*^?l??U3????s? +???n????Gd]?z????c|rRE??L?^zH??B??Df?n/k????D?Q?;_??A?????Z??k?~?D??~??;s2qAx?KI? +??????xL?&Q 9b?s?:?u>?O3p1??????????\?????p.???X9?Us??;??? v{k???PYe?0k?r???'??+?Z???#?-v?,? ???a1?V1"?H?#X?Y37t?!??jXh"????9 ??????????Xy???-?O??p??/??????p????o?????%n??Wr0ZD?Yr???E?*?????-nD?]?H?????YO?*[X?ZV???????>?????C?? ?q?r?y?????????????p????? ?E??s1?_?#?U?????#0?LW?&D?`??m???syJ?r??S??m???ZV?]iJI??z7?_?>\9s?'?0?3A?f?? ????i}???{?O?ZGy???l?H ???zn~3?z??m?h?~v?w????.????$?(?????>W?O?_~?f?\:*?^?had?????fL???,???,!z]?b???h ??????z??'??????e??a%??1???G?M?? +4V+??<'???/;. ?i??rx???%:??????W!?;r??`?a???D?B???T'????~?f?C????R??R??F???z?????&??_Az? ??v???R9?DE?m1w???????h?Zd?Uy?d`???Q???$W??w??,??1???? +.?f?f??\??Z???aEu???k?h?F?3????+???E'????n$??}??????????[?Y?Q@?3??Wo??k?$???9u???GA;???'????s.?k?=]??2??Z/:??? .N?????*,??U ??8??????P??}#o?`???;??z??G???????rS??<e?????A?????1*???????_![??z??? 9G?2?U???????5Y?k6??z'?Y??????17???T#?S?b???V?o?X~ykw?Z'N???????3z?O????y?X????? ?(??vno?&(*?zW?s??-???r???p??????c???g??84??E????R ^????N????^?!T1??0?????h???d??A??Tn??\??????R?m?yKslb??h??%?(???? +??{??}?(???F??????M?????? ???????????]?*?Ems??f>H??=?i?m??uK?y?-?????m,????3???Hc;??=[???@? ?3^? ???Rn?m????=?@]?#?????U??G??v??_??????KI??/?lY?????????p?>?y&25?.? w "????e?Kr??????????'??b???????W??W2*1e{??&?q?Y-??~?4??M?t9???`^ a??y??????? Y{?????[,????z?????c&XJ???'n`K?U8??^?????(?n?'????gHd"?o?b??????{u?q???i??Q??^M6s3'?J??rz???-???6?@??*?????u?u"oM?o?K'?^js???U????/ +t?Z{???????>??????H?!?@??0R??H???B?????lO???F?'E???vU??HLs???l???5????f8M????q???h????=????W?A?1?#??/8???? +Zf/?VY? ??V?[Jj?$p ?i???[?z?v?????Y???~#??I?? +?4????????e??_????W>?{\e????Q??T?)]?2?mF{??{J??;?aM?TvX8???.(???G?V?????O? +T??????k7??\oQ??;?_?Y9???a???7t??sd?Nh??y?h?j?$????????7>?H??u????/?e~???d?? ^^U at N?? d?Z???V?~fj?c?wPJ????%?A?????6? ;??? sB.??W7?X?D??I? ?H?/?H?I[R???????u?<1Px?}q?$uJW??e?????1P??%?ii??Y?X?H??????rj???U#???????>r:??|?????g?T??? +!??"y0my?9?O*v?O???kvrv?,??d_BI[?8q6?rc/??????~??*N?-{?]???????H??Z>0??^[?^???2?6y?${??u?3h??-??????????3m?w?h9 at I???c[>????5?Wo????fv?tr???U???C??? S???/+A$V???eW?MHEM????W????????Ng?Q??k?> endobj 57 0 obj << /Ascent 694 /CapHeight 686 /Descent -194 -/FontName /OSQHOH+CMBX12 +/FontName /RBZBPG+CMBX12 /ItalicAngle 0 /StemV 109 /XHeight 444 @@ -596,8 +598,8 @@ stream x???eT???hq ?4????wo?-8 ww????w????????;9??|???f???jU??????? J?????@1['zff???"3????I??\?h?dnk#b??0ss??????_v6vr??????????J???$N??5????? k?d??ad`P?52:?1????p(?. at cff?????hjn????????-??_acg??r:8??TkR@???6Vnc? ??-???C??s???3??k????? ?????;????? ???5:??g??_n?@csg???t2?27?1???2w3w+?;?L ????6??)??? -??2* -???????? ?m?????Y??????7???`? +??j?j +??????? ?m?????Y??????7???`? ?b???z??'???%jcdklnc `a?88?!?N???sc?+? fd??uM?z?0?u@?kCA{?h?w?_?B??? ?h?l?46???N?3???#?fc0?8m??&D??;?????????????????;????? h?;??*kk?;?`t:????lm??0;H????qv?????? PiGP??aPaG??u???????#??W????G9 at 3?V?7q?h???? r?M C????????oU??M K??? ?q?*(?&???? ???ouC?7????!? ?????]=???w?$b??@"F?O???}Y???!?Aj? ??????IX?? ???a?A?$?????Av H??i8??????)N ???Y??? ?/?#???/?p?)?8:u??K??i?8??2?FI?~?,?I?ZK?tF]????X?08Q??F??[E!z??????bI? ?????>?????bfg??P?jp)? ?O????k?;?d????_??*??[??????????&???!n?????c?;?{??~1#???1H??>ZFRn??hBT??Sa ????t?&?????'?b&l ?,XXE??? ????/???F?$?????Y-LY%??]=?????????Q]??lo??G_{???M$???(J]???3??Dd??&????V??8?????u?d?w ?~??)j?Q???H???=?Y?&?)?A 6???v??r-???????$Ny???}n??`?z???s???\$?[??p????}??L?( 'o*?@q/?>?$?s:?#??Dqn?o?n?A.?'T?@??-?0-8;?r:?;???4???S??s?/???]W?`?????2??[????db?|.?CXV???I 6py?l21????K2#m???d????????{"?"?$H? ? -5~???|oz???`?? Z????ol????Zf!o???I?o?Kb]?,?F??/?e??Vfb [??q?TC??>??"????????gC??????h?Pr|Z??T???T3??Sf2[?????^???p???H#?9??w?w??????vu?u??5??R!a??zw??2"=???^wV???6~ ?6?Kf"??B?????T??]??Oy????hk?J??|F:HJ7?????af? ??RF?7?????c??A?4 ??+?8???f?y?P'M-2?x???Z???QD????[(???PWs?????\fT?1???*jB8?"??F???{?'c???????????W??????5]?>^?G#a?t??y??_ ?EsS????8s?s6GPM??M???{k??????S?=?????6?.?h???s$M?,??F??d`?v??5i{?W?????????EZeP?=D???B?6???;jL?? is???f???A?? ???????????????E?3endstream +5~???|oz???`?? Z????ol????Zf!o???I?o?Kb]?,?F??/?e??Vfb [??q?TC??>??"????????gC??????h?Pr|Z??T???T3??Sf2[?????^???p???H#?9??w?w??????vu?u??5??R!a??zw??2"=???^wV???6~ ?6?Kf"??B?????T??]??Oy????hk?J??|F:HJ7?????af? ??RF?7?????c??A?4 ??+?8???f?y?P'M-2?x???Z???QD????[(???PWs?????\fT?1???*jB8?"??F???{?'c???????????W??????5]?>^?G#a?t??y??_ ?EsS????8s?s6GPM??M???{k??????S?=?????6?.?h???s$M?,??F??d`?v??5i{?W?????????EZeP?=D???B?6???;jL?? is???f???A?? ??????????????????Iendstream endobj 47 0 obj << /Type /Font @@ -656,14 +658,14 @@ /FirstChar 11 /LastChar 122 /Widths 112 0 R -/BaseFont /ELUPCG+CMR10 +/BaseFont /EWAWPR+CMR10 /FontDescriptor 45 0 R >> endobj 45 0 obj << /Ascent 694 /CapHeight 683 /Descent -194 -/FontName /ELUPCG+CMR10 +/FontName /EWAWPR+CMR10 /ItalicAngle 0 /StemV 69 /XHeight 431 @@ -683,33 +685,22 @@ /Length1 1041 /Length2 4846 /Length3 532 -/Length 5537 +/Length 5535 /Filter /FlateDecode >> stream -x???g????u?k??z?????T?vP %$*,*P????D?EDT?????P[ W?EA????b ?f???$%?D???jw?$?? ?S???$ Pq?"a[8d?r??a4 ??0????*???_+<FPO(?j/L$* -??AP;?# N??I??H?#l????)o(?c -???&?c?w??C????nP??? [?.?????o??K?w??c?? ???? ??? -???P$??S???0??p??m?Q??0? -?? -?G???????? N[WO??8n??0??m?g?P1???????g ???????????E?fLu?0_??????D??????mvA????1I)?-i?G??=??`p{?/??q ?#P?%LIH?_ ???1=A????II?*?4??7?????8???`?a? ???DED@??P???b??(:??C?????o??1??????b?? F????b???7?a??~??[U? $?9?????/% ??????? ?B"?p??? sk??0??B}???ID>?9?.?$?n?H)?????x?7m??????] ?u=?k?/?2?H????|.??B??~gR -}??P+-$+????^?]W?v?`j[??x?RC????????Z??e???2&??m?????L?'Z?>? U-????4?D@ H???z??3j6x????? ?F:h?]? ?n??#?kM??a'R????_W?(?+???!{][??+???*wr??????>?b*u?G?}^???{u?=???w(?????????? ??&??ex??b g????9QB??L<&:???{??PXn?-??i?|?????A?a:i?(?p??G??g+b????_????LFz???'?I?F??}???gf?U?\?B??sa????=3?v??>"\???E?h???v??I~??E?@?T?Dv^????#?;??*??|#x?h?q(?/?T??_`8???T??&,P'}[Zy?sxW?+V??J#?(?4? je???.L?"U??r?KNA?6?< ? ??R??#??l{?yM??|??KqL?2?3R?|c??RC??/??[??O????s_T}z?T??3??D?????mD:^????KY:?ph??6????C?[?'~?7RX??????vsF?)????1??oC??;? #?xt?????eU_???7?G_ )?hK??????CH?`???rL?+????g,?x?o3?????X?V??A?h;??R???Q?l???u?7??v??E?1???)?Cr?l????????h&TJ{?Kf??I$??????????-6??/?????kn1???Q[??KNr??#c~????y?S?{?% ?v ??????E(?\????g??}?l???,??$5? NpD???~?|?c/???'B??4???J*Nn????E'F?g ?z?@???????k?#?W??0o2?Q .?????????u???fM?aie?X%e?9??7?>??D??+??k????^??V??$q??%P~[?sd?y??? ?2s@??K??Rk? ;Y7? ??????'(??????"??k?????g??D??? ?%?P??#?0??r@?6G???D????7}?t???0????(?B?y???x9?????E???1?qC??YCl??O??Z=?T???c ?Xg??'???w ?g???y???7(???? 3M?R??????` b5?~??=?Z?????=ea21???]??????r>/?B$??????2S?:?=?P5?G??{?c6??3`?1 ]???M?\???I??MIr??P?T,;???????_:???-???B_?^o]LK???????????t???0HW;?c=o??Ou,?4????X???E8?Z??L?8#oq????r???.7???J????Y???sQ??Q? ?k??he???/%??)?7L?,??M(V?N??'_????!??IOI?u?}?&h??p?g????p??????^??W?b??^u#:OU?%,~?f?d?a?l8m?:^???_?8?yS???S?/d?]?\J?:???4l?fO(2?V?^=?t?2??N?\??I???|{j???????hD?G??? -#}J???L?zx????wl*G??c?M???[???jS@???B?l?*??K|2??~.?????(A??;K?p6L ???c?92??Pqb?????YY???e???9?j?{t??j3???%?]?Zt*%C?y??kq?.,2Q*?7?(j?lQ8????yMc?$P?lh??????8H?O??T??|/:?x???qx?5??S?:c]@z??? ?M/?*?L?F?Vmy? 5n? r??%?3???^??b9=??B7g??7IB?Ksnr??6???????E???U QO??0?ZZ -???+3f??b?GZ????????{?4e}???B??I3=<??C?????o???Z3???kz4??k??;????r??=??? ??.Q]???J????}?? -P0?gx?"W? I??2x?????9???=??T? 3l?@N!??????d???_??????B?W?i???U???? -V???>x???,q???+? ?56?????V?g /L???N??|?????:?UV?R??mK????w+?kb?'?b?p?#?d?@????=????W??? d?\??b ??:?*?(??????Z??A?C??? ??T????\?kZuH??=??U??XZ???'?A\j??H}????y?\??????A???D\B -"V? ??}+N???o?AN??????????WT|U??)?z.?`CF????F???????L???#?Sf??-???????????C?9of?6^b??q??????ST?-?6??? ?y???4??6RE???\$s?P9J?)? -?5RL???Yr??N?????',?x?$?C?2B?f?k???i?f?n?ms??t[&?)?k?|??' ?4??+9g??;????5/??C&4'G????r????JV?` N??I*?A?B#??O?sE?0????F????*?O?D?Y??s~???>P,?g???????LIE??'????0?????QQ??xO? ?K?j?????hW??5E?S+??O6?F'??4??? -??-LDd?Z????3|???#M;g}?5 ?RzH???Se?G??.Om}x??=???D?<`?S???c?}??x? ?????W?X?{?=????X$Nkh?`??:#?5???UU?9I}?i]KhpV?rp??#k?R?c??[Mm???C7B%B?Vfr????>?=B??)?:tc=?Z?{???Snz?????)?????=J} xlL? -???"?P?Q?}?Zs????#????RPu7???T|????i???????,OY??uy??$i?k?R?T?? ?U?\?*???\:?NsuWiq???$?8?&?N??"??$? ?I?$??????5?8Mj&_????>???>#`!E ?????Qo?v??|R<?62?7?0R ?8}??T'2?G?G'? ????V?v?$s?n?9TY??n????[u_6??????1???8zEJ?????H?sR[??m????\)?H??p[???*d??7??G{%?W?1(0?5????????.?1 ?h:??O???????????_?????'????0?w|??l? ??? -T??????????t?? ??RL?D??"n'Tq????M??z????0?r?? tZ~?????`&xV1%a?ArY?#?C???(/??bE?} ????7????/????S?c^?T?6EZ4?~???uK??i?????x?#5"??#y??A?X?C?I.????R?3??pS??????????*??DSL???f??? ???7???4?????{qv??,???????#?y_????[?i??L ?u{??-Y??o???y?Qa?y;-???hL ??Hj??~?j??#?3g y??T.:l???3?Z?L??N???#???Es??$?*??L?X?2??ku?????R??b5?xofD[e~??mV??p:?k???/?:TP???V??"T? -u??K7`z-?K?C????%b"?m????$G?I???u{M)?f???!Wu?o?CM?v?vT`@????4????y?U???G/?V?????r?*-?x2??G????V????Fw???^|?$s\?P3?x?Bh1>k???h??????vA?m?O7????0??????X~2=R?????w?r????a?'????Y????i?'y???O"?yx??9?Z?????? ?+??B??"]?? G? }endstream +x???e\????i ??:?n$???b??????f(A:???P?n????}={????u?k??z8Y? ????58 ) ,(,P)? ???? 99U$S?ABd???"5?-z??d??d?$9*p7_?? ?Q???$ Pr? ?`d?t???5?6.C8 +A? +?\\?Vx ??N?PX`#?(????&???G????_S^?????M^???? ???u??? h/???]\???E??????J????+????pW7O$?? ????B?aN???h"m\?`%??  ???C ????"??{??8f?????mh??n??|??=?=?g?!?|?????????ftuP??????D??????mv??Aaq ? a?K??=h? ?0;???v ????%tI????_ ???=?????I??J?$??7I????(??I???/B7h? ?v?0?E@??P t???? ?????.,???? Z??D+#?@????.?D??oA+????l??2??_@},q?_Jbi1?'?-??@@`??????????;??@??s?p?l?SjCDY????r\>Le??q??;>????c?j??-??]VdP?????x_1xD????=u?K??^??^??kb0;???????~#mn?U}L??B4:*???5j_,(???????j??T????t??j??~'lG'???V?:??@?7?I????$lA??U?J7??????c?O????V?#f3)????.m?]=?`????W"?!L??&???,Y7?x?/?b^?US?=57N6?u????9lM??_??`5?g?:???a? ??????z?:??\l?J?YD?2?+?????*x?9?q????]??G??O#?'(R???y?1??????18# Y8[t?x?'/??????h??Y???????"???-?????/???j2?K#?("???F ?[???f??+\?D?G???T?U?)\??}g/??w????"?1q???;?????[??w????>:i*?4m??????#?Ri$?h?r(Ci?x?????J????`\????OJ B????L?H??????;??`?{h?H???x~????H??a??A_E?T4?$l????$v??????{2/+???P? +q??W?????????z??uBL?`??I??b?4???8??Uj&????Z????O2??? ?)???@?NCt[F??Sf~L?????m???%ka1??v3]+X-2??eV{oq??VH?>?X?=????.b0??&?Y??e/?A?L?DT/9??hm??? +5?????s??I?w?? ???W?o?????[???I?U"???????*???zx?R??5??,?????????l?'2??0??lYiQ??'N?in(Ff?Y?0??1?*TQ?kR?BZy?}??A?j?`|??0`????Oa???M?;9??(???Kr??r?#???Rv?%???C?hHm?:t???>EW?.??????G??t?C?????Z??`z??/?xM?? 08?.??%?r?.??%???~>???5????;?s?Lp????z<~??Z?3jh*???i??#??X????J |b???7???;U??????/??????Yc|? ??? +?G-&?\;?KUs?F???au?^P?????d.9??"??n?3?E?+T?]?4M????q}?????h??d??T /`nkN&??df??s???&Z?/?EhEf?\????I?/%a?j???6U?????l????0?????~?S????\???Z\j?????'??y?/L??R??4??\?jM?q=??????`s????/????????`????}L???G?# +???$??x!???o+?Ta??????[E??Z?iOc??41q.t?I??G???k? ?????i??P??4??O?i?'G????5??D?5#t???4\????U]?#??U???K???]}??>F?a?l?I'?7?W?9u??ZH?????g???b,?h?P`??r???y|[4?np#????????X????G??W?Ys?^???????%2Fe???Z?????kTIo??.d'eA?dcV?d???U??S?kv?@v`?OR'b??k???K???????????????B????%-[(q????(|?3???????? _?f ???(??2???u???w?v???A?a??>????;??E???l?H???C? +?b??f0????w??b5FV?Fx?2????oZvQ6A?U64????????X?&HE???????\T3D,dbu.?rH6????d???????a????????????[????? ?kr R1E,9???u????"?????7p????E?! *??~??9>s *??'X????5k?P???y????Z????e? Z?}?????????cw?????? ?????????Q?aqvh?/+-?q]M?%?V%?+I???5E}????.?5?v?????????O?D1W???$??=:0???z[d???F?????x4???[?_?????e]???Fg??2????????q???j? ?/b?g#??? ?? +??u1?G??yi?T%?????$???w+57g=U??????)????O&??k?{Ma w???r~??(????????r ?p????,u}?????3???4Q??^????????????I??&????I>?4I???M???F?'???????L???Y?=?yw??smK??????7*N?Qq???5?? ???JP??hCA???*???e5?Q?>Rxx?UePs??t??z???p????????\???|d?d?1?????? ?>?.?????1??]?Z?H,Y7?_?{??u??[??????>??u9?????????-??N?)???????u????PX????? ?":?????Hg??????TM??Lu;???|r?$????'?o?L4K*?????}m.????????Lg`?5T??X?f` +?????????@\3 ??+?6??=[?G????X|??,?}?????!???`?  w?A8??} ?endstream endobj 44 0 obj << /Type /Font @@ -718,14 +709,14 @@ /FirstChar 46 /LastChar 121 /Widths 114 0 R -/BaseFont /LQSFAO+CMBX10 +/BaseFont /WPGRJB+CMBX10 /FontDescriptor 42 0 R >> endobj 42 0 obj << /Ascent 694 /CapHeight 686 /Descent -194 -/FontName /LQSFAO+CMBX10 +/FontName /WPGRJB+CMBX10 /ItalicAngle 0 /StemV 114 /XHeight 444 @@ -751,7 +742,7 @@ stream x???y???~q?????]e5?I`#???{??T?%????Y?>?{???'?h??-r?~`Bl??4??6i??[??6??F~??k?S?yw???????r??9??);A??{??J3?RU??q?q?P???Gz?? @@ -766,7 +757,7 @@ ?=,2?iM3??.?x;?ja\?zCmn?z????Q??Sw?q??\S?Q?????|?Q?v?????Z???I?????u?Nv??? ???4E??D??????????+?rj?`N?A??{?????G?????1;?I????Hc?? {?O]=O?O{??Ib'w??j??k???C?Ax??:;?????<2?"?????,?/??B3? .???6?#?V?8?V???8"??????-???e&(? .CgMQQub?(???W}?Z?R~??"[????K????6d?F\3?????AE??A??6?E/???ZJ??K???S??1?&?Ve?=??P?io at BV???X5^??#LR?qn?????????ll??=??Y?U???`]rr?\?t??????[z?y? ???$?L;?l? ?TWi>b?8????q???EcA?i??O??FW  %??Fe_?M?O5?n??????+??3?Z?~(?????J????????T?u?>K;0,???mf??P?z?P?{L.M??c???Bk????9v???RK?u?mV?????8???w??=?'?o?M???K??,/? ?WC@?h??_/|??e??TNN?n?y????,m??|???f"?,%??v??????P??H?????f??V? ?bw?&??????3????????????& ?fC[}??????gh?????<?????p?????kB???5A?????f; ???2$b[i]{??%yL?yHd_??Rc????3)?P]N?????`?????????????\) ???\?6???*WJ??y???v??E(!n6??b @`???oQ??>?????!?( -??????? W???endstream +??????? &???endstream endobj 41 0 obj << /Type /Font @@ -775,14 +766,14 @@ /FirstChar 46 /LastChar 121 /Widths 116 0 R -/BaseFont /IJZGFK+CMR17 +/BaseFont /AGUAVN+CMR17 /FontDescriptor 39 0 R >> endobj 39 0 obj << /Ascent 694 /CapHeight 683 /Descent -195 -/FontName /IJZGFK+CMR17 +/FontName /AGUAVN+CMR17 /ItalicAngle 0 /StemV 53 /XHeight 430 @@ -876,7 +867,7 @@ >> endobj 122 0 obj << /Author(Bill Spotz)/Title(Testing the numpy.i Typemaps)/Subject()/Creator(LaTeX with hyperref package)/Producer(pdfeTeX-1.21a)/Keywords() -/CreationDate (D:20070913152306-06'00') +/CreationDate (D:20071120065848-07'00') /PTEX.Fullbanner (This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4) kpathsea version 3.5.6) >> endobj xref @@ -888,31 +879,31 @@ 0000000000 00000 f 0000000009 00000 n 0000004918 00000 n -0000068530 00000 n +0000068781 00000 n 0000000055 00000 n 0000000081 00000 n 0000005100 00000 n -0000068444 00000 n +0000068695 00000 n 0000000131 00000 n 0000000162 00000 n 0000005283 00000 n -0000068356 00000 n +0000068607 00000 n 0000000221 00000 n 0000000260 00000 n 0000009560 00000 n -0000068268 00000 n +0000068519 00000 n 0000000319 00000 n 0000000358 00000 n 0000009743 00000 n -0000068180 00000 n +0000068431 00000 n 0000000417 00000 n 0000000456 00000 n 0000009926 00000 n -0000068092 00000 n +0000068343 00000 n 0000000523 00000 n 0000000570 00000 n -0000015242 00000 n -0000068017 00000 n +0000015244 00000 n +0000068268 00000 n 0000000631 00000 n 0000000672 00000 n 0000003039 00000 n @@ -920,15 +911,15 @@ 0000000722 00000 n 0000004735 00000 n 0000004796 00000 n -0000067208 00000 n -0000063111 00000 n -0000067049 00000 n -0000062361 00000 n -0000056544 00000 n -0000062201 00000 n -0000055258 00000 n -0000042506 00000 n -0000055099 00000 n +0000067459 00000 n +0000063362 00000 n +0000067300 00000 n +0000062612 00000 n +0000056797 00000 n +0000062452 00000 n +0000055511 00000 n +0000042759 00000 n +0000055352 00000 n 0000004857 00000 n 0000004978 00000 n 0000003232 00000 n @@ -938,23 +929,23 @@ 0000003884 00000 n 0000004057 00000 n 0000005039 00000 n -0000041807 00000 n -0000035964 00000 n -0000041647 00000 n +0000042060 00000 n +0000036216 00000 n +0000041900 00000 n 0000005161 00000 n -0000034753 00000 n -0000024858 00000 n -0000034593 00000 n +0000035005 00000 n +0000025110 00000 n +0000034845 00000 n 0000004223 00000 n 0000004393 00000 n 0000004563 00000 n 0000005222 00000 n 0000005344 00000 n -0000067870 00000 n +0000068121 00000 n 0000009499 00000 n 0000009682 00000 n 0000009865 00000 n -0000015181 00000 n +0000015183 00000 n 0000009987 00000 n 0000008777 00000 n 0000005522 00000 n @@ -963,54 +954,54 @@ 0000009096 00000 n 0000009267 00000 n 0000009621 00000 n -0000024540 00000 n -0000023153 00000 n -0000024381 00000 n +0000024792 00000 n +0000023405 00000 n +0000024633 00000 n 0000009804 00000 n -0000015364 00000 n -0000013474 00000 n +0000015366 00000 n +0000013476 00000 n 0000010092 00000 n -0000015059 00000 n -0000015120 00000 n -0000013662 00000 n -0000013832 00000 n -0000014003 00000 n -0000014173 00000 n -0000014343 00000 n -0000014513 00000 n -0000015303 00000 n -0000022288 00000 n -0000015482 00000 n -0000022129 00000 n -0000014683 00000 n -0000014867 00000 n -0000022814 00000 n -0000022576 00000 n -0000024771 00000 n -0000024747 00000 n -0000035434 00000 n -0000035136 00000 n -0000042237 00000 n -0000042056 00000 n -0000056034 00000 n -0000055669 00000 n -0000062818 00000 n -0000062604 00000 n -0000067633 00000 n -0000067433 00000 n -0000067943 00000 n -0000068602 00000 n -0000069309 00000 n -0000069348 00000 n -0000069386 00000 n -0000069514 00000 n +0000015061 00000 n +0000015122 00000 n +0000013664 00000 n +0000013834 00000 n +0000014005 00000 n +0000014175 00000 n +0000014345 00000 n +0000014515 00000 n +0000015305 00000 n +0000022512 00000 n +0000015484 00000 n +0000022353 00000 n +0000014685 00000 n +0000014869 00000 n +0000023046 00000 n +0000022806 00000 n +0000025023 00000 n +0000024999 00000 n +0000035686 00000 n +0000035388 00000 n +0000042490 00000 n +0000042309 00000 n +0000056287 00000 n +0000055922 00000 n +0000063069 00000 n +0000062855 00000 n +0000067884 00000 n +0000067684 00000 n +0000068194 00000 n +0000068853 00000 n +0000069560 00000 n +0000069599 00000 n +0000069637 00000 n +0000069765 00000 n trailer << /Size 123 /Root 121 0 R /Info 122 0 R -/ID [ ] +/ID [<22CAB95FA618956618AF61D3E6E41861> <22CAB95FA618956618AF61D3E6E41861>] >> startxref -69815 +70066 %%EOF From numpy-svn at scipy.org Tue Nov 20 09:27:51 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 20 Nov 2007 08:27:51 -0600 (CST) Subject: [Numpy-svn] r4477 - trunk/numpy/lib Message-ID: <20071120142751.9F9CC39C0CC@new.scipy.org> Author: rc Date: 2007-11-20 08:26:44 -0600 (Tue, 20 Nov 2007) New Revision: 4477 Modified: trunk/numpy/lib/arraysetops.py Log: Edited module docstring. Modified: trunk/numpy/lib/arraysetops.py =================================================================== --- trunk/numpy/lib/arraysetops.py 2007-11-20 13:58:47 UTC (rev 4476) +++ trunk/numpy/lib/arraysetops.py 2007-11-20 14:26:44 UTC (rev 4477) @@ -1,7 +1,7 @@ """ Set operations for 1D numeric arrays based on sorting. -Contains: +:Contains: ediff1d, unique1d, intersect1d, @@ -11,6 +11,8 @@ union1d, setdiff1d +:Notes: + All functions work best with integer numerical arrays on input (e.g. indices). For floating point arrays, innacurate results may appear due to usual round-off and floating point comparison issues. @@ -25,10 +27,10 @@ To do: Optionally return indices analogously to unique1d for all functions. -Author: Robert Cimrman - created: 01.11.2005 last revision: 07.01.2007 + +:Author: Robert Cimrman """ __all__ = ['ediff1d', 'unique1d', 'intersect1d', 'intersect1d_nu', 'setxor1d', 'setmember1d', 'union1d', 'setdiff1d'] From numpy-svn at scipy.org Wed Nov 21 00:20:22 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 20 Nov 2007 23:20:22 -0600 (CST) Subject: [Numpy-svn] r4478 - branches/numpy.scons/numpy/distutils/scons/core Message-ID: <20071121052022.27C1539C05D@new.scipy.org> Author: cdavid Date: 2007-11-20 23:20:17 -0600 (Tue, 20 Nov 2007) New Revision: 4478 Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py Log: Adding -fPIC for shared object fortran code Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-20 14:26:44 UTC (rev 4477) +++ branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-21 05:20:17 UTC (rev 4478) @@ -115,7 +115,8 @@ def GetNumpyEnvironment(args): env = _GetNumpyEnvironment(args) - env.AppendUnique(CFLAGS = env['NUMPY_WARN_CFLAGS'] + env['NUMPY_OPTIM_CFLAGS'] +\ + env.AppendUnique(CFLAGS = env['NUMPY_WARN_CFLAGS'] +\ + env['NUMPY_OPTIM_CFLAGS'] +\ env['NUMPY_DEBUG_SYMBOL_CFLAGS'] +\ env['NUMPY_EXTRA_CFLAGS'] +\ env['NUMPY_THREAD_CFLAGS']) @@ -123,9 +124,6 @@ return env def initialize_cc(env, path_list): - # XXX: how to handle tools which are not in standard location ? Is adding - # the full path of the compiler enough ? (I am sure some compilers also - # need LD_LIBRARY_SHARED and other variables to be set, too....) from SCons.Tool import Tool, FindTool if len(env['cc_opt']) > 0: @@ -186,7 +184,9 @@ env['F77'] = env['_FORTRAND'] if is_f77_gnu(env['F77']): - env.AppendUnique(SHF77FLAGS = '-fno-second-underscore') + # XXX: this has nothing to do here ! + env.AppendUnique(SHF77FLAGS = ['-fno-second-underscore']) + env.AppendUnique(SHF77FLAGS = ['-fPIC']) def _GetNumpyEnvironment(args): """Call this with args = ARGUMENTS.""" @@ -263,17 +263,11 @@ # t = Tool('npyctpl', # toolpath = [os.path.dirname(numpy.distutils.scons.tools.__file__)]) - # try: - # t(env) - # except Exception, e: - # pass + # t(env) # t = Tool('npyftpl', # toolpath = [os.path.dirname(numpy.distutils.scons.tools.__file__)]) - # try: - # t(env) - # except Exception, e: - # pass + # t(env) finalize_env(env) From numpy-svn at scipy.org Wed Nov 21 00:25:26 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 20 Nov 2007 23:25:26 -0600 (CST) Subject: [Numpy-svn] r4479 - branches/numpy.scons/numpy/distutils/scons/core Message-ID: <20071121052526.E551039C170@new.scipy.org> Author: cdavid Date: 2007-11-20 23:25:06 -0600 (Tue, 20 Nov 2007) New Revision: 4479 Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py Log: Fix indentation in distutils.scons Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-21 05:20:17 UTC (rev 4478) +++ branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-21 05:25:06 UTC (rev 4479) @@ -50,21 +50,21 @@ return suncc.search(cnt) def is_f77_gnu(fullpath): - # XXX + # XXX: do this properly return pbasename(fullpath) == 'g77' or pbasename(fullpath) == 'gfortran' def get_vs_version(env): try: - version = env['MSVS']['VERSION'] - m = re.compile("([0-9]).([0-9])").match(version) - if m: - major = int(m.group(1)) - minor = int(m.group(2)) - return (major, minor) - else: - raise RuntimeError("FIXME: failed to parse VS version") + version = env['MSVS']['VERSION'] + m = re.compile("([0-9]).([0-9])").match(version) + if m: + major = int(m.group(1)) + minor = int(m.group(2)) + return (major, minor) + else: + raise RuntimeError("FIXME: failed to parse VS version") except KeyError: - raise RuntimeError("Could not get VS version !") + raise RuntimeError("Could not get VS version !") def GetNumpyOptions(args): """Call this with args=ARGUMENTS to take into account command line args.""" From numpy-svn at scipy.org Wed Nov 21 00:32:04 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Tue, 20 Nov 2007 23:32:04 -0600 (CST) Subject: [Numpy-svn] r4480 - branches/numpy.scons/numpy/distutils/scons/core Message-ID: <20071121053204.3444D39C05D@new.scipy.org> Author: cdavid Date: 2007-11-20 23:31:50 -0600 (Tue, 20 Nov 2007) New Revision: 4480 Modified: branches/numpy.scons/numpy/distutils/scons/core/default.py Log: More indent fix in distutils.scons Modified: branches/numpy.scons/numpy/distutils/scons/core/default.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/default.py 2007-11-21 05:25:06 UTC (rev 4479) +++ branches/numpy.scons/numpy/distutils/scons/core/default.py 2007-11-21 05:31:50 UTC (rev 4480) @@ -113,11 +113,11 @@ def get_flags_dict(self): d = {'NUMPY_OPTIM_CFLAGS' : self.optim, 'NUMPY_OPTIM_LDFLAGS' : self.link_optim, - 'NUMPY_WARN_CFLAGS' : self.warn, - 'NUMPY_THREAD_CFLAGS' : self.thread, - 'NUMPY_EXTRA_CFLAGS' : self.debug, - 'NUMPY_DEBUG_CFLAGS' : self.debug, - 'NUMPY_DEBUG_SYMBOL_CFLAGS' : self.debug_symbol} + 'NUMPY_WARN_CFLAGS' : self.warn, + 'NUMPY_THREAD_CFLAGS' : self.thread, + 'NUMPY_EXTRA_CFLAGS' : self.debug, + 'NUMPY_DEBUG_CFLAGS' : self.debug, + 'NUMPY_DEBUG_SYMBOL_CFLAGS' : self.debug_symbol} for k, v in d.items(): if v is None: d[k] = [] @@ -178,14 +178,14 @@ cfg = CompilerConfig(optim = ['-O2', '-fno-strict-aliasing'], warn = ['-Wall', '-Wstrict-prototypes']) elif name == 'suncc': - # -xtarget and co (-xarch, etc...) should be put in link_optim and - # optim for optimal performances. If you do not need the package to be - # redistributable, using -xtarget=native is a good choice. See man cc - # for more info. - # XXX: detect this automatically ? + # -xtarget and co (-xarch, etc...) should be put in link_optim and + # optim for optimal performances. If you do not need the package to be + # redistributable, using -xtarget=native is a good choice. See man cc + # for more info. + # XXX: detect this automatically ? cfg = CompilerConfig(optim = ['-fast'], - debug_symbol = ['-g'], - link_optim = []) + debug_symbol = ['-g'], + link_optim = []) else: # For not yet supported compiler, just put everything in optims from # distutils From numpy-svn at scipy.org Wed Nov 21 01:22:46 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 21 Nov 2007 00:22:46 -0600 (CST) Subject: [Numpy-svn] r4481 - trunk/numpy/distutils Message-ID: <20071121062246.95FE739C170@new.scipy.org> Author: jarrod.millman Date: 2007-11-21 00:22:43 -0600 (Wed, 21 Nov 2007) New Revision: 4481 Modified: trunk/numpy/distutils/ccompiler.py Log: removed split_quoted as per #619 Modified: trunk/numpy/distutils/ccompiler.py =================================================================== --- trunk/numpy/distutils/ccompiler.py 2007-11-21 05:31:50 UTC (rev 4480) +++ trunk/numpy/distutils/ccompiler.py 2007-11-21 06:22:43 UTC (rev 4481) @@ -399,63 +399,5 @@ return _distutils_gen_preprocess_options(macros, include_dirs) ccompiler.gen_preprocess_options = gen_preprocess_options -##Fix distutils.util.split_quoted: -import re -import string -_wordchars_re = re.compile(r'[^\\\'\"%s ]*' % string.whitespace) -_squote_re = re.compile(r"'(?:[^'\\]|\\.)*'") -_dquote_re = re.compile(r'"(?:[^"\\]|\\.)*"') -_has_white_re = re.compile(r'\s') -def split_quoted(s): - s = string.strip(s) - words = [] - pos = 0 - - while s: - m = _wordchars_re.match(s, pos) - end = m.end() - if end == len(s): - words.append(s[:end]) - break - - if s[end] in string.whitespace: # unescaped, unquoted whitespace: now - words.append(s[:end]) # we definitely have a word delimiter - s = string.lstrip(s[end:]) - pos = 0 - - elif s[end] == '\\': # preserve whatever is being escaped; - # will become part of the current word - s = s[:end] + s[end+1:] - pos = end+1 - - else: - if s[end] == "'": # slurp singly-quoted string - m = _squote_re.match(s, end) - elif s[end] == '"': # slurp doubly-quoted string - m = _dquote_re.match(s, end) - else: - raise RuntimeError, \ - "this can't happen (bad char '%c')" % s[end] - - if m is None: - raise ValueError, \ - "bad string (mismatched %s quotes?)" % s[end] - - (beg, end) = m.span() - if _has_white_re.search(s[beg+1:end-1]): - s = s[:beg] + s[beg+1:end-1] + s[end:] - pos = m.end() - 2 - else: - # Keeping quotes when a quoted word does not contain - # white-space. XXX: send a patch to distutils - pos = m.end() - - if pos >= len(s): - words.append(s) - break - - return words -ccompiler.split_quoted = split_quoted - # define DISTUTILS_USE_SDK when necessary to workaround distutils/msvccompiler.py bug msvc_on_amd64() From numpy-svn at scipy.org Wed Nov 21 05:29:58 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 21 Nov 2007 04:29:58 -0600 (CST) Subject: [Numpy-svn] r4482 - branches/numpy.scons/numpy/distutils/scons/core Message-ID: <20071121102958.65F4CC7C031@new.scipy.org> Author: cdavid Date: 2007-11-21 04:29:54 -0600 (Wed, 21 Nov 2007) New Revision: 4482 Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py Log: Add a StaticExtLibrary builder, to build static libraries usable in python extensions (e.g. use SharedObject builders, but build .a) Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-21 06:22:43 UTC (rev 4481) +++ branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-21 10:29:54 UTC (rev 4482) @@ -337,6 +337,8 @@ env['BUILDERS']['NumpyFromCTemplate'] = NumpyFromCTemplate env['BUILDERS']['NumpyFromFTemplate'] = NumpyFromFTemplate + createStaticExtLibBuilder(env) + # Setting build directory according to command line option if len(env['src_dir']) > 0: BuildDir(env['build_dir'], env['src_dir']) @@ -356,3 +358,27 @@ get_scons_configres_filename()) return env + +def createStaticExtLibBuilder(env): + """This is a utility function that creates the StaticExtLibrary Builder in + an Environment if it is not there already. + + If it is already there, we return the existing one.""" + + try: + static_extlib = env['BUILDERS']['StaticExtLibrary'] + except KeyError: + action_list = [ SCons.Action.Action("$ARCOM", "$ARCOMSTR") ] + if env.Detect('ranlib'): + ranlib_action = SCons.Action.Action("$RANLIBCOM", "$RANLIBCOMSTR") + action_list.append(ranlib_action) + + static_extlib = SCons.Builder.Builder(action = action_list, + emitter = '$LIBEMITTER', + prefix = '$LIBPREFIX', + suffix = '$LIBSUFFIX', + src_suffix = '$OBJSUFFIX', + src_builder = 'SharedObject') + + env['BUILDERS']['StaticExtLibrary'] = static_extlib + return static_extlib From numpy-svn at scipy.org Wed Nov 21 06:31:28 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 21 Nov 2007 05:31:28 -0600 (CST) Subject: [Numpy-svn] r4483 - branches/numpy.scons/numpy/distutils/scons/core Message-ID: <20071121113128.8EDDA39C170@new.scipy.org> Author: cdavid Date: 2007-11-21 05:31:17 -0600 (Wed, 21 Nov 2007) New Revision: 4483 Modified: branches/numpy.scons/numpy/distutils/scons/core/custom_builders.py branches/numpy.scons/numpy/distutils/scons/core/default.py branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py Log: Handle keyword args in PythonExtension builder Modified: branches/numpy.scons/numpy/distutils/scons/core/custom_builders.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/custom_builders.py 2007-11-21 10:29:54 UTC (rev 4482) +++ branches/numpy.scons/numpy/distutils/scons/core/custom_builders.py 2007-11-21 11:31:17 UTC (rev 4483) @@ -28,7 +28,18 @@ inst_lib = env.Install("$distutils_installdir", lib) return lib, inst_lib +def NumpyStaticExtLibrary(env, target, source, *args, **kw): + """This builder is the same than StaticExtLibrary, except for the fact that it + takes into account build dir info passed by distutils, and put the target at + the right location in distutils build directory for correct installation.""" + newsource = [pjoin(env['build_dir'], i) for i in source] + # XXX: why target is a list ? It is always true ? + lib = env.StaticExtLibrary("$build_dir/%s" % target[0], newsource, *args, **kw) + + inst_lib = env.Install("$distutils_installdir", lib) + return lib, inst_lib + def NumpyCtypes(env, target, source, *args, **kw): """This builder is essentially the same than SharedLibrary, but should be used for libraries which will only be used through ctypes. Modified: branches/numpy.scons/numpy/distutils/scons/core/default.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/default.py 2007-11-21 10:29:54 UTC (rev 4482) +++ branches/numpy.scons/numpy/distutils/scons/core/default.py 2007-11-21 11:31:17 UTC (rev 4483) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Thu Nov 08 06:00 PM 2007 J +# Last Change: Tue Nov 20 07:00 PM 2007 J import sys import distutils.sysconfig @@ -193,3 +193,10 @@ distutils.sysconfig.get_config_vars('CFLAGS')) return cfg + +import numpy.distutils.fcompiler as _FC + +def get_f77_config(name): + # name is the scons name for the tool + if name == 'g77': + cfg = CompilerConfig(optim = ['-O2']) Modified: branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py 2007-11-21 10:29:54 UTC (rev 4482) +++ branches/numpy.scons/numpy/distutils/scons/core/extension_scons.py 2007-11-21 11:31:17 UTC (rev 4483) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Thu Nov 15 07:00 PM 2007 J +# Last Change: Wed Nov 21 08:00 PM 2007 J # Module for support to build python extension. scons specific code goes here. import sys @@ -40,49 +40,44 @@ def PythonExtension(env, target, source, *args, **kw): - # XXX Check args and kw # XXX: Some things should not be set here... Actually, this whole # thing is a mess. - if env.has_key('LINKFLAGS'): - LINKFLAGS = deepcopy(env['LINKFLAGS']) - else: - LINKFLAGS = [] - if env.has_key('CPPPATH'): - CPPPATH = deepcopy(env['CPPPATH']) - else: - CPPPATH = [] + def floupi(key): + if env.has_key(key): + narg = deepcopy(env[key]) + else: + narg = [] - if env.has_key('LIBPATH'): - LIBPATH = deepcopy(env['LIBPATH']) - else: - LIBPATH = [] + if kw.has_key(key): + narg.append(kw.pop(key)) - if env.has_key('LIBS'): - LIBS = deepcopy(env['LIBS']) - else: - LIBS = [] + return narg + LINKFLAGS = floupi('LINKFLAGS') + CPPPATH = floupi('CPPPATH') + LIBPATH = floupi('LIBPATH') + LIBS = floupi('LIBS') + CPPPATH.append(get_python_inc()) if sys.platform == 'win32': if built_with_mstools(env): # XXX: We add the path where to find python lib (or any other # version, of course). This seems to be necessary for MS compilers. #env.AppendUnique(LIBPATH = get_pythonlib_dir()) - LIBPATH.append(get_pythonlib_dir()) + LIBPATH.append(get_pythonlib_dir()) elif built_with_mingw(env): - # XXX: this part should be moved elsewhere (mingw abstraction - # for python) + # XXX: this part should be moved elsewhere (mingw abstraction + # for python) - # This is copied from mingw32ccompiler.py in numpy.distutils - # (not supported by distutils.) + # This is copied from mingw32ccompiler.py in numpy.distutils + # (not supported by distutils.) - # Include the appropiate MSVC runtime library if Python was - # built with MSVC >= 7.0 (MinGW standard is msvcrt) + # Include the appropiate MSVC runtime library if Python was + # built with MSVC >= 7.0 (MinGW standard is msvcrt) py_runtime_library = msvc_runtime_library() - LIBPATH.append(get_pythonlib_dir()) - LIBS.extend([get_pythonlib_name(), py_runtime_library]) - + LIBPATH.append(get_pythonlib_dir()) + LIBS.extend([get_pythonlib_name(), py_runtime_library]) elif sys.platform == "darwin": # XXX: When those should be used ? (which version of Mac OS X ?) LINKFLAGS += ' -undefined dynamic_lookup ' @@ -99,8 +94,7 @@ LINKFLAGS = LINKFLAGS, LIBS = LIBS, LIBPATH = LIBPATH, - CPPPATH = CPPPATH, - *args, **kw) + CPPPATH = CPPPATH, *args, **kw) else: wrap = env.LoadableModule(target, source, SHLIBPREFIX = '', LDMODULESUFFIX = '$PYEXTSUFFIX', Modified: branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-21 10:29:54 UTC (rev 4482) +++ branches/numpy.scons/numpy/distutils/scons/core/numpyenv.py 2007-11-21 11:31:17 UTC (rev 4483) @@ -10,7 +10,8 @@ get_scons_configres_filename from default import tool_list, get_cc_config -from custom_builders import NumpySharedLibrary, NumpyCtypes, NumpyPythonExtension +from custom_builders import NumpySharedLibrary, NumpyCtypes, \ + NumpyPythonExtension, NumpyStaticExtLibrary from libinfo import get_config from extension_scons import PythonExtension, built_with_mstools from utils import pkg_to_path @@ -337,7 +338,8 @@ env['BUILDERS']['NumpyFromCTemplate'] = NumpyFromCTemplate env['BUILDERS']['NumpyFromFTemplate'] = NumpyFromFTemplate - createStaticExtLibBuilder(env) + createStaticExtLibraryBuilder(env) + env['BUILDERS']['NumpyStaticExtLibrary'] = NumpyStaticExtLibrary # Setting build directory according to command line option if len(env['src_dir']) > 0: @@ -359,11 +361,12 @@ return env -def createStaticExtLibBuilder(env): +def createStaticExtLibraryBuilder(env): """This is a utility function that creates the StaticExtLibrary Builder in an Environment if it is not there already. If it is already there, we return the existing one.""" + import SCons.Action try: static_extlib = env['BUILDERS']['StaticExtLibrary'] From numpy-svn at scipy.org Wed Nov 21 22:19:07 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 21 Nov 2007 21:19:07 -0600 (CST) Subject: [Numpy-svn] r4484 - branches/numpy.scons/numpy/distutils/scons/tools Message-ID: <20071122031907.77AD039C27E@new.scipy.org> Author: cdavid Date: 2007-11-21 21:19:02 -0600 (Wed, 21 Nov 2007) New Revision: 4484 Modified: branches/numpy.scons/numpy/distutils/scons/tools/f2py.py Log: Change F2PY builder to F2py to stay consistent with scons convention Modified: branches/numpy.scons/numpy/distutils/scons/tools/f2py.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/tools/f2py.py 2007-11-21 11:31:17 UTC (rev 4483) +++ branches/numpy.scons/numpy/distutils/scons/tools/f2py.py 2007-11-22 03:19:02 UTC (rev 4484) @@ -45,8 +45,6 @@ return os.path.splitext(source_file)[1] == '.pyf' def _pyf2c(target, source, env): - from SCons.Script import Touch - from threading import Lock import numpy.f2py import shutil @@ -118,7 +116,7 @@ scanner = SCons.Scanner.ClassicCPP("F2PYScan", ".pyf", "F2PYPATH", expr) env.Append(SCANNERS = scanner) - env['BUILDERS']['F2PY'] = SCons.Builder.Builder(action = _pyf2c, + env['BUILDERS']['F2py'] = SCons.Builder.Builder(action = _pyf2c, emitter = _f2pyEmitter, suffix = _f2pySuffixEmitter) From numpy-svn at scipy.org Wed Nov 21 22:24:19 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 21 Nov 2007 21:24:19 -0600 (CST) Subject: [Numpy-svn] r4485 - trunk Message-ID: <20071122032419.0242F39C27E@new.scipy.org> Author: cdavid Date: 2007-11-21 21:24:16 -0600 (Wed, 21 Nov 2007) New Revision: 4485 Modified: trunk/ Log: Initialized merge tracking via "svnmerge" with revisions "1-4484" from http://svn.scipy.org/svn/numpy/branches/numpy.scons Property changes on: trunk ___________________________________________________________________ Name: svnmerge-integrated - /branches/distutils-revamp:1-2752 /branches/multicore:1-3687 /trunk:1-2871 + /branches/distutils-revamp:1-2752 /branches/multicore:1-3687 /branches/numpy.scons:1-4484 /trunk:1-2871 From numpy-svn at scipy.org Wed Nov 21 22:40:19 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 21 Nov 2007 21:40:19 -0600 (CST) Subject: [Numpy-svn] r4486 - branches/numpy.scons Message-ID: <20071122034019.3A05339C0A6@new.scipy.org> Author: cdavid Date: 2007-11-21 21:40:16 -0600 (Wed, 21 Nov 2007) New Revision: 4486 Modified: branches/numpy.scons/ Log: Initialized merge tracking via "svnmerge" with revisions "1-4485" from http://svn.scipy.org/svn/numpy/trunk Property changes on: branches/numpy.scons ___________________________________________________________________ Name: svnmerge-integrated - /branches/distutils-revamp:1-2752 /branches/multicore:1-3687 /trunk:1-2871 + /branches/distutils-revamp:1-2752 /branches/multicore:1-3687 /trunk:1-4485 From numpy-svn at scipy.org Wed Nov 21 23:55:49 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 21 Nov 2007 22:55:49 -0600 (CST) Subject: [Numpy-svn] r4487 - branches/numpy.scons/numpy/distutils/scons Message-ID: <20071122045549.1893939C076@new.scipy.org> Author: cdavid Date: 2007-11-21 22:55:44 -0600 (Wed, 21 Nov 2007) New Revision: 4487 Modified: branches/numpy.scons/numpy/distutils/scons/configuration.py Log: Avoid 'stringifying' configres for NUMPY_PKG_CONFIG from the beginning Modified: branches/numpy.scons/numpy/distutils/scons/configuration.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/configuration.py 2007-11-22 03:40:16 UTC (rev 4486) +++ branches/numpy.scons/numpy/distutils/scons/configuration.py 2007-11-22 04:55:44 UTC (rev 4487) @@ -1,15 +1,19 @@ #! /usr/bin/env python -# Last Change: Thu Nov 01 06:00 PM 2007 J +# Last Change: Thu Nov 22 12:00 PM 2007 J import os def add_info(env, name, opt): cfg = env['NUMPY_PKG_CONFIG'] - cfg[name] = str(opt) + cfg[name] = opt def write_info(env): dir = os.path.dirname(env['NUMPY_PKG_CONFIG_FILE']) if not os.path.exists(dir): os.makedirs(dir) + cfg = env['NUMPY_PKG_CONFIG'] + config_str = {} + for k, i in cfg.items(): + config_str[k] = str(i) f = open(env['NUMPY_PKG_CONFIG_FILE'], 'w') - f.writelines("config = %s" % str(env['NUMPY_PKG_CONFIG'])) + f.writelines("config = %s" % str(config_str)) f.close() From numpy-svn at scipy.org Wed Nov 21 23:59:23 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Wed, 21 Nov 2007 22:59:23 -0600 (CST) Subject: [Numpy-svn] r4488 - branches/numpy.scons/numpy/distutils/scons/checkers Message-ID: <20071122045923.2AAB139C076@new.scipy.org> Author: cdavid Date: 2007-11-21 22:59:19 -0600 (Wed, 21 Nov 2007) New Revision: 4488 Modified: branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py Log: fix indentation in perflib.py Modified: branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-11-22 04:55:44 UTC (rev 4487) +++ branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-11-22 04:59:19 UTC (rev 4488) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Tue Nov 06 06:00 PM 2007 J +# Last Change: Thu Nov 22 01:00 PM 2007 J # This module defines checkers for performances libs providing standard API, # such as MKL (Intel), ATLAS, Sunperf (solaris and linux), Accelerate (Mac OS @@ -244,7 +244,8 @@ check_version, None, autoadd) if not st: - return st, res + return st, res + # We are not done: the option -xlic_lib=sunperf is not used by the linked # for shared libraries, I have no idea why. So if the test is succesfull, # we need more work to get the link options necessary to make the damn @@ -261,7 +262,7 @@ restore(env, saved) if not res: - return context.Result('Failed !'), res + return context.Result('Failed !'), res saved = save_and_set(env, opts) env.Append(LINKFLAGS = '-#') From numpy-svn at scipy.org Thu Nov 22 03:34:13 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 22 Nov 2007 02:34:13 -0600 (CST) Subject: [Numpy-svn] r4489 - in branches/numpy.scons/numpy/distutils/scons: . checkers Message-ID: <20071122083413.B576F39C048@new.scipy.org> Author: cdavid Date: 2007-11-22 02:34:00 -0600 (Thu, 22 Nov 2007) New Revision: 4489 Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py branches/numpy.scons/numpy/distutils/scons/checkers/__init__.py branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py Log: Some perflib cleaning Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-11-22 04:59:19 UTC (rev 4488) +++ branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-11-22 08:34:00 UTC (rev 4489) @@ -4,7 +4,9 @@ from core.extension import get_python_inc, get_pythonlib_dir from core.utils import isstring, rsplit -from checkers import CheckCBLAS, CheckCLAPACK, CheckF77BLAS, CheckF77LAPACK +from checkers import CheckCBLAS, CheckCLAPACK, CheckF77BLAS, CheckF77LAPACK, \ + IsMKL, IsATLAS, IsVeclib, IsAccelerate, IsSunperf + from fortran_scons import CheckF77Verbose, CheckF77Clib, CheckF77Mangling # XXX: this is ugly, better find the mathlibs with a checker Modified: branches/numpy.scons/numpy/distutils/scons/checkers/__init__.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/__init__.py 2007-11-22 04:59:19 UTC (rev 4488) +++ branches/numpy.scons/numpy/distutils/scons/checkers/__init__.py 2007-11-22 08:34:00 UTC (rev 4489) @@ -1 +1,2 @@ from custom_checkers import CheckCLAPACK, CheckCBLAS, CheckF77BLAS, CheckF77LAPACK +from perflib import IsMKL, IsATLAS, IsVeclib, IsAccelerate, IsSunperf Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-22 04:59:19 UTC (rev 4488) +++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-22 08:34:00 UTC (rev 4489) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Fri Nov 16 06:00 PM 2007 J +# Last Change: Thu Nov 22 04:00 PM 2007 J # Module for custom, common checkers for numpy (and scipy) import sys @@ -23,15 +23,8 @@ # LAPACK and CLAPACK ? How to test for fortran ? def CheckCBLAS(context, autoadd = 1): - """This checker tries to find optimized library for cblas. - - This test is pretty strong: it first detects an optimized library, and then - tests that a simple cblas program can be run using this lib. - - It looks for the following libs: - - Mac OS X: Accelerate, and then vecLib. - - Others: MKL, then ATLAS, then Sunperf.""" - # XXX: rpath vs LD_LIBRARY_PATH ? + """This checker tries to find optimized library for cblas.""" + libname = 'cblas' env = context.env def check(func, name, suplibs): @@ -42,7 +35,7 @@ st = check_include_and_run(context, 'CBLAS (%s)' % name, res.cfgopts, [], cblas_src, autoadd) if st: - add_info(env, 'cblas', res) + add_info(env, libname, res) return st # If section cblas is in site.cfg, use those options. Otherwise, use default @@ -55,25 +48,17 @@ st = check_include_and_run(context, 'CBLAS (from site.cfg) ', cfg, [], cblas_src, autoadd) if st: - add_info(env, 'cblas', ConfigRes('cblas', cfg, found)) - return st + add_info(env, libname, ConfigRes('Generic CBLAS', cfg, found)) + return st else: if sys.platform == 'darwin': - # Check Accelerate st = check(CheckAccelerate, 'Accelerate Framework', []) if st: return st - st = check(CheckVeclib, 'vecLib Framework', []) if st: return st - - add_info(env, 'cblas', 'Def numpy implementation used') - return 0 - else: - # XXX: think about how to share headers info between checkers ? - # Check MKL st = check(CheckMKL, 'MKL', []) if st: @@ -89,25 +74,20 @@ if st: return st - add_info(env, 'cblas', 'Def numpy implementation used') - return 0 + add_info(env, libname, None) + return 0 def CheckF77BLAS(context, autoadd = 1): - """This checker tries to find optimized library for blas (fortran F77). - - This test is pretty strong: it first detects an optimized library, and then - tests that a simple blas program (in C) can be run using this (F77) lib. - - It looks for the following libs: - - Mac OS X: Accelerate, and then vecLib. - - Others: MKL, then ATLAS, then Sunperf.""" - # XXX: rpath vs LD_LIBRARY_PATH ? + """This checker tries to find optimized library for blas (fortran F77).""" + libname = 'blas' env = context.env # Get Fortran things we need if not env.has_key('F77_NAME_MANGLER'): if not CheckF77Mangling(context): + add_info(env, libname, None) return 0 + func_name = env['F77_NAME_MANGLER']('sgemm') test_src = c_sgemm2 % {'func' : func_name} @@ -119,7 +99,7 @@ st = check_include_and_run(context, 'BLAS (%s)' % name, res.cfgopts, [], test_src, autoadd) if st: - add_info(env, 'blas', res) + add_info(env, libname, res) return st # If section blas is in site.cfg, use those options. Otherwise, use default @@ -132,8 +112,8 @@ st = check_include_and_run(context, 'BLAS (from site.cfg) ', cfg, [], test_src, autoadd) if st: - add_info(env, 'blas', ConfigRes('blas', cfg, found)) - return st + add_info(env, libname, ConfigRes('Generic BLAS', cfg, found)) + return st else: if sys.platform == 'darwin': # Check Accelerate @@ -160,8 +140,7 @@ if st: return st - # XXX: Use default values for blas - + add_info(env, libname, None) return 0 def CheckF77LAPACK(context, autoadd = 1): @@ -173,11 +152,12 @@ It looks for the following libs: - Mac OS X: Accelerate, and then vecLib. - Others: MKL, then ATLAS.""" + libname = 'lapack' env = context.env if not env.has_key('F77_NAME_MANGLER'): if not CheckF77Mangling(context): - add_info(env, 'lapack', 'Def numpy implementation used') + add_info(env, 'lapack', None) return 0 # Get the mangled name of our test function @@ -185,6 +165,8 @@ test_src = lapack_sgesv % sgesv_string def check(func, name, suplibs): + # func is the perflib checker, name the printed name for the check, and + # suplibs a list of libraries to link in addition. st, res = func(context, autoadd) if st: for lib in suplibs: @@ -192,7 +174,7 @@ st = check_include_and_run(context, 'LAPACK (%s)' % name, res.cfgopts, [], test_src, autoadd) if st: - add_info(env, 'lapack', res) + add_info(env, libname, res) return st # If section lapack is in site.cfg, use those options. Otherwise, use default @@ -213,8 +195,8 @@ st = check_include_and_run(context, 'LAPACK (from site.cfg) ', fortrancfg, [], test_src, autoadd) if st: - add_info(env, 'lapack', ConfigRes('lapack', cfg, found)) - return st + add_info(env, libname, ConfigRes('Generic LAPACK', cfg, found)) + return st else: if sys.platform == 'darwin': st = check(CheckAccelerate, 'Accelerate Framework', []) @@ -224,9 +206,6 @@ st = check(CheckVeclib, 'vecLib Framework', []) if st: return st - - add_info(env, 'lapack: def numpy implementation', opts) - return 0 else: # Check MKL # XXX: handle different versions of mkl (with different names) @@ -244,7 +223,7 @@ if st: return st - add_info(env, 'lapack', 'Def numpy implementation used') + add_info(env, libname, None) return 0 def CheckCLAPACK(context, autoadd = 1): @@ -259,6 +238,7 @@ context.Message('Checking CLAPACK ...') context.Result('FIXME: not implemented yet') return 0 + libname = 'clapack' env = context.env # If section lapack is in site.cfg, use those options. Otherwise, use default @@ -292,30 +272,30 @@ st = check_include_and_run(context, 'LAPACK (from site.cfg) ', fortrancfg, [], test_src, autoadd) if st: - add_info(env, 'lapack', ConfigRes('lapack', cfg, found)) + add_info(env, libname, ConfigRes('Generic CLAPACK', cfg, found)) return st else: if sys.platform == 'darwin': st, opts = CheckAccelerate(context, autoadd) if st: if st: - add_info(env, 'lapack: Accelerate', opts) + add_info(env, libname, opts) return st st, opts = CheckAccelerate(context, autoadd) if st: if st: - add_info(env, 'lapack: vecLib', opts) + add_info(env, libname, opts) return st else: # Get fortran stuff (See XXX at the top on F77 vs C) if not env.has_key('F77_NAME_MANGLER'): if not CheckF77Mangling(context): - add_info(env, 'lapack', 'Def numpy implementation used') + add_info(env, libname, None) return 0 if not env.has_key('F77_LDFLAGS'): if not CheckF77Clib(context): - add_info(env, 'lapack', 'Def numpy implementation used') + add_info(env, libname, None) return 0 # Get the mangled name of our test function @@ -330,7 +310,7 @@ st = check_include_and_run(context, 'LAPACK (MKL)', res.cfgopts, [], test_src, autoadd) if st: - add_info(env, 'lapack', res) + add_info(env, libname, res) return st # Check ATLAS @@ -340,7 +320,7 @@ st = check_include_and_run(context, 'LAPACK (ATLAS)', res.cfgopts, [], test_src, autoadd) if st: - add_info(env, 'lapack', res) + add_info(env, libname, res) # XXX: Check complete LAPACK or not. (Checking for not # implemented lapack symbols ?) return st @@ -351,8 +331,8 @@ st = check_include_and_run(context, 'LAPACK (Sunperf)', res.cfgopts, [], test_src, autoadd) if st: - add_info(env, 'lapack', res) + add_info(env, libname, res) return st - add_info(env, 'lapack', 'Def numpy implementation used') + add_info(env, libname, None) return 0 Modified: branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-11-22 04:59:19 UTC (rev 4488) +++ branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-11-22 08:34:00 UTC (rev 4489) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Thu Nov 22 01:00 PM 2007 J +# Last Change: Thu Nov 22 05:00 PM 2007 J # This module defines checkers for performances libs providing standard API, # such as MKL (Intel), ATLAS, Sunperf (solaris and linux), Accelerate (Mac OS @@ -20,6 +20,82 @@ from support import check_include_and_run, check_symbol from support import save_and_set, restore, ConfigOpts, ConfigRes +#------------------------------------------- +# Perflib specific configuration and helpers +#------------------------------------------- +class PerflibConfig: + def __init__(self, name, section, defopts, headers, funcs, version_checker = None): + """Initialize the configuration. + + Args: + - name : str + the name of the perflib + - section : str + the name of the section used in site.cfg for customization + - defopts : ConfigOpts + the compilation configuration for the checker + - headers : list + the list of headers to test in the checker + - funcs : list + the list of functions to test in the checker. + - version_checker : callable + optional function to check version of the perflib. Its + arguments should be env and opts, where env is a scons + environment and opts a ConfigOpts instance. It should return an + integer (1 if successfull) and a version string.""" + + self.name = name + self.section = section + self.defopts = defopts + self.headers = headers + self.funcs = funcs + self.version_checker = version_checker + +_CONFIG = { + 'MKL': PerflibConfig('MKL', 'mkl', ConfigOpts(libs = ['mkl', 'guide', 'm']), + ['mkl.h'], ['MKLGetVersion']), + 'ATLAS': PerflibConfig('ATLAS', 'atlas', + ConfigOpts(libs = ['atlas'], + libpath = [pjoin(i, 'atlas') for i in + default_lib_dirs]), + ['atlas_enum.h'], + ['ATL_sgemm']), + 'Accelerate' : PerflibConfig('Framework: Accelerate', 'accelerate', + ConfigOpts(frameworks = ['Accelerate']), + ['Accelerate/Accelerate.h'], + ['cblas_sgemm']), + 'vecLib' : PerflibConfig('Framework: vecLib', 'vecLib', + ConfigOpts(frameworks = ['vecLib']), + ['vecLib/vecLib.h'], + ['cblas_sgemm']), + 'Sunperf' : PerflibConfig('Sunperf', 'sunperf', + ConfigOpts(cflags = ['-dalign'], + linkflags = ['-xlic_lib=sunperf']), + ['sunperf.h'], + ['cblas_sgemm'])} + +class IsFactory: + def __init__(self, name): + """Name should be one key of _CONFIG.""" + try: + _CONFIG[name] + except KeyError, e: + raise RuntimeError("name %s is unknown") + + def f(env, libname): + if env['NUMPY_PKG_CONFIG'][libname] is None: + return 0 == 1 + else: + return env['NUMPY_PKG_CONFIG'][libname].name == \ + _CONFIG[name].name + self.func = f + + def get_func(self): + return self.func + +#------------------------ +# Generic functionalities +#------------------------ def _check(context, name, section, defopts, headers_to_check, funcs_to_check, check_version, version_checker, autoadd, rpath_is_libpath = True): """Generic implementation for perflib check. @@ -103,6 +179,9 @@ return st, cfgres +#-------------- +# MKL checker +#-------------- def _mkl_version_checker(env, opts): version_code = r""" #include @@ -135,6 +214,17 @@ return vst, version +def CheckMKL(context, autoadd = 1, check_version = 0): + cfg = _CONFIG['MKL'] + + return _check(context, cfg.name, cfg.section, cfg.defopts, cfg.headers, + cfg.funcs, check_version, _mkl_version_checker, autoadd) + +IsMKL = IsFactory('MKL').get_func() + +#--------------- +# ATLAS Checker +#--------------- def _atlas_version_checker(env, opts): version_code = """ void ATL_buildinfo(void); @@ -161,29 +251,18 @@ return vst, version -def CheckMKL(context, autoadd = 1, check_version = 0): - name = 'MKL' - section = 'mkl' - defopts = ConfigOpts(libs = ['mkl', 'guide', 'm']) - headers = ['mkl.h'] - funcs = ['MKLGetVersion'] - - return _check(context, name, section, defopts, headers, funcs, - check_version, _mkl_version_checker, autoadd) - def CheckATLAS(context, autoadd = 1, check_version = 0): """Check whether ATLAS is usable in C.""" - name = 'ATLAS' - section = 'atlas' - defopts = ConfigOpts(libs = ['atlas'], - libpath = [pjoin(i, 'atlas') for i in - default_lib_dirs]) - headers = ['atlas_enum.h'] - funcs = ['ATL_sgemm'] - - return _check(context, name, section, defopts, headers, funcs, - check_version, _atlas_version_checker, autoadd) + cfg = _CONFIG['ATLAS'] + return _check(context, cfg.name, cfg.section, cfg.defopts, cfg.headers, + cfg.funcs, check_version, _atlas_version_checker, autoadd) + +IsATLAS = IsFactory('ATLAS').get_func() + +#------------------------------ +# Mac OS X Frameworks checkers +#------------------------------ def CheckAccelerate(context, autoadd = 1, check_version = 0): """Checker for Accelerate framework (on Mac OS X >= 10.3). """ # According to @@ -203,29 +282,25 @@ # is_intel = 0 # cflags.append('-faltivec') - name = 'Framework: Accelerate' - # XXX: does it make sense to customize mac os X frameworks ? - section = 'accelerate' - defopts = ConfigOpts(frameworks = ['Accelerate']) - headers = ['Accelerate/Accelerate.h'] - funcs = ['cblas_sgemm'] - - return _check(context, name, section, defopts, headers, funcs, - check_version, None, autoadd) + cfg = _CONFIG['Accelerate'] + return _check(context, cfg.name, cfg.section, cfg.defopts, cfg.headers, + cfg.funcs, check_version, None, autoadd) + +IsAccelerate = IsFactory('Accelerate').get_func() + def CheckVeclib(context, autoadd = 1, check_version = 0): """Checker for Veclib framework (on Mac OS X < 10.3).""" - name = 'Framework: Accelerate' - # XXX: does it make sense to customize mac os X frameworks ? - section = 'accelerate' - defopts = ConfigOpts(frameworks = ['Accelerate']) - headers = ['vecLib/vecLib.h'] - funcs = ['cblas_sgemm'] - - return _check(context, name, section, defopts, headers, funcs, - check_version, None, autoadd) + cfg = _CONFIG['vecLib'] + return _check(context, cfg.name, cfg.section, cfg.defopts, cfg.headers, + cfg.funcs, check_version, None, autoadd) +IsVeclib = IsFactory('vecLib').get_func() + +#----------------- +# Sunperf checker +#----------------- from os.path import basename, dirname from copy import deepcopy from numpy.distutils.scons.core.utils import popen_wrapper @@ -233,16 +308,10 @@ def CheckSunperf(context, autoadd = 1, check_version = 0): """Checker for sunperf.""" - name = 'Sunperf' - section = 'sunperf' - # XXX: Other options needed ? - defopts = ConfigOpts(cflags = ['-dalign'], linkflags = ['-xlic_lib=sunperf']) - headers = ['sunperf.h'] - funcs = ['cblas_sgemm'] + cfg = _CONFIG['vecLib'] - st, res = _check(context, name, section, defopts, headers, funcs, - check_version, None, autoadd) - + st, res = _check(context, cfg.name, cfg.section, cfg.defopts, cfg.headers, + cfg.funcs, check_version, None, autoadd) if not st: return st, res @@ -342,3 +411,5 @@ t = parse(t) return keep + +IsSunperf = IsFactory('Sunperf').get_func() From numpy-svn at scipy.org Thu Nov 22 07:34:06 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 22 Nov 2007 06:34:06 -0600 (CST) Subject: [Numpy-svn] r4490 - in branches/numpy.scons: . numpy/distutils/scons numpy/distutils/scons/checkers numpy/scons_fake/checkers Message-ID: <20071122123406.6B18939C12B@new.scipy.org> Author: cdavid Date: 2007-11-22 06:33:55 -0600 (Thu, 22 Nov 2007) New Revision: 4490 Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py branches/numpy.scons/numpy/scons_fake/checkers/SConstruct branches/numpy.scons/test.sh Log: More work on perflib version checkers: implement version getters for atlas/mkl Modified: branches/numpy.scons/numpy/distutils/scons/__init__.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-11-22 08:34:00 UTC (rev 4489) +++ branches/numpy.scons/numpy/distutils/scons/__init__.py 2007-11-22 12:33:55 UTC (rev 4490) @@ -6,6 +6,7 @@ from checkers import CheckCBLAS, CheckCLAPACK, CheckF77BLAS, CheckF77LAPACK, \ IsMKL, IsATLAS, IsVeclib, IsAccelerate, IsSunperf +from checkers.perflib import GetATLASVersion, GetMKLVersion from fortran_scons import CheckF77Verbose, CheckF77Clib, CheckF77Mangling Modified: branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-22 08:34:00 UTC (rev 4489) +++ branches/numpy.scons/numpy/distutils/scons/checkers/custom_checkers.py 2007-11-22 12:33:55 UTC (rev 4490) @@ -1,5 +1,5 @@ #! /usr/bin/env python -# Last Change: Thu Nov 22 04:00 PM 2007 J +# Last Change: Thu Nov 22 05:00 PM 2007 J # Module for custom, common checkers for numpy (and scipy) import sys @@ -22,13 +22,13 @@ # exception for LAPACK). So shall we make the difference between BLAS, CBLAS, # LAPACK and CLAPACK ? How to test for fortran ? -def CheckCBLAS(context, autoadd = 1): +def CheckCBLAS(context, autoadd = 1, check_version = 0): """This checker tries to find optimized library for cblas.""" libname = 'cblas' env = context.env def check(func, name, suplibs): - st, res = func(context, autoadd) + st, res = func(context, autoadd, check_version) if st: for lib in suplibs: res.cfgopts['libs'].insert(0, lib) @@ -77,7 +77,7 @@ add_info(env, libname, None) return 0 -def CheckF77BLAS(context, autoadd = 1): +def CheckF77BLAS(context, autoadd = 1, check_version = 0): """This checker tries to find optimized library for blas (fortran F77).""" libname = 'blas' env = context.env @@ -92,7 +92,7 @@ test_src = c_sgemm2 % {'func' : func_name} def check(func, name, suplibs): - st, res = func(context, autoadd) + st, res = func(context, autoadd, check_version) if st: for lib in suplibs: res.cfgopts['libs'].insert(0, lib) @@ -143,7 +143,7 @@ add_info(env, libname, None) return 0 -def CheckF77LAPACK(context, autoadd = 1): +def CheckF77LAPACK(context, autoadd = 1, check_version = 0): """This checker tries to find optimized library for F77 lapack. This test is pretty strong: it first detects an optimized library, and then @@ -167,7 +167,7 @@ def check(func, name, suplibs): # func is the perflib checker, name the printed name for the check, and # suplibs a list of libraries to link in addition. - st, res = func(context, autoadd) + st, res = func(context, autoadd, check_version) if st: for lib in suplibs: res.cfgopts['libs'].insert(0, lib) @@ -226,7 +226,7 @@ add_info(env, libname, None) return 0 -def CheckCLAPACK(context, autoadd = 1): +def CheckCLAPACK(context, autoadd = 1, check_version = 0): """This checker tries to find optimized library for lapack. This test is pretty strong: it first detects an optimized library, and then Modified: branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py =================================================================== --- branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-11-22 08:34:00 UTC (rev 4489) +++ branches/numpy.scons/numpy/distutils/scons/checkers/perflib.py 2007-11-22 12:33:55 UTC (rev 4490) @@ -93,6 +93,24 @@ def get_func(self): return self.func +class GetVersionFactory: + def __init__(self, name): + """Name should be one key of _CONFIG.""" + try: + _CONFIG[name] + except KeyError, e: + raise RuntimeError("name %s is unknown") + + def f(env, libname): + if env['NUMPY_PKG_CONFIG'][libname] is None: + return 'No version info' + else: + return env['NUMPY_PKG_CONFIG'][libname].version + self.func = f + + def get_func(self): + return self.func + #------------------------ # Generic functionalities #------------------------ @@ -166,7 +184,7 @@ # Check version if requested if check_version: if version_checker: - vst, v = version_checker(env, opts) + vst, v = version_checker(context, opts) if vst: version = v else: @@ -182,7 +200,8 @@ #-------------- # MKL checker #-------------- -def _mkl_version_checker(env, opts): +def _mkl_version_checker(context, opts): + env = context.env version_code = r""" #include #include @@ -207,8 +226,10 @@ finally: restore(env, saved) - if vst and re.search(r'Full version: (\d+[.]\d+[.]\d+)', out): - version = m.group(1) + if vst: + m = re.search(r'Full version: (\d+[.]\d+[.]\d+)', out) + if m: + version = m.group(1) else: version = '' @@ -221,11 +242,13 @@ cfg.funcs, check_version, _mkl_version_checker, autoadd) IsMKL = IsFactory('MKL').get_func() +GetMKLVersion = GetVersionFactory('MKL').get_func() #--------------- # ATLAS Checker #--------------- -def _atlas_version_checker(env, opts): +def _atlas_version_checker(context, opts): + env = context.env version_code = """ void ATL_buildinfo(void); int main(void) { @@ -259,6 +282,7 @@ cfg.funcs, check_version, _atlas_version_checker, autoadd) IsATLAS = IsFactory('ATLAS').get_func() +GetATLASVersion = GetVersionFactory('ATLAS').get_func() #------------------------------ # Mac OS X Frameworks checkers Modified: branches/numpy.scons/numpy/scons_fake/checkers/SConstruct =================================================================== --- branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-11-22 08:34:00 UTC (rev 4489) +++ branches/numpy.scons/numpy/scons_fake/checkers/SConstruct 2007-11-22 12:33:55 UTC (rev 4490) @@ -1,7 +1,8 @@ # vim:syntax=python from numpy.distutils.scons import GetNumpyEnvironment from numpy.distutils.scons.checkers.perflib import \ - CheckATLAS, CheckAccelerate, CheckMKL, CheckSunperf + CheckATLAS, CheckAccelerate, CheckMKL, CheckSunperf,\ + IsMKL, IsATLAS, IsAccelerate, GetATLASVersion from numpy.distutils.scons.checkers.custom_checkers import CheckCBLAS, \ CheckCLAPACK, CheckF77BLAS, CheckF77LAPACK from numpy.distutils.scons import CheckF77Mangling @@ -38,6 +39,11 @@ st = config.CheckCLAPACK(autoadd = 0) st = config.CheckF77Mangling() + print "Is blas MKL ? %s" % IsMKL(env, 'blas') + print "Is cblas MKL ? %s" % IsMKL(env, 'cblas') + print "Is blas ATLAS ? %s" % IsATLAS(env, 'blas') + print "Is cblas ATLAS ? %s" % IsATLAS(env, 'cblas') + if env.has_key('LIBS'): print "LIBS of env is %s" % env.Dump('LIBS') else: Modified: branches/numpy.scons/test.sh =================================================================== --- branches/numpy.scons/test.sh 2007-11-22 08:34:00 UTC (rev 4489) +++ branches/numpy.scons/test.sh 2007-11-22 12:33:55 UTC (rev 4490) @@ -4,15 +4,15 @@ # MKL=None python setupscons.py scons --jobs=4 install --prefix=$PREFIX/tmp # (cd $PREFIX/tmp && PYTHONPATH=$PREFIX/tmp/lib/python2.5/site-packages python -c "import numpy; print numpy; numpy.test(level = 9999); numpy.show_config()") +PREFIX=$PWD +rm -rf $PREFIX/build +rm -rf $PREFIX/tmp +ATLAS=None python setupscons.py scons --jobs=4 install --prefix=$PREFIX/tmp +(cd $PREFIX/tmp && PYTHONPATH=$PREFIX/tmp/lib/python2.5/site-packages python -c "import numpy; print numpy; numpy.test(level = 9999); numpy.show_config()") + # PREFIX=$PWD -# rm -rf $PREFIX/build -# rm -rf $PREFIX/tmp -# python setupscons.py scons --jobs=4 install --prefix=$PREFIX/tmp -# (cd $PREFIX/tmp && PYTHONPATH=$PREFIX/tmp/lib/python2.5/site-packages python -c "import numpy; print numpy; numpy.test(level = 9999); numpy.show_config()") - -PREFIX=$PWD -#rm -rf $PREFIX/build -#rm -rf $PREFIX/tmp -MKL=None python setupscons.py scons --jobs=4 --silent=2 install --prefix=$PREFIX/tmp -(cd $PREFIX/tmp/lib/python2.5/site-packages/numpy/distutils/scons/tests/f2pyext/ && \ - PYTHONPATH=$PREFIX/tmp/lib/python2.5/site-packages python setup.py scons) +# #rm -rf $PREFIX/build +# #rm -rf $PREFIX/tmp +# MKL=None python setupscons.py scons --jobs=4 --silent=2 install --prefix=$PREFIX/tmp +# (cd $PREFIX/tmp/lib/python2.5/site-packages/numpy/distutils/scons/tests/f2pyext/ && \ +# PYTHONPATH=$PREFIX/tmp/lib/python2.5/site-packages python setup.py scons) From numpy-svn at scipy.org Thu Nov 22 11:14:08 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 22 Nov 2007 10:14:08 -0600 (CST) Subject: [Numpy-svn] r4491 - trunk/numpy/doc/swig Message-ID: <20071122161408.EC0A439C06D@new.scipy.org> Author: wfspotz at sandia.gov Date: 2007-11-22 10:14:03 -0600 (Thu, 22 Nov 2007) New Revision: 4491 Added: trunk/numpy/doc/swig/pyfragments.swg Modified: trunk/numpy/doc/swig/numpy.i Log: Added pyfragments.swg, which expands integer type-checking to accept numpy array scalars Modified: trunk/numpy/doc/swig/numpy.i =================================================================== --- trunk/numpy/doc/swig/numpy.i 2007-11-22 12:33:55 UTC (rev 4490) +++ trunk/numpy/doc/swig/numpy.i 2007-11-22 16:14:03 UTC (rev 4491) @@ -318,8 +318,8 @@ /* %numpy_typemaps() macro * - * This macro defines a family of typemaps that allow pure input C - * arguments of the form + * This macro defines a family of 23 typemaps that allow C arguments + * of the form * * (DATA_TYPE IN_ARRAY1[ANY]) * (DATA_TYPE* IN_ARRAY1, DIM_TYPE DIM1) @@ -329,6 +329,10 @@ * (DATA_TYPE* IN_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) * (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* IN_ARRAY2) * + * (DATA_TYPE IN_ARRAY3[ANY][ANY][ANY]) + * (DATA_TYPE* IN_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) + * (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* IN_ARRAY3) + * * (DATA_TYPE INPLACE_ARRAY1[ANY]) * (DATA_TYPE* INPLACE_ARRAY1, DIM_TYPE DIM1) * (DIM_TYPE DIM1, DATA_TYPE* INPLACE_ARRAY1) @@ -337,12 +341,18 @@ * (DATA_TYPE* INPLACE_ARRAY2, DIM_TYPE DIM1, DIM_TYPE DIM2) * (DIM_TYPE DIM1, DIM_TYPE DIM2, DATA_TYPE* INPLACE_ARRAY2) * + * (DATA_TYPE INPLACE_ARRAY3[ANY][ANY][ANY]) + * (DATA_TYPE* INPLACE_ARRAY3, DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3) + * (DIM_TYPE DIM1, DIM_TYPE DIM2, DIM_TYPE DIM3, DATA_TYPE* INPLACE_ARRAY3) + * * (DATA_TYPE ARGOUT_ARRAY1[ANY]) * (DATA_TYPE* ARGOUT_ARRAY1, DIM_TYPE DIM1) * (DIM_TYPE DIM1, DATA_TYPE* ARGOUT_ARRAY1) * * (DATA_TYPE ARGOUT_ARRAY2[ANY][ANY]) * + * (DATA_TYPE ARGOUT_ARRAY3[ANY][ANY][ANY]) + * * where "DATA_TYPE" is any type supported by the NumPy module, and * "DIM_TYPE" is any int-like type suitable for specifying dimensions. * In python, the dimensions will not need to be specified (except for Added: trunk/numpy/doc/swig/pyfragments.swg =================================================================== --- trunk/numpy/doc/swig/pyfragments.swg 2007-11-22 12:33:55 UTC (rev 4490) +++ trunk/numpy/doc/swig/pyfragments.swg 2007-11-22 16:14:03 UTC (rev 4491) @@ -0,0 +1,213 @@ +// Override the SWIG_AsVal_frag(long) fragment so that it also checks +// for numpy scalar array types. The code through the %#endif is +// essentially cut-and-paste from pyprimtype.swg + +%fragment(SWIG_AsVal_frag(long), "header", + fragment="SWIG_CanCastAsInteger") +{ + SWIGINTERN int + SWIG_AsVal_dec(long)(PyObject * obj, long * val) + { + if (PyInt_Check(obj)) { + if (val) *val = PyInt_AsLong(obj); + return SWIG_OK; + } else if (PyLong_Check(obj)) { + long v = PyLong_AsLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_OK; + } else { + PyErr_Clear(); + } + } +%#ifdef SWIG_PYTHON_CAST_MODE + { + int dispatch = 0; + long v = PyInt_AsLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_AddCast(SWIG_OK); + } else { + PyErr_Clear(); + } + if (!dispatch) { + double d; + int res = SWIG_AddCast(SWIG_AsVal(double)(obj,&d)); + if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { + if (val) *val = (long)(d); + return res; + } + } + } +%#endif + if (!PyArray_CheckScalar(obj)) return SWIG_TypeError; + int dataType = PyArray_TYPE(obj); + switch (dataType) + { + case NPY_BYTE: + { + char data = *((char*)PyArray_DATA(obj)); + if (val) *val = %numeric_cast(data, long); + break; + } + case NPY_UBYTE: + { + unsigned char data = *((unsigned char*)PyArray_DATA(obj)); + if (val) *val = %numeric_cast(data, long); + break; + } + case NPY_SHORT: + { + short data = *((short*)PyArray_DATA(obj)); + if (val) *val = %numeric_cast(data, long); + break; + } + case NPY_USHORT: + { + unsigned short data = *((unsigned short*)PyArray_DATA(obj)); + if (val) *val = %numeric_cast(data, long); + break; + } + case NPY_INT: + { + int data = *((int*)PyArray_DATA(obj)); + if (val) *val = %numeric_cast(data, long); + break; + } + case NPY_UINT: + { + unsigned int data = *((unsigned int*)PyArray_DATA(obj)); + if (data > NPY_MAX_LONG) return SWIG_OverflowError; + if (val) *val = %numeric_cast(data, long); + break; + } + case NPY_LONG: + { + *val = *((long*)PyArray_DATA(obj)); + break; + } + case NPY_ULONG: + { + unsigned long data = *((unsigned long*)PyArray_DATA(obj)); + if (data > NPY_MAX_LONG) return SWIG_OverflowError; + if (val) *val = %numeric_cast(data, long); + break; + } + default: + return SWIG_TypeError; + } + return SWIG_OK; + } +} + + + + +// Override the SWIG_AsVal_frag(unsigned long) fragment so that it +// also checks for numpy scalar array types. The code through the +// %#endif is essentially cut-and-paste from pyprimtype.swg + +%fragment(SWIG_AsVal_frag(unsigned long),"header", + fragment="SWIG_CanCastAsInteger") +{ + SWIGINTERN int + SWIG_AsVal_dec(unsigned long)(PyObject *obj, unsigned long *val) + { + if (PyInt_Check(obj)) { + long v = PyInt_AsLong(obj); + if (v >= 0) { + if (val) *val = v; + return SWIG_OK; + } else { + return SWIG_OverflowError; + } + } else if (PyLong_Check(obj)) { + unsigned long v = PyLong_AsUnsignedLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_OK; + } else { + PyErr_Clear(); + } + } +%#ifdef SWIG_PYTHON_CAST_MODE + { + int dispatch = 0; + unsigned long v = PyLong_AsUnsignedLong(obj); + if (!PyErr_Occurred()) { + if (val) *val = v; + return SWIG_AddCast(SWIG_OK); + } else { + PyErr_Clear(); + } + if (!dispatch) { + double d; + int res = SWIG_AddCast(SWIG_AsVal(double)(obj,&d)); + if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) { + if (val) *val = (unsigned long)(d); + return res; + } + } + } +%#endif + if (!PyArray_CheckScalar(obj)) return SWIG_TypeError; + int dataType = PyArray_TYPE(obj); + switch (dataType) + { + case NPY_BYTE: + { + char data = *((char*)PyArray_DATA(obj)); + if (data < 0) return SWIG_OverflowError; + if (val) *val = %numeric_cast(data, unsigned long); + break; + } + case NPY_UBYTE: + { + unsigned char data = *((unsigned char*)PyArray_DATA(obj)); + if (val) *val = %numeric_cast(data, unsigned long); + break; + } + case NPY_SHORT: + { + short data = *((short*)PyArray_DATA(obj)); + if (data < 0) return SWIG_OverflowError; + if (val) *val = %numeric_cast(data, unsigned long); + break; + } + case NPY_USHORT: + { + unsigned short data = *((unsigned short*)PyArray_DATA(obj)); + if (val) *val = %numeric_cast(data, unsigned long); + break; + } + case NPY_INT: + { + int data = *((int*)PyArray_DATA(obj)); + if (data < 0) return SWIG_OverflowError; + if (val) *val = %numeric_cast(data, unsigned long); + break; + } + case NPY_UINT: + { + unsigned int data = *((unsigned int*)PyArray_DATA(obj)); + if (val) *val = %numeric_cast(data, unsigned long); + break; + } + case NPY_LONG: + { + long data = *((long*)PyArray_DATA(obj)); + if (data < 0) return SWIG_OverflowError; + if (val) *val = %numeric_cast(data, unsigned long); + break; + } + case NPY_ULONG: + { + *val = *((unsigned long*)PyArray_DATA(obj)); + break; + } + default: + return SWIG_TypeError; + } + return SWIG_OK; + } +} From numpy-svn at scipy.org Thu Nov 22 13:34:54 2007 From: numpy-svn at scipy.org (numpy-svn at scipy.org) Date: Thu, 22 Nov 2007 12:34:54 -0600 (CST) Subject: [Numpy-svn] r4492 - trunk/numpy/doc/swig/doc Message-ID: <20071122183454.A250839C045@new.scipy.org> Author: wfspotz at sandia.gov Date: 2007-11-22 12:34:50 -0600 (Thu, 22 Nov 2007) New Revision: 4492 Modified: trunk/numpy/doc/swig/doc/numpy_swig.html trunk/numpy/doc/swig/doc/numpy_swig.pdf trunk/numpy/doc/swig/doc/numpy_swig.txt Log: Updated documentation to include pyfragments.swg explanation Modified: trunk/numpy/doc/swig/doc/numpy_swig.html =================================================================== --- trunk/numpy/doc/swig/doc/numpy_swig.html 2007-11-22 16:14:03 UTC (rev 4491) +++ trunk/numpy/doc/swig/doc/numpy_swig.html 2007-11-22 18:34:50 UTC (rev 4492) @@ -5,7 +5,7 @@ numpy.i: a SWIG Interface File for NumPy - +