From fc9c1d719629858fcaa077ad5661bf414864220a Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 25 Jun 2009 13:31:31 -0400 Subject: [PATCH] Added auto-generated version info. (be --version) --- Makefile | 13 +++++++++++-- be | 4 +++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 47fbbfd..f924608 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,9 @@ MODULES += ${DOC_DIR} RM = rm +PREFIX = ${HOME} +INSTALL_OPTIONS = "--prefix=${PREFIX}" + .PHONY: all all: build @@ -36,12 +39,18 @@ include $(patsubst %,%/module.mk,${MODULES}) .PHONY: build -build: +build: libbe/_version.py + python setup.py build .PHONY: install -install: +install: doc build + python setup.py install ${INSTALL_OPTIONS} + cp -v xml/* ${PREFIX}/bin .PHONY: clean clean: $(RM) -rf ${GENERATED_FILES} + +libbe/_version.py: + bzr version-info --format python > $@ diff --git a/be b/be index 35dab69..fbe964f 100755 --- a/be +++ b/be @@ -18,7 +18,7 @@ import sys -from libbe import cmdutil +from libbe import cmdutil, _version __doc__ == cmdutil.help() @@ -28,6 +28,8 @@ elif sys.argv[1] == '--complete': for command, module in cmdutil.iter_commands(): print command print '\n'.join(["--help","--complete","--options"]) +elif sys.argv[1] == '--version': + print _version.version_info["revision_id"] else: try: try: -- 2.26.2