From 435130568f78858e4d122c2ff2d1de7eb25feb80 Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Sun, 9 Oct 2005 04:47:13 +0000 Subject: Get rid of the last tabs in the source files and have the TestSCons infrastructure use the python -tt option when executing SCons to make sure they do not recur. --- SConstruct | 23 ++++++++++++----------- etc/TestCmd.py | 13 ++++++++----- etc/TestSCons.py | 2 +- src/CHANGES.txt | 4 ++++ src/engine/SCons/Action.py | 6 +++--- src/engine/SCons/Environment.py | 12 ++++++------ src/engine/SCons/Optik/option.py | 4 ++-- src/engine/SCons/Optik/option_parser.py | 14 +++++++------- src/engine/SCons/Tool/msvs.py | 2 +- src/engine/SCons/Tool/tex.py | 6 +++--- test/Actions/actions.py | 2 +- test/Repository/LIBPATH.py | 8 ++++---- 12 files changed, 52 insertions(+), 44 deletions(-) diff --git a/SConstruct b/SConstruct index c4c99b3..9effc18 100644 --- a/SConstruct +++ b/SConstruct @@ -287,7 +287,8 @@ env = Environment( BUILDERS = { 'SCons_revision' : revbuilder }, - PYTHON = sys.executable + PYTHON = sys.executable, + PYTHONFLAGS = '-tt', ) Version_values = [Value(version), Value(build_id)] @@ -643,7 +644,7 @@ for p in [ scons ]: 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'), ]) @@ -716,7 +717,7 @@ for p in [ scons ]: 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'), ]) @@ -812,12 +813,12 @@ for p in [ scons ]: '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) @@ -837,7 +838,7 @@ for p in [ scons ]: 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), ] @@ -1021,11 +1022,11 @@ if change: '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', @@ -1077,11 +1078,11 @@ if change: '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', diff --git a/etc/TestCmd.py b/etc/TestCmd.py index e4cae74..83696ea 100644 --- a/etc/TestCmd.py +++ b/etc/TestCmd.py @@ -38,6 +38,7 @@ things. Here is an overview of them: 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('') @@ -175,8 +176,8 @@ version. # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. __author__ = "Steven Knight " -__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 @@ -658,11 +659,13 @@ class TestCmd: 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) diff --git a/etc/TestSCons.py b/etc/TestSCons.py index b49afad..5dce768 100644 --- a/etc/TestSCons.py +++ b/etc/TestSCons.py @@ -131,7 +131,7 @@ class TestSCons(TestCommon): 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'): diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 383be62..b169fde 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -349,6 +349,10 @@ RELEASE 0.97 - XXX 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. diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py index 0bbcc3a..98de34e 100644 --- a/src/engine/SCons/Action.py +++ b/src/engine/SCons/Action.py @@ -409,8 +409,8 @@ class CommandAction(_ActionAction): 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): @@ -462,7 +462,7 @@ class CommandAction(_ActionAction): # 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): diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 08e085d..b4e8aac 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -791,12 +791,12 @@ class Base(SubstitutionEnvironment): 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): """ diff --git a/src/engine/SCons/Optik/option.py b/src/engine/SCons/Optik/option.py index 2e1ec33..7493205 100644 --- a/src/engine/SCons/Optik/option.py +++ b/src/engine/SCons/Optik/option.py @@ -346,8 +346,8 @@ class Option: 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)) diff --git a/src/engine/SCons/Optik/option_parser.py b/src/engine/SCons/Optik/option_parser.py index 94375d0..49b1874 100644 --- a/src/engine/SCons/Optik/option_parser.py +++ b/src/engine/SCons/Optik/option_parser.py @@ -530,8 +530,8 @@ class OptionParser: (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") @@ -544,8 +544,8 @@ class OptionParser: 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") @@ -649,10 +649,10 @@ def _match_abbrev (s, wordmap): 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] diff --git a/src/engine/SCons/Tool/msvs.py b/src/engine/SCons/Tool/msvs.py index 280c456..5542a88 100644 --- a/src/engine/SCons/Tool/msvs.py +++ b/src/engine/SCons/Tool/msvs.py @@ -197,7 +197,7 @@ class _DSPGenerator: for v in variants: outdir.append(s) - self.sconscript = env['MSVSSCONSCRIPT'] + self.sconscript = env['MSVSSCONSCRIPT'] self.env = env diff --git a/src/engine/SCons/Tool/tex.py b/src/engine/SCons/Tool/tex.py index db2664a..adb6c06 100644 --- a/src/engine/SCons/Tool/tex.py +++ b/src/engine/SCons/Tool/tex.py @@ -81,7 +81,7 @@ def is_LaTeX(flist): 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): @@ -89,9 +89,9 @@ 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, diff --git a/test/Actions/actions.py b/test/Actions/actions.py index c805a05..7ae951a 100644 --- a/test/Actions/actions.py +++ b/test/Actions/actions.py @@ -94,7 +94,7 @@ class bld: 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)), diff --git a/test/Repository/LIBPATH.py b/test/Repository/LIBPATH.py index 4b249e5..8f0a12f 100644 --- a/test/Repository/LIBPATH.py +++ b/test/Repository/LIBPATH.py @@ -50,10 +50,10 @@ def write_LIBDIRFLAGS(env, target, source): 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 -- cgit v0.12