From b5ee2df91ff32bf5bfe0cff64428f6ac7e9e013c Mon Sep 17 00:00:00 2001 From: giovannibajo Date: Wed, 28 Apr 2010 09:36:05 +0000 Subject: [PATCH] Restore compatibility with Python 2.3 git-svn-id: http://svn.pyinstaller.org/trunk@826 8dd32b29-ccff-0310-8a9a-9233e24343b1 --- buildtests/runtests.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/buildtests/runtests.py b/buildtests/runtests.py index c1405c7..7e39a48 100755 --- a/buildtests/runtests.py +++ b/buildtests/runtests.py @@ -98,10 +98,12 @@ def runtests(alltests, filters=None, configfile=None, run_executable=1): tests = [] for part in filters: tests += [t for t in alltests if part in t and t not in tests] - tests.sort(key=lambda x: (len(x), x)) # test1 < test10 + + tests = [(len(x), x) for x in tests] + tests.sort() path = os.environ["PATH"] counter = dict(passed=[],failed=[]) - for test in tests: + for _,test in tests: test = os.path.splitext(os.path.basename(test))[0] _msg("BUILDING TEST", test) prog = string.join([PYTHON, PYOPTS, os.path.join(HOME, 'Build.py'), @@ -144,8 +146,12 @@ if __name__ == '__main__': interactive_tests = glob.glob('test*i.spec') from optparse import OptionParser - parser = OptionParser(usage="%prog [options] [TEST-NAME ...]", - epilog="TEST-NAME can be the name of the .py-file, the .spec-file or only the basename.") + if sys.version_info < (2,4): + parser = OptionParser(usage="%prog [options] [TEST-NAME ...]") + else: + parser = OptionParser(usage="%prog [options] [TEST-NAME ...]", + epilog="TEST-NAME can be the name of the .py-file, the .spec-file or only the basename.") + parser.add_option('-c', '--clean', action='store_true', help='Clean up generated files') parser.add_option('-i', '--interactive-tests', action='store_true',