#log_res_step(logger, res)
res=1
error_step = "PIP"
- logger.write("\nError in pip command, please consult details with sat log command's internal traces\n", 5)
+ logger.write("\nError in pip command, please consult details with sat log command's internal traces\n", 3)
return res, len_end_line, error_step
for n in all_products_graph:
if n not in visited_nodes:
visited_nodes,sorted_nodes=depth_first_topo_graph(all_products_graph, n, visited_nodes,sorted_nodes)
- logger.write("Complete depndency graph topological search (sorting): %s\n" % sorted_nodes, 6)
+ logger.write("Complete dependency graph topological search (sorting): %s\n" % sorted_nodes, 6)
# use the sorted list of all products to sort the list of products we have to compile
sorted_product_list=[]
# to get the current setting
sat config SALOME-xx --value APPLICATION
+
+Globals
+
+ * name : the name of the application
+ * workdir : the directory in which the application is produced
+ * tag : the default tag to use for the git bases
+ * dev : activate the dev mode. in dev mode git bases are checked out only one time, to avoid risks of removing developments.
+ * verbose : activate verbosity in the compilation
+ * debug : activate debug mode in the compilation, i.e -g option
+ * python3 : 'yes/no' tell sat that the application uses python3
+ * no_base : 'yes/no'
+ * base : 'yes/no/name'
+
+
PRODUCTS section
---------------------
| This section contains all the information required to build the products contained in the application.
Its purpose is to cover the maintenance and the production of the salome platform and its applications.
Notably:
+
* the definition of the applications content (the products, the resources, the options, the environment, the launcher, etc.)
-* the description of the products (the environment to set, how to get the sources; how to compilation, the dependencies, etc).
+* the description of the products (the environment to set, how to get the sources; how to compilation (which options), , the dependencies, etc).
* the complete preparation and build
* the management of unit or integration tests
* the production of binary or source packages
-It can be used from interactively from a terminal, or in batch mode.
+It is designed to run on several Linux OS and Windows, with
+the possibility to specify platform dependent specifics (with the **__overwrite__** functionality.
+It can be used from interactively from a terminal, or in batch mode.
.. code-block:: bash
sat -h # or --help : get the list of existing commands and main options
sat compile -h # get the help on the specific command 'compile'
-completion mode
+Completion mode
---------------
When getting started with sat, the use of the competion mode is usefull. This mode will display by type twice on the **tab key** the available options, command, applications or product available. The completion mode has to be activated by sourcing the file **complete_sat.sh** contained in salomeTool directory:
self.enable_simple_env_script = enable_simple_env_script
self.silent = False
self.has_python = False
+ self.__set_sorted_products_list()
def __repr__(self):
"""easy almost exhaustive quick resume for debug print"""
}
return "%s(\n%s\n)" % (self.__class__.__name__, PP.pformat(res))
+ def __set_sorted_products_list(self):
+ from compile import get_dependencies_graph, depth_first_topo_graph
+ all_products_infos = src.product.get_products_infos(
+ self.cfg.APPLICATION.products,
+ self.cfg)
+
+ all_products_graph=get_dependencies_graph(all_products_infos)
+ visited_nodes=[]
+ sorted_nodes=[]
+ for n in all_products_graph:
+ if n not in visited_nodes:
+ visited_nodes,sorted_nodes=depth_first_topo_graph(
+ all_products_graph,
+ n,
+ visited_nodes,
+ sorted_nodes)
+ self.sorted_product_list=sorted_nodes
+
+
def append(self, key, value, sep=os.pathsep):
"""\
append value to key using sep
compo_name = pi.component_name
else:
compo_name = pi.name
- self.prepend('SALOME_MODULES', compo_name, ',')
+ self.append('SALOME_MODULES', compo_name, ',')
def set_salome_generic_product_env(self, pi):
traceback.print_tb(exceptionTraceback)
traceback.print_exc()
-
def set_products(self, logger, src_root=None):
"""\
Sets the environment for all the products.
self.add_comment('setting environ for all products')
# Make sure that the python lib dirs are set after python
- if "Python" in self.cfg.APPLICATION.products:
+ if "Python" in self.sorted_product_list:
self.set_a_product("Python", logger)
self.set_python_libdirs()
# The loop on the products
- for product in self.cfg.APPLICATION.products.keys():
+ for product in self.sorted_product_list:
if product == "Python":
continue
self.set_a_product(product, logger)
# set product environ
self.set_application_env(logger)
- if "Python" in env_info:
+ # use the sorted list of all products to sort the list of products
+ # we have to set
+ sorted_product_list=[]
+ for n in self.sorted_nodes:
+ if n in env_info:
+ sorted_product_list.append(n)
+
+ if "Python" in sorted_product_list:
self.set_a_product("Python", logger)
self.set_python_libdirs()
# set products
- for product in env_info:
+ for product in sorted_product_list:
if product == "Python":
continue
self.set_a_product(product, logger)
:param key str: the environment variable to set
:param value str: the value
"""
- #print "CNC TclFileEnviron set ", key, " to ", value
self.output.write('setenv %s "%s"\n' % (key, value))
self.environ.set(key, value)
"""
self.output.write('# "WARNING %s"\n' % warning)
- def append_value(self, key, value, sep=":"):
+ def append_value(self, key, value, sep=os.pathsep):
"""append value to key using sep,
if value contains ":" or ";" then raise error
- :param key str: the environment variable to append
- :param value str: the value to append to key
+ :param key str: the environment variable to prepend
+ :param value str: the value to prepend to key
:param sep str: the separator string
"""
- # append is not defined in context api
- self.prepend_value(key, value)
+ # check that value so no contain the system separator
+ separator=os.pathsep
+ msg="LauncherFileEnviron append key '%s' value '%s' contains forbidden character '%s'"
+ if separator in value:
+ raise Exception(msg % (key, value, separator))
+
+ if (self.init_path and (not self.environ.is_defined(key))):
+ # reinitialisation mode set to true (the default)
+ # for the first occurrence of key, we set it.
+ # therefore key will not be inherited from environment
+ self.set(key, value)
+ return
+
+ # in all other cases we use append (except if value is already the key
+ do_append=True
+ if self.environ.is_defined(key):
+ value_list = self.environ.get(key).split(sep)
+ # rem : value cannot be expanded (unlike bash/bat case) - but it doesn't matter.
+ if value in value_list:
+ do_append=False # value is already in key path : we don't append it again
+
+ if do_append:
+ self.environ.append_value(key, value,sep) # register value in self.environ
+ if key in self.specialKeys.keys():
+ #for these special keys we use the specific salomeContext function
+ self.output.write(self.begin+'addTo%s(r"%s")\n' %
+ (self.specialKeys[key], self.value_filter(value)))
+ else:
+ # else we use the general salomeContext addToVariable function
+ self.output.write(self.indent+'appendPath(r"%s", r"%s",separator="%s")\n'
+ % (key, self.value_filter(value), sep))
def append(self, key, value, sep=":"):
"""Same as append_value but the value argument can be a list
import logging
logging.getLogger("salome").error(e)
sys.exit(1)
-#
+
+# salomeContext only prepend variables, we use our own appendPath when required
+def appendPath(name, value, separator=os.pathsep):
+ if value == '':
+ return
+
+ value = os.path.expandvars(value) # expand environment variables
+ env = os.getenv(name, None)
+ if env is None:
+ os.environ[name] = value
+ else:
+ os.environ[name] = env + separator + value
+
if __name__ == "__main__":
args = sys.argv[1:]