]> SALOME platform Git repositories - tools/sat.git/blob - src/product.py
Salome HOME
begin to fix 8596, 8908, 8605, 8638, 10458, 8646, 8576
[tools/sat.git] / src / product.py
1 #!/usr/bin/env python
2 #-*- coding:utf-8 -*-
3 #  Copyright (C) 2010-2012  CEA/DEN
4 #
5 #  This library is free software; you can redistribute it and/or
6 #  modify it under the terms of the GNU Lesser General Public
7 #  License as published by the Free Software Foundation; either
8 #  version 2.1 of the License.
9 #
10 #  This library is distributed in the hope that it will be useful,
11 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 #  Lesser General Public License for more details.
14 #
15 #  You should have received a copy of the GNU Lesser General Public
16 #  License along with this library; if not, write to the Free Software
17 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
18 '''In this file are implemented the methods 
19    relative to the product notion of salomeTools
20 '''
21
22 import os
23 import re
24
25 import src
26
27 AVAILABLE_VCS = ['git', 'svn', 'cvs']
28 config_expression = "^config-\d+$"
29 VERSION_DELIMITER = "_to_"
30
31 def get_product_config(config, product_name, with_install_dir=True):
32     '''Get the specific configuration of a product from the global configuration
33     
34     :param config Config: The global configuration
35     :param product_name str: The name of the product
36     :param with_install_dir boolean: If false, do not provide an install 
37                                      directory (at false only for internal use 
38                                      of the function check_config_exists)
39     :return: the specific configuration of the product
40     :rtype: Config
41     '''
42     
43     # Get the version of the product from the application definition
44     version = config.APPLICATION.products[product_name]
45     # if no version, then take the default one defined in the application
46     if isinstance(version, bool): 
47         version = config.APPLICATION.tag      
48     
49     # Define debug and dev modes
50     # Get the tag if a dictionary is given in APPLICATION.products for the
51     # current product 
52     debug = 'no'
53     dev = 'no'
54     base = 'maybe'
55     section = None
56     if isinstance(version, src.pyconf.Mapping):
57         dic_version = version
58         # Get the version/tag
59         if not 'tag' in dic_version:
60             version = config.APPLICATION.tag
61         else:
62             version = dic_version.tag
63         
64         # Get the debug if any
65         if 'debug' in dic_version:
66             debug = dic_version.debug
67         
68         # Get the dev if any
69         if 'dev' in dic_version:
70             dev = dic_version.dev
71         
72         # Get the base if any
73         if 'base' in dic_version:
74             base = dic_version.base
75
76         # Get the section if any
77         if 'section' in dic_version:
78             section = dic_version.section
79     
80     vv = version
81     # substitute some character with _ in order to get the correct definition
82     # in config.PRODUCTS. This is done because the pyconf tool does not handle
83     # the . and - characters 
84     for c in ".-": vv = vv.replace(c, "_")
85     
86     prod_info = None
87     if product_name in config.PRODUCTS:
88         # Search for the product description in the configuration
89         prod_info = get_product_section(config, product_name, vv, section)
90         
91         # merge opt_depend in depend
92         if prod_info is not None and 'opt_depend' in prod_info:
93             for depend in prod_info.opt_depend:
94                 if depend in config.APPLICATION.products:
95                     prod_info.depend.append(depend,'')
96         
97         # In case of a product get with a vcs, 
98         # put the tag (equal to the version)
99         if prod_info is not None and prod_info.get_source in AVAILABLE_VCS:
100             
101             if prod_info.get_source == 'git':
102                 prod_info.git_info.tag = version
103             
104             if prod_info.get_source == 'svn':
105                 prod_info.svn_info.tag = version
106             
107             if prod_info.get_source == 'cvs':
108                 prod_info.cvs_info.tag = version
109         
110         # In case of a fixed product, 
111         # define the install_dir (equal to the version)
112         if prod_info is not None and os.path.isdir(version):
113             prod_info.install_dir = version
114             prod_info.get_source = "fixed"
115         
116         # Check if the product is defined as native in the application
117         if prod_info is not None:
118             if version == "native":
119                 prod_info.get_source = "native"
120             elif prod_info.get_source == "native":
121                 msg = _("The product %(prod)s has version %(ver)s but is "
122                         "declared as native in its definition" %
123                         { 'prod': prod_info.name, 'ver': version})
124                 raise src.SatException(msg)
125
126     # If there is no definition but the product is declared as native,
127     # construct a new definition containing only the get_source key
128     if prod_info is None and version == "native":
129         prod_info = src.pyconf.Config()
130         prod_info.name = product_name
131         prod_info.get_source = "native"
132
133     # If there is no definition but the product is fixed,
134     # construct a new definition containing only the product name
135     if prod_info is None and os.path.isdir(version):
136         prod_info = src.pyconf.Config()
137         prod_info.name = product_name
138         prod_info.get_source = "fixed"
139         prod_info.addMapping("environ", src.pyconf.Mapping(prod_info), "")
140
141
142     # If prod_info is still None, it means that there is no product definition
143     # in the config. The user has to provide it.
144     if prod_info is None:
145         prod_pyconf_path = src.find_file_in_lpath(product_name + ".pyconf",
146                                                   config.PATHS.PRODUCTPATH)
147         if not prod_pyconf_path:
148             msg = _("""\
149 No definition found for the product %(1)s.
150 Please create a %(2)s.pyconf file somewhere in:
151 %(3)s""") % {
152   "1": product_name, 
153   "2": product_name,
154   "3": config.PATHS.PRODUCTPATH }
155         else:
156             msg = _("""\
157 No definition corresponding to the version %(1)s was found in the file:
158   %(2)s.
159 Please add a section in it.""") % {"1" : vv, "2" : prod_pyconf_path}
160         raise src.SatException(msg)
161     
162     # Set the debug, dev and version keys
163     prod_info.debug = debug
164     prod_info.dev = dev
165     prod_info.version = version
166     
167     # Set the archive_info if the product is get in archive mode
168     if prod_info.get_source == "archive":
169         if not "archive_info" in prod_info:
170             prod_info.addMapping("archive_info",
171                                  src.pyconf.Mapping(prod_info),
172                                  "")
173         if "archive_name" not in prod_info.archive_info: 
174             arch_name = product_name + "-" + version + ".tar.gz"
175             arch_path = src.find_file_in_lpath(arch_name,
176                                                config.PATHS.ARCHIVEPATH)
177             if not arch_path:
178                 msg = _("Archive %(1)s for %(2)s not found.\n") % \
179                        {"1" : arch_name, "2" : prod_info.name}
180                 raise src.SatException(msg)
181             prod_info.archive_info.archive_name = arch_path
182         else:
183             if (os.path.basename(prod_info.archive_info.archive_name) == 
184                                         prod_info.archive_info.archive_name):
185                 arch_name = prod_info.archive_info.archive_name
186                 arch_path = src.find_file_in_lpath(
187                                             arch_name,
188                                             config.PATHS.ARCHIVEPATH)
189                 if not arch_path:
190                     msg = _("Archive %(1)s for %(2)s not found:\n") % \
191                            {"1" : arch_name, "2" : prod_info.name}
192                     raise src.SatException(msg)
193                 prod_info.archive_info.archive_name = arch_path
194         
195     # If the product compiles with a script, check the script existence
196     # and if it is executable
197     if product_has_script(prod_info):
198         # Check the compil_script key existence
199         if "compil_script" not in prod_info:
200             msg = _("""\
201 No compilation script found for the product %s.
202 Please provide a 'compil_script' key in its definition.""") % product_name
203             raise src.SatException(msg)
204         
205         # Get the path of the script
206         script = prod_info.compil_script
207         script_name = os.path.basename(script)
208         if script == script_name:
209             # Only a name is given. Search in the default directory
210             script_path = src.find_file_in_lpath(script_name,
211                                                  config.PATHS.PRODUCTPATH,
212                                                  "compil_scripts")
213             if not script_path:
214                 raise src.SatException(
215                     _("Compilation script not found: %s") % script_name)
216             prod_info.compil_script = script_path
217             if src.architecture.is_windows():
218                 prod_info.compil_script = prod_info.compil_script[:-len(".sh")] + ".bat"
219        
220         # Check that the script is executable
221         if not os.access(prod_info.compil_script, os.X_OK):
222             #raise src.SatException(
223             #        _("Compilation script cannot be executed: %s") % 
224             #        prod_info.compil_script)
225             print("WARNING: Compilation script cannot be executed:\n         %s" % prod_info.compil_script)
226     
227     # Get the full paths of all the patches
228     if product_has_patches(prod_info):
229         patches = []
230         for patch in prod_info.patches:
231             patch_path = patch
232             # If only a filename, then search for the patch in the PRODUCTPATH
233             if os.path.basename(patch_path) == patch_path:
234                 # Search in the PRODUCTPATH/patches
235                 patch_path = src.find_file_in_lpath(patch,
236                                                     config.PATHS.PRODUCTPATH,
237                                                     "patches")
238                 if not patch_path:
239                     msg = _("Patch %(patch_name)s for %(prod_name)s not found:"
240                             "\n" % {"patch_name" : patch,
241                                      "prod_name" : prod_info.name}) 
242                     raise src.SatException(msg)
243             patches.append(patch_path)
244         prod_info.patches = patches
245
246     # Get the full paths of the environment scripts
247     if product_has_env_script(prod_info):
248         env_script_path = prod_info.environ.env_script
249         # If only a filename, then search for the environment script 
250         # in the PRODUCTPATH/env_scripts
251         if os.path.basename(env_script_path) == env_script_path:
252             # Search in the PRODUCTPATH/env_scripts
253             env_script_path = src.find_file_in_lpath(
254                                             prod_info.environ.env_script,
255                                             config.PATHS.PRODUCTPATH,
256                                             "env_scripts")
257             if not env_script_path:
258                 msg = _("Environment script %(env_name)s for %(prod_name)s not "
259                         "found.\n" % {"env_name" : env_script_path,
260                                        "prod_name" : prod_info.name}) 
261                 raise src.SatException(msg)
262
263         prod_info.environ.env_script = env_script_path
264     
265     if with_install_dir: 
266         # The variable with_install_dir is at false only for internal use 
267         # of the function get_install_dir
268         
269         # Save the install_dir key if there is any
270         if "install_dir" in prod_info and not "install_dir_save" in prod_info:
271             prod_info.install_dir_save = prod_info.install_dir
272         
273         # if it is not the first time the install_dir is computed, it means
274         # that install_dir_save exists and it has to be taken into account.
275         if "install_dir_save" in prod_info:
276             prod_info.install_dir = prod_info.install_dir_save
277         
278         # Set the install_dir key
279         prod_info.install_dir = get_install_dir(config, base, version, prod_info)
280                 
281     return prod_info
282
283 def get_product_section(config, product_name, version, section=None):
284     '''Get the product description from the configuration
285     
286     :param config Config: The global configuration
287     :param product_name str: The product name
288     :param version str: The version of the product
289     :param section str: The searched section (if not None, the section is 
290                         explicitly given
291     :return: The product description
292     :rtype: Config
293     '''
294
295     # if section is not None, try to get the corresponding section
296     if section:
297         if section not in config.PRODUCTS[product_name]:
298             return None
299         # returns specific information for the given version
300         prod_info = config.PRODUCTS[product_name][section]
301         prod_info.section = section
302         prod_info.from_file = config.PRODUCTS[product_name].from_file
303         return prod_info
304
305     # If it exists, get the information of the product_version
306     if "version_" + version in config.PRODUCTS[product_name]:
307         # returns specific information for the given version
308         prod_info = config.PRODUCTS[product_name]["version_" + version]
309         prod_info.section = "version_" + version
310         prod_info.from_file = config.PRODUCTS[product_name].from_file
311         return prod_info
312     
313     # Else, check if there is a description for multiple versions
314     l_section_name = config.PRODUCTS[product_name].keys()
315     l_section_ranges = [section_name for section_name in l_section_name 
316                         if VERSION_DELIMITER in section_name]
317     for section_range in l_section_ranges:
318         minimum, maximum = section_range.split(VERSION_DELIMITER)
319         if (src.only_numbers(version) >= src.only_numbers(minimum)
320                     and src.only_numbers(version) <= src.only_numbers(maximum)):
321             # returns specific information for the versions
322             prod_info = config.PRODUCTS[product_name][section_range]
323             prod_info.section = section_range
324             prod_info.from_file = config.PRODUCTS[product_name].from_file
325             return prod_info
326     
327     # Else, get the standard informations
328     if "default" in config.PRODUCTS[product_name]:
329         # returns the generic information (given version not found)
330         prod_info = config.PRODUCTS[product_name].default
331         prod_info.section = "default"
332         prod_info.from_file = config.PRODUCTS[product_name].from_file
333         return prod_info
334     
335     # if noting was found, return None
336     return None
337     
338 def get_install_dir(config, base, version, prod_info):
339     '''Compute the installation directory of a given product 
340     
341     :param config Config: The global configuration
342     :param base str: This corresponds to the value given by user in its 
343                      application.pyconf for the specific product. If "yes", the
344                     user wants the product to be in base. If "no", he wants the
345                     product to be in the application workdir
346     :param version str: The version of the product
347     :param product_info Config: The configuration specific to 
348                                the product
349     
350     :return: The path of the product installation
351     :rtype: str
352     '''
353     install_dir = ""
354     in_base = False
355     if (("install_dir" in prod_info and prod_info.install_dir == "base") 
356                                                             or base == "yes"):
357         in_base = True
358     if (base == "no" or ("no_base" in config.APPLICATION 
359                          and config.APPLICATION.no_base == "yes")):
360         in_base = False
361     
362     if in_base:
363         install_dir = get_base_install_dir(config, prod_info, version)
364     else:
365         if "install_dir" not in prod_info or prod_info.install_dir == "base":
366             # Set it to the default value (in application directory)
367             install_dir = os.path.join(config.APPLICATION.workdir,
368                                                 "INSTALL",
369                                                 prod_info.name)
370         else:
371             install_dir = prod_info.install_dir
372
373     return install_dir
374
375 def get_base_install_dir(config, prod_info, version):
376     '''Compute the installation directory of a product in base 
377     
378     :param config Config: The global configuration
379     :param product_info Config: The configuration specific to 
380                                the product
381     :param version str: The version of the product    
382     :return: The path of the product installation
383     :rtype: str
384     '''    
385     base_path = src.get_base_path(config) 
386     prod_dir = os.path.join(base_path, prod_info.name + "-" + version)
387     if not os.path.exists(prod_dir):
388         return os.path.join(prod_dir, "config-1")
389     
390     exists, install_dir = check_config_exists(config, prod_dir, prod_info)
391     if exists:
392         return install_dir
393     
394     # Find the first config-<i> directory that is available in the product
395     # directory
396     found = False 
397     label = 1
398     while not found:
399         install_dir = os.path.join(prod_dir, "config-%i" % label)
400         if os.path.exists(install_dir):
401             label+=1
402         else:
403             found = True
404             
405     return install_dir
406
407 def check_config_exists(config, prod_dir, prod_info):
408     '''Verify that the installation directory of a product in a base exists
409        Check all the config-<i> directory and verify the sat-config.pyconf file
410        that is in it 
411     
412     :param config Config: The global configuration
413     :param prod_dir str: The product installation directory path 
414                          (without config-<i>)
415     :param product_info Config: The configuration specific to 
416                                the product
417     :return: True or false is the installation is found or not 
418              and if it is found, the path of the found installation
419     :rtype: (boolean, str)
420     '''   
421     # check if the directories or files of the directory corresponds to the 
422     # directory installation of the product
423     l_dir_and_files = os.listdir(prod_dir)
424     for dir_or_file in l_dir_and_files:
425         oExpr = re.compile(config_expression)
426         if not(oExpr.search(dir_or_file)):
427             # not config-<i>, not interesting
428             continue
429         # check if there is the file sat-config.pyconf file in the installation
430         # directory    
431         config_file = os.path.join(prod_dir, dir_or_file, src.CONFIG_FILENAME)
432         if not os.path.exists(config_file):
433             continue
434         
435         # If there is no dependency, it is the right path
436         if len(prod_info.depend)==0:
437             compile_cfg = src.pyconf.Config(config_file)
438             if len(compile_cfg) == 0:
439                 return True, os.path.join(prod_dir, dir_or_file)
440             continue
441         
442         # check if there is the config described in the file corresponds the 
443         # dependencies of the product
444         config_corresponds = True    
445         compile_cfg = src.pyconf.Config(config_file)
446         for prod_dep in prod_info.depend:
447             # if the dependency is not in the config, 
448             # the config does not correspond
449             if prod_dep not in compile_cfg:
450                 config_corresponds = False
451                 break
452             else:
453                 prod_dep_info = get_product_config(config, prod_dep, False)
454                 # If the version of the dependency does not correspond, 
455                 # the config does not correspond
456                 if prod_dep_info.version != compile_cfg[prod_dep]:
457                     config_corresponds = False
458                     break
459         
460         for prod_name in compile_cfg:
461             if prod_name not in prod_info.depend:
462                 config_corresponds = False
463                 break
464         
465         if config_corresponds:
466             return True, os.path.join(prod_dir, dir_or_file)
467     
468     return False, None
469             
470             
471     
472 def get_products_infos(lproducts, config):
473     '''Get the specific configuration of a list of products
474     
475     :param lproducts List: The list of product names
476     :param config Config: The global configuration
477     :return: the list of tuples 
478              (product name, specific configuration of the product)
479     :rtype: [(str, Config)]
480     '''
481     products_infos = []
482     # Loop on product names
483     for prod in lproducts:       
484         # Get the specific configuration of the product
485         prod_info = get_product_config(config, prod)
486         if prod_info is not None:
487             products_infos.append((prod, prod_info))
488         else:
489             msg = _("The %s product has no definition "
490                     "in the configuration.") % prod
491             raise src.SatException(msg)
492     return products_infos
493
494 def get_product_dependencies(config, product_info):
495     '''Get recursively the list of products that are 
496        in the product_info dependencies
497     
498     :param config Config: The global configuration
499     :param product_info Config: The configuration specific to 
500                                the product
501     :return: the list of products in dependence
502     :rtype: list
503     '''
504     if "depend" not in product_info or product_info.depend == []:
505         return []
506     res = []
507     for prod in product_info.depend:
508         if prod == product_info.name:
509             continue
510         if prod not in res:
511             res.append(prod)
512         prod_info = get_product_config(config, prod)
513         dep_prod = get_product_dependencies(config, prod_info)
514         for prod_in_dep in dep_prod:
515             if prod_in_dep not in res:
516                 res.append(prod_in_dep)
517     return res
518
519 def check_installation(product_info):
520     '''Verify if a product is well installed. Checks install directory presence
521        and some additional files if it is defined in the config 
522     
523     :param product_info Config: The configuration specific to 
524                                the product
525     :return: True if it is well installed
526     :rtype: boolean
527     '''
528     if not product_compiles(product_info):
529         return True
530     install_dir = product_info.install_dir
531     if not os.path.exists(install_dir):
532         return False
533     if ("present_files" in product_info and 
534         "install" in product_info.present_files):
535         for file_relative_path in product_info.present_files.install:
536             file_path = os.path.join(install_dir, file_relative_path)
537             if not os.path.exists(file_path):
538                 return False
539     return True
540
541 def product_is_sample(product_info):
542     '''Know if a product has the sample type
543     
544     :param product_info Config: The configuration specific to 
545                                the product
546     :return: True if the product has the sample type, else False
547     :rtype: boolean
548     '''
549     if 'type' in product_info:
550         ptype = product_info.type
551         return ptype.lower() == 'sample'
552     else:
553         return False
554
555 def product_is_salome(product_info):
556     '''Know if a product is a SALOME module
557     
558     :param product_info Config: The configuration specific to 
559                                the product
560     :return: True if the product is a SALOME module, else False
561     :rtype: boolean
562     '''
563     return ("properties" in product_info and
564             "is_SALOME_module" in product_info.properties and
565             product_info.properties.is_SALOME_module == "yes")
566
567 def product_is_fixed(product_info):
568     '''Know if a product is fixed
569     
570     :param product_info Config: The configuration specific to 
571                                the product
572     :return: True if the product is fixed, else False
573     :rtype: boolean
574     '''
575     get_src = product_info.get_source
576     return get_src.lower() == 'fixed'
577
578 def product_is_native(product_info):
579     '''Know if a product is native
580     
581     :param product_info Config: The configuration specific to 
582                                the product
583     :return: True if the product is native, else False
584     :rtype: boolean
585     '''
586     get_src = product_info.get_source
587     return get_src.lower() == 'native'
588
589 def product_is_dev(product_info):
590     '''Know if a product is in dev mode
591     
592     :param product_info Config: The configuration specific to 
593                                the product
594     :return: True if the product is in dev mode, else False
595     :rtype: boolean
596     '''
597     dev = product_info.dev
598     return dev.lower() == 'yes'
599
600 def product_is_debug(product_info):
601     '''Know if a product is in debug mode
602     
603     :param product_info Config: The configuration specific to 
604                                the product
605     :return: True if the product is in debug mode, else False
606     :rtype: boolean
607     '''
608     debug = product_info.debug
609     return debug.lower() == 'yes'
610
611 def product_is_autotools(product_info):
612     '''Know if a product is compiled using the autotools
613     
614     :param product_info Config: The configuration specific to 
615                                the product
616     :return: True if the product is autotools, else False
617     :rtype: boolean
618     '''
619     build_src = product_info.build_source
620     return build_src.lower() == 'autotools'
621
622 def product_is_cmake(product_info):
623     '''Know if a product is compiled using the cmake
624     
625     :param product_info Config: The configuration specific to 
626                                the product
627     :return: True if the product is cmake, else False
628     :rtype: boolean
629     '''
630     build_src = product_info.build_source
631     return build_src.lower() == 'cmake'
632
633 def product_is_vcs(product_info):
634     '''Know if a product is download using git, svn or cvs (not archive)
635     
636     :param product_info Config: The configuration specific to 
637                                the product
638     :return: True if the product is vcs, else False
639     :rtype: boolean
640     '''
641     return product_info.get_source in AVAILABLE_VCS
642
643 def product_is_smesh_plugin(product_info):
644     '''Know if a product is a SMESH plugin
645     
646     :param product_info Config: The configuration specific to 
647                                the product
648     :return: True if the product is a SMESH plugin, else False
649     :rtype: boolean
650     '''
651     return ("properties" in product_info and
652             "smesh_plugin" in product_info.properties and
653             product_info.properties.smesh_plugin == "yes")
654
655 def product_is_cpp(product_info):
656     '''Know if a product is cpp
657     
658     :param product_info Config: The configuration specific to 
659                                the product
660     :return: True if the product is a cpp, else False
661     :rtype: boolean
662     '''
663     return ("properties" in product_info and
664             "cpp" in product_info.properties and
665             product_info.properties.cpp == "yes")
666
667 def product_compiles(product_info):
668     '''Know if a product compiles or not (some products do not have a 
669        compilation procedure)
670     
671     :param product_info Config: The configuration specific to 
672                                the product
673     :return: True if the product compiles, else False
674     :rtype: boolean
675     '''
676     return not("properties" in product_info and
677             "compilation" in product_info.properties and
678             product_info.properties.compilation == "no")
679
680 def product_has_script(product_info):
681     '''Know if a product has a compilation script
682     
683     :param product_info Config: The configuration specific to 
684                                the product
685     :return: True if the product it has a compilation script, else False
686     :rtype: boolean
687     '''
688     if "build_source" not in product_info:
689         # Native case
690         return False
691     build_src = product_info.build_source
692     return build_src.lower() == 'script'
693
694 def product_has_env_script(product_info):
695     '''Know if a product has an environment script
696     
697     :param product_info Config: The configuration specific to 
698                                the product
699     :return: True if the product it has an environment script, else False
700     :rtype: boolean
701     '''
702     return "environ" in product_info and "env_script" in product_info.environ
703
704 def product_has_patches(product_info):
705     '''Know if a product has one or more patches
706     
707     :param product_info Config: The configuration specific to 
708                                the product
709     :return: True if the product has one or more patches
710     :rtype: boolean
711     '''
712     return "patches" in product_info and len(product_info.patches) > 0
713
714 def product_has_logo(product_info):
715     '''Know if a product has a logo (YACSGEN generate)
716     
717     :param product_info Config: The configuration specific to 
718                                the product
719     :return: The path of the logo if the product has a logo, else False
720     :rtype: Str
721     '''
722     if ("properties" in product_info and
723             "logo" in product_info.properties):
724         return product_info.properties.logo
725     else:
726         return False
727
728 def product_has_salome_gui(product_info):
729     '''Know if a product has a SALOME gui
730     
731     :param product_info Config: The configuration specific to 
732                                the product
733     :return: True if the product has a SALOME gui, else False
734     :rtype: Boolean
735     '''
736     return ("properties" in product_info and
737             "has_salome_gui" in product_info.properties and
738             product_info.properties.has_salome_gui == "yes")
739
740 def product_is_mpi(product_info):
741     '''Know if a product has openmpi in its dependencies
742     
743     :param product_info Config: The configuration specific to 
744                                the product
745     :return: True if the product has openmpi inits dependencies
746     :rtype: boolean
747     '''
748     return "openmpi" in product_info.depend
749
750 def product_is_generated(product_info):
751     '''Know if a product is generated (YACSGEN)
752     
753     :param product_info Config: The configuration specific to 
754                                the product
755     :return: True if the product is generated
756     :rtype: boolean
757     '''
758     return ("properties" in product_info and
759             "generate" in product_info.properties and
760             product_info.properties.generate == "yes")
761
762 def get_product_components(product_info):
763     '''Get the component list to generate with the product
764     
765     :param product_info Config: The configuration specific to 
766                                the product
767     :return: The list of names of the components
768     :rtype: List
769     
770     '''
771     if not product_is_generated(product_info):
772         return []
773     
774     compo_list = []
775     if "component_name" in product_info:
776         compo_list = product_info.component_name
777     
778         if isinstance(compo_list, str):
779             compo_list = [ compo_list ]
780
781     return compo_list