#!/usr/bin/env python
+import warnings
+warnings.filterwarnings("ignore", "", DeprecationWarning)
+
import xmllib
import sys, os, string, re
# get_help_info
#==============================================================
def get_help_info() :
- str = "\nSALOME2 Installation Wizard\n\n"
+ str = "\nSALOME Installation Wizard\n\n"
str = str + "\tUsage : \n\tInstall [-g|b] [-f <xml-file>] [-t <target-dir>] [-tmp <tmp-dir>]\n"
str = str + "\n"
str = str + " -g Runs the Installation Wizard in the GUI mode.\n"
str = str + " -f <xml-file> The configuration file to be parsed by the Installation Wizard.\n"
str = str + " If this parameter is missed then the script tries to define\n"
str = str + " the Red Hat version and use the corresponding xml. For example,\n"
- str = str + " for Red Hat 8.0 config_RedHat8_0.xml file is supposed to be used\n"
+ str = str + " for Red Hat 8.0 config_RedHat_8.0.xml file is supposed to be used\n"
str = str + " by default. If the appropriate xml file is not found, the config.xml\n"
str = str + " is used by default.\n"
str = str + "\n"
# define xml file -----------------
if (xml_file is None) :
+ plt_name = ""
+ plt_ver = ""
xml_file_name = "config.xml"
- if os.path.exists("/proc/version"):
- data = open("/proc/version").readline()
- res = re.search(r'Red\s+Hat\s+\w+(\s+)?(\d[.]\d)', data)
- if res is not None:
- num = re.sub("[.]", "_", (res.groups())[1])
- filename = "config_RedHat" + num+ ".xml"
- if (os.path.exists(cur_dir + filename)):
- xml_file_name = filename
-
+ if os.path.exists("/etc/redhat-release"):
+ # - Red Hat Linux 8.0
+ # - Red Hat Linux 9
+ # - Mandrake Linux 10.1
+ # - Scientific Linux 3.0.5
+ data = open("/etc/redhat-release").readline()
+ res = re.search(r'(.*)[L|l]inux.*release\s+([\d.]*)', data)
+ if res:
+ plt_name = "".join(res.group(1).split())
+ plt_ver = res.group(2)
+ elif os.path.exists("/etc/debian_version"):
+ # - Debian 3.1
+ plt_name = "Debian"
+ plt_ver = open("/etc/debian_version").readline().strip()
+ _xml_file_name = "config_%s_%s.xml"%(plt_name, plt_ver)
+ if plt_name and plt_ver and os.path.exists(cur_dir + _xml_file_name):
+ xml_file_name = _xml_file_name
+ else:
+ print ""
+ print "Not supported Linux platform!"
+ print "Trying to use default configuration!"
+ print ""
+
xml_file = cur_dir + xml_file_name
- if xml_file is None or not os.path.exists(xml_file):
- error_exit("No xml file is found, try to run with options -f <xmlfile>")
+
+ if not xml_file or not os.path.exists(xml_file):
+ msg = "Configuration file %s is not found!"%xml_file
+ msg += "\nTry to run with -f <xmlfile> option."
+ error_exit(msg)
if not os.access(xml_file, os.R_OK):
- print "There is no read access for "+ xml_file
+ print "There is no read access for %s file!"%xml_file
sys.exit(1)
#---- GUI ----------------