From b7b2824975ff4c113c32a5dca6df74cf10172f73 Mon Sep 17 00:00:00 2001 From: stevenknight Date: Mon, 10 Sep 2001 18:48:55 +0000 Subject: [PATCH] Fill in the -v option. git-svn-id: http://scons.tigris.org/svn/scons/trunk@36 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/scons.py | 14 +++++++++++++- test/option-v.py | 12 ++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/scons.py b/src/scons.py index 49f8deca..7f86d152 100644 --- a/src/scons.py +++ b/src/scons.py @@ -1,4 +1,9 @@ #! /usr/bin/env python +# +# SCons +# + +__revision__ = "scons.py __REVISION__ __DATE__ __DEVELOPER__" import getopt import os.path @@ -363,7 +368,12 @@ Option(func = opt_not_yet, future = 1, short = 'u', long = ['up', 'search-up'], help = "Search up directory tree for SConstruct.") -Option(func = opt_not_yet, +def option_v(opt, arg): + print "SCons version __VERSION__, by Steven Knight et al." + print "Copyright 2001 Steven Knight" + sys.exit(0) + +Option(func = option_v, short = 'v', long = ['version'], help = "Print the SCons version number and exit.") @@ -483,6 +493,8 @@ def main(): if __name__ == "__main__": try: main() + except SystemExit: + pass except KeyboardInterrupt: print "Build interrupted." except SyntaxError, e: diff --git a/test/option-v.py b/test/option-v.py index 6e7ca07e..02b8f2c8 100644 --- a/test/option-v.py +++ b/test/option-v.py @@ -14,13 +14,17 @@ test.write('SConstruct', "") test.run(chdir = '.', arguments = '-v') -test.fail_test(test.stderr() != - "Warning: the -v option is not yet implemented\n") +expect = r"""SCons version \S+, by Steven Knight et al. +Copyright 2001 Steven Knight +""" + +test.fail_test(not test.match_re(test.stdout(), expect)) +test.fail_test(test.stderr() != "") test.run(chdir = '.', arguments = '--version') -test.fail_test(test.stderr() != - "Warning: the --version option is not yet implemented\n") +test.fail_test(not test.match_re(test.stdout(), expect)) +test.fail_test(test.stderr() != "") test.pass_test() -- 2.26.2