From 64c7e4aca167a3662bf98a4a39c8d489a87d4451 Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Sun, 13 Sep 2009 23:33:03 +0000 Subject: Have TestSCons.py add --warn=no-python-version every invocation, not just at TestSCons intialization. --- QMTest/TestSCons.py | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py index 89fe5a6..b4e910a 100644 --- a/QMTest/TestSCons.py +++ b/QMTest/TestSCons.py @@ -245,15 +245,6 @@ class TestSCons(TestCommon): # TERM can cause test failures due to control chars in prompts etc. os.environ['TERM'] = 'dumb' - if deprecated_python_version(): - sconsflags = os.environ.get('SCONSFLAGS') - if sconsflags: - sconsflags = [sconsflags] - else: - sconsflags = [] - sconsflags = sconsflags + ['--warn=no-python-version'] - os.environ['SCONSFLAGS'] = string.join(sconsflags) - apply(TestCommon.__init__, [self], kw) import SCons.Node.FS @@ -341,6 +332,26 @@ class TestSCons(TestCommon): build_str + \ term + def run(self, *args, **kw): + """ + Add the --warn=no-python-version option to SCONSFLAGS every + command so test scripts don't have to filter out Python version + deprecation warnings. + """ + save_sconsflags = os.environ.get('SCONSFLAGS') + if deprecated_python_version(): + if save_sconsflags: + sconsflags = [save_sconsflags] + else: + sconsflags = [] + sconsflags = sconsflags + ['--warn=no-python-version'] + os.environ['SCONSFLAGS'] = string.join(sconsflags) + try: + result = apply(TestCommon.run, (self,)+args, kw) + finally: + sconsflags = save_sconsflags + return result + def up_to_date(self, options = None, arguments = None, read_str = "", **kw): s = "" for arg in string.split(arguments): -- cgit v0.12