From 0510a9773d213732892dd6a0a8644a252d95f4b5 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 15 Sep 2009 09:32:40 -0400 Subject: Added libbe.version, wrapping the auto-generated libbe._version. Two major benefits: 1) Programatic access to the BE version. Previously the version-string logic was internal to the commandline interface ./be, which left the other interfaces hanging. 2) Simple to override auto-generated revision id version with any string you like (by setting libbe.version._VERSION, if that's the way you want to run things or the way your packaging system requires. Note that other modules should never read libbe.version._VERSION, since it may not be defined. Instead they should use the output of libbe.version.version(). --- be | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'be') diff --git a/be b/be index 36deaba..1f7e4a3 100755 --- a/be +++ b/be @@ -21,7 +21,7 @@ import os import sys -from libbe import cmdutil, _version +from libbe import cmdutil, version __doc__ = cmdutil.help() @@ -51,7 +51,7 @@ except cmdutil.GetCompletions, e: sys.exit(0) if options.version == True: - print _version.version_info["revision_id"] + print version.version() sys.exit(0) if options.dir != None: os.chdir(options.dir) -- cgit From 5d03e60a2a12074e8d2cfb705d47f40a45cdf730 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 15 Sep 2009 18:59:16 -0400 Subject: Added `be --verbose-version' option to print full version information. --- be | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'be') diff --git a/be b/be index 1f7e4a3..feacfb4 100755 --- a/be +++ b/be @@ -31,6 +31,8 @@ parser = cmdutil.CmdOptionParser(usage) parser.command = "be" parser.add_option("--version", action="store_true", dest="version", help="Print version string and exit.") +parser.add_option("--verbose-version", action="store_true", dest="verbose_version", + help="Print verbose version information and exit.") parser.add_option("-d", "--dir", dest="dir", metavar="DIR", help="Run this command from DIR instead of the current directory.") @@ -50,8 +52,8 @@ except cmdutil.GetCompletions, e: print '\n'.join(e.completions) sys.exit(0) -if options.version == True: - print version.version() +if options.version == True or options.verbose_version == True: + print version.version(verbose=options.verbose_version) sys.exit(0) if options.dir != None: os.chdir(options.dir) -- cgit