Print waf version

This commit is contained in:
Waf Project 2024-05-12 02:20:25 +02:00
parent 66a013ed28
commit 4d0edd113a
2 changed files with 5 additions and 1 deletions

View File

@ -134,7 +134,8 @@ class OptionsContext(Context.Context):
p('--zones', dest='zones', default='', action='store', help='debugging zones (task_gen, deps, tasks, etc)')
p('--profile', dest='profile', default=0, action='store_true', help=argparse.SUPPRESS)
p('--pdb', dest='pdb', default=0, action='store_true', help=argparse.SUPPRESS)
p('-h', '--help', dest='whelp', default=0, action='store_true', help="show this help message and exit")
p('-h', '--help', dest='whelp', default=0, action='store_true', help='show this help message and exit')
p('--version', dest='version', default=False, action='store_true', help='show the Waf version and exit')
gr = self.add_option_group('Configuration options')

View File

@ -51,6 +51,9 @@ def waf_entry_point(current_directory, version, wafdir):
ctx = Context.create_context('options')
(options, commands) = ctx.parse_cmd_args(allow_unknown=True)
if options.version:
print('%s %s (%s)'%(Context.WAFNAME, Context.WAFVERSION, Context.WAFREVISION))
sys.exit(0)
if options.top:
start_dir = Context.run_dir = Context.top_dir = options.top
no_climb = True