]> SALOME platform Git repositories - modules/yacs.git/commitdiff
Salome HOME
show software info
authorCédric Aguerre <cedric.aguerre@edf.fr>
Mon, 24 Oct 2016 11:49:21 +0000 (13:49 +0200)
committerCédric Aguerre <cedric.aguerre@edf.fr>
Mon, 24 Oct 2016 11:49:21 +0000 (13:49 +0200)
bin/appli_gen.py
bin/salomeContext.py

index 4c64c7a79b8a234254d55d6ee4ba961521a7ad48..4e04d1d3256f84712f93c8ac0c82fc4dbd295b5f 100644 (file)
@@ -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'))
index c5eda0a516aae432bd351660860b6baa6970c852..ac6f616bb167d4716ed0fec45a40edef259bd77e 100644 (file)
@@ -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):