本文整理汇总了Python中sickbeard.notifiers.notify_git_update函数的典型用法代码示例。如果您正苦于以下问题:Python notify_git_update函数的具体用法?Python notify_git_update怎么用?Python notify_git_update使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了notify_git_update函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: update
def update(self):
"""
Calls git pull origin <branch> in order to update SickChill. Returns a bool depending
on the call's success.
"""
# update remote origin url
self.update_remote_origin()
# remove untracked files and performs a hard reset on git branch to avoid update issues
if sickbeard.GIT_RESET:
# self.clean() # This is removing user data and backups
self.reset()
if self.branch == self._find_installed_branch():
stdout_, stderr_, exit_status = self._run_git(self._git_path, 'pull -f {0} {1}'.format(sickbeard.GIT_REMOTE, self.branch))
else:
stdout_, stderr_, exit_status = self._run_git(self._git_path, 'checkout -f ' + self.branch)
if exit_status == 0:
self._find_installed_version()
# Notify update successful
notifiers.notify_git_update(sickbeard.CUR_COMMIT_HASH or "")
return True
else:
return False
开发者ID:murbaniak,项目名称:SickRage,代码行数:27,代码来源:versionChecker.py
示例2: update
def update(self):
"""
Calls git pull origin <branch> in order to update SickRage. Returns a bool depending
on the call's success.
"""
# update remote origin url
self.update_remote_origin()
# remove untracked files and performs a hard reset on git branch to avoid update issues
if sickbeard.GIT_RESET:
self.clean()
self.reset()
if self.branch == self._find_installed_branch():
output, err, exit_status = self._run_git(self._git_path, 'pull -f %s %s' % (sickbeard.GIT_REMOTE, self.branch)) # @UnusedVariable
else:
output, err, exit_status = self._run_git(self._git_path, 'checkout -f ' + self.branch) # @UnusedVariable
if exit_status == 0:
self._find_installed_version()
# Notify update successful
if sickbeard.NOTIFY_ON_UPDATE:
notifiers.notify_git_update(sickbeard.CUR_COMMIT_HASH if sickbeard.CUR_COMMIT_HASH else "")
return True
开发者ID:zezineustaquio,项目名称:SickRage,代码行数:27,代码来源:versionChecker.py
示例3: update
def update(self):
"""
Calls git pull origin <branch> in order to update SickRage. Returns a bool depending
on the call's success.
"""
# update remote origin url
self.update_remote_origin()
# remove untracked files and performs a hard reset on git branch to avoid update issues
if sickbeard.GIT_RESET:
# self.clean() # This is removing user data and backups
self.reset()
if self.branch == self._find_installed_branch():
stdout_, stderr_, exit_status = self._run_git(self._git_path, 'pull -f {0} {1}'.format(sickbeard.GIT_REMOTE, self.branch))
else:
stdout_, stderr_, exit_status = self._run_git(self._git_path, 'checkout -f ' + self.branch)
if exit_status == 0:
self._find_installed_version()
# Notify update successful
if sickbeard.NOTIFY_ON_UPDATE:
try:
notifiers.notify_git_update(sickbeard.CUR_COMMIT_HASH or "")
except Exception:
logger.log(u"Unable to send update notification. Continuing the update process", logger.DEBUG)
return True
else:
return False
开发者ID:Arcanemagus,项目名称:SickRage,代码行数:32,代码来源:versionChecker.py
示例4: update
def update(self):
"""
Calls git pull origin <branch> in order to update SickRage. Returns a bool depending
on the call's success.
"""
output, err, exit_status = self._run_git(self._git_path, 'remote set-url origin https://github.com/SickragePVR/SickRage.git')
if not exit_status == 0:
logger.log(u"Unable to contact github, can't check for update", logger.ERROR)
return False
output, err, exit_status = self._run_git(self._git_path, 'fetch origin')
if not exit_status == 0:
logger.log(u"Unable to contact github, can't check for update", logger.ERROR)
return False
output, err, exit_status = self._run_git(self._git_path, 'reset --hard origin/master')
if not exit_status == 0:
logger.log(u"Unable to contact github, can't check for update", logger.ERROR)
return False
# Notify update successful
if sickbeard.NOTIFY_ON_UPDATE:
notifiers.notify_git_update(sickbeard.CUR_COMMIT_HASH if sickbeard.CUR_COMMIT_HASH else "")
sickbeard.BRANCH = "master"
return True
开发者ID:Soulflavour,项目名称:SickRage,代码行数:29,代码来源:versionChecker.py
示例5: update
def update(self):
"""
Calls git pull origin <branch> in order to update SickRage. Returns a bool depending
on the call's success.
"""
output, err, exit_status = self._run_git(self._git_path, 'pull origin ' + self.branch) # @UnusedVariable
if exit_status == 0:
# Notify update successful
if sickbeard.NOTIFY_ON_UPDATE:
notifiers.notify_git_update(self._newest_commit_hash[:10])
return True
return False
开发者ID:tcavallari,项目名称:SickRage,代码行数:15,代码来源:versionChecker.py
示例6: update
def update(self):
"""
Calls git pull origin <branch> in order to update SickRage. Returns a bool depending
on the call's success.
"""
if self.branch == self._find_installed_branch():
output, err, exit_status = self._run_git(self._git_path, 'pull -f origin ' + self.branch) # @UnusedVariable
else:
output, err, exit_status = self._run_git(self._git_path, 'checkout -f ' + self.branch) # @UnusedVariable
if exit_status == 0:
self._find_installed_version()
# Notify update successful
if sickbeard.NOTIFY_ON_UPDATE:
notifiers.notify_git_update(sickbeard.CUR_COMMIT_HASH if sickbeard.CUR_COMMIT_HASH else "")
return True
return False
开发者ID:AlexisWalravens,项目名称:SickRage,代码行数:20,代码来源:versionChecker.py
示例7: update
def update(self, branch=sickbeard.version.SICKBEARD_VERSION):
"""
Calls git pull origin <branch> in order to update SickRage. Returns a bool depending
on the call's success.
"""
# set branch version
self.branch = branch
if self.branch == sickbeard.version.SICKBEARD_VERSION:
output, err, exit_status = self._run_git(self._git_path, 'pull -f origin ' + self.branch) # @UnusedVariable
else:
output, err, exit_status = self._run_git(self._git_path, 'checkout -f ' + self.branch) # @UnusedVariable
if exit_status == 0:
# Notify update successful
if sickbeard.NOTIFY_ON_UPDATE:
notifiers.notify_git_update(self._newest_commit_hash[:10])
return True
return False
开发者ID:Th3MadHatter,项目名称:SickRage,代码行数:21,代码来源:versionChecker.py
示例8: update
def update(self):
"""
Calls git pull origin <branch> in order to update SickRage. Returns a bool depending
on the call's success.
"""
# update remote origin url
self.update_remote_origin()
# remove untracked files and performs a hard reset on git branch to avoid update issues
if sickbeard.GIT_RESET:
# self.clean() # This is removing user data and backups
self.reset()
if self.branch == self._find_installed_branch():
_, _, exit_status = self._run_git(
self._git_path, "pull -f %s %s" % (sickbeard.GIT_REMOTE, self.branch)
) # @UnusedVariable
else:
_, _, exit_status = self._run_git(self._git_path, "checkout -f " + self.branch) # @UnusedVariable
if exit_status == 0:
_, _, exit_status = self._run_git(self._git_path, "submodule update --init --recursive")
if exit_status == 0:
self._find_installed_version()
sickbeard.GIT_NEWVER = True
# Notify update successful
if sickbeard.NOTIFY_ON_UPDATE:
notifiers.notify_git_update(sickbeard.CUR_COMMIT_HASH if sickbeard.CUR_COMMIT_HASH else "")
return True
else:
return False
else:
return False
开发者ID:zeroX-tj,项目名称:SickRage,代码行数:39,代码来源:versionChecker.py
示例9: update
def update(self):
"""
Calls git pull origin <branch> in order to update SickGear. Returns a bool depending
on the call's success.
"""
if self.branch == self._find_installed_branch():
if not self._cur_pr_number:
output, err, exit_status = self._run_git(self._git_path, 'pull -f %s %s' % (sickbeard.GIT_REMOTE, self.branch)) # @UnusedVariable
else:
output, err, exit_status = self._run_git(self._git_path, 'pull -f %s pull/%s/head:%s' % (sickbeard.GIT_REMOTE, self._cur_pr_number, self.branch))
else:
output, err, exit_status = self._run_git(self._git_path, 'checkout -f ' + self.branch) # @UnusedVariable
if exit_status == 0:
self._find_installed_version()
# Notify update successful
notifiers.notify_git_update(sickbeard.CUR_COMMIT_HASH if sickbeard.CUR_COMMIT_HASH else "")
return True
return False
开发者ID:JackDandy,项目名称:SickGear,代码行数:23,代码来源:version_checker.py
示例10: ex
os.remove(new_path)
os.renames(old_path, new_path)
except Exception, e:
logger.log(u"Unable to update " + new_path + ': ' + ex(e), logger.DEBUG)
os.remove(old_path) # Trash the updated file without moving in new path
continue
if os.path.isfile(new_path):
os.remove(new_path)
os.renames(old_path, new_path)
sickbeard.CUR_COMMIT_HASH = self._newest_commit_hash
sickbeard.CUR_COMMIT_BRANCH = self.branch
except Exception, e:
logger.log(u"Error while trying to update: " + ex(e), logger.ERROR)
logger.log(u"Traceback: " + traceback.format_exc(), logger.DEBUG)
return False
# Notify update successful
notifiers.notify_git_update(sickbeard.NEWEST_VERSION_STRING)
return True
def list_remote_branches(self):
gh = github.GitHub(self.github_repo_user, self.github_repo, self.branch)
return [x['name'] for x in gh.branches() if x and 'name' in x]
def list_remote_pulls(self):
# we don't care about testers that don't use git
return []
开发者ID:Koernia,项目名称:SickGear,代码行数:31,代码来源:versionChecker.py
示例11: update
def update(self):
zip_download_url = self._find_newest_version(True)
logger.log(u"new_link: " + repr(zip_download_url), logger.DEBUG)
if not zip_download_url:
logger.log(u"Unable to find a new version link on google code, not updating")
return False
try:
# prepare the update dir
sr_update_dir = ek.ek(os.path.join, sickbeard.PROG_DIR, u"sr-update")
if os.path.isdir(sr_update_dir):
logger.log(u"Clearing out update folder " + sr_update_dir + " before extracting")
shutil.rmtree(sr_update_dir)
logger.log(u"Creating update folder " + sr_update_dir + " before extracting")
os.makedirs(sr_update_dir)
# retrieve file
logger.log(u"Downloading update from " + zip_download_url)
zip_download_path = os.path.join(sr_update_dir, u"sr-update.zip")
urllib.urlretrieve(zip_download_url, zip_download_path)
if not ek.ek(os.path.isfile, zip_download_path):
logger.log(u"Unable to retrieve new version from " + zip_download_url + ", can't update", logger.ERROR)
return False
if not ek.ek(zipfile.is_zipfile, zip_download_path):
logger.log(u"Retrieved version from " + zip_download_url + " is corrupt, can't update", logger.ERROR)
return False
# extract to sr-update dir
logger.log(u"Unzipping from " + str(zip_download_path) + " to " + sr_update_dir)
update_zip = zipfile.ZipFile(zip_download_path, "r")
update_zip.extractall(sr_update_dir)
update_zip.close()
# delete the zip
logger.log(u"Deleting zip file from " + str(zip_download_path))
os.remove(zip_download_path)
# find update dir name
update_dir_contents = [
x for x in os.listdir(sr_update_dir) if os.path.isdir(os.path.join(sr_update_dir, x))
]
if len(update_dir_contents) != 1:
logger.log(
u"Invalid update data, update failed. Maybe try deleting your sr-update folder?", logger.ERROR
)
return False
content_dir = os.path.join(sr_update_dir, update_dir_contents[0])
old_update_path = os.path.join(content_dir, u"updater.exe")
new_update_path = os.path.join(sickbeard.PROG_DIR, u"updater.exe")
logger.log(u"Copying new update.exe file from " + old_update_path + " to " + new_update_path)
shutil.move(old_update_path, new_update_path)
# Notify update successful
notifiers.notify_git_update(sickbeard.NEWEST_VERSION_STRING)
except Exception, e:
logger.log(u"Error while trying to update: " + ex(e), logger.ERROR)
return False
开发者ID:RoostayFish,项目名称:SickRage,代码行数:66,代码来源:versionChecker.py
示例12: update
def update(self):
"""
Downloads the latest source tarball from github and installs it over the existing version.
"""
tar_download_url = 'http://github.com/' + self.github_org + '/' + self.github_repo + '/tarball/' + self.branch
try:
# prepare the update dir
sr_update_dir = ek(os.path.join, sickbeard.PROG_DIR, 'sr-update')
if ek(os.path.isdir, sr_update_dir):
logging.info("Clearing out update folder " + sr_update_dir + " before extracting")
ek(removetree, sr_update_dir)
logging.info("Creating update folder " + sr_update_dir + " before extracting")
ek(os.makedirs, sr_update_dir)
# retrieve file
logging.info("Downloading update from " + repr(tar_download_url))
tar_download_path = ek(os.path.join, sr_update_dir, 'sr-update.tar')
helpers.download_file(tar_download_url, tar_download_path, session=self.session)
if not ek(os.path.isfile, tar_download_path):
logging.warning("Unable to retrieve new version from " + tar_download_url + ", can't update")
return False
if not ek(tarfile.is_tarfile, tar_download_path):
logging.error("Retrieved version from " + tar_download_url + " is corrupt, can't update")
return False
# extract to sr-update dir
logging.info("Extracting file " + tar_download_path)
tar = tarfile.open(tar_download_path)
tar.extractall(sr_update_dir)
tar.close()
# delete .tar.gz
logging.info("Deleting file " + tar_download_path)
ek(os.remove, tar_download_path)
# find update dir name
update_dir_contents = [x for x in ek(os.listdir, sr_update_dir) if
ek(os.path.isdir, ek(os.path.join, sr_update_dir, x))]
if len(update_dir_contents) != 1:
logging.error("Invalid update data, update failed: " + str(update_dir_contents))
return False
content_dir = ek(os.path.join, sr_update_dir, update_dir_contents[0])
# walk temp folder and move files to main folder
logging.info("Moving files from " + content_dir + " to " + sickbeard.PROG_DIR)
for dirname, _, filenames in ek(os.walk, content_dir): # @UnusedVariable
dirname = dirname[len(content_dir) + 1:]
for curfile in filenames:
old_path = ek(os.path.join, content_dir, dirname, curfile)
new_path = ek(os.path.join, sickbeard.PROG_DIR, dirname, curfile)
# Avoid DLL access problem on WIN32/64
# These files needing to be updated manually
# or find a way to kill the access from memory
if curfile in ('unrar.dll', 'unrar64.dll'):
try:
ek(os.chmod, new_path, stat.S_IWRITE)
ek(os.remove, new_path)
ek(os.renames, old_path, new_path)
except Exception as e:
logging.debug("Unable to update " + new_path + ': ' + ex(e))
ek(os.remove, old_path) # Trash the updated file without moving in new path
continue
if ek(os.path.isfile, new_path):
ek(os.remove, new_path)
ek(os.renames, old_path, new_path)
sickbeard.CUR_COMMIT_HASH = self._newest_commit_hash
sickbeard.CUR_COMMIT_BRANCH = self.branch
except Exception as e:
logging.error("Error while trying to update: {}".format(ex(e)))
logging.debug("Traceback: " + traceback.format_exc())
return False
# Notify update successful
notifiers.notify_git_update(sickbeard.NEWEST_VERSION_STRING)
return True
开发者ID:coderbone,项目名称:SickRage,代码行数:86,代码来源:versionChecker.py
示例13: update
def update(self):
"""
Downloads the latest source tarball from github and installs it over the existing version.
"""
base_url = 'http://github.com/' + self.github_repo_user + '/' + self.github_repo
tar_download_url = base_url + '/tarball/' + self.branch
try:
# prepare the update dir
sg_update_dir = ek.ek(os.path.join, sickbeard.PROG_DIR, u'sg-update')
if os.path.isdir(sg_update_dir):
logger.log(u'Clearing out update folder ' + sg_update_dir + ' before extracting')
shutil.rmtree(sg_update_dir)
logger.log(u'Creating update folder ' + sg_update_dir + ' before extracting')
os.makedirs(sg_update_dir)
# retrieve file
logger.log(u"Downloading update from " + repr(tar_download_url))
tar_download_path = os.path.join(sg_update_dir, u'sg-update.tar')
urllib.urlretrieve(tar_download_url, tar_download_path)
if not ek.ek(os.path.isfile, tar_download_path):
logger.log(u"Unable to retrieve new version from " + tar_download_url + ", can't update", logger.ERROR)
return False
if not ek.ek(tarfile.is_tarfile, tar_download_path):
logger.log(u"Retrieved version from " + tar_download_url + " is corrupt, can't update", logger.ERROR)
return False
# extract to sg-update dir
logger.log(u"Extracting file " + tar_download_path)
tar = tarfile.open(tar_download_path)
tar.extractall(sg_update_dir)
tar.close()
# delete .tar.gz
logger.log(u"Deleting file " + tar_download_path)
os.remove(tar_download_path)
# find update dir name
update_dir_contents = [x for x in os.listdir(sg_update_dir) if
os.path.isdir(os.path.join(sg_update_dir, x))]
if len(update_dir_contents) != 1:
logger.log(u"Invalid update data, update failed: " + str(update_dir_contents), logger.ERROR)
return False
content_dir = os.path.join(sg_update_dir, update_dir_contents[0])
# walk temp folder and move files to main folder
logger.log(u"Moving files from " + content_dir + " to " + sickbeard.PROG_DIR)
for dirname, dirnames, filenames in os.walk(content_dir): # @UnusedVariable
dirname = dirname[len(content_dir) + 1:]
for curfile in filenames:
old_path = os.path.join(content_dir, dirname, curfile)
new_path = os.path.join(sickbeard.PROG_DIR, dirname, curfile)
# Avoid DLL access problem on WIN32/64
# These files needing to be updated manually
#or find a way to kill the access from memory
if curfile in ('unrar.dll', 'unrar64.dll'):
try:
os.chmod(new_path, stat.S_IWRITE)
os.remove(new_path)
os.renames(old_path, new_path)
except Exception as e:
logger.log(u"Unable to update " + new_path + ': ' + ex(e), logger.DEBUG)
os.remove(old_path) # Trash the updated file without moving in new path
continue
if os.path.isfile(new_path):
os.remove(new_path)
os.renames(old_path, new_path)
sickbeard.CUR_COMMIT_HASH = self._newest_commit_hash
sickbeard.CUR_COMMIT_BRANCH = self.branch
except Exception as e:
logger.log(u"Error while trying to update: " + ex(e), logger.ERROR)
logger.log(u"Traceback: " + traceback.format_exc(), logger.DEBUG)
return False
# Notify update successful
notifiers.notify_git_update(sickbeard.NEWEST_VERSION_STRING)
return True
开发者ID:joshguerette,项目名称:SickGear,代码行数:87,代码来源:versionChecker.py
注:本文中的sickbeard.notifiers.notify_git_update函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论