summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Traut <manut@linutronix.de>2017-12-04 15:24:46 +0100
committerManuel Traut <manut@linutronix.de>2017-12-04 15:24:46 +0100
commit819e9489ce3d3d240cae36d947b14d7c6503ecc4 (patch)
tree561d9c0b6f9aa6c5b0a9b65ecdfcb0d5e6b166a8
parent39db08abe769ece5ac93d05b83f07aa2cf73dbf8 (diff)
add option parser and --version parameter
future extensions will need an optionparser. also a --version parameter is useful. Signed-off-by: Manuel Traut <manut@linutronix.de>
-rwxr-xr-xpyju/version.py9
-rwxr-xr-xpyjutest16
-rwxr-xr-x[-rw-r--r--]setup.py5
3 files changed, 27 insertions, 3 deletions
diff --git a/pyju/version.py b/pyju/version.py
new file mode 100755
index 0000000..d19ccec
--- /dev/null
+++ b/pyju/version.py
@@ -0,0 +1,9 @@
+#!/usr/bin/env python3
+#
+# (C) 2017 - Manuel Traut <manut@mecka.net>
+#
+# SPDX-License-Identifier: GPL-3.0
+#
+# pyjutest - junit xml generator
+
+pyju_version = "1.3"
diff --git a/pyjutest b/pyjutest
index b18a36c..b3ca92d 100755
--- a/pyjutest
+++ b/pyjutest
@@ -11,13 +11,25 @@ from __future__ import print_function
from junit_xml import TestSuite, TestCase
from pickle import dump, load
from subprocess import Popen, PIPE, STDOUT
+from optparse import OptionParser
import os
import sys
import time
-if len (sys.argv) != 2:
- print("%s 'mycmd param1' # to record a test" % sys.argv[0])
+from pyju.version import pyju_version
+
+oparser = OptionParser(usage="usage: %prog [options] \'mycmd param1 param2\'")
+oparser.add_option("--version", dest="version", action="store_true", default=False)
+
+(opt,args) = oparser.parse_args(sys.argv)
+
+if opt.version:
+ print("pyjutest v%s" % pyju_version)
+ sys.exit(0)
+
+if len(args) != 2:
+ oparser.print_help()
sys.exit(-1)
if os.path.exists('pyjutest.dat'):
diff --git a/setup.py b/setup.py
index 49d6cbb..e12676e 100644..100755
--- a/setup.py
+++ b/setup.py
@@ -2,11 +2,14 @@
from distutils.core import setup
+from pyju.version import pyju_version
+
setup(name='pyjutest',
- version='1.3',
+ version=pyju_version,
description='junit xml generator',
author='Manuel Traut',
author_email='manut@linutronix.de',
url='http://mecka.net/',
+ packages=['pyju'],
scripts=['pyjutest'],
)