]> SALOME platform Git repositories - modules/kernel.git/blob - bin/appli_gen.py
Salome HOME
269573403290573ea7c11368138a966a1289bfc8
[modules/kernel.git] / bin / appli_gen.py
1 #! /usr/bin/env python3
2 # Copyright (C) 2007-2022  CEA/DEN, EDF R&D, OPEN CASCADE
3 #
4 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
5 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 #
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License, or (at your option) any later version.
11 #
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 # Lesser General Public License for more details.
16 #
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
20 #
21 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #
23
24 # \file appli_gen.py
25 #  Create a %SALOME application (virtual Salome installation)
26 #
27
28 import json
29 import os
30 import sys
31 import shutil
32 import virtual_salome
33 import xml.sax
34 import optparse
35 import subprocess
36
37 usage = """%(prog)s [options]
38 Typical use is:
39   python %(prog)s
40 Typical use with options is:
41   python %(prog)s --verbose --prefix=<install directory> --config=<configuration file>
42 """
43
44 # --- names of tags in XML configuration file
45 appli_tag = "application"
46 prereq_tag = "prerequisites"
47 context_tag = "context"
48 venv_directory_tag = "venv_directory"
49 sha1_collect_tag = "sha1_collections"
50 system_conf_tag = "system_conf"
51 modules_tag = "modules"
52 module_tag = "module"
53 samples_tag = "samples"
54 extra_tests_tag = "extra_tests"
55 extra_test_tag = "extra_test"
56 resources_tag = "resources"
57 env_modules_tag = "env_modules"
58 env_module_tag = "env_module"
59 python_tag = "python"
60
61 # --- names of attributes in XML configuration file
62 nam_att = "name"
63 path_att = "path"
64 gui_att = "gui"
65 version_att = "version"
66 # -----------------------------------------------------------------------------
67
68
69 # --- xml reader for SALOME application configuration file
70
71 class xml_parser:
72     def __init__(self, fileName):
73         print("Configure parser: processing %s ..." % fileName)
74         self.space = []
75         self.config = {}
76         self.config["modules"] = []
77         self.config["guimodules"] = []
78         self.config["extra_tests"] = []
79         self.config["env_modules"] = []
80         parser = xml.sax.make_parser()
81         parser.setContentHandler(self)
82         parser.parse(fileName)
83         pass
84
85     def boolValue(self, text):
86         if text in ("yes", "y", "1"):
87             return 1
88         elif text in ("no", "n", "0"):
89             return 0
90         else:
91             return text
92         pass
93
94     def startElement(self, name, attrs):
95         self.space.append(name)
96         self.current = None
97         # --- if we are analyzing "prerequisites" element then store its "path" attribute
98         if self.space == [appli_tag, prereq_tag] and path_att in attrs.getNames():
99             self.config["prereq_path"] = attrs.getValue( path_att )
100             pass
101         # --- if we are analyzing "context" element then store its "path" attribute
102         if self.space == [appli_tag, context_tag] and path_att in attrs.getNames():
103             self.config["context_path"] = attrs.getValue( path_att )
104             pass
105         # --- if we are analyzing "venv_directory" element then store its "path" attribute
106         if self.space == [appli_tag, venv_directory_tag] and path_att in attrs.getNames():
107             self.config["venv_directory_path"] = attrs.getValue( path_att )
108             pass
109         # --- if we are analyzing "sha1_collection" element then store its "path" attribute
110         if self.space == [appli_tag, sha1_collect_tag] and path_att in attrs.getNames():
111             self.config["sha1_collect_path"] = attrs.getValue( path_att )
112             pass
113         # --- if we are analyzing "python" element then store its "version" attribute
114         if self.space == [appli_tag, python_tag] and version_att in attrs.getNames():
115             self.config["python_version"] = attrs.getValue( version_att )
116             pass
117         # --- if we are analyzing "system_conf" element then store its "path" attribute
118         if self.space == [appli_tag, system_conf_tag] and path_att in attrs.getNames():
119             self.config["system_conf_path"] = attrs.getValue( path_att )
120             pass
121         # --- if we are analyzing "resources" element then store its "path" attribute
122         if self.space == [appli_tag, resources_tag] and path_att in attrs.getNames():
123             self.config["resources_path"] = attrs.getValue( path_att )
124             pass
125         # --- if we are analyzing "samples" element then store its "path" attribute
126         if self.space == [appli_tag, samples_tag] and path_att in attrs.getNames():
127             self.config["samples_path"] = attrs.getValue( path_att )
128             pass
129         # --- if we are analyzing "module" element then store its "name" and "path" attributes
130         elif self.space == [appli_tag,modules_tag,module_tag] and \
131             nam_att in attrs.getNames() and \
132             path_att in attrs.getNames():
133             nam = attrs.getValue( nam_att )
134             path = attrs.getValue( path_att )
135             gui = 1
136             if gui_att in attrs.getNames():
137                 gui = self.boolValue(attrs.getValue( gui_att ))
138                 pass
139             self.config["modules"].append(nam)
140             self.config[nam]=path
141             if gui:
142                 self.config["guimodules"].append(nam)
143                 pass
144             pass
145         # --- if we are analyzing "env_module" element then store its "name" attribute
146         elif self.space == [appli_tag, env_modules_tag, env_module_tag] and \
147                 nam_att in attrs.getNames():
148             nam = attrs.getValue( nam_att )
149             self.config["env_modules"].append(nam)
150             pass
151         # --- if we are analyzing "extra_test" element then store its "name" and "path" attributes
152         elif self.space == [appli_tag,extra_tests_tag,extra_test_tag] and \
153             nam_att in attrs.getNames() and \
154             path_att in attrs.getNames():
155             nam = attrs.getValue( nam_att )
156             path = attrs.getValue( path_att )
157             self.config["extra_tests"].append(nam)
158             self.config[nam]=path
159             pass
160         pass
161
162     def endElement(self, name):
163         self.space.pop()
164         self.current = None
165         pass
166
167     def characters(self, content):
168         pass
169
170     def processingInstruction(self, target, data):
171         pass
172
173     def setDocumentLocator(self, locator):
174         pass
175
176     def startDocument(self):
177         self.read = None
178         pass
179
180     def endDocument(self):
181         self.read = None
182         pass
183
184 # -----------------------------------------------------------------------------
185
186 class params:
187     pass
188
189 # -----------------------------------------------------------------------------
190
191 def makedirs(namedir):
192   if os.path.exists(namedir):
193     dirbak = namedir+".bak"
194     if os.path.exists(dirbak):
195       shutil.rmtree(dirbak)
196     os.rename(namedir, dirbak)
197     os.listdir(dirbak) #sert seulement a mettre a jour le systeme de fichier sur certaines machines
198   os.makedirs(namedir)
199
200 def install(prefix, config_file, verbose=0):
201     home_dir = os.path.abspath(os.path.expanduser(prefix))
202     filename = os.path.abspath(os.path.expanduser(config_file))
203     _config = {}
204     try:
205         parser = xml_parser(filename)
206         _config = parser.config
207     except xml.sax.SAXParseException as inst:
208         print(inst.getMessage())
209         print("Configure parser: parse error in configuration file %s" % filename)
210         pass
211     except xml.sax.SAXException as inst:
212         print(inst.args)
213         print("Configure parser: error in configuration file %s" % filename)
214         pass
215     except Exception:
216         print("Configure parser: Error : can not read configuration file %s, check existence and rights" % filename)
217         pass
218
219     if verbose:
220         for cle,val in _config.items():
221             print(cle, val)
222             pass
223
224     # Remove CTestTestfile.cmake; this file will be filled by successive calls to link_module and link_extra_test
225     try:
226       ctest_file = os.path.join(home_dir, 'bin', 'salome', 'test', "CTestTestfile.cmake")
227       os.remove(ctest_file)
228     except Exception:
229       pass
230
231     for module in _config.get("modules", []):
232         if module in _config:
233             print("--- add module ", module, _config[module])
234             options = params()
235             options.verbose = verbose
236             options.clear = 0
237             options.prefix = home_dir
238             options.module_name = module
239             options.module_path = _config[module]
240             virtual_salome.link_module(options)
241             # To fix GEOM_TestXAO issue https://codev-tuleap.cea.fr/plugins/tracker/?aid=16599
242             if module == "GEOM":
243                 # link <appli_path>/bin/salome/test/<module> to <module_path>/bin/salome/test
244                 test_dir=os.path.join(home_dir,'bin','salome', 'test')
245                 module_dir=os.path.abspath(options.module_path)
246                 xao_link=os.path.join(module_dir,'bin','salome', 'test', "xao")
247                 print("link %s --> %s"%(os.path.join(test_dir, "xao"), xao_link))
248                 virtual_salome.symlink(xao_link, os.path.join(test_dir, "xao"))
249             pass
250         pass
251
252     for extra_test in _config.get("extra_tests", []):
253         if extra_test in _config:
254             print("--- add extra test ", extra_test, _config[extra_test])
255             options = params()
256             options.verbose = verbose
257             options.clear = 0
258             options.prefix = home_dir
259             options.extra_test_name = extra_test
260             options.extra_test_path = _config[extra_test]
261             virtual_salome.link_extra_test(options)
262             pass
263         pass
264
265     # Sort test labels by name in generated CTestTestfile.cmake
266     with open(ctest_file) as f:
267         lines = f.readlines()
268     lines.sort()
269     with open(ctest_file, "w") as f:
270         f.write("".join(lines))
271
272     # Generate CTestCustom.cmake to handle long output
273     ctest_custom = os.path.join(home_dir, 'bin', 'salome', 'test', "CTestCustom.cmake")
274     with open(ctest_custom, 'w') as f:
275       f.write("SET(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 1048576) # 1MB\n")
276       f.write("SET(CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE 1048576) # 1MB\n")
277
278     appliskel_dir = os.path.join(prefix, 'bin', 'salome', 'appliskel')
279
280     for fn in ('envd',
281                'getAppliPath.py',
282                'kill_remote_containers.py',
283                'runRemote.sh',
284                'runRemoteSSL.sh',
285                '.salome_run',
286                'salome',
287                'salome_mesa',
288                'salome_common.py',
289                'update_catalogs.py',
290                '.bashrc',
291                ):
292         virtual_salome.symlink( os.path.join( appliskel_dir, fn ), os.path.join( home_dir, fn) )
293         pass
294
295     if filename != os.path.join(home_dir,"config_appli.xml"):
296         shutil.copyfile(filename, os.path.join(home_dir,"config_appli.xml"))
297         pass
298
299     # Creation of env.d directory
300     virtual_salome.mkdir(os.path.join(home_dir,'env.d'))
301
302     venv_directory_path = _config.get('venv_directory_path')
303     if venv_directory_path and os.path.isdir(venv_directory_path):
304         virtual_salome.symlink(venv_directory_path, os.path.join(home_dir, "venv"))
305
306     # Get the env modules which will be loaded
307     # In the same way as: module load [MODULE_LIST]
308     env_modules = _config.get('env_modules', [])
309     if env_modules:
310         with open(os.path.join(home_dir, 'env_modules.json'), 'w') as fd:
311             json.dump({"env_modules": env_modules}, fd)
312         with open(os.path.join(home_dir, 'env.d', 'envModules.sh'), 'w') as fd:
313             fd.write('#!/bin/bash\n')
314             fd.write('module load %s\n' % (' '.join(env_modules)))
315
316     # Add .salome-completion.sh file
317     shutil.copyfile(os.path.join(appliskel_dir, ".salome-completion.sh"),
318                     os.path.join(home_dir, ".salome-completion.sh"))
319
320     if "prereq_path" in _config and os.path.isfile(_config["prereq_path"]):
321         shutil.copyfile(_config["prereq_path"],
322                         os.path.join(home_dir, 'env.d', 'envProducts.sh'))
323         pass
324     else:
325         print("WARNING: prerequisite file does not exist")
326         pass
327
328     if "context_path" in _config and os.path.isfile(_config["context_path"]):
329         shutil.copyfile(_config["context_path"],
330                         os.path.join(home_dir, 'env.d', 'envProducts.cfg'))
331         pass
332     else:
333         print("WARNING: context file does not exist")
334         pass
335
336     if "sha1_collect_path" in _config and os.path.isfile(_config["sha1_collect_path"]):
337         shutil.copyfile(_config["sha1_collect_path"],
338                         os.path.join(home_dir, 'sha1_collections.txt'))
339         pass
340     else:
341         print("WARNING: sha1 collections file does not exist")
342         pass
343
344     if "system_conf_path" in _config and os.path.isfile(_config["system_conf_path"]):
345         shutil.copyfile(_config["system_conf_path"],
346                         os.path.join(home_dir, 'env.d', 'envConfSystem.sh'))
347         pass
348
349     # Create environment file: configSalome.sh
350
351     if "python_version" in _config:
352        versionPython_split = _config["python_version"].split('.')
353        versionPython = versionPython_split[0] + "." + versionPython_split[1]
354     else:
355        cmd='source %s && python3 -c "import sys ; sys.stdout.write(\\"{}.{}\\".format(sys.version_info.major,sys.version_info.minor))"' %(_config["prereq_path"])
356        versionPython=subprocess.check_output(['/bin/bash', '-l' ,'-c',cmd]).decode("utf-8")
357
358     venv_directory_path = None
359     if "venv_directory_path" in _config:
360         venv_directory_path = _config["venv_directory_path"]
361         venv_bin_directory_path = os.path.join(venv_directory_path, 'bin')
362         venv_pip_executable = os.path.join(venv_bin_directory_path, 'pip')
363         venv_python_executable = os.path.join(venv_bin_directory_path, 'python')
364         if os.path.isdir(venv_directory_path) and os.path.isfile(venv_pip_executable):
365             requirement_file = os.path.join(home_dir, 'requirements.txt')
366             with open(requirement_file, 'w') as fd:
367                 subprocess.call([venv_python_executable, '-m', 'pip', 'freeze'], stdout=fd)
368         else:
369             venv_directory_path = None
370
371     with open(os.path.join(home_dir, 'env.d', 'configSalome.sh'),'w') as f:
372         for module in _config.get("modules", []):
373             command = 'export '+ module + '_ROOT_DIR=${HOME}/${APPLI}\n'
374             f.write(command)
375             pass
376         if "samples_path" in _config:
377             command = 'export DATA_DIR=' + _config["samples_path"] +'\n'
378             f.write(command)
379             pass
380         if "resources_path" in _config and os.path.isfile(_config["resources_path"]):
381             command = 'export USER_CATALOG_RESOURCES_FILE=' + os.path.abspath(_config["resources_path"]) +'\n'
382             f.write(command)
383         # Note: below, PYTHONPATH should not be extended to bin/salome! Python modules must be installed in lib/pythonX.Y, to be fixed (e.g. Kernel SALOME_Container.py)
384         command ="""export PATH=${HOME}/${APPLI}/bin/salome:$PATH
385 export PYTHONPATH=${HOME}/${APPLI}/lib/python%s/site-packages/salome:$PYTHONPATH
386 export PYTHONPATH=${HOME}/${APPLI}/lib/salome:$PYTHONPATH
387 export PYTHONPATH=${HOME}/${APPLI}/bin/salome:$PYTHONPATH
388 export LD_LIBRARY_PATH=${HOME}/${APPLI}/lib/salome:$LD_LIBRARY_PATH
389 """ %versionPython
390         f.write(command)
391         # Create environment variable for the salome test
392         for module in _config.get("modules", []):
393             command = "export LD_LIBRARY_PATH=${HOME}/${APPLI}/bin/salome/test/" + module + "/lib:$LD_LIBRARY_PATH\n"
394             f.write(command)
395             pass
396         # Create environment for plugins GEOM
397         command = "export GEOM_PluginsList=BREPPlugin:STEPPlugin:IGESPlugin:STLPlugin:XAOPlugin:VTKPlugin:AdvancedGEOM\n"
398         f.write(command)
399         # Create environment for Healing
400         command = "export CSF_ShHealingDefaults=${HOME}/${APPLI}/share/salome/resources/geom\n"
401         f.write(command)
402         # Create environment for Meshers
403         command = "export SMESH_MeshersList=StdMeshers:HYBRIDPlugin:HexoticPLUGIN:GMSHPlugin:GHS3DPlugin:NETGENPlugin:HEXABLOCKPlugin:BLSURFPlugin:GHS3DPRLPlugin\nexport SALOME_StdMeshersResources=${HOME}/${APPLI}/share/salome/resources/smesh\n"
404         f.write(command)
405         # Create environment for virtual env
406         if venv_directory_path:
407             command = """# SALOME venv Configuration
408 export SALOME_VENV_DIRECTORY=${HOME}/${APPLI}/venv
409 export PATH=${HOME}/${APPLI}/venv/bin:$PATH
410 export LD_LIBRARY_PATH=${HOME}/${APPLI}/venv/lib:$LD_LIBRARY_PATH
411 export PYTHONPATH=${HOME}/${APPLI}/venv/lib/python%s/site-packages
412 """ % (versionPython)
413             f.write(command)
414             pass
415
416     # Create configuration file: configSalome.cfg
417     with open(os.path.join(home_dir, 'env.d', 'configSalome.cfg'),'w') as f:
418         command = "[SALOME ROOT_DIR (modules) Configuration]\n"
419         f.write(command)
420         for module in _config.get("modules", []):
421             command = module + '_ROOT_DIR=${HOME}/${APPLI}\n'
422             f.write(command)
423             pass
424         if "samples_path" in _config:
425             command = 'DATA_DIR=' + _config["samples_path"] +'\n'
426             f.write(command)
427             pass
428         if "resources_path" in _config and os.path.isfile(_config["resources_path"]):
429             command = 'USER_CATALOG_RESOURCES_FILE=' + os.path.abspath(_config["resources_path"]) +'\n'
430             f.write(command)
431         command ="""ADD_TO_PATH: ${HOME}/${APPLI}/bin/salome
432 ADD_TO_PYTHONPATH: ${HOME}/${APPLI}/lib/python%s/site-packages/salome
433 ADD_TO_PYTHONPATH: ${HOME}/${APPLI}/lib/salome
434 ADD_TO_LD_LIBRARY_PATH: ${HOME}/${APPLI}/lib/salome
435 """%versionPython
436         f.write(command)
437         for module in _config.get("modules", []):
438             command = "ADD_TO_LD_LIBRARY_PATH: ${HOME}/${APPLI}/bin/salome/test/" + module + "/lib\n"
439             f.write(command)
440             pass
441         # Create environment for plugins GEOM
442         command = "GEOM_PluginsList=BREPPlugin:STEPPlugin:IGESPlugin:STLPlugin:XAOPlugin:VTKPlugin:AdvancedGEOM\n"
443         f.write(command)
444         # Create environment for Healing
445         command = "CSF_ShHealingDefaults=${HOME}/${APPLI}/share/salome/resources/geom\n"
446         f.write(command)
447         # Create environment for Meshers
448         command = "SMESH_MeshersList=StdMeshers:HYBRIDPlugin:HexoticPLUGIN:GMSHPlugin:GHS3DPlugin:NETGENPlugin:HEXABLOCKPlugin:BLSURFPlugin:GHS3DPRLPlugin\nSALOME_StdMeshersResources=${HOME}/${APPLI}/share/salome/resources/smesh\n"
449         f.write(command)
450         # Create environment for virtual env
451         if venv_directory_path:
452             command = """[SALOME venv Configuration]
453 SALOME_VENV_DIRECTORY: ${HOME}/${APPLI}/venv
454 ADD_TO_PATH: ${HOME}/${APPLI}/venv/bin
455 ADD_TO_LD_LIBRARY_PATH: ${HOME}/${APPLI}/venv/lib
456 ADD_TO_PYTHONPATH: ${HOME}/${APPLI}/venv/lib/python%s/site-packages
457 """ % (versionPython)
458             f.write(command)
459             pass
460
461     # Create environment file: configGUI.sh
462     dirs_ress_icon = []
463     salomeappname  = "SalomeApp"
464     with open(os.path.join(home_dir, 'env.d', 'configGUI.sh'),'w') as f:
465         for module in _config.get("modules", []):
466             if module not in ["KERNEL", "GUI", ""]:
467                 d = os.path.join(_config[module],"share","salome","resources",module.lower())
468                 d_appli = os.path.join("${HOME}","${APPLI}","share","salome","resources",module.lower())
469                 if os.path.exists( os.path.join(d,"{0}.xml".format(salomeappname)) ):
470                    dirs_ress_icon.append( d_appli )
471         AppConfig="export SalomeAppConfig=${HOME}/${APPLI}:${HOME}/${APPLI}/share/salome/resources/gui/"
472         for dir_module in dirs_ress_icon:
473              AppConfig=AppConfig+":"+dir_module
474         f.write(AppConfig+"\n")
475         command = """export SUITRoot=${HOME}/${APPLI}/share/salome
476 export DISABLE_FPE=1
477 export MMGT_REENTRANT=1
478 """
479         f.write(command)
480
481     # Create configuration file: configGUI.cfg
482     dirs_ress_icon = []
483     with open(os.path.join(home_dir, 'env.d', 'configGUI.cfg'),'w') as f:
484         command = """[SALOME GUI Configuration]\n"""
485         f.write(command)
486         for module in _config.get("modules", []):
487             if module not in ["KERNEL", "GUI", ""]:
488                 d = os.path.join(_config[module],"share","salome","resources",module.lower())
489                 d_appli = os.path.join("${HOME}","${APPLI}","share","salome","resources",module.lower())
490                 if os.path.exists( os.path.join(d,"{0}.xml".format(salomeappname)) ):
491                    dirs_ress_icon.append( d_appli )
492         AppConfig="SalomeAppConfig=${HOME}/${APPLI}:${HOME}/${APPLI}/share/salome/resources/gui/"
493         for dir_module in dirs_ress_icon:
494              AppConfig=AppConfig+":"+dir_module
495         f.write(AppConfig+"\n")
496         command = """SUITRoot=${HOME}/${APPLI}/share/salome
497 DISABLE_FPE=1
498 MMGT_REENTRANT=1
499 """
500         f.write(command)
501
502     #SalomeApp.xml file
503     with open(os.path.join(home_dir,'SalomeApp.xml'),'w') as f:
504         command = """<document>
505   <section name="launch">
506     <!-- SALOME launching parameters -->
507     <parameter name="gui"        value="yes"/>
508     <parameter name="splash"     value="yes"/>
509     <parameter name="file"       value="no"/>
510     <parameter name="key"        value="no"/>
511     <parameter name="interp"     value="no"/>
512     <parameter name="logger"     value="no"/>
513     <parameter name="xterm"      value="no"/>
514     <parameter name="portkill"   value="no"/>
515     <parameter name="killall"    value="no"/>
516     <parameter name="noexcepthandler"  value="no"/>
517     <parameter name="modules"    value="%s"/>
518     <parameter name="pyModules"  value=""/>
519     <parameter name="embedded"   value="SalomeAppEngine,study,cppContainer,registry,moduleCatalog"/>
520     <parameter name="standalone" value=""/>
521   </section>
522 </document>
523 """
524         mods = []
525         #Keep all modules except KERNEL and GUI
526         for module in _config.get("modules", []):
527             if module in ("KERNEL","GUI"):
528                 continue
529             mods.append(module)
530         f.write(command % ",".join(mods))
531
532     #Add USERS directory with 777 permission to store users configuration files
533     users_dir = os.path.join(home_dir,'USERS')
534     makedirs(users_dir)
535     os.chmod(users_dir, 0o777)
536
537 def main():
538     parser = optparse.OptionParser(usage=usage)
539
540     parser.add_option('--prefix', dest="prefix", default='.',
541                       help="Installation directory (default .)")
542
543     parser.add_option('--config', dest="config", default='config_appli.xml',
544                       help="XML configuration file (default config_appli.xml)")
545
546     parser.add_option('-v', '--verbose', action='count', dest='verbose',
547                       default=0, help="Increase verbosity")
548
549     options, args = parser.parse_args()
550     if not os.path.exists(options.config):
551         print("ERROR: config file %s does not exist. It is mandatory." % options.config)
552         sys.exit(1)
553
554     install(prefix=options.prefix, config_file=options.config, verbose=options.verbose)
555     pass
556
557 # -----------------------------------------------------------------------------
558
559 if __name__ == '__main__':
560     main()
561     pass