From d82d5b37cebce569cb8c463736102176bbda58af Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=A9dric=20Aguerre?= Date: Fri, 19 Aug 2016 15:01:46 +0200 Subject: [PATCH] Add command to show software versions --- bin/appliskel/.salome-completion.sh | 2 +- bin/salomeContext.py | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/bin/appliskel/.salome-completion.sh b/bin/appliskel/.salome-completion.sh index 07dcd4ba4..68beb5af3 100644 --- a/bin/appliskel/.salome-completion.sh +++ b/bin/appliskel/.salome-completion.sh @@ -77,7 +77,7 @@ _salome() options='-h --help -p --port= -m --machine= -d --directory= -u --user= --with-mpi-module= --config= --extra_env=' ;; info) - options='-h --help -p --ports -v --version' + options='-h --help -p --ports -s --softwares -v --version' ;; connect) options='-h --help -c -p' diff --git a/bin/salomeContext.py b/bin/salomeContext.py index 2b74009bc..c5eda0a51 100644 --- a/bin/salomeContext.py +++ b/bin/salomeContext.py @@ -447,6 +447,24 @@ class SalomeContext: return runTests.runTests(args, exe="salome test") # + def _showSoftwareVersions(self): + config = ConfigParser.SafeConfigParser() + absoluteAppliPath = os.getenv('ABSOLUTE_APPLI_PATH') + filename = os.path.join(absoluteAppliPath, ".softwares_versions") + try: + config.read(filename) + sections = config.sections() + for section in sections: + entries = config.items(section, raw=True) # do not use interpolation + for key,val in entries: + version,text = [ x.strip() for x in val.split(',') ] + print "%s: %s"%(text, version) + except: + import traceback + traceback.print_exc() + return + pass + def _showInfo(self, args=None): if args is None: args = [] @@ -455,7 +473,8 @@ class SalomeContext: epilog = """\n Display some information about SALOME.\n Available options are: - -p,--ports Show list of busy ports (running SALOME instances). + -p,--ports Show the list of busy ports (running SALOME instances). + -s,--softwares Show the list and versions of SALOME softwares. -v,--version Show running SALOME version. -h,--help Show this message. """ @@ -473,6 +492,9 @@ Available options are: if ports: print "Last started instance on port %s"%ports[-1] + if "-s" in args or "--softwares" in args: + self._showSoftwareVersions() + if "-v" in args or "--version" in args: print "Running with python", platform.python_version() self._runAppli(["--version"]) -- 2.39.2