+ msg = "There is no read access for %s file!"%xml_file
+ error_exit(msg, False)
+ pass
+
+#==============================================================
+# get_supported_plts : gets map of supported Linux platforms and
+# corresponding configuration files
+#===============================================================
+def get_supported_platforms(xml_file=None):
+ """
+ Gets map of supported Linux platforms and
+ corresponding configuration files.
+ """
+ platforms_map = {}
+ if xml_file:
+ xml_file_list = [xml_file]
+ pass
+ else:
+ xml_file_list = filter(lambda i: i.endswith(".xml"), os.listdir(get_program_path()))
+ while 'config.xml' in xml_file_list: xml_file_list.remove('config.xml')
+ if os.path.exists(os.path.join(get_program_path(), 'config.xml')):
+ xml_file_list.append('config.xml')
+ xml_file_list = [os.path.abspath(i) for i in xml_file_list]
+ pass
+ for an_xml_file in xml_file_list: # XML files parsing
+ check_xml_file(an_xml_file)
+ parser = ConfigParser()
+ parser.parse(an_xml_file)
+ if parser.config.platforms is not None:
+ for plt in parser.config.platforms.split(","):
+ if not plt or plt in platforms_map.keys(): continue
+ platforms_map[strip(plt)] = an_xml_file
+ pass
+ pass
+ pass
+ return platforms_map
+
+#==============================================================
+# Print menu with list of supported platform
+# and return user choice
+#===============================================================
+def select_platform(all_platforms):
+ platforms = all_platforms.keys()
+ platforms.sort()
+ pltname = None
+ while not pltname:
+ print "Please, select any platform from the list below."
+ print "--------------------------"
+ for idx in range(len(platforms)):
+ print " %2d. %s" % (idx+1, " ".join(platforms[idx].split("_")))
+ print " 0. Exit"
+ print "--------------------------"
+ print "Type your choice (%d-%d) and press <Enter>:" % (0, len(platforms)),
+ try:
+ idx = raw_input()
+ except:
+ sys.exit(1)
+ try:
+ idx = int(idx)
+ except:
+ warning("Invalid input!")
+ pass
+ if idx == 0: sys.exit(0)
+ if idx > 0 and idx <= len(platforms):
+ pltname = platforms[idx-1]
+ else:
+ warning("Invalid input!")
+ 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 #
+# #
+#------------------------------------------------------------------#
+
+if __name__ == "__main__":
+ # parse command line
+ [xml_file, target_dir, tmp_dir, is_gui, is_force_src, is_single_dir, pltname] = parse_parameters()
+ if xml_file: xml_file = os.path.abspath(xml_file)
+ if target_dir: target_dir = os.path.abspath(target_dir)
+ if tmp_dir: tmp_dir = os.path.abspath(tmp_dir)
+ # get program dir
+ cur_dir = get_program_path()