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

Python formulabase.FormulaBase类代码示例

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

本文整理汇总了Python中sprinter.formulabase.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:danielra,项目名称:sprinter,代码行数:7,代码来源:perforce.py


示例2: update

 def update(self):
     if not lib.which('git'):
         self.logger.warn("git is not installed! Please install git to install this feature.")
         return
     target_directory = self.directory.install_directory(self.feature_name)
     source_branch = self.source.get('branch', 'master')
     target_branch = self.target.get('branch', 'master')
     if self.target.get('url') != self.source.get('url') or \
        not os.path.exists(target_directory):
         if os.path.exists(target_directory):
             self.logger.debug("Old git repository Found. Deleting...")
             self.directory.remove_feature(self.feature_name)
         self.__clone_repo(self.target.get('url'),
                           target_directory,
                           branch=self.target.get('branch', 'master'))
     elif source_branch != target_branch:
         self.__checkout_branch(target_directory, target_branch)
     else:
         if not os.path.exists(target_directory):
             self.logger.debug("No repository cloned. Re-cloning...")
             self.__clone_repo(self.target.get('url'),
                               target_directory,
                               branch=target_branch)
         os.chdir(target_directory)
         error, output = lib.call("git pull origin %s" % target_branch,
                                  output_log_level=logging.DEBUG)
         if error:
             self.logger.info(output)
             raise GitException("An error occurred when pulling!")
     FormulaBase.update(self)
开发者ID:danielra,项目名称:sprinter,代码行数:30,代码来源:git.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:tmckay,项目名称:sprinter,代码行数:7,代码来源:template.py


示例4: 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:danielra,项目名称:sprinter,代码行数:8,代码来源:git.py


示例5: 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'))
     self.system.isDebianBased = Mock(return_value=True)
     assert fb.should_run()
     self.system.isDebianBased = Mock(return_value=False)
     assert not fb.should_run()
开发者ID:tmckay,项目名称:sprinter,代码行数:8,代码来源:formulabase_test.py


示例6: update

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


示例7: 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:pombredanne,项目名称:sprinter,代码行数:9,代码来源:unpack.py


示例8: 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:tmckay,项目名称:sprinter,代码行数:11,代码来源:package.py


示例9: 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:pombredanne,项目名称:yt.formula.node,代码行数:11,代码来源:node.py


示例10: 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:danielra,项目名称:sprinter,代码行数:14,代码来源:perforce.py


示例11: update

 def update(self):
     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)
             self.__add_paths(self.target)
     return FormulaBase.update(self)
开发者ID:tmckay,项目名称:sprinter,代码行数:7,代码来源:eggscript.py


示例12: update

 def update(self):
     if self.source.get("url") != self.target.get("url"):
         if os.path.exists(self.directory.install_directory(self.feature_name)):
             try:
                 self.directory.remove_feature(self.feature_name)
             except DirectoryException:
                 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")))
             except DirectoryException:
                 pass
     if self.target.has("executable"):
         symlink = self.target.get("symlink", self.target.get("executable"))
         if not os.path.exists(symlink):
             self.__symlink_executable(self.target.get("executable"), symlink)
     FormulaBase.update(self)
开发者ID:pombredanne,项目名称:sprinter,代码行数:20,代码来源:unpack.py


示例13: test_osx_only

 def test_osx_only(self):
     """ Test a feature that should only occur on osx """
     fb = FormulaBase(self.environment, 'osx',
                      target=self.environment.target.get_feature_config('osx'))
     fb2 = FormulaBase(self.environment, 'osx2',
                       target=self.environment.target.get_feature_config('osx2'))
     self.system.isOSX = Mock(return_value=True)
     assert fb.should_run()
     assert fb2.should_run()
     self.system.isOSX = Mock(return_value=False)
     assert not fb.should_run()
     assert not fb2.should_run()
开发者ID:tmckay,项目名称:sprinter,代码行数:12,代码来源:formulabase_test.py


示例14: remove

 def remove(self, feature_name, config):
     if self.source.is_affirmative('remove_file_on_delete', False):
         os.path.unlink(
             os.path.expanduser(self.source.get('target')))
     FormulaBase.remove(feature_name, config)
开发者ID:tmckay,项目名称:sprinter,代码行数:5,代码来源:template.py


示例15: update

 def update(self):
     if self.target.has('on_update') and self.target.is_affirmative('on_update'):
         self.__install_file(self.target)
     FormulaBase.update(self)
开发者ID:tmckay,项目名称:sprinter,代码行数:4,代码来源:template.py


示例16: install

 def install(self):
     self.__install_file(self.target)
     FormulaBase.install(self)
开发者ID:tmckay,项目名称:sprinter,代码行数:3,代码来源:template.py


示例17: update

 def update(self):
     for c in (c for c in self.target.keys() if c not in self.ignored_keys):
         self.directory.add_to_env('export %s=%s' % (c.upper(), self.target.get(c)))
     FormulaBase.update(self)
开发者ID:danielra,项目名称:sprinter,代码行数:4,代码来源:env.py


示例18: install

 def install(self):
     self.__run_command('install', 'target')
     FormulaBase.install(self)
开发者ID:pombredanne,项目名称:sprinter,代码行数:3,代码来源:command.py


示例19: update

 def update(self):
     self.__run_command('update', 'target')
     FormulaBase.update(self)
开发者ID:pombredanne,项目名称:sprinter,代码行数:3,代码来源:command.py


示例20: deactivate

 def deactivate(self):
     self.__run_command('deactivate', 'source')
     FormulaBase.deactivate(self)
开发者ID:pombredanne,项目名称:sprinter,代码行数:3,代码来源:command.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python lib.call函数代码示例发布时间:2022-05-27
下一篇:
Python base.FormulaBase类代码示例发布时间: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