当前位置: 首页>>代码示例>>Python>>正文


Python base.FormulaBase类代码示例

本文整理汇总了Python中sprinter.formula.base.FormulaBase的典型用法代码示例。如果您正苦于以下问题:Python FormulaBase类的具体用法?Python FormulaBase怎么用?Python FormulaBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了FormulaBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: validate

 def validate(self):
     FormulaBase.validate(self)
     config = self.target or self.source
     version = config.get('version', 'r13.2')
     if version not in package_dict:
         raise PerforceFormulaException("Version %s in not supported by perforce formula!\n" % version +
                                        "Supported versions are: %s" % ", ".join(package_dict.keys()))
开发者ID:evocateur,项目名称:sprinter,代码行数:7,代码来源:perforce.py

示例2: update

    def update(self):
        acted = False
        if not os.path.exists(self._get_destination()):
            self.install()
            return True

        if self.source.get('url') != self.target.get('url'):
            acted = True
            if os.path.exists(self.directory.install_directory(self.feature_name)):
                try:
                    self.directory.remove_feature(self.feature_name)
                except DirectoryException:
                    self.logger.exception()
                    self.logger.error("Unable to remove old directory!")
            self.__install(self.target)
        if self.source.has('executable'):
            symlink = self.source.get('symlink', self.source.get('executable'))
            if os.path.exists(symlink) and os.path.islink(symlink):
                try:
                    self.directory.remove_from_bin(
                        self.source('symlink', self.source.get('executable')))
                    acted = True
                except DirectoryException:
                    pass
        if self.target.has('executable'):
            symlink = self.target.get('symlink', self.target.get('executable'))
            if not os.path.exists(symlink):
                acted = True
                self.__symlink_executable(self.target.get('executable'),
                                          symlink)
        FormulaBase.update(self)
        return acted
开发者ID:GreenGremlin,项目名称:sprinter,代码行数:32,代码来源:unpack.py

示例3: validate

 def validate(self):
     if self.target:
         if (self.target.has('username') and not self.target.has('password') or
            self.target.has('password') and not self.target.has('username')):
             self.logger.warn("Username and password are " +
                              "both required to authenticate to a source!")
     FormulaBase.validate(self)
开发者ID:dwwoelfel,项目名称:sprinter,代码行数:7,代码来源:template.py

示例4: update

 def update(self):
     acted = False
     if self.target.has('on_update') and self.target.is_affirmative('on_update'):
         self.__install_file(self.target)
         acted = True
     FormulaBase.update(self)
     return acted
开发者ID:dwwoelfel,项目名称:sprinter,代码行数:7,代码来源:template.py

示例5: install

 def install(self):
     self.__install(self.target)
     if self.target.has('executable'):
         symlink_target = self.target.get('symlink',
                                          self.target.get('executable'))
         self.__symlink_executable(self.target.get('executable'),
                                   symlink_target)
     FormulaBase.install(self)
开发者ID:GreenGremlin,项目名称:sprinter,代码行数:8,代码来源:unpack.py

示例6: test_debianbased_only

 def test_debianbased_only(self):
     """ Test a feature that should only occur on debian-based distributions """
     fb = FormulaBase(self.environment, "debian", target=self.environment.target.get_feature_config("debian"))
     with patch("sprinter.lib.system.is_debian") as is_debian:
         is_debian.return_value = True
         assert fb.should_run()
         is_debian.return_value = False
         assert not fb.should_run()
开发者ID:GreenGremlin,项目名称:sprinter,代码行数:8,代码来源:test_base.py

示例7: install

 def install(self):
     if not lib.which('git'):
         self.logger.warn("git is not installed! Please install git to install this feature.")
         return
     self.__clone_repo(self.target.get('url'),
                       self.directory.install_directory(self.feature_name),
                       branch=self.target.get('branch', 'master'))
     FormulaBase.install(self)
开发者ID:dwwoelfel,项目名称:sprinter,代码行数:8,代码来源:git.py

示例8: update

 def update(self):
     acted = False
     if self.source.get('version', 'r13.2') != self.target.get('version', 'r13.2'):
         os.unlink(os.path.join(self.directory.install_directory(self.feature_name), 'p4'))
         self.__install_perforce(self.target)
         acted = True
     self.__add_p4_env(self.target)
     FormulaBase.update(self)
     return acted
