parser.add_option('e', 'exe', 'string', 'path_exe', _('Use this option to generate a launcher which sets'
' the environment and call the executable given as argument'
' (its relative path to application workdir, or an exe name present in appli PATH)'))
+parser.add_option('p', 'products', 'list2', 'products',
+ _("Optional: Includes only the specified products."))
parser.add_option('c', 'catalog', 'string', 'catalog',
_('Optional: The resources catalog to use'))
parser.add_option('', 'gencat', 'string', 'gencat',
launcher_name,
pathlauncher,
path_exe,
+ env_info,
display=True,
additional_env={},
no_path_init=False):
:param display boolean: If False, do not print anything in the terminal
:param additional_env dict: The dict giving additional
environment variables
+ :param env_info str: The list of products to add in the files.
:return: The launcher file path.
:rtype: str
'''
writer = src.environment.FileEnvWriter(config,
logger,
pathlauncher,
- src_root=None,
- env_info=None)
+ None,
+ env_info)
# Display some information
if display:
src.check_config_has_application( runner.cfg )
# Determine the launcher name (from option, profile section or by default "salome")
+ if options.products is None:
+ environ_info = None
+ else:
+ # add products specified by user (only products
+ # included in the application)
+ environ_info = filter(lambda l:
+ l in runner.cfg.APPLICATION.products.keys(),
+ options.products)
if options.name:
launcher_name = options.name
else:
launcher_path,
options.path_exe,
additional_env = additional_environ,
+ env_info=environ_info,
no_path_init = no_path_initialisation )
return 0
return 0
;;
launcher)
- opts="--name --exe --catalog --gencat --no_path_init --use_mesa"
+ opts="--products --name --exe --catalog --gencat --no_path_init --use_mesa"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
sat launcher <application> --use_mesa
+* Generate the environment files only with the given products:
+
+ .. code-block:: bash
+
+ # This will create a launcher file called salome-pre,
+ # which will contain GEOM,SMESH and their prerequisites.
+ # It is useful if you want to create a launcher with only a part of Salome
+ sat launcher <application> --product GEOM,SMESH -n salome-pre
+
Configuration
=============
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)
+ from compile import get_dependencies_graph,depth_first_topo_graph
all_products_graph=get_dependencies_graph(all_products_infos, self.forBuild)
visited_nodes=[]
sorted_nodes=[]
visited_nodes,
sorted_nodes)
self.sorted_product_list=sorted_nodes
+ self.all_products_graph=all_products_graph
def append(self, key, value, sep=os.pathsep):
def set_full_environ(self, logger, env_info):
"""\
- Sets the full environment for products
+ Sets the full environment for products, with their dependencies
specified in env_info dictionary.
:param logger Logger: The logger instance to display messages
# use the sorted list of all products to sort the list of products
# we have to set
+ visited=[]
+ from compile import depth_search_graph # to get the dependencies
+ for p_name in env_info:
+ visited=depth_search_graph(self.all_products_graph, p_name, visited)
sorted_product_list=[]
for n in self.sorted_product_list:
- if n in env_info:
+ if n in visited:
sorted_product_list.append(n)
if "Python" in sorted_product_list: