]> SALOME platform Git repositories - tools/sat.git/blob - src/product.py
Salome HOME
120 s betwenn two refreshs in the boards
[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 get_install_dir)
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:
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 prod_info.get_source=="fixed":
113             prod_info.install_dir = version
114         
115         # Check if the product is defined as native in the application
116         if prod_info is not None:
117             if version == "native":
118                 prod_info.get_source = "native"
119             elif prod_info.get_source == "native":
120                 msg = _("The product %(prod)s has version %(ver)s but is "
121                         "declared as native in its definition" %
122                         { 'prod': prod_info.name, 'ver': version})
123                 raise src.SatException(msg)
124
125     # If there is no definition but the product is declared as native,
126     # construct a new definition containing only the get_source key
127     if prod_info is None and version == "native":
128         prod_info = src.pyconf.Config()
129         prod_info.name = product_name
130         prod_info.get_source = "native"
131     
132     # If prod_info is still None, it means that there is no product definition
133     # in the config. The user has to provide it.
134     if prod_info is None:
135         prod_pyconf_path = src.find_file_in_lpath(product_name + ".pyconf",
136                                                   config.PATHS.PRODUCTPATH)
137         if not prod_pyconf_path:
138             msg = _("No definition found for the product %s\n"
139                "Please create a %s.pyconf file." % (product_name, product_name))
140         else:
141             msg = _("No definition corresponding to the version %(version)s was"
142                     " found in the file %(prod_file_path)s.\nPlease add a "
143                     "section in it." % {"version" : vv,
144                                         "prod_file_path" : prod_pyconf_path} )
145         raise src.SatException(msg)
146     
147     # Set the debug, dev and version keys
148     prod_info.debug = debug
149     prod_info.dev = dev
150     prod_info.version = version
151     
152     # Set the archive_info if the product is get in archive mode
153     if prod_info.get_source == "archive":
154         if not "archive_info" in prod_info:
155             prod_info.addMapping("archive_info",
156                                  src.pyconf.Mapping(prod_info),
157                                  "")
158         if "archive_name" not in prod_info.archive_info: 
159             arch_name = product_name + "-" + version + ".tar.gz"
160             arch_path = src.find_file_in_lpath(arch_name,
161                                                config.PATHS.ARCHIVEPATH)
162             if not arch_path:
163                 msg = _("Archive %(arch_name)s for %(prod_name)s not found:"
164                             "\n" % {"arch_name" : arch_name,
165                                      "prod_name" : prod_info.name}) 
166                 raise src.SatException(msg)
167             prod_info.archive_info.archive_name = arch_path
168         else:
169             if (os.path.basename(prod_info.archive_info.archive_name) == 
170                                         prod_info.archive_info.archive_name):
171                 arch_name = prod_info.archive_info.archive_name
172                 arch_path = src.find_file_in_lpath(
173                                             arch_name,
174                                             config.PATHS.ARCHIVEPATH)
175                 if not arch_path:
176                     msg = _("Archive %(arch_name)s for %(prod_name)s not found:"
177                                 "\n" % {"arch_name" : arch_name,
178                                          "prod_name" : prod_info.name}) 
179                     raise src.SatException(msg)
180                 prod_info.archive_info.archive_name = arch_path
181         
182     # If the product compiles with a script, check the script existence
183     # and if it is executable
184     if product_has_script(prod_info):
185         # Check the compil_script key existence
186         if "compil_script" not in prod_info:
187             msg = _("No compilation script found for the product %s\n"
188                 "Please provide a \"compil_script\" key in its definition." 
189                 % (product_name))
190             raise src.SatException(msg)
191         
192         # Get the path of the script
193         script = prod_info.compil_script
194         script_name = os.path.basename(script)
195         if script == script_name:
196             # Only a name is given. Search in the default directory
197             script_path = src.find_file_in_lpath(script_name,
198                                                  config.PATHS.PRODUCTPATH,
199                                                  "compil_scripts")
200             if not script_path:
201                 raise src.SatException(_("Compilation script not found: %s") % 
202                                    script_name)
203             prod_info.compil_script = script_path
204        
205         # Check that the script is executable
206         if not os.access(prod_info.compil_script, os.X_OK):
207             raise src.SatException(
208                     _("Compilation script cannot be executed: %s") % 
209                     prod_info.compil_script)
210     
211     # Get the full paths of all the patches
212     if product_has_patches(prod_info):
213         patches = []
214         for patch in prod_info.patches:
215             patch_path = patch
216             # If only a filename, then search for the patch in the PRODUCTPATH
217             if os.path.basename(patch_path) == patch_path:
218                 # Search in the PRODUCTPATH/patches
219                 patch_path = src.find_file_in_lpath(patch,
220                                                     config.PATHS.PRODUCTPATH,
221                                                     "patches")
222                 if not patch_path:
223                     msg = _("Patch %(patch_name)s for %(prod_name)s not found:"
224                             "\n" % {"patch_name" : patch,
225                                      "prod_name" : prod_info.name}) 
226                     raise src.SatException(msg)
227             patches.append(patch_path)
228         prod_info.patches = patches
229
230     # Get the full paths of the environment scripts
231     if product_has_env_script(prod_info):
232         env_script_path = prod_info.environ.env_script
233         # If only a filename, then search for the environment script 
234         # in the PRODUCTPATH/env_scripts
235         if os.path.basename(env_script_path) == env_script_path:
236             # Search in the PRODUCTPATH/env_scripts
237             env_script_path = src.find_file_in_lpath(
238                                             prod_info.environ.env_script,
239                                             config.PATHS.PRODUCTPATH,
240                                             "env_scripts")
241             if not env_script_path:
242                 msg = _("Environment script %(env_name)s for %(prod_name)s not "
243                         "found.\n" % {"env_name" : env_script_path,
244                                        "prod_name" : prod_info.name}) 
245                 raise src.SatException(msg)
246
247         prod_info.environ.env_script = env_script_path
248     
249     if with_install_dir: 
250         # The variable with_install_dir is at false only for internal use 
251         # of the function get_install_dir
252         
253         # Set the install_dir key
254         prod_info.install_dir = get_install_dir(config, base, version, prod_info)
255                 
256     return prod_info
257
258 def get_product_section(config, product_name, version, section=None):
259     '''Get the product description from the configuration
260     
261     :param config Config: The global configuration
262     :param product_name str: The product name
263     :param version str: The version of the product
264     :param section str: The searched section (if not None, the section is 
265                         explicitly given
266     :return: The product description
267     :rtype: Config
268     '''
269
270     # if section is not None, try to get the corresponding section
271     if section:
272         if section not in config.PRODUCTS[product_name]:
273             return None
274         # returns specific information for the given version
275         prod_info = config.PRODUCTS[product_name][section]
276         prod_info.section = section
277         return prod_info
278
279     # If it exists, get the information of the product_version
280     if "version_" + version in config.PRODUCTS[product_name]:
281         # returns specific information for the given version
282         prod_info = config.PRODUCTS[product_name]["version_" + version]
283         prod_info.section = "version_" + version
284         return prod_info
285     
286     # Else, check if there is a description for multiple versions
287     l_section_name = config.PRODUCTS[product_name].keys()
288     l_section_ranges = [section_name for section_name in l_section_name 
289                         if VERSION_DELIMITER in section_name]
290     for section_range in l_section_ranges:
291         minimum, maximum = section_range.split(VERSION_DELIMITER)
292         if (src.only_numbers(version) >= src.only_numbers(minimum)
293                     and src.only_numbers(version) <= src.only_numbers(maximum)):
294             # returns specific information for the versions
295             prod_info = config.PRODUCTS[product_name][section_range]
296             prod_info.section = section_range
297             return prod_info
298     
299     # Else, get the standard informations
300     if "default" in config.PRODUCTS[product_name]:
301         # returns the generic information (given version not found)
302         prod_info = config.PRODUCTS[product_name].default
303         prod_info.section = "default"
304         return prod_info
305     
306     # if noting was found, return None
307     return None
308     
309 def get_install_dir(config, base, version, prod_info):
310     '''Compute the installation directory of a given product 
311     
312     :param config Config: The global configuration
313     :param base str: This corresponds to the value given by user in its 
314                      application.pyconf for the specific product. If "yes", the
315                     user wants the product to be in base. If "no", he wants the
316                     product to be in the application workdir
317     :param version str: The version of the product
318     :param product_info Config: The configuration specific to 
319                                the product
320     
321     :return: The path of the product installation
322     :rtype: str
323     '''
324     install_dir = ""
325     in_base = False
326     if (("install_dir" in prod_info and prod_info.install_dir == "base") 
327                                                             or base == "yes"):
328         in_base = True
329     if (base == "no" or ("no_base" in config.APPLICATION 
330                          and config.APPLICATION.no_base == "yes")):
331         in_base = False
332     
333     if in_base:
334         install_dir = get_base_install_dir(config, prod_info, version)
335     else:
336         if "install_dir" not in prod_info or prod_info.install_dir == "base":
337             # Set it to the default value (in application directory)
338             install_dir = os.path.join(config.APPLICATION.workdir,
339                                                 "INSTALL",
340                                                 prod_info.name)
341         else:
342             install_dir = prod_info.install_dir
343
344     return install_dir
345
346 def get_base_install_dir(config, prod_info, version):
347     '''Compute the installation directory of a product in base 
348     
349     :param config Config: The global configuration
350     :param product_info Config: The configuration specific to 
351                                the product
352     :param version str: The version of the product    
353     :return: The path of the product installation
354     :rtype: str
355     '''    
356     base_path = src.get_base_path(config) 
357     prod_dir = os.path.join(base_path, prod_info.name + "-" + version)
358     if not os.path.exists(prod_dir):
359         return os.path.join(prod_dir, "config-1")
360     
361     exists, install_dir = check_config_exists(config, prod_dir, prod_info)
362     if exists:
363         return install_dir
364     
365     # Find the first config-<i> directory that is available in the product
366     # directory
367     found = False 
368     label = 1
369     while not found:
370         install_dir = os.path.join(prod_dir, "config-%i" % label)
371         if os.path.exists(install_dir):
372             label+=1
373         else:
374             found = True
375             
376     return install_dir
377
378 def check_config_exists(config, prod_dir, prod_info):
379     '''Verify that the installation directory of a product in a base exists
380        Check all the config-<i> directory and verify the sat-config.pyconf file
381        that is in it 
382     
383     :param config Config: The global configuration
384     :param prod_dir str: The product installation directory path 
385                          (without config-<i>)
386     :param product_info Config: The configuration specific to 
387                                the product
388     :return: True or false is the installation is found or not 
389              and if it is found, the path of the found installation
390     :rtype: (boolean, str)
391     '''   
392     # check if the directories or files of the directory corresponds to the 
393     # directory installation of the product
394     l_dir_and_files = os.listdir(prod_dir)
395     for dir_or_file in l_dir_and_files:
396         oExpr = re.compile(config_expression)
397         if not(oExpr.search(dir_or_file)):
398             # not config-<i>, not interesting
399             continue
400         # check if there is the file sat-config.pyconf file in the installation
401         # directory    
402         config_file = os.path.join(prod_dir, dir_or_file, src.CONFIG_FILENAME)
403         if not os.path.exists(config_file):
404             continue
405         
406         # If there is no dependency, it is the right path
407         if len(prod_info.depend)==0:
408             return True, os.path.join(prod_dir, dir_or_file)
409         
410         # check if there is the config described in the file corresponds the 
411         # dependencies of the product
412         config_corresponds = True    
413         compile_cfg = src.pyconf.Config(config_file)
414         for prod_dep in prod_info.depend:
415             # if the dependency is not in the config, 
416             # the config does not correspond
417             if prod_dep not in compile_cfg:
418                 config_corresponds = False
419                 break
420             else:
421                 prod_dep_info = get_product_config(config, prod_dep, False)
422                 # If the version of the dependency does not correspond, 
423                 # the config does not correspond
424                 if prod_dep_info.version != compile_cfg[prod_dep]:
425                     config_corresponds = False
426                     break
427         if config_corresponds:
428             return True, os.path.join(prod_dir, dir_or_file)
429     
430     return False, None
431             
432             
433     
434 def get_products_infos(lproducts, config):
435     '''Get the specific configuration of a list of products
436     
437     :param lproducts List: The list of product names
438     :param config Config: The global configuration
439     :return: the list of tuples 
440              (product name, specific configuration of the product)
441     :rtype: [(str, Config)]
442     '''
443     products_infos = []
444     # Loop on product names
445     for prod in lproducts:       
446         # Get the specific configuration of the product
447         prod_info = get_product_config(config, prod)
448         if prod_info is not None:
449             products_infos.append((prod, prod_info))
450         else:
451             msg = _("The %s product has no definition "
452                     "in the configuration.") % prod
453             raise src.SatException(msg)
454     return products_infos
455
456 def get_product_dependencies(config, product_info):
457     '''Get recursively the list of products that are 
458        in the product_info dependencies
459     
460     :param config Config: The global configuration
461     :param product_info Config: The configuration specific to 
462                                the product
463     :return: the list of products in dependence
464     :rtype: list
465     '''
466     if "depend" not in product_info or product_info.depend == []:
467         return []
468     res = []
469     for prod in product_info.depend:
470         if prod == product_info.name:
471             continue
472         if prod not in res:
473             res.append(prod)
474         prod_info = get_product_config(config, prod)
475         dep_prod = get_product_dependencies(config, prod_info)
476         for prod_in_dep in dep_prod:
477             if prod_in_dep not in res:
478                 res.append(prod_in_dep)
479     return res
480
481 def check_installation(product_info):
482     '''Verify if a product is well installed. Checks install directory presence
483        and some additional files if it is defined in the config 
484     
485     :param product_info Config: The configuration specific to 
486                                the product
487     :return: True if it is well installed
488     :rtype: boolean
489     '''
490     if not product_compiles(product_info):
491         return True
492     install_dir = product_info.install_dir
493     if not os.path.exists(install_dir):
494         return False
495     if ("present_files" in product_info and 
496         "install" in product_info.present_files):
497         for file_relative_path in product_info.present_files.install:
498             file_path = os.path.join(install_dir, file_relative_path)
499             if not os.path.exists(file_path):
500                 return False
501     return True
502
503 def product_is_sample(product_info):
504     '''Know if a product has the sample type
505     
506     :param product_info Config: The configuration specific to 
507                                the product
508     :return: True if the product has the sample type, else False
509     :rtype: boolean
510     '''
511     if 'type' in product_info:
512         ptype = product_info.type
513         return ptype.lower() == 'sample'
514     else:
515         return False
516
517 def product_is_salome(product_info):
518     '''Know if a product is of type salome
519     
520     :param product_info Config: The configuration specific to 
521                                the product
522     :return: True if the product is salome, else False
523     :rtype: boolean
524     '''
525     if 'type' in product_info:
526         ptype = product_info.type
527         return ptype.lower() == 'salome'
528     else:
529         return False
530
531 def product_is_fixed(product_info):
532     '''Know if a product is fixed
533     
534     :param product_info Config: The configuration specific to 
535                                the product
536     :return: True if the product is fixed, else False
537     :rtype: boolean
538     '''
539     get_src = product_info.get_source
540     return get_src.lower() == 'fixed'
541
542 def product_is_native(product_info):
543     '''Know if a product is native
544     
545     :param product_info Config: The configuration specific to 
546                                the product
547     :return: True if the product is native, else False
548     :rtype: boolean
549     '''
550     get_src = product_info.get_source
551     return get_src.lower() == 'native'
552
553 def product_is_dev(product_info):
554     '''Know if a product is in dev mode
555     
556     :param product_info Config: The configuration specific to 
557                                the product
558     :return: True if the product is in dev mode, else False
559     :rtype: boolean
560     '''
561     dev = product_info.dev
562     return dev.lower() == 'yes'
563
564 def product_is_debug(product_info):
565     '''Know if a product is in debug mode
566     
567     :param product_info Config: The configuration specific to 
568                                the product
569     :return: True if the product is in debug mode, else False
570     :rtype: boolean
571     '''
572     debug = product_info.debug
573     return debug.lower() == 'yes'
574
575 def product_is_autotools(product_info):
576     '''Know if a product is compiled using the autotools
577     
578     :param product_info Config: The configuration specific to 
579                                the product
580     :return: True if the product is autotools, else False
581     :rtype: boolean
582     '''
583     build_src = product_info.build_source
584     return build_src.lower() == 'autotools'
585
586 def product_is_cmake(product_info):
587     '''Know if a product is compiled using the cmake
588     
589     :param product_info Config: The configuration specific to 
590                                the product
591     :return: True if the product is cmake, else False
592     :rtype: boolean
593     '''
594     build_src = product_info.build_source
595     return build_src.lower() == 'cmake'
596
597 def product_is_vcs(product_info):
598     '''Know if a product is download using git, svn or cvs (not archive)
599     
600     :param product_info Config: The configuration specific to 
601                                the product
602     :return: True if the product is vcs, else False
603     :rtype: boolean
604     '''
605     return product_info.get_source in AVAILABLE_VCS
606
607 def product_is_SALOME(product_info):
608     '''Know if a product is a SALOME module
609     
610     :param product_info Config: The configuration specific to 
611                                the product
612     :return: True if the product is a SALOME module, else False
613     :rtype: boolean
614     '''
615     return ("properties" in product_info and
616             "is_SALOME_module" in product_info.properties and
617             product_info.properties.is_SALOME_module == "yes")
618
619 def product_is_smesh_plugin(product_info):
620     '''Know if a product is a SMESH plugin
621     
622     :param product_info Config: The configuration specific to 
623                                the product
624     :return: True if the product is a SMESH plugin, else False
625     :rtype: boolean
626     '''
627     return ("properties" in product_info and
628             "smesh_plugin" in product_info.properties and
629             product_info.properties.smesh_plugin == "yes")
630
631 def product_is_cpp(product_info):
632     '''Know if a product is cpp
633     
634     :param product_info Config: The configuration specific to 
635                                the product
636     :return: True if the product is a cpp, else False
637     :rtype: boolean
638     '''
639     return ("properties" in product_info and
640             "cpp" in product_info.properties and
641             product_info.properties.cpp == "yes")
642
643 def product_compiles(product_info):
644     '''Know if a product compiles or not (some products do not have a 
645        compilation procedure)
646     
647     :param product_info Config: The configuration specific to 
648                                the product
649     :return: True if the product compiles, else False
650     :rtype: boolean
651     '''
652     return not("properties" in product_info and
653             "compilation" in product_info.properties and
654             product_info.properties.compilation == "no")
655
656 def product_has_script(product_info):
657     '''Know if a product has a compilation script
658     
659     :param product_info Config: The configuration specific to 
660                                the product
661     :return: True if the product it has a compilation script, else False
662     :rtype: boolean
663     '''
664     if "build_source" not in product_info:
665         # Native case
666         return False
667     build_src = product_info.build_source
668     return build_src.lower() == 'script'
669
670 def product_has_env_script(product_info):
671     '''Know if a product has an environment script
672     
673     :param product_info Config: The configuration specific to 
674                                the product
675     :return: True if the product it has an environment script, else False
676     :rtype: boolean
677     '''
678     return "environ" in product_info and "env_script" in product_info.environ
679
680 def product_has_patches(product_info):
681     '''Know if a product has one or more patches
682     
683     :param product_info Config: The configuration specific to 
684                                the product
685     :return: True if the product has one or more patches
686     :rtype: boolean
687     '''
688     return "patches" in product_info and len(product_info.patches) > 0
689
690 def product_has_logo(product_info):
691     '''Know if a product has a logo (YACSGEN generate)
692     
693     :param product_info Config: The configuration specific to 
694                                the product
695     :return: The path of the logo if the product has a logo, else False
696     :rtype: Str
697     '''
698     if ("properties" in product_info and
699             "logo" in product_info.properties):
700         return product_info.properties.logo
701     else:
702         return False
703
704 def product_has_salome_gui(product_info):
705     '''Know if a product has a SALOME gui
706     
707     :param product_info Config: The configuration specific to 
708                                the product
709     :return: True if the product has a SALOME gui, else False
710     :rtype: Boolean
711     '''
712     return ("properties" in product_info and
713             "has_salome_gui" in product_info.properties and
714             product_info.properties.has_salome_gui == "yes")
715
716 def product_is_mpi(product_info):
717     '''Know if a product has openmpi in its dependencies
718     
719     :param product_info Config: The configuration specific to 
720                                the product
721     :return: True if the product has openmpi inits dependencies
722     :rtype: boolean
723     '''
724     return "openmpi" in product_info.depend
725
726 def product_is_generated(product_info):
727     '''Know if a product is generated (YACSGEN)
728     
729     :param product_info Config: The configuration specific to 
730                                the product
731     :return: True if the product is generated
732     :rtype: boolean
733     '''
734     return ("properties" in product_info and
735             "generate" in product_info.properties and
736             product_info.properties.generate == "yes")
737
738 def get_product_components(product_info):
739     '''Get the component list to generate with the product
740     
741     :param product_info Config: The configuration specific to 
742                                the product
743     :return: The list of names of the components
744     :rtype: List
745     
746     '''
747     if not product_is_generated(product_info):
748         return []
749     
750     compo_list = []
751     if "component_name" in product_info:
752         compo_list = product_info.component_name
753     
754         if isinstance(compo_list, str):
755             compo_list = [ compo_list ]
756
757     return compo_list