當前位置: 首頁>>代碼示例>>Python>>正文


Python FormulaBase.update方法代碼示例

本文整理匯總了Python中sprinter.formulabase.FormulaBase.update方法的典型用法代碼示例。如果您正苦於以下問題:Python FormulaBase.update方法的具體用法?Python FormulaBase.update怎麽用?Python FormulaBase.update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sprinter.formulabase.FormulaBase的用法示例。


在下文中一共展示了FormulaBase.update方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: update

# 需要導入模塊: from sprinter.formulabase import FormulaBase [as 別名]
# 或者: from sprinter.formulabase.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 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,代碼行數:32,代碼來源:git.py

示例2: update

# 需要導入模塊: from sprinter.formulabase import FormulaBase [as 別名]
# 或者: from sprinter.formulabase.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)
         self._install_node()
         fresh = True
     self._install_packages(fresh=fresh)
     self._link_executables()
     FormulaBase.update(self)
開發者ID:pombredanne,項目名稱:yt.formula.node,代碼行數:11,代碼來源:node.py

示例3: update

# 需要導入模塊: from sprinter.formulabase import FormulaBase [as 別名]
# 或者: from sprinter.formulabase.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:tmckay,項目名稱:sprinter,代碼行數:13,代碼來源:package.py

示例4: update

# 需要導入模塊: from sprinter.formulabase import FormulaBase [as 別名]
# 或者: from sprinter.formulabase.FormulaBase import update [as 別名]
 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,代碼行數:9,代碼來源:eggscript.py

示例5: update

# 需要導入模塊: from sprinter.formulabase import FormulaBase [as 別名]
# 或者: from sprinter.formulabase.FormulaBase import update [as 別名]
 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,代碼行數:22,代碼來源:unpack.py

示例6: update

# 需要導入模塊: from sprinter.formulabase import FormulaBase [as 別名]
# 或者: from sprinter.formulabase.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:tmckay,項目名稱:sprinter,代碼行數:6,代碼來源:template.py

示例7: update

# 需要導入模塊: from sprinter.formulabase import FormulaBase [as 別名]
# 或者: from sprinter.formulabase.FormulaBase import update [as 別名]
 def update(self):
     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)
     self.__add_p4_env(self.target)
     FormulaBase.update(self)
開發者ID:danielra,項目名稱:sprinter,代碼行數:8,代碼來源:perforce.py

示例8: update

# 需要導入模塊: from sprinter.formulabase import FormulaBase [as 別名]
# 或者: from sprinter.formulabase.FormulaBase import update [as 別名]
 def update(self):
     self.__run_command('update', 'target')
     FormulaBase.update(self)
開發者ID:pombredanne,項目名稱:sprinter,代碼行數:5,代碼來源:command.py

示例9: update

# 需要導入模塊: from sprinter.formulabase import FormulaBase [as 別名]
# 或者: from sprinter.formulabase.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:danielra,項目名稱:sprinter,代碼行數:6,代碼來源:env.py

示例10: update

# 需要導入模塊: from sprinter.formulabase import FormulaBase [as 別名]
# 或者: from sprinter.formulabase.FormulaBase import update [as 別名]
 def update(self):
     for c in (c for c in self.target.keys() if c != 'formula'):
         self.directory.add_to_rc('export %s=%s' % (c.upper(), self.target.get(c)))
     FormulaBase.update(self)
開發者ID:tmckay,項目名稱:sprinter,代碼行數:6,代碼來源:env.py


注:本文中的sprinter.formulabase.FormulaBase.update方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。