[Avida-cvs] [avida3-svn] r44 - in trunk: . source/bindings/Boost.Python source/tools support/utils tests/Python tests/c
kaben@myxo.css.msu.edu
kaben at myxo.css.msu.edu
Sat Apr 8 23:36:49 PDT 2006
Author: kaben
Date: 2006-04-09 02:36:49 -0400 (Sun, 09 Apr 2006)
New Revision: 44
Modified:
trunk/SConstruct
trunk/source/bindings/Boost.Python/SConscript
trunk/source/bindings/Boost.Python/cFile.pyste
trunk/source/bindings/Boost.Python/cString.pyste
trunk/source/tools/cString.cpp
trunk/source/tools/cString.h
trunk/support/utils/GCCXMLTool.py
trunk/support/utils/PysteTool.py
trunk/tests/Python/SConscript
trunk/tests/c/SConscript
trunk/tests/c/cConfigOverrides_test.cpp
trunk/tests/c/cConfig_test.cpp
Log:
Found the source of bad dependencies in Pyste tool: Pyste changes its
cached .pystec files, I'm not sure how, but I don't think I can use the
cache, so I've disabled it.
Modified: trunk/SConstruct
===================================================================
--- trunk/SConstruct 2006-04-08 23:54:43 UTC (rev 43)
+++ trunk/SConstruct 2006-04-09 06:36:49 UTC (rev 44)
@@ -227,6 +227,7 @@
archive_dir = 'archive'
include_paths.append(archive_dir)
library_paths.append(archive_dir)
+ environment.Append(LIBPATH = ['$BOOST_PYTHON_LIBPATH'])
for dir in include_paths:
environment.Append(CPPPATH = ['#' + os.path.join(source_dir, dir)])
Modified: trunk/source/bindings/Boost.Python/SConscript
===================================================================
--- trunk/source/bindings/Boost.Python/SConscript 2006-04-08 23:54:43 UTC (rev 43)
+++ trunk/source/bindings/Boost.Python/SConscript 2006-04-09 06:36:49 UTC (rev 44)
@@ -9,77 +9,20 @@
import os
Import('environment')
-
e = environment
-
if e.subst('$enablePyPkg') is "1":
-
pf = e.File('pyste_util.py')
e.Local(pf)
- # Sorry about having to specify the package name all over the place... I
- # could fix it, but things work well enough for now. @kgn
+ # Have to specify the package name all over the place...
+ # Fixable, but things work well enough for now. @kgn
#
package_name = "AvidaCore"
- #pyste_package = e.PystePackage(
- # e.PystePackageSubmodule(
- # [
- # 'cCycleCheck.pyste',
- # 'cID.pyste',
- # ],
- # pyste_package_name = package_name,
- # LIBS = ['tools']
- # ) + e.PystePackageSubmodule(
- # [
- # 'cStringable.pyste',
- # 'cTextTestInterpreter.pyste',
- # 'cTestCase.pyste',
- # 'cTestProblem.pyste',
- # 'cTestResult.pyste',
- # ],
- # pyste_package_name = package_name,
- # LIBS = ['yaktest']
- # ) + e.PystePackageSubmodule(
- # [
- # 'cFile.pyste',
- # ],
- # pyste_package_name = package_name,
- # LIBS = ['tools', 'yaktest']
- # ),
- # pyste_package_name = package_name,
- #)
-
-
- # Sadly, the build system won't let me install a subdirectory.
- #
- # Happily, I can get at the package contents -- the package init file,
- # and the package modules -- which I can install into a subdirectory
- # with the same name as the package. It's a pain, but it works.
- #
-
-
# Build and keep track of the package's modules.
#
package_modules = e.PystePackageSubmodule(
- # [
- # 'cID.pyste',
- # 'cCycleCheck.pyste',
- # ],
- # pyste_package_name = package_name,
- # LIBS = ['tools']
- #) + e.PystePackageSubmodule(
- # [
- # 'cStringable.pyste',
- # 'cTextTestInterpreter.pyste',
- # 'cTestCase.pyste',
- # 'cTestProblem.pyste',
- # 'cTestResult.pyste',
- # ],
- # pyste_package_name = package_name,
- # LIBS = ['yaktest']
- #) + e.PystePackageSubmodule(
[
'cScheduler.pyste',
'cConfigManager.pyste',
@@ -111,16 +54,10 @@
'cStringIterator.pyste',
'cStringList.pyste',
'cStringUtil.pyste',
-
- #'tArray.pyste',
- #'tDictionary.pyste',
- #'tList.pyste',
- #'tMatrix.pyste',
],
pyste_package_name = package_name,
LIBS = ['tools'],
)
-
# Build and keep track of the package's init file.
#
package_init_file = e.PystePackageInitFile(
@@ -135,7 +72,6 @@
package_modules + package_init_file,
pyste_package_name = package_name,
)
-
# Install the package by installing its contents into a subdirectory
# with the same name as the package.
#
Modified: trunk/source/bindings/Boost.Python/cFile.pyste
===================================================================
--- trunk/source/bindings/Boost.Python/cFile.pyste 2006-04-08 23:54:43 UTC (rev 43)
+++ trunk/source/bindings/Boost.Python/cFile.pyste 2006-04-09 06:36:49 UTC (rev 44)
@@ -1,4 +1,5 @@
+
typename = 'cFile'
import os.path
execfile('%s/pyste_util.py' % os.path.split(INTERFACE_FILE)[0])
Modified: trunk/source/bindings/Boost.Python/cString.pyste
===================================================================
--- trunk/source/bindings/Boost.Python/cString.pyste 2006-04-08 23:54:43 UTC (rev 43)
+++ trunk/source/bindings/Boost.Python/cString.pyste 2006-04-09 06:36:49 UTC (rev 44)
@@ -1,6 +1,7 @@
Include("tPtr.h")
+
cString = Class("cString", "cString.h")
holder(cString, lambda T: "tPtr<%s>" % T)
Modified: trunk/source/tools/cString.cpp
===================================================================
--- trunk/source/tools/cString.cpp 2006-04-08 23:54:43 UTC (rev 43)
+++ trunk/source/tools/cString.cpp 2006-04-09 06:36:49 UTC (rev 44)
@@ -13,7 +13,6 @@
#include <stdarg.h>
}
-
using namespace std;
Modified: trunk/source/tools/cString.h
===================================================================
--- trunk/source/tools/cString.h 2006-04-08 23:54:43 UTC (rev 43)
+++ trunk/source/tools/cString.h 2006-04-09 06:36:49 UTC (rev 44)
@@ -24,7 +24,6 @@
#define MAX_STRING_REF_COUNT 32767
#define CONTINUE_LINE_CHAR '\\'
-
/**
* A multipurpose string class with many convenient methods of
* manipulating and comparing strings.
Modified: trunk/support/utils/GCCXMLTool.py
===================================================================
--- trunk/support/utils/GCCXMLTool.py 2006-04-08 23:54:43 UTC (rev 43)
+++ trunk/support/utils/GCCXMLTool.py 2006-04-09 06:36:49 UTC (rev 44)
@@ -19,9 +19,6 @@
import SCons
import os.path
-def _checkKey(env, key):
- if env.Dictionary().has_key(key) and (None != env[key]): return env[key]
-
def _checkKeySubst(env, key):
if env.Dictionary().has_key(key) and (None != env[key]): return env.subst('$%s' % key)
@@ -48,7 +45,6 @@
GCCXML_TOOL_ERR = '',
GCCXML_CMD = '$GccXmlCommand',
)
-
if env.subst('$runConfTests') in ['yes', '1']:
find(env)
Modified: trunk/support/utils/PysteTool.py
===================================================================
--- trunk/support/utils/PysteTool.py 2006-04-08 23:54:43 UTC (rev 43)
+++ trunk/support/utils/PysteTool.py 2006-04-09 06:36:49 UTC (rev 44)
@@ -38,22 +38,13 @@
def _keyCheck(env, key):
if env.Dictionary().has_key(key): return env[key]
- return None
-def PysteScanner(fs = SCons.Node.FS.default_fs):
+def PysteScanner():
"""
A classic CPP-style include-scanner, customized to scan .pyste files for
dependencies.
"""
- return SCons.Scanner.Classic(
- 'PysteScanner',
- [
- '.pyste',
- ],
- 'CPPPATH',
- """["'](\S*?\.h|\S*?\.pyste)["']""",
- fs = fs
- )
+ return SCons.Scanner.Classic('PysteScanner', ['.pyste',], 'CPPPATH', """["'](\S*?\.h|\S*?\.pyste)["']""")
def PysteRecursiveScanner(node, env, path):
"""
@@ -61,82 +52,20 @@
scanner is available. If file is a .pyste file, calls PysteScanner
instance.
"""
- if _keyCheck(env, "PYSTE_DEBUG") == '1':
- print "PysteRecursiveScanner:"
- print " scanning node:", str(node)
- print " search paths:"
- for p in path(): print " ", str(p)
-
pyste_scanner = PysteScanner()
scanner_key = node.scanner_key()
- if scanner_key in pyste_scanner.skeys:
- return pyste_scanner(node,env,path)
+ if scanner_key in pyste_scanner.skeys: return pyste_scanner(node,env,path)
else:
scanner = env.get_scanner(scanner_key)
- if scanner:
- return scanner(node,env,path)
- else:
- return []
+ if scanner: return scanner(node,env,path)
+ else: return []
-def PystePackageCacheBuildGenerator(source, target, env, for_signature):
- """
- Builds a Pyste command that generates a Pyste cache file from a .pyste
- file. Pyste can later reuse this cache file to generate corresponding c++
- files.
- """
- if _keyCheck(env, "PYSTE_DEBUG") == '1':
- print "PystePackageCacheBuildGenerator:"
- print " targets:"
- for t in target: print " ", str(t)
- print " sources:"
- for s in source: print " ", str(s)
-
- cmd = "$PYSTE_CMD "
- out_string = "${TARGET}"
- src_string = "${SOURCES}"
-
- if not _keyCheck(env, "GCCXML_CMD") in (None, ''):
- cmd += "--gccxml-path=$GCCXML_CMD "
- cmd += "--cache-dir=${TARGET.dir} "
- cmd += "--only-create-cache "
- cmd += "$_CPPINCFLAGS $_CPPDEFFLAGS --out=%s %s" % (out_string,src_string)
- return cmd
-
-def PystePackageCXXBuildGenerator(source, target, env, for_signature):
- """
- Builds a Pyste command that generates a c++ file from Pyste caches and a
- .pyste file.
- """
- if _keyCheck(env, "PYSTE_DEBUG") == '1':
- print "PystePackageCXXBuildGenerator:"
- print " targets:"
- for t in target: print " ", str(t)
- print " sources:"
- for s in source: print " ", str(s)
-
- cmd = "$PYSTE_CMD "
- out_string = "${TARGET}"
- src_string = "${SOURCE.base}.pyste"
-
- if not _keyCheck(env, "GCCXML_CMD") in (None, ''):
- cmd += "--gccxml-path=$GCCXML_CMD "
- cmd += "--cache-dir=${TARGET.dir} "
- cmd += "$_CPPINCFLAGS $_CPPDEFFLAGS --out=%s %s" % (out_string,src_string)
- return cmd
-
def PystePackageSubmoduleEmitter(target, source, env):
"""
Used by PystePackageSubmodule builders, which build Python modules from
generated c++ code, to locate the Python package subdirectory where a
particular new module should be placed.
"""
- if _keyCheck(env, "PYSTE_DEBUG") == '1':
- print "PystePackageSubmoduleEmitter:"
- print " initial targets:"
- for t in target: print " ", str(t)
- print " initial sources:"
- for s in source: print " ", str(s)
-
try:
pyste_package_name = env.overrides["pyste_package_name"]
except:
@@ -148,15 +77,7 @@
if ext == env.subst('$PYTHON_SO'):
new_tgt_name = os.path.join(head, pyste_package_name, str(tail))
new_target_list.append(new_tgt_name)
- else:
- new_target_list.append(tgt)
-
- if _keyCheck(env, "PYSTE_DEBUG") == '1':
- print " final targets:"
- for t in new_target_list: print " ", str(t)
- print " final sources:"
- for s in source: print " ", str(s)
-
+ else: new_target_list.append(tgt)
return new_target_list, source
def PystePackageInitFileEmitter(target, source, env):
@@ -165,13 +86,6 @@
where a new Python package init file ('__init__.py') for the package
should be placed.
"""
- if _keyCheck(env, "PYSTE_DEBUG") == '1':
- print "PystePackageInitFileEmitter:"
- print " initial targets:"
- for t in target: print " ", str(t)
- print " initial sources:"
- for s in source: print " ", str(s)
-
try:
pyste_package_name = env.overrides["pyste_package_name"]
except:
@@ -179,13 +93,6 @@
head, tail = os.path.split(str(target[0]))
init_file_name = os.path.join(head, '__init__.py')
target = [init_file_name,]
-
- if _keyCheck(env, "PYSTE_DEBUG") == '1':
- print " final targets:"
- for t in target: print " ", str(t)
- print " final sources:"
- for s in source: print " ", str(s)
-
return target, source
def PystePackageInitFileAction(target, source, env):
@@ -194,18 +101,10 @@
package's Python modules when the package is imported into a Python
script.
"""
- if _keyCheck(env, "PYSTE_DEBUG") == '1':
- print "PystePackageInitFileAction:"
- print " targets:"
- for t in target: print " ", str(t)
- print " sources:"
- for s in source: print " ", str(s)
-
try:
pyste_package_name = env.overrides["pyste_package_name"]
except:
raise SCons.Errors.UserError, missing_pyste_package_name_error_msg
-
init_file = open(str(target[0]), 'w')
init_file.write('"""\n' +
"""Init file for package "%s".
@@ -226,26 +125,12 @@
Used by PystePackage builders to locate the subdirectory for the Python
package being built.
"""
- if _keyCheck(env, "PYSTE_DEBUG") == '1':
- print "PystePackageEmitter:"
- print " initial targets:"
- for t in target: print " ", str(t)
- print " initial sources:"
- for s in source: print " ", str(s)
-
try:
pyste_package_name = env.overrides["pyste_package_name"]
except:
raise SCons.Errors.UserError, missing_pyste_package_name_error_msg
pyste_package_dir, tail = os.path.split(str(target[0]))
target = [pyste_package_dir,]
-
- if _keyCheck(env, "PYSTE_DEBUG") == '1':
- print " final targets:"
- for t in target: print " ", str(t)
- print " final sources:"
- for s in source: print " ", str(s)
-
return target, source
def PystePackageAction(target, source, env):
@@ -253,13 +138,6 @@
Makes a Python package subdirectory, if it doesn't already exist, to
contain the package's Python modules.
"""
- if _keyCheck(env, "PYSTE_DEBUG") == '1':
- print "PystePackageAction:"
- print " targets:"
- for t in target: print " ", str(t)
- print " sources:"
- for s in source: print " ", str(s)
-
try:
pyste_package_name = env.overrides["pyste_package_name"]
except:
@@ -273,43 +151,21 @@
determine the dependencies of a given Pyste file. Adds the builders and
scanners to the given environment.
"""
-
- # The Pyste package cache builder reads .pyste (Pyste) files and generates
- # .pystec (Pyste cache) files for use by the Pyste cxx builder.
- pyste_package_cache_builder = SCons.Builder.Builder(
- generator = lambda source, target, env, for_signature: PystePackageCacheBuildGenerator(
- source,
- target,
- env,
- for_signature,
- ),
- suffix = '.pystec',
- src_suffix = '.pyste',
- single_source = True
- )
# The Pyste cxx builder reads .pystec (Pyste cache) files, produced by the
# Pyste package cache builder, and generates .pyste.cpp (regular c++)
# files for use by the Pyste shared object builder.
pyste_package_cxx_builder = SCons.Builder.Builder(
- generator = lambda source, target, env, for_signature: PystePackageCXXBuildGenerator(
- source,
- target,
- env,
- for_signature,
- ),
+ action = SCons.Action.Action('$PYSTE_CMD --gccxml-path=$GCCXML_CMD $_CPPINCFLAGS $_CPPDEFFLAGS --out=$TARGET $SOURCE'),
prefix = '',
suffix = '$BOOST_PYTHON_CXX_SUFFIX',
- src_suffix = '.pystec',
- src_builder = 'PystePackageCache',
+ src_suffix = '.pyste',
single_source = True
)
# The Pyste shared object builder reads .pyste.cpp (regular c++) files,
# produced by the Pyste cxx builder, and generates .os (regular shared
# object) files for use by the Pyste submodule builder.
pyste_package_shared_object_builder = SCons.Builder.Builder(
- action = [
- BoostPythonTool.ShCXXAction,
- ],
+ action = BoostPythonTool.ShCXXAction,
prefix = '$SHOBJPREFIX',
suffix = '$SHOBJSUFFIX',
src_suffix = '$BOOST_PYTHON_CXX_SUFFIX',
@@ -321,9 +177,7 @@
# generated by the Pyste shared object builder, and generates .so (regular
# loadabled shared module) comprising a Python package.
pyste_package_submodule_builder = SCons.Builder.Builder(
- action = [
- BoostPythonTool.LdModuleLinkAction,
- ],
+ action = BoostPythonTool.LdModuleLinkAction,
emitter = PystePackageSubmoduleEmitter,
prefix = '',
suffix = '$PYTHON_SO',
@@ -354,7 +208,6 @@
src_builder = 'PystePackageInitFile',
target_factory = SCons.Node.FS.default_fs.Dir
)
-
# The Pyste scanner, given a .pyste (Pyste) file, reads the file to
# identify any header files loaded by the 'Include' directive, and any
# Pyste files loaded by the 'Import' directive. It returns a list of any
@@ -362,15 +215,10 @@
pyste_scanner = SCons.Scanner.Base(
function = PysteRecursiveScanner,
name = 'PysteRecursiveScanner',
- skeys = [
- '.pyste',
- ],
- path_function = SCons.Scanner.FindPathDirs(
- SCons.Node.FS.default_fs
- ),
+ skeys = ['.pyste',],
+ path_function = SCons.Scanner.FindPathDirs(SCons.Node.FS.default_fs),
recursive = True
)
- env.AppendUnique(BUILDERS = {'PystePackageCache' : pyste_package_cache_builder})
env.AppendUnique(BUILDERS = {'PystePackageCXX' : pyste_package_cxx_builder})
env.AppendUnique(BUILDERS = {'PystePackageSharedObject' : pyste_package_shared_object_builder})
env.AppendUnique(BUILDERS = {'PystePackageSubmodule' : pyste_package_submodule_builder})
Modified: trunk/tests/Python/SConscript
===================================================================
--- trunk/tests/Python/SConscript 2006-04-08 23:54:43 UTC (rev 43)
+++ trunk/tests/Python/SConscript 2006-04-09 06:36:49 UTC (rev 44)
@@ -56,22 +56,22 @@
Alias('combined_core_unit_tests', string.join(core_unit_tests))
-binding_test_library = environment.Library('binding_test', ['binding_test.cpp', ],)
-binding_test_package_name = "binding_test"
-binding_test_package_module = environment.PystePackageSubmodule(['binding_test.pyste'],
- pyste_package_name = binding_test_package_name,
- CPPPATH = string.split(environment.subst('$CPPPATH')) + ['.'],
- LIBPATH = ['.'],
- LIBS = ['binding_test', ],
-)
-binding_test_package_init_file = environment.PystePackageInitFile(
- binding_test_package_module, pyste_package_name = binding_test_package_name,)
-binding_test_package = environment.PystePackage(
- binding_test_package_module + binding_test_package_init_file, pyste_package_name = binding_test_package_name,)
-binding_test_package_install_dir = '#' + os.path.join(environment['execPrefix'], binding_test_package_name)
-environment.Install(binding_test_package_install_dir, [binding_test_package_module, binding_test_package_init_file])
-environment.Alias('install', binding_test_package_install_dir)
-PythonUnitTest('unit_test_binding_test', '#' + os.path.join(environment.subst('$execPrefix'), 'binding_test'))
+#binding_test_library = environment.Library('binding_test', ['binding_test.cpp', ],)
+#binding_test_package_name = "binding_test"
+#binding_test_package_module = environment.PystePackageSubmodule(['binding_test.pyste'],
+# pyste_package_name = binding_test_package_name,
+# CPPPATH = string.split(environment.subst('$CPPPATH')) + ['.'],
+# LIBPATH = ['.'],
+# LIBS = ['binding_test', ],
+#)
+#binding_test_package_init_file = environment.PystePackageInitFile(
+# binding_test_package_module, pyste_package_name = binding_test_package_name,)
+#binding_test_package = environment.PystePackage(
+# binding_test_package_module + binding_test_package_init_file, pyste_package_name = binding_test_package_name,)
+#binding_test_package_install_dir = '#' + os.path.join(environment['execPrefix'], binding_test_package_name)
+#environment.Install(binding_test_package_install_dir, [binding_test_package_module, binding_test_package_init_file])
+#environment.Alias('install', binding_test_package_install_dir)
+#PythonUnitTest('unit_test_binding_test', '#' + os.path.join(environment.subst('$execPrefix'), 'binding_test'))
# vim: set ft=python:
Modified: trunk/tests/c/SConscript
===================================================================
--- trunk/tests/c/SConscript 2006-04-08 23:54:43 UTC (rev 43)
+++ trunk/tests/c/SConscript 2006-04-09 06:36:49 UTC (rev 44)
@@ -140,6 +140,7 @@
'cConfigOverrides_test',
source = ['cConfigOverrides_test.cpp'] + cConfig_override_objects
)
+ Depends(cConfigOverrides_test, cConfig_test)
PhonyTarget('cConfigOverrides_test', [cConfigOverrides_test], cConfigOverrides_test[0].abspath)
brainstorm_test = environment.Program('brainstorm_test',
Modified: trunk/tests/c/cConfigOverrides_test.cpp
===================================================================
--- trunk/tests/c/cConfigOverrides_test.cpp 2006-04-08 23:54:43 UTC (rev 43)
+++ trunk/tests/c/cConfigOverrides_test.cpp 2006-04-09 06:36:49 UTC (rev 44)
@@ -54,8 +54,8 @@
config.Status();
config.Load(cConfig_data_file_name.c_str());
- //config.Print("testfile.cfg");
- //config.GenerateOverides();
+ config.Print("testfile.cfg");
+ config.GenerateOverides();
//double total = 0.0;
//for (int i = 0; i < (int) config.VAR5.Get(); i++) {
Modified: trunk/tests/c/cConfig_test.cpp
===================================================================
--- trunk/tests/c/cConfig_test.cpp 2006-04-08 23:54:43 UTC (rev 43)
+++ trunk/tests/c/cConfig_test.cpp 2006-04-09 06:36:49 UTC (rev 44)
@@ -54,8 +54,8 @@
config.Status();
config.Load(cConfig_data_file_name.c_str());
- //config.Print("testfile.cfg");
- //config.GenerateOverides();
+ config.Print("testfile.cfg");
+ config.GenerateOverides();
//double total = 0.0;
//for (int i = 0; i < (int) config.VAR5.Get(); i++) {
More information about the Avida-cvs
mailing list