开发者ID:dwwoelfel,项目名称:sprinter,代码行数:9,代码来源:perforce.py

示例9: test_prompt_value_default

 def test_prompt_value_default(self):
     """ _prompt_value default should be overwritten by the source if it exists """
     fb = FormulaBase(self.environment, 'prompt_value',
                      source=self.environment.source.get_feature_config('prompt_value_source'),
                      target=self.environment.target.get_feature_config('prompt_value_source'))
     with patch('sprinter.lib.prompt') as prompt:
         prompt.return_value = "foo"
         fb._prompt_value('source_value', 'this value exists')
         prompt.assert_called_once_with('this value exists', default="old")
开发者ID:WmoT,项目名称:sprinter,代码行数:9,代码来源:test_base.py

示例10: update

 def update(self):
     acted = False
     if (self.source.get('egg', '') != self.target.get('egg', '') or
         self.source.get('eggs', '') != self.target.get('eggs', '') or
         (self.target.has('redownload') and self.target.is_affirmative('redownload'))):
             self.__install_eggs(self.target)
             acted = True
     self.__add_paths(self.target)
     FormulaBase.update(self)
     return acted
开发者ID:GreenGremlin,项目名称:sprinter,代码行数:10,代码来源:eggscript.py

示例11: test_prompt_value

 def test_prompt_value(self):
     """ _prompt_value should prompt a value if it does not exist in the target """
     fb = FormulaBase(self.environment, 'prompt_value',
                      target=self.environment.target.get_feature_config('prompt_value'))
     with patch('sprinter.lib.prompt') as prompt:
         prompt.return_value = "foo"
         fb._prompt_value('existing_value', 'this value exists')
         assert fb.target.get('existing_value') == "here"
         fb._prompt_value('non_existing_value', "this value doesn't exists")
         assert fb.target.get('non_existing_value') == "foo"
开发者ID:WmoT,项目名称:sprinter,代码行数:10,代码来源:test_base.py

示例12: remove

 def remove(self):
     if self.source.has('executable'):
         symlink = self.source.get('symlink', self.source.get('executable'))
         if os.path.exists(symlink) and os.path.islink(symlink):
             try:
                 self.directory.remove_from_bin(
                     self.source('symlink', self.source.get('executable')))
             except DirectoryException:
                 pass
     FormulaBase.remove(self)
开发者ID:GreenGremlin,项目名称:sprinter,代码行数:10,代码来源:unpack.py

示例13: test_resolve_dont_carry_over_options

 def test_resolve_dont_carry_over_options(self):
     """ resolve should resolve non-carry over options """
     fb = FormulaBase(
         self.environment,
         "prompt_value",
         source=self.environment.source.get_feature_config("resolve"),
         target=self.environment.target.get_feature_config("resolve"),
     )
     fb.resolve()
     assert not fb.target.has("systems")
     assert not fb.target.has("depends")
开发者ID:GreenGremlin,项目名称:sprinter,代码行数:11,代码来源:test_base.py

示例14: update

 def update(self):
     self.__get_package_manager()
     install_package = False
     if self.package_manager and self.target.has(self.package_manager):
         if not self.source.has(self.package_manager):
             install_package = True
         if self.source.get(self.package_manager) != self.target.get(self.package_manager):
             install_package = True
     if install_package:
         self.__install_package(self.target)
     FormulaBase.update(self)
开发者ID:WmoT,项目名称:sprinter,代码行数:11,代码来源:package.py

示例15: validate

 def validate(self):
     FormulaBase.validate(self)
     if self.target:
         versions = self.target.get('version').split('.')
         if len(versions) != 3:
             self._log_error("Version string %s is invalid! please format it as : X.X.X")
         for v in versions:
             try:
                 int(v)
             except ValueError:
                 self._log_error("Versions must all be integers! %s is not one" % v)
开发者ID:toumorokoshi,项目名称:yt.formula.node,代码行数:11,代码来源:node.py


注:本文中的sprinter.formula.base.FormulaBase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。