diff --git a/CHANGES.md b/CHANGES.md
index ad7e3bf0..416db44c 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -16,6 +16,7 @@
* Remove unsupported t411 search provider
* Remove obsolete Animezb search provider
* Add option to treat anime releases that lack a quality tag as HDTV instead of "unknown"
+* Remove old version checking code that no longer applies to SickGear's release system
[develop changelog]
* Change descriptions and layout on Config/Anime page
diff --git a/googlecode_upload.py b/googlecode_upload.py
deleted file mode 100644
index 1b934925..00000000
--- a/googlecode_upload.py
+++ /dev/null
@@ -1,250 +0,0 @@
-#!/usr/bin/env python2
-#
-# Copyright 2006, 2007 Google Inc. All Rights Reserved.
-# Author: danderson@google.com (David Anderson)
-#
-# Script for uploading files to a Google Code project.
-#
-# This is intended to be both a useful script for people who want to
-# streamline project uploads and a reference implementation for
-# uploading files to Google Code projects.
-#
-# To upload a file to Google Code, you need to provide a path to the
-# file on your local machine, a small summary of what the file is, a
-# project name, and a valid account that is a member or owner of that
-# project. You can optionally provide a list of labels that apply to
-# the file. The file will be uploaded under the same name that it has
-# in your local filesystem (that is, the "basename" or last path
-# component). Run the script with '--help' to get the exact syntax
-# and available options.
-#
-# Note that the upload script requests that you enter your
-# googlecode.com password. This is NOT your Gmail account password!
-# This is the password you use on googlecode.com for committing to
-# Subversion and uploading files. You can find your password by going
-# to http://code.google.com/hosting/settings when logged in with your
-# Gmail account. If you have already committed to your project's
-# Subversion repository, the script will automatically retrieve your
-# credentials from there (unless disabled, see the output of '--help'
-# for details).
-#
-# If you are looking at this script as a reference for implementing
-# your own Google Code file uploader, then you should take a look at
-# the upload() function, which is the meat of the uploader. You
-# basically need to build a multipart/form-data POST request with the
-# right fields and send it to https://PROJECT.googlecode.com/files .
-# Authenticate the request using HTTP Basic authentication, as is
-# shown below.
-#
-# Licensed under the terms of the Apache Software License 2.0:
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Questions, comments, feature requests and patches are most welcome.
-# Please direct all of these to the Google Code users group:
-# http://groups.google.com/group/google-code-hosting
-
-"""Google Code file uploader script.
-"""
-
-__author__ = 'danderson@google.com (David Anderson)'
-
-import httplib
-import os.path
-import optparse
-import getpass
-import base64
-import sys
-
-
-def upload(file, project_name, user_name, password, summary, labels=None):
- """Upload a file to a Google Code project's file server.
-
- Args:
- file: The local path to the file.
- project_name: The name of your project on Google Code.
- user_name: Your Google account name.
- password: The googlecode.com password for your account.
- Note that this is NOT your global Google Account password!
- summary: A small description for the file.
- labels: an optional list of label strings with which to tag the file.
-
- Returns: a tuple:
- http_status: 201 if the upload succeeded, something else if an
- error occured.
- http_reason: The human-readable string associated with http_status
- file_url: If the upload succeeded, the URL of the file on Google
- Code, None otherwise.
- """
- # The login is the user part of user@gmail.com. If the login provided
- # is in the full user@domain form, strip it down.
- if user_name.endswith('@gmail.com'):
- user_name = user_name[:user_name.index('@gmail.com')]
-
- form_fields = [('summary', summary)]
- if labels is not None:
- form_fields.extend([('label', l.strip()) for l in labels])
-
- content_type, body = encode_upload_request(form_fields, file)
-
- upload_host = '%s.googlecode.com' % project_name
- upload_uri = '/files'
- auth_token = base64.b64encode('%s:%s'% (user_name, password))
- headers = {
- 'Authorization': 'Basic %s' % auth_token,
- 'User-Agent': 'Googlecode.com uploader v0.9.4',
- 'Content-Type': content_type,
- }
-
- server = httplib.HTTPSConnection(upload_host)
- server.request('POST', upload_uri, body, headers)
- resp = server.getresponse()
- server.close()
-
- if resp.status == 201:
- location = resp.getheader('Location', None)
- else:
- location = None
- return resp.status, resp.reason, location
-
-
-def encode_upload_request(fields, file_path):
- """Encode the given fields and file into a multipart form body.
-
- fields is a sequence of (name, value) pairs. file is the path of
- the file to upload. The file will be uploaded to Google Code with
- the same file name.
-
- Returns: (content_type, body) ready for httplib.HTTP instance
- """
- BOUNDARY = '----------Googlecode_boundary_reindeer_flotilla'
- CRLF = '\r\n'
-
- body = []
-
- # Add the metadata about the upload first
- for key, value in fields:
- body.extend(
- ['--' + BOUNDARY,
- 'Content-Disposition: form-data; name="%s"' % key,
- '',
- value,
- ])
-
- # Now add the file itself
- file_name = os.path.basename(file_path)
- f = open(file_path, 'rb')
- file_content = f.read()
- f.close()
-
- body.extend(
- ['--' + BOUNDARY,
- 'Content-Disposition: form-data; name="filename"; filename="%s"'
- % file_name,
- # The upload server determines the mime-type, no need to set it.
- 'Content-Type: application/octet-stream',
- '',
- file_content,
- ])
-
- # Finalize the form body
- body.extend(['--' + BOUNDARY + '--', ''])
-
- return 'multipart/form-data; boundary=%s' % BOUNDARY, CRLF.join(body)
-
-
-def upload_find_auth(file_path, project_name, summary, labels=None,
- user_name=None, password=None, tries=3):
- """Find credentials and upload a file to a Google Code project's file server.
-
- file_path, project_name, summary, and labels are passed as-is to upload.
-
- Args:
- file_path: The local path to the file.
- project_name: The name of your project on Google Code.
- summary: A small description for the file.
- labels: an optional list of label strings with which to tag the file.
- config_dir: Path to Subversion configuration directory, 'none', or None.
- user_name: Your Google account name.
- tries: How many attempts to make.
- """
-
- while tries > 0:
- if user_name is None:
- # Read username if not specified or loaded from svn config, or on
- # subsequent tries.
- sys.stdout.write('Please enter your googlecode.com username: ')
- sys.stdout.flush()
- user_name = sys.stdin.readline().rstrip()
- if password is None:
- # Read password if not loaded from svn config, or on subsequent tries.
- print 'Please enter your googlecode.com password.'
- print '** Note that this is NOT your Gmail account password! **'
- print 'It is the password you use to access Subversion repositories,'
- print 'and can be found here: http://code.google.com/hosting/settings'
- password = getpass.getpass()
-
- status, reason, url = upload(file_path, project_name, user_name, password,
- summary, labels)
- # Returns 403 Forbidden instead of 401 Unauthorized for bad
- # credentials as of 2007-07-17.
- if status in [httplib.FORBIDDEN, httplib.UNAUTHORIZED]:
- # Rest for another try.
- user_name = password = None
- tries = tries - 1
- else:
- # We're done.
- break
-
- return status, reason, url
-
-
-def main():
- parser = optparse.OptionParser(usage='googlecode-upload.py -s SUMMARY '
- '-p PROJECT [options] FILE')
- parser.add_option('-s', '--summary', dest='summary',
- help='Short description of the file')
- parser.add_option('-p', '--project', dest='project',
- help='Google Code project name')
- parser.add_option('-u', '--user', dest='user',
- help='Your Google Code username')
- parser.add_option('-w', '--password', dest='password',
- help='Your Google Code password')
- parser.add_option('-l', '--labels', dest='labels',
- help='An optional list of comma-separated labels to attach '
- 'to the file')
-
- options, args = parser.parse_args()
-
- if not options.summary:
- parser.error('File summary is missing.')
- elif not options.project:
- parser.error('Project name is missing.')
- elif len(args) < 1:
- parser.error('File to upload not provided.')
- elif len(args) > 1:
- parser.error('Only one file may be specified.')
-
- file_path = args[0]
-
- if options.labels:
- labels = options.labels.split(',')
- else:
- labels = None
-
-def upload_file(file, project, summary, labels, username, password):
-
- status, reason, url = upload_find_auth(file, project,
- summary, labels,
- username, password)
- if url:
- print 'The file was uploaded successfully.'
- print 'URL: %s' % url
- return 0
- else:
- print 'An error occurred. Your file was not uploaded.'
- print 'Google Code upload server said: %s (%s)' % (reason, status)
- return 1
-
-
-if __name__ == '__main__':
- sys.exit(main())
diff --git a/sickbeard/versionChecker.py b/sickbeard/versionChecker.py
index dfab40b2..4c6d5a32 100644
--- a/sickbeard/versionChecker.py
+++ b/sickbeard/versionChecker.py
@@ -44,9 +44,7 @@ class CheckVersion():
def __init__(self):
self.install_type = self.find_install_type()
- if self.install_type == 'win':
- self.updater = WindowsUpdateManager()
- elif self.install_type == 'git':
+ if self.install_type == 'git':
self.updater = GitUpdateManager()
elif self.install_type == 'source':
self.updater = SourceUpdateManager()
@@ -71,15 +69,11 @@ class CheckVersion():
Determines how this copy of sr was installed.
returns: type of installation. Possible values are:
- 'win': any compiled windows build
'git': running from source using git
'source': running from source without git
"""
- # check if we're a windows build
- if sickbeard.BRANCH.startswith('build '):
- install_type = 'win'
- elif os.path.isdir(ek.ek(os.path.join, sickbeard.PROG_DIR, u'.git')):
+ if os.path.isdir(ek.ek(os.path.join, sickbeard.PROG_DIR, u'.git')):
install_type = 'git'
else:
install_type = 'source'
@@ -139,158 +133,6 @@ class UpdateManager():
return sickbeard.WEB_ROOT + "/home/update/?pid=" + str(sickbeard.PID)
-class WindowsUpdateManager(UpdateManager):
- def __init__(self):
- self.github_repo_user = self.get_github_repo_user()
- self.github_repo = self.get_github_repo()
-
- self.branch = sickbeard.BRANCH
- if sickbeard.BRANCH == '':
- self.branch = self._find_installed_branch()
-
- self._cur_version = None
- self._cur_commit_hash = None
- self._newest_version = None
-
- self.gc_url = 'http://code.google.com/p/sickbeard/downloads/list'
- self.version_url = 'https://raw.github.com/' + self.github_repo_user + '/' + self.github_repo + '/' + self.branch + '/updates.txt'
-
- def _find_installed_version(self):
- version = ''
-
- try:
- version = sickbeard.BRANCH
- return int(version[6:])
- except ValueError:
- logger.log(u"Unknown SickGear Windows binary release: " + version, logger.ERROR)
- return None
-
- def _find_installed_branch(self):
- return 'windows_binaries'
-
- def _find_newest_version(self, whole_link=False):
- """
- Checks git for the newest Windows binary build. Returns either the
- build number or the entire build URL depending on whole_link's value.
-
- whole_link: If True, returns the entire URL to the release. If False, it returns
- only the build number. default: False
- """
-
- regex = ".*SickGear\-win32\-alpha\-build(\d+)(?:\.\d+)?\.zip"
-
- version_url_data = helpers.getURL(self.version_url)
- if not version_url_data:
- return
-
- for curLine in version_url_data.splitlines():
- logger.log(u"checking line " + curLine, logger.DEBUG)
- match = re.match(regex, curLine)
- if match:
- logger.log(u"found a match", logger.DEBUG)
- if whole_link:
- return curLine.strip()
- else:
- return int(match.group(1))
-
- def need_update(self):
- if self.branch != self._find_installed_branch():
- logger.log(u"Branch checkout: " + self._find_installed_branch() + "->" + self.branch, logger.DEBUG)
- return True
-
- self._cur_version = self._find_installed_version()
- self._newest_version = self._find_newest_version()
-
- logger.log(u"newest version: " + repr(self._newest_version), logger.DEBUG)
- if self._newest_version and self._newest_version > self._cur_version:
- return True
-
- return False
-
- def set_newest_text(self):
-
- sickbeard.NEWEST_VERSION_STRING = None
-
- if not self._cur_version:
- newest_text = "Unknown SickGear Windows binary version. Not updating with original version."
- else:
- newest_text = 'There is a newer version available (build ' + str(
- self._newest_version) + ')'
- newest_text += "— Update Now"
-
- sickbeard.NEWEST_VERSION_STRING = newest_text
-
- 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
-
- return True
-
- def list_remote_branches(self):
- return ['windows_binaries']
-
-
class GitUpdateManager(UpdateManager):
def __init__(self):
self._git_path = self._find_working_git()