diff options
-rw-r--r-- | src/scons.py | 14 | ||||
-rw-r--r-- | test/option-v.py | 12 |
2 files changed, 21 insertions, 5 deletions
diff --git a/src/scons.py b/src/scons.py index 49f8dec..7f86d15 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 6e7ca07..02b8f2c 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() |