--- a/Beremiz_service.py Wed Sep 12 11:36:50 2018 +0200
+++ b/Beremiz_service.py Wed Sep 12 22:59:30 2018 +0200
@@ -40,7 +40,13 @@
import util.paths as paths
+def version():
+ from version import app_version
+ print("Beremiz_service: ", app_version)
+
+
def usage():
+ version()
print("""
Usage of Beremiz PLC execution service :\n
%s {[-n servicename] [-i IP] [-p port] [-x enabletaskbar] [-a autostart]|-h|--help} working_dir
@@ -61,8 +67,8 @@
try:
- opts, argv = getopt.getopt(sys.argv[1:], "i:p:n:x:t:a:w:c:e:s:h")
-except getopt.GetoptError, err:
+ opts, argv = getopt.getopt(sys.argv[1:], "i:p:n:x:t:a:w:c:e:s:h", ["help", "version"])
+except getopt.GetoptError as err:
# print help information and exit:
print(str(err)) # will print something like "option -a not recognized"
usage()
@@ -84,9 +90,12 @@
extensions = []
for o, a in opts:
- if o == "-h":
+ if o == "-h" or o == "--help":
usage()
sys.exit()
+ if o == "--version":
+ version()
+ sys.exit()
elif o == "-i":
if len(a.split(".")) == 4 or a == "localhost":
given_ip = a
@@ -135,6 +144,7 @@
__builtin__.__dict__['_'] = lambda x: x
# TODO: add a cmdline parameter if Trying Preloading Xenomai makes problem
TryPreloadXenomai()
+ version()
def Bpath(*args):