Salome HOME
CCAR: add a new parameter (resources) to configuration of SALOME Application
authorcaremoli <caremoli>
Mon, 22 Mar 2010 09:15:41 +0000 (09:15 +0000)
committercaremoli <caremoli>
Mon, 22 Mar 2010 09:15:41 +0000 (09:15 +0000)
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
bin/config_appli.xml
doc/salome/salome_application.dox

index e16a780fe5b34515b7dd600fdfef58d0db8ce030..5a0cdd6fd9b86556a2ed0968f79fec78c18b4d18 100644 (file)
@@ -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=<install directory> --config=<configuration file>
 """
@@ -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):
     <parameter name="killall"    value="no"/>
     <parameter name="noexcepthandler"  value="no"/>
     <parameter name="modules"    value="""
-    f.write(command)    
+    f.write(command)
     f.write('"')
     for module in _config["guimodules"][:-1]:
         f.write(module)
@@ -258,7 +267,7 @@ def install(prefix,config_file,verbose=0):
   </section>
 </document>
 """
-    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" />
 </resources>
 """
-    f.write(command)    
+    f.write(command)
     f.close()
 
     #Add USERS directory with 777 permission to store users configuration files
index 2695ad7e58028311c74902eb134f574c37058055..027a166f449cb0de123fa71174820cbbf7c17de4 100644 (file)
@@ -1,5 +1,6 @@
 <application>
 <prerequisites path="/data/tmplgls/secher/SALOME_V4.1.1_MD08/env_products.sh"/>
+<resources path="myCata.xml"/>
 <modules>
    <!-- variable name <MODULE>_ROOT_DIR is built with <MODULE> == name attribute value -->
    <!-- <MODULE>_ROOT_DIR values is set with path attribute value -->
index 31961aa32aeddb355828978d4795755d44c87096..e91b71e1193d9059593f4f2b24b8b3928cdc6005 100644 (file)
@@ -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