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


Python FormulaBase.update方法代码示例

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


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

示例1: update

# 需要导入模块: from sprinter.formula.base import FormulaBase [as 别名]
# 或者: from sprinter.formula.base.FormulaBase import update [as 别名]
    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,代码行数:34,代码来源:unpack.py

示例2: update

# 需要导入模块: from sprinter.formula.base import FormulaBase [as 别名]
# 或者: from sprinter.formula.base.FormulaBase import update [as 别名]
 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,代码行数:9,代码来源:template.py

示例3: update

# 需要导入模块: from sprinter.formula.base import FormulaBase [as 别名]
# 或者: from sprinter.formula.base.FormulaBase import update [as 别名]
 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,代码行数:11,代码来源:perforce.py

示例4: update

# 需要导入模块: from sprinter.formula.base import FormulaBase [as 别名]
# 或者: from sprinter.formula.base.FormulaBase import update [as 别名]
 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,代码行数:12,代码来源:eggscript.py

示例5: update

# 需要导入模块: from sprinter.formula.base import FormulaBase [as 别名]
# 或者: from sprinter.formula.base.FormulaBase import update [as 别名]
 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,代码行数:13,代码来源:package.py

示例6: update

# 需要导入模块: from sprinter.formula.base import FormulaBase [as 别名]
# 或者: from sprinter.formula.base.FormulaBase import update [as 别名]
 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,代码行数:16,代码来源:node.py

示例7: update

# 需要导入模块: from sprinter.formula.base import FormulaBase [as 别名]
# 或者: from sprinter.formula.base.FormulaBase import update [as 别名]
    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,代码行数:13,代码来源:symlink.py

示例8: update

# 需要导入模块: from sprinter.formula.base import FormulaBase [as 别名]
# 或者: from sprinter.formula.base.FormulaBase import update [as 别名]
    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 not os.path.exists(target_directory):
            # directory doesn't exist, so we just clone again
            self.logger.debug("No repository cloned. Re-cloning...")
            self.__clone_repo(self.target.get('url'),
                              target_directory,
                              branch=target_branch)

        if self.target.get('url') != self.source.get('url'):

            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:WmoT,项目名称:sprinter,代码行数:41,代码来源:git.py

示例9: update

# 需要导入模块: from sprinter.formula.base import FormulaBase [as 别名]
# 或者: from sprinter.formula.base.FormulaBase import update [as 别名]
    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 not os.path.exists(target_directory):
            # directory doesn't exist, so we just clone again
            self.logger.debug("No repository cloned. Re-cloning...")
            self.__clone_repo(self.target.get('url'),
                              target_directory,
                              branch=target_branch)

        if self.target.get('url') != self.source.get('url'):

            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)
            self.__fetch_merge_repo(target_directory, target_branch)

        FormulaBase.update(self)
        return True
开发者ID:dwwoelfel,项目名称:sprinter,代码行数:38,代码来源:git.py

示例10: update

# 需要导入模块: from sprinter.formula.base import FormulaBase [as 别名]
# 或者: from sprinter.formula.base.FormulaBase import update [as 别名]
 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:WmoT,项目名称:sprinter,代码行数:6,代码来源:env.py

示例11: update

# 需要导入模块: from sprinter.formula.base import FormulaBase [as 别名]
# 或者: from sprinter.formula.base.FormulaBase import update [as 别名]
 def update(self):
     self.__run_command('update', 'target')
     FormulaBase.update(self)
开发者ID:WmoT,项目名称:sprinter,代码行数:5,代码来源:command.py

示例12: update

# 需要导入模块: from sprinter.formula.base import FormulaBase [as 别名]
# 或者: from sprinter.formula.base.FormulaBase import update [as 别名]
 def update(self):
     value = self.__run_command('update', 'target')
     return value or FormulaBase.update(self)
开发者ID:GreenGremlin,项目名称:sprinter,代码行数:5,代码来源:command.py

示例13: update

# 需要导入模块: from sprinter.formula.base import FormulaBase [as 别名]
# 或者: from sprinter.formula.base.FormulaBase import update [as 别名]
 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:WmoT,项目名称:sprinter,代码行数:6,代码来源:template.py


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