• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python base.FormulaBase类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: 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:GreenGremlin,项目名称:sprinter,代码行数:12,代码来源:test_base.py


示例17: install

 def install(self):
     config = self.target
     self.p4environ = dict(list(os.environ.items()) + [('P4USER', config.get('username')),
                                                       ('P4PASSWD', config.get('password')),
                                                       ('P4CLIENT', config.get('client'))])
     installed = self.__install_perforce(config)
     if not os.path.exists(os.path.expanduser(config.get('root_path'))):
         os.makedirs(os.path.expanduser(config['root_path']))
     if config.is_affirmative('write_p4settings'):
         self.__write_p4settings(config)
     if config.is_affirmative('overwrite_client') and installed:
         self.__configure_client(config)
     self.__add_p4_env(config)
     FormulaBase.install(self)
开发者ID:evocateur,项目名称:sprinter,代码行数:14,代码来源:perforce.py


示例18: update

 def update(self):
     fresh = False
     if self.source.get('version') != self.target.get('version'):
         self.directory.remove_feature(self.feature_name)
         fresh = True
     if not os.path.exists(
             self.directory.install_directory(self.feature_name)
     ):
         fresh = True
     if fresh:
         self._install_node()
     self._link_executables()
     self._install_packages(fresh=fresh)
     FormulaBase.update(self)
开发者ID:toumorokoshi,项目名称:yt.formula.node,代码行数:14,代码来源:node.py


示例19: update

    def update(self):
        source_opts = self.__get_options(self.source)
        target_opts = self.__get_options(self.target)

        # compare old and new link source and link target
        if (source_opts['source'] != target_opts['source'] or
            source_opts['target'] != target_opts['target']):
            self.__remove_symlink(**source_opts)
            self.__create_symlink(**target_opts)

        return FormulaBase.update(self)
开发者ID:GreenGremlin,项目名称:sprinter,代码行数:11,代码来源:symlink.py


示例20: validate

 def validate(self):
     if self.target:
         target_opts = self.__get_options(self.target)
         for k in self._required_options:
             if k not in target_opts:
                 error_message = "Required option {option} not present in feature {feature}!".format(
                     option=k, feature=self.feature_name)
                 if self.target.is_affirmative('fail_on_error', False):
                     self._log_error(error_message)
                 else:
                     self.logger.error(error_message)
     return FormulaBase.validate(self)
开发者ID:GreenGremlin,项目名称:sprinter,代码行数:12,代码来源:symlink.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python formulabase.FormulaBase类代码示例发布时间:2022-05-27
下一篇:
Python core.DatabaseTemplate类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap