From db71879e94a3ca8daf4bdd744fe345abf7178d6f Mon Sep 17 00:00:00 2001 From: Francesco Vollero Date: Mon, 20 Jan 2014 17:01:20 +0100 Subject: [PATCH] [Enhancement] Added --version flag Change-Id: I4f90673ce4855ada405c4e93c9f4c2c08707e6fe Fix: bz#1011691 --- bin/release.sh | 1 + packstack/installer/run_setup.py | 3 ++- packstack/version.py | 11 +++++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/bin/release.sh b/bin/release.sh index 6a6ebe000..29502bd3b 100755 --- a/bin/release.sh +++ b/bin/release.sh @@ -11,6 +11,7 @@ if [ "$1" = "release" ] ; then SNAPTAG="" else SNAPTAG=$(git log --oneline | wc -l) + sed -i -e "s/SNAPTAG=None/SNAPTAG=${SNAPTAG}/g" packstack/version.py fi python setup.py setopt -o tag_build -s "$SNAPTAG" -c egg_info diff --git a/packstack/installer/run_setup.py b/packstack/installer/run_setup.py index e8376f60f..f93ed5f86 100644 --- a/packstack/installer/run_setup.py +++ b/packstack/installer/run_setup.py @@ -20,6 +20,7 @@ import processors import output_messages from .exceptions import FlagValidationError, ParamValidationError +from packstack import version from packstack.modules.ospluginutils import gethostlist from setup_controller import Controller @@ -702,7 +703,7 @@ def initCmdLineParser(): # Init parser and all general flags usage = "usage: %prog [options] [--help]" - parser = OptionParser(usage) + parser = OptionParser(usage=usage,version="%prog {0} {1}".format(version.release_string(), version.version_string())) parser.add_option("--gen-answer-file", help="Generate a template of an answer file, using this option excludes all other options") parser.add_option("--answer-file", help="Runs the configuration in non-interactive mode, extracting all information from the \ configuration file. using this option excludes all other options") diff --git a/packstack/version.py b/packstack/version.py index bd4a6162c..d1a0130ca 100644 --- a/packstack/version.py +++ b/packstack/version.py @@ -1,11 +1,14 @@ -VERSION = ['2013', '2', '1'] +VERSION = ['2014', '1', '1'] FINAL=False +RELEASE="Icehouse" +SNAPTAG=None + +def release_string(): + return RELEASE def version_string(): if FINAL: return '.'.join(filter(None, VERSION)) else: - return '.'.join(filter(None, VERSION))+"dev" - - + return '.'.join(filter(None, VERSION))+"dev{0}".format(SNAPTAG)