From: Cédric Aguerre Date: Mon, 24 Oct 2016 11:49:21 +0000 (+0200) Subject: show software info X-Git-Tag: V8_2_0a1~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5076f07bf7c5e2ea320e2bbad7748425960ad635;p=modules%2Fkernel.git show software info --- diff --git a/bin/appli_gen.py b/bin/appli_gen.py index 4c64c7a79..4e04d1d32 100644 --- a/bin/appli_gen.py +++ b/bin/appli_gen.py @@ -43,6 +43,7 @@ import optparse appli_tag = "application" prereq_tag = "prerequisites" context_tag = "context" +sha1_collect_tag = "sha1_collections" system_conf_tag = "system_conf" modules_tag = "modules" module_tag = "module" @@ -93,6 +94,10 @@ class xml_parser: if self.space == [appli_tag, context_tag] and path_att in attrs.getNames(): self.config["context_path"] = attrs.getValue( path_att ) pass + # --- if we are analyzing "sha1_collection" element then store its "path" attribute + if self.space == [appli_tag, sha1_collect_tag] and path_att in attrs.getNames(): + self.config["sha1_collect_path"] = attrs.getValue( path_att ) + pass # --- if we are analyzing "system_conf" element then store its "path" attribute if self.space == [appli_tag, system_conf_tag] and path_att in attrs.getNames(): self.config["system_conf_path"] = attrs.getValue( path_att ) @@ -275,6 +280,14 @@ def install(prefix, config_file, verbose=0): print "WARNING: context file does not exist" pass + if _config.has_key("sha1_collect_path") and os.path.isfile(_config["sha1_collect_path"]): + shutil.copyfile(_config["sha1_collect_path"], + os.path.join(home_dir, 'sha1_collections.txt')) + pass + else: + print "WARNING: context file does not exist" + pass + if _config.has_key("system_conf_path") and os.path.isfile(_config["system_conf_path"]): shutil.copyfile(_config["system_conf_path"], os.path.join(home_dir, 'env.d', 'envConfSystem.sh')) diff --git a/bin/salomeContext.py b/bin/salomeContext.py index c5eda0a51..ac6f616bb 100644 --- a/bin/salomeContext.py +++ b/bin/salomeContext.py @@ -447,22 +447,30 @@ class SalomeContext: return runTests.runTests(args, exe="salome test") # - def _showSoftwareVersions(self): + def _showSoftwareVersions(self, softwares=None): 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 + filename = os.path.join(absoluteAppliPath, "sha1_collections.txt") + versions = {} + max_len = 0 + with open(filename) as f: + for line in f: + try: + software, version, sha1 = line.split() + versions[software.upper()] = version + if len(software) > max_len: + max_len = len(software) + except: + pass + pass + pass + if softwares: + for soft in softwares: + if versions.has_key(soft.upper()): + print soft.upper().rjust(max_len), versions[soft.upper()] + else: + for name, version in versions.items(): + print name.rjust(max_len), versions[name] pass def _showInfo(self, args=None):