[virt-tools-list] [virt-bootstrap] [PATCH v6 18/26] Add --version flag
Radostin Stoyanov
rstoyanov1 at gmail.com
Thu Aug 17 09:39:56 UTC 2017
---
setup.py | 6 +++++-
src/virtBootstrap/__init__.py | 3 +--
src/virtBootstrap/virt_bootstrap.py | 6 ++++++
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/setup.py b/setup.py
index 0d047c3..0f617e4 100755
--- a/setup.py
+++ b/setup.py
@@ -12,6 +12,10 @@ import sys
import subprocess
import setuptools
+# pylint: disable=import-error, wrong-import-position
+sys.path.insert(0, 'src') # noqa: E402
+import virtBootstrap
+
def read(fname):
"""
@@ -70,7 +74,7 @@ class CheckPylint(setuptools.Command):
setuptools.setup(
name='virt-bootstrap',
- version='0.1.0',
+ version=virtBootstrap.__version__,
author='Cedric Bosdonnat',
author_email='cbosdonnat at suse.com',
description='Container bootstrapping tool',
diff --git a/src/virtBootstrap/__init__.py b/src/virtBootstrap/__init__.py
index 3f8346b..68bf28f 100644
--- a/src/virtBootstrap/__init__.py
+++ b/src/virtBootstrap/__init__.py
@@ -22,5 +22,4 @@ virt-bootstrap - Is a tool providing an easy way to setup the root file system
"""
from virtBootstrap.virt_bootstrap import bootstrap
-
-__version__ = "0.1.0"
+from virtBootstrap.virt_bootstrap import __version__
diff --git a/src/virtBootstrap/virt_bootstrap.py b/src/virtBootstrap/virt_bootstrap.py
index 68e6516..50fb604 100755
--- a/src/virtBootstrap/virt_bootstrap.py
+++ b/src/virtBootstrap/virt_bootstrap.py
@@ -37,6 +37,9 @@ from virtBootstrap import progress
from virtBootstrap import utils
+__version__ = "0.1.0"
+
+
gettext.bindtextdomain("virt-bootstrap", "/usr/share/locale")
gettext.textdomain("virt-bootstrap")
try:
@@ -218,6 +221,9 @@ def main():
parser.add_argument("--status-only", action="store_const",
const=utils.write_progress,
help=_("Show only progress information"))
+ parser.add_argument('--version', action='version',
+ version='%(prog)s ' + __version__,
+ help=_("Print the version"))
try:
args = parser.parse_args()
--
2.13.5
More information about the virt-tools-list
mailing list