BUILDERS = { 'SCons_revision' : revbuilder },
- PYTHON = sys.executable
+ PYTHON = sys.executable,
+ PYTHONFLAGS = '-tt',
)
Version_values = [Value(version), Value(build_id)]
env.Command(dfiles, unpack_tar_gz_files, [
Delete(os.path.join(unpack_tar_gz_dir, pkg_version, 'build')),
Delete("$TEST_TAR_GZ_DIR"),
- '$PYTHON "%s" install "--prefix=$TEST_TAR_GZ_DIR" --standalone-lib' % \
+ '$PYTHON $PYTHONFLAGS "%s" install "--prefix=$TEST_TAR_GZ_DIR" --standalone-lib' % \
os.path.join(unpack_tar_gz_dir, pkg_version, 'setup.py'),
])
env.Command(dfiles, unpack_zip_files, [
Delete(os.path.join(unpack_zip_dir, pkg_version, 'build')),
Delete("$TEST_ZIP_DIR"),
- '$PYTHON "%s" install "--prefix=$TEST_ZIP_DIR" --standalone-lib' % \
+ '$PYTHON $PYTHONFLAGS "%s" install "--prefix=$TEST_ZIP_DIR" --standalone-lib' % \
os.path.join(unpack_zip_dir, pkg_version, 'setup.py'),
])
'bdist.' + platform,
'dumb')))
for format in distutils_formats:
- commands.append("$PYTHON $SETUP_PY bdist_dumb -f %s" % format)
+ commands.append("$PYTHON $PYTHONFLAGS $SETUP_PY bdist_dumb -f %s" % format)
- commands.append("$PYTHON $SETUP_PY sdist --formats=%s" % \
+ commands.append("$PYTHON $PYTHONFLAGS $SETUP_PY sdist --formats=%s" % \
string.join(distutils_formats, ','))
- commands.append("$PYTHON $SETUP_PY bdist_wininst")
+ commands.append("$PYTHON $PYTHONFLAGS $SETUP_PY bdist_wininst")
env.Command(distutils_targets, build_src_files, commands)
commands = [
Delete(local),
- '$PYTHON $SETUP_PY install "--install-script=%s" "--install-lib=%s" --no-install-man --no-compile --standalone-lib --no-version-script' % \
+ '$PYTHON $PYTHONFLAGS $SETUP_PY install "--install-script=%s" "--install-lib=%s" --no-install-man --no-compile --standalone-lib --no-version-script' % \
(cwd_local, cwd_local_slv),
]
'scons',
'build')),
Delete("$TEST_SRC_TAR_GZ_DIR"),
- 'cd "%s" && $PYTHON "%s" "%s"' % \
+ 'cd "%s" && $PYTHON $PYTHONFLAGS "%s" "%s"' % \
(os.path.join(unpack_tar_gz_dir, psv),
os.path.join('src', 'script', 'scons.py'),
os.path.join('build', 'scons')),
- '$PYTHON "%s" install "--prefix=$TEST_SRC_TAR_GZ_DIR" --standalone-lib' % \
+ '$PYTHON $PYTHONFLAGS "%s" install "--prefix=$TEST_SRC_TAR_GZ_DIR" --standalone-lib' % \
os.path.join(unpack_tar_gz_dir,
psv,
'build',
'scons',
'build')),
Delete("$TEST_SRC_ZIP_DIR"),
- 'cd "%s" && $PYTHON "%s" "%s"' % \
+ 'cd "%s" && $PYTHON $PYTHONFLAGS "%s" "%s"' % \
(os.path.join(unpack_zip_dir, psv),
os.path.join('src', 'script', 'scons.py'),
os.path.join('build', 'scons')),
- '$PYTHON "%s" install "--prefix=$TEST_SRC_ZIP_DIR" --standalone-lib' % \
+ '$PYTHON $PYTHONFLAGS "%s" install "--prefix=$TEST_SRC_ZIP_DIR" --standalone-lib' % \
os.path.join(unpack_zip_dir,
psv,
'build',
test.program_set('program_or_script_to_test')
test.interpreter_set('script_interpreter')
+ test.interpreter_set(['script_interpreter', 'arg'])
test.workdir_set('prefix')
test.workdir_set('')
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
__author__ = "Steven Knight <knight at baldmt dot com>"
-__revision__ = "TestCmd.py 0.16.D002 2005/08/19 16:58:31 knight"
-__version__ = "0.16"
+__revision__ = "TestCmd.py 0.17.D001 2005/10/08 22:58:27 knight"
+__version__ = "0.17"
import os
import os.path
program = self.program
if not interpreter:
interpreter = self.interpreter
- if type(program) != type([]):
+ if not type(program) in [type([]), type(())]:
program = [program]
- cmd = program
+ cmd = list(program)
if interpreter:
- cmd = [interpreter] + cmd
+ if not type(interpreter) in [type([]), type(())]:
+ interpreter = [interpreter]
+ cmd = list(interpreter) + cmd
if arguments:
if type(arguments) == type(''):
arguments = string.split(arguments)
else:
kw['program'] = 'scons.py'
if not kw.has_key('interpreter') and not os.environ.get('SCONS_EXEC'):
- kw['interpreter'] = python
+ kw['interpreter'] = [python, '-tt']
if not kw.has_key('match'):
kw['match'] = match_exact
if not kw.has_key('workdir'):
throw a KeyError if we were able to delte the variable from any
Environment in the stack.
+ - Get rid of the last indentation tabs in the SCons source files and
+ add -tt to the Python invocations in the packaging build and the
+ tests so they don't creep back in.
+
From Chen Lee:
- Handle Visual Studio project and solution files in Unicode.
if c:
return c
cmd_list, ignore, silent = self.process(target, source, env)
- if silent:
- return ''
+ if silent:
+ return ''
return _string_from_cmd_list(cmd_list[0])
def execute(self, target, source, env):
# reasonable for just about everything else:
ENV[key] = str(value)
- cmd_list, ignore, silent = self.process(target, map(rfile, source), env)
+ cmd_list, ignore, silent = self.process(target, map(rfile, source), env)
# Use len() to filter out any "command" that's zero-length.
for cmd_line in filter(len, cmd_list):
return None
def Dictionary(self, *args):
- if not args:
- return self._dict
- dlist = map(lambda x, s=self: s._dict[x], args)
- if len(dlist) == 1:
- dlist = dlist[0]
- return dlist
+ if not args:
+ return self._dict
+ dlist = map(lambda x, s=self: s._dict[x], args)
+ if len(dlist) == 1:
+ dlist = dlist[0]
+ return dlist
def Dump(self, key = None):
"""
if self.nargs == 1:
value = self.check_value(opt, value)
else:
- def cv(v,check=self.check_value,o=opt):
- return check(o,v)
+ def cv(v,check=self.check_value,o=opt):
+ return check(o,v)
value = tuple(map(cv,value))
(basename of sys.argv[0]). Does nothing if self.usage is empty
or not defined.
"""
- if file is None:
- file = sys.stdout
+ if file is None:
+ file = sys.stdout
if self.usage:
usage = string.replace(self.usage,"%prog", get_prog_name())
file.write(usage + "\n")
of "%prog" in self.version is replaced by the current program's
name. Does nothing if self.version is empty or undefined.
"""
- if file is None:
- file = sys.stdout
+ if file is None:
+ file = sys.stdout
if self.version:
version = string.replace(self.version,"%prog", get_prog_name())
file.write(version+"\n")
else:
# Isolate all words with s as a prefix.
possibilities = []
- ls = len(s)
- for word in wordmap.keys():
+ ls = len(s)
+ for word in wordmap.keys():
if len(word)>=ls and word[:ls]==s:
- possibilities.append(word)
+ possibilities.append(word)
# No exact match, so there had better be just one possibility.
if len(possibilities) == 1:
return possibilities[0]
for v in variants:
outdir.append(s)
- self.sconscript = env['MSVSSCONSCRIPT']
+ self.sconscript = env['MSVSSCONSCRIPT']
self.env = env
for f in flist:
content = f.get_contents()
if LaTeX_re.search(content):
- return 1
+ return 1
return 0
def TeXLaTeXFunction(target = None, source= None, env=None):
decide the "flavor" of the source and then executes the appropriate
program."""
if is_LaTeX(source):
- LaTeXAuxAction(target,source,env)
+ LaTeXAuxAction(target,source,env)
else:
- TeXAction(target,source,env)
+ TeXAction(target,source,env)
return 0
TeXLaTeXAction = SCons.Action.Action(TeXLaTeXFunction,
self.cmd = r'%s build.py %%s 4 %%s'
def __call__(self, env, target, source):
cmd = self.get_contents(env, target, source)
- print cmd
+ print cmd
return os.system(cmd)
def get_contents(self, env, target, source):
return self.cmd %% (string.join(map(str, target)),
suf = env.subst('$LIBDIRSUFFIX')
f = open(str(target[0]), 'wb')
for arg in string.split(env.subst('$_LIBDIRFLAGS', target=target)):
- if arg[:len(pre)] == pre:
- arg = arg[len(pre):]
- if arg[-len(suf):] == suf:
- arg = arg[:-len(pre)]
+ if arg[:len(pre)] == pre:
+ arg = arg[len(pre):]
+ if arg[-len(suf):] == suf:
+ arg = arg[:-len(pre)]
f.write(arg + '\n')
f.close()
return 0