diff mbox

[Branch,~linaro-image-tools/linaro-image-tools/trunk] Rev 439: Enable -v/--version option.

Message ID 20111005092113.2211.62346.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Mattias Backman Oct. 5, 2011, 9:21 a.m. UTC
Merge authors:
  Mattias Backman (mabac)
Related merge proposals:
  https://code.launchpad.net/~mabac/linaro-image-tools/display-version/+merge/77872
  proposed by: Mattias Backman (mabac)
------------------------------------------------------------
revno: 439 [merge]
committer: Mattias Backman <mattias.backman@linaro.org>
branch nick: trunl
timestamp: Wed 2011-10-05 11:12:42 +0200
message:
  Enable -v/--version option.
added:
  linaro_image_tools/__version__.py
modified:
  do-release
  linaro-hwpack-create
  linaro_image_tools/media_create/__init__.py
  setup.py


--
lp:linaro-image-tools
https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk

You are subscribed to branch lp:linaro-image-tools.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'do-release'
--- do-release	2011-05-23 15:07:05 +0000
+++ do-release	2011-10-04 09:34:27 +0000
@@ -22,6 +22,11 @@ 
     exit 1
 }
 
+set_version() {
+    log_i "Setting version to $1 in __version__.py"
+    sed -i "s/^__version__ =.*/__version__ = \"$1\"/" linaro_image_tools/__version__.py
+}
+
 version="$1"
 
 if [ -z "$version" ]; then
@@ -47,8 +52,7 @@ 
     die "Tag $version already exists"
 fi
 
-log_i "Setting version to $version in setup.py"
-sed -i "s/^\\([[:space:]]*version=\"\\)[^\"]*\",\$/\1$version\",/" setup.py
+set_version $version
 
 log_i "Committing $version"
 bzr commit -m "Release $version"
@@ -68,8 +72,7 @@ 
 log_i "Signing tarball"
 gpg --armor --sign --detach-sig "../linaro-image-tools-$version.tar.gz"
 
-log_i "Setting version to $version.1 in setup.py"
-sed -i "s/^\\([[:space:]]*version=\"\\)[^\"]*\",\$/\1$version.1\",/" setup.py
+set_version "$version.1"
 
-log_i "Committing $version"
+log_i "Committing $version.1"
 bzr commit -m "Post-release version bump to $version.1"

=== modified file 'linaro-hwpack-create'
--- linaro-hwpack-create	2011-05-25 15:47:02 +0000
+++ linaro-hwpack-create	2011-10-03 08:18:45 +0000
@@ -27,9 +27,10 @@ 
 from linaro_image_tools.hwpack.builder import (
     ConfigFileMissing, HardwarePackBuilder)
 
+from linaro_image_tools.__version__ import __version__
 
 if __name__ == '__main__':
-    parser = argparse.ArgumentParser()
+    parser = argparse.ArgumentParser(version='%(prog)s ' + __version__)
     parser.add_argument(
         "CONFIG_FILE",
         help="The configuration file to take the hardware pack information "

=== added file 'linaro_image_tools/__version__.py'
--- linaro_image_tools/__version__.py	1970-01-01 00:00:00 +0000
+++ linaro_image_tools/__version__.py	2011-10-04 10:51:40 +0000
@@ -0,0 +1,1 @@ 
+__version__ = "2011.09.1"

=== modified file 'linaro_image_tools/media_create/__init__.py'
--- linaro_image_tools/media_create/__init__.py	2011-08-19 14:04:54 +0000
+++ linaro_image_tools/media_create/__init__.py	2011-10-03 08:18:45 +0000
@@ -21,6 +21,7 @@ 
 
 from linaro_image_tools.media_create.boards import board_configs
 from linaro_image_tools.media_create.android_boards import android_board_configs
+from linaro_image_tools.__version__ import __version__
 
 
 KNOWN_BOARDS = board_configs.keys()
@@ -47,7 +48,7 @@ 
 
 def get_args_parser():
     """Get the ArgumentParser for the arguments given on the command line."""
-    parser = argparse.ArgumentParser()
+    parser = argparse.ArgumentParser(version='%(prog)s ' + __version__)
     group = parser.add_mutually_exclusive_group(required=True)
     group.add_argument(
         '--mmc', dest='device', help='The storage device to use.')
@@ -128,7 +129,7 @@ 
 
 def get_android_args_parser():
     """Get the ArgumentParser for the arguments given on the command line."""
-    parser = argparse.ArgumentParser()
+    parser = argparse.ArgumentParser(version='%(prog)s ' + __version__)
     group = parser.add_mutually_exclusive_group(required=True)
     group.add_argument(
         '--mmc', dest='device', help='The storage device to use.')

=== modified file 'setup.py'
--- setup.py	2011-09-23 07:41:58 +0000
+++ setup.py	2011-10-03 08:37:32 +0000
@@ -2,10 +2,12 @@ 
 
 # https://launchpad.net/python-distutils-extra
 import DistUtilsExtra.auto
+from linaro_image_tools.__version__ import __version__
+
 
 DistUtilsExtra.auto.setup(
         name="linaro-image-tools",
-        version="2011.09.1",
+        version=__version__,
         description="Tools to create and write Linaro images",
         url="https://launchpad.net/linaro-image-tools",
         license="GPL v3 or later",