Salome HOME
Update for Salome 5.1.2
[tools/install.git] / runInstall
index 3f82079cd2fe104bb990f5ad95a1e1a6ac7dfc2b..70bfc6c47c4ea60d983f5601fc599020c4c9fee5 100755 (executable)
@@ -373,6 +373,7 @@ class Config :
     - SALOME platform version
     - Copyright and license info
     - Default target and temporary directories
+    - List of optional libraries for Salome
     """
     def __init__(self,
                  theVersion   = None,
@@ -381,7 +382,8 @@ class Config :
                  theLicense   = None,
                  thePlatforms = None,
                  theTargetdir = None,
-                 theTmpdir    = None):
+                 theTmpdir    = None,
+                 theOptLibs   = None):
         self.version   = strip(theVersion)
         self.caption   = strip(theCaption)
         self.copyright = strip(theCopyright)
@@ -389,6 +391,7 @@ class Config :
         self.platforms = strip(thePlatforms)
         self.targetdir = strip(theTargetdir)
         self.tmpdir    = strip(theTmpdir)
+        self.optlibs   = strip(theOptLibs)
 
 #==============================================================
 # class Product : pre-requisite product options
@@ -456,7 +459,8 @@ class ConfigParser:
                              configElem.getAttribute('license').strip(),
                              configElem.getAttribute('platforms').strip(),
                              configElem.getAttribute('targetdir').strip(),
-                             configElem.getAttribute('tempdir').strip())
+                             configElem.getAttribute('tempdir').strip(),
+                             configElem.getAttribute('optionallibs').strip())
         if not self.pltname and self.config.platforms:
             self.pltname = self.config.platforms.split(",")[0].strip()
         pass
@@ -1098,6 +1102,46 @@ def select_platform(all_platforms):
         pass
     return pltname, all_platforms[pltname]
 
+#==============================================================
+# Check existence of required libraries in system and
+# warn user if some ones are absent
+#===============================================================
+def check_not_found_libs(filepath, optlibs):
+    a_file = open(filepath, 'r')
+    nf_mand_libs = list()
+    nf_opt_libs = list()
+    pref_opt_libs = optlibs.split(",")
+    for line in a_file:
+        line = line.strip()
+        if not line:
+            continue
+        line = line.split(" ")[0]
+        if line in nf_mand_libs or line in nf_opt_libs:
+            continue
+        is_optional = False;
+        for opt_lib in pref_opt_libs:
+            if line.lower().startswith(opt_lib.lower().strip()):
+                is_optional = True
+                break
+        if is_optional:
+            nf_opt_libs.append(line)
+        else:
+            nf_mand_libs.append(line)
+        pass
+
+    msg = "=== WARNING: Some libraries are absent! ===\n"
+    if nf_mand_libs:
+        msg += "One or several MANDATORY libraries listed below are not found. SALOME may not work properly.\n\t"
+        msg += "\n\t".join(nf_mand_libs)
+        msg += "\n"
+    if nf_opt_libs:
+        msg += "One or several OPTIONAL libraries listed below are not found. This does not affect on the correct work of SALOME platform.\n\t"
+        msg += "\n\t".join(nf_opt_libs)
+    if nf_mand_libs or nf_opt_libs:
+        print msg
+    a_file.close()
+    pass
+
 #------------------------------------------------------------------#
 #                                                                  #
 #                    EXECUTION STARTS HERE                         #
@@ -1301,12 +1345,6 @@ if __name__ == "__main__":
         rm_src_tmp = "FALSE"
         pass
 
-    # modify *.la files, if --single-directory option was  -----------
-    if is_single_dir:
-        message("Modifying of *.la files of SALOME modules...")
-        cmd = '%s/modifyLaFiles.sh modify_la_files %s' % (scripts_dir, target_dir)
-        res = os.system(cmd)
-
     # pickup environment -----------
     message("Creating environment files")
     for product in parser.products :
@@ -1333,6 +1371,19 @@ if __name__ == "__main__":
             pass
         pass
 
+    if not is_force_src:
+        if is_single_dir:
+            # modify *.la files, if --single-directory option was pointed -----------
+            message("Modifying of *.la files of SALOME modules...")
+            cmd = '%s/modifyLaFiles.sh modify_la_files %s' % (scripts_dir, target_dir)
+            res = os.system(cmd)
+        else:
+            # check that all required libraries are in system
+            message("Check existence of Fortran and other required libraries...")
+            cmd = '%s/checkFortran.sh find_libraries %s > %s/not_found_libs.txt' % (scripts_dir, target_dir, tmp_dir)
+            if os.system(cmd):
+                check_not_found_libs("%s/not_found_libs.txt" % (tmp_dir), parser.config.optlibs)
+
     # clean temporary directory -----------
     message("Cleaning temporary directory")
     clean_all()