Пример #1
0
 def _load_universal_recipe(self,
                            globals_dict,
                            recipe_cls,
                            recipe_cls_key,
                            filepath,
                            custom=None):
     if self._config.target_platform in [Platform.IOS, Platform.DARWIN]:
         recipe = crecipe.UniversalFlatRecipe(self._config)
     else:
         recipe = crecipe.UniversalRecipe(self._config)
     for c in list(self._config.arch_config.keys()):
         conf = self._config.arch_config[c]
         conf.prefix = os.path.join(self._config.prefix, c)
         # For univeral recipes, we need to parse again the recipe file.
         # Otherwise, class variables with mutable types like the "deps"
         # dictionary are reused in new instances
         if recipe_cls is None:
             parsed_dict = dict(globals_dict)
             parse_file(filepath, parsed_dict)
             recipe_cls = parsed_dict[recipe_cls_key]
         r = self._load_recipe_from_class(recipe_cls, conf, filepath)
         if r is not None:
             recipe.add_recipe(r)
         recipe_cls = None
     if recipe.is_empty():
         return None
     return recipe
Пример #2
0
 def setUp(self):
     self.config = DummyConfig()
     self.config.target_platform = Platform.LINUX
     self.config_x86 = DummyConfig()
     self.config_x86.target_platform = Platform.LINUX
     self.config_x86.target_architecture = Architecture.X86
     self.config_x86_64 = DummyConfig()
     self.config_x86_64.target_platform = Platform.LINUX
     self.config_x86_64.target_architecture = Architecture.X86_64
     self.recipe = recipe.UniversalRecipe(self.config)
     self.recipe_x86 = Recipe1(self.config_x86)
     self.recipe_x86_64 = Recipe1(self.config_x86_64)
Пример #3
0
 def _load_recipe_from_file(self, filepath, custom=None):
     mod_name, file_ext = os.path.splitext(os.path.split(filepath)[-1])
     if self._config.target_arch == Architecture.UNIVERSAL:
         if self._config.target_platform in [Platform.IOS, Platform.DARWIN]:
             recipe = crecipe.UniversalFlatRecipe(self._config)
         else:
             recipe = crecipe.UniversalRecipe(self._config)
     for c in self._config.arch_config.keys():
         try:
             d = {
                 'Platform': Platform,
                 'Architecture': Architecture,
                 'BuildType': BuildType,
                 'SourceType': SourceType,
                 'Distro': Distro,
                 'DistroVersion': DistroVersion,
                 'License': License,
                 'recipe': crecipe,
                 'os': os,
                 'BuildSteps': crecipe.BuildSteps,
                 'InvalidRecipeError': InvalidRecipeError,
                 'FatalError': FatalError,
                 'custom': custom,
                 '_': _,
                 'shell': shell
             }
             parse_file(filepath, d)
             conf = self._config.arch_config[c]
             if self._config.target_arch == Architecture.UNIVERSAL:
                 if self._config.target_platform not in [
                         Platform.IOS, Platform.DARWIN
                 ]:
                     conf.prefix = os.path.join(self._config.prefix, c)
             r = d['Recipe'](conf)
             r.__file__ = os.path.abspath(filepath)
             self._config.arch_config[c].do_setup_env()
             r.prepare()
             if self._config.target_arch == Architecture.UNIVERSAL:
                 recipe.add_recipe(r)
             else:
                 return r
         except InvalidRecipeError as e:
             self._invalid_recipes[r.name] = e
         except Exception as ex:
             m.warning("Error loading recipe in file %s %s" %
                       (filepath, ex))
     if self._config.target_arch == Architecture.UNIVERSAL:
         if not recipe.is_empty():
             return recipe
     return None