From 1aeade9a3b449c32fa3e4aadf9f7706a2a63fd32 Mon Sep 17 00:00:00 2001 From: caremoli Date: Mon, 22 Mar 2010 09:15:41 +0000 Subject: [PATCH] CCAR: add a new parameter (resources) to configuration of SALOME Application It is a new entry in config_appli.xml file (tag resources) that gives the path of a user resources catalog It is added to the SALOME Application as the USER_CATALOG_RESOURCES_FILE environment variable in env.d/configSalome.sh --- bin/appli_gen.py | 21 +++++++++++++++------ bin/config_appli.xml | 1 + doc/salome/salome_application.dox | 6 ++++-- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/bin/appli_gen.py b/bin/appli_gen.py index e16a780fe..5a0cdd6fd 100644 --- a/bin/appli_gen.py +++ b/bin/appli_gen.py @@ -26,7 +26,7 @@ # usage="""usage: %prog [options] Typical use is: - python appli_gen.py + python appli_gen.py Typical use with options is: python appli_gen.py --verbose --prefix= --config= """ @@ -43,6 +43,7 @@ prereq_tag = "prerequisites" modules_tag = "modules" module_tag = "module" samples_tag = "samples" +resources_tag = "resources" # --- names of attributes in XML configuration file nam_att = "name" @@ -81,6 +82,10 @@ class xml_parser: if self.space == [appli_tag, prereq_tag] and path_att in attrs.getNames(): self.config["prereq_path"] = attrs.getValue( path_att ) pass + # --- if we are analyzing "resources" element then store its "path" attribute + if self.space == [appli_tag, resources_tag] and path_att in attrs.getNames(): + self.config["resources_path"] = attrs.getValue( path_att ) + pass # --- if we are analyzing "samples" element then store its "path" attribute if self.space == [appli_tag, samples_tag] and path_att in attrs.getNames(): self.config["samples_path"] = attrs.getValue( path_att ) @@ -153,7 +158,7 @@ def install(prefix,config_file,verbose=0): print "Configure parser: parse error in configuration file %s" % filename pass except xml.sax.SAXException, inst: - print inst.args + print inst.args print "Configure parser: error in configuration file %s" % filename pass except: @@ -194,7 +199,7 @@ def install(prefix,config_file,verbose=0): command = "cp -p " + filename + ' ' + os.path.join(home_dir,"config_appli.xml") os.system(command) pass - + virtual_salome.mkdir(os.path.join(home_dir,'env.d')) if os.path.isfile(_config["prereq_path"]): command='cp -p ' + _config["prereq_path"] + ' ' + os.path.join(home_dir,'env.d','envProducts.sh') @@ -214,6 +219,10 @@ def install(prefix,config_file,verbose=0): command='export DATA_DIR=' + _config["samples_path"] +'\n' f.write(command) pass + if _config.has_key("resources_path") and os.path.isfile(_config["resources_path"]): + command='export USER_CATALOG_RESOURCES_FILE=' + os.path.abspath(_config["resources_path"]) +'\n' + f.write(command) + f.close() @@ -242,7 +251,7 @@ def install(prefix,config_file,verbose=0): """ - f.write(command) + f.write(command) f.close() #Add default CatalogResources.xml file @@ -269,7 +278,7 @@ def install(prefix,config_file,verbose=0): hostname="localhost" /> """ - f.write(command) + f.write(command) f.close() #Add USERS directory with 777 permission to store users configuration files diff --git a/bin/config_appli.xml b/bin/config_appli.xml index 2695ad7e5..027a166f4 100644 --- a/bin/config_appli.xml +++ b/bin/config_appli.xml @@ -1,5 +1,6 @@ + diff --git a/doc/salome/salome_application.dox b/doc/salome/salome_application.dox index 31961aa32..e91b71e11 100644 --- a/doc/salome/salome_application.dox +++ b/doc/salome/salome_application.dox @@ -46,8 +46,10 @@ First, the user must create a %SALOME application configuration file by modifyin copy of ${KERNEL_ROOT_DIR}/bin/salome/config_appli.xml. The file describes the list of %SALOME modules used in the application, with their respective installation path. The configuration file also defines the -path of an existing script which sets the %SALOME prerequisites, -and optionnaly, the path of samples directory (SAMPLES_SRC). +path of an existing script which sets the %SALOME prerequisites (tag "prerequisites"), +and optionally, the path of samples directory (SAMPLES_SRC) (tag "samples") +and the path of a catalog of resources (tag "resources"). + The following command: \code -- 2.39.2