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
+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?, ?2