Commit 5ade5180 authored by echel0n's avatar echel0n

Merge branch 'fix-source-version-updater' into 'develop'

Added regex for semantic versioning along with matching of each section of the...

See merge request SiCKRAGE/sickrage!20
parents cf431b23 0c4de1b1
......@@ -204,6 +204,10 @@ class VersionUpdater(object):
class UpdateManager(object):
def version_regex(self):
return re.compile('^(?P<major>[0-9]+).(?P<minor>[0-9]+).(?P<patch>[0-9]+)(?<pre_release>[0-9]+))?$', re.IGNORECASE)
def _git_path(self):
test_cmd = '--version'
......@@ -577,19 +581,31 @@ class SourceUpdateManager(UpdateManager):
return sickrage.version() or ""
def need_update(self):
return (False, True)[self.version != self.get_newest_version]
except Exception as e:"Unable to contact server, can't check for update: " + repr(e))
return False
current_version_match = self.version_regex.match(self.version)
new_version_match = self.version_regex.match(self.get_newest_version)
if current_version_match and new_version_match:
for version_label in ['major', 'minor', 'patch', 'pre_release']:
if version_label not in current_version_match.groupdict().keys() or version_label not in new_version_match.groupdict().keys():
current_version_part =
new_version_part =
if current_version_part is None or new_version_part is None:
if int(new_version_part) > int(current_version_part):
return True
except (IndexError, TypeError):
def _check_for_new_version(self):
git_version_url = "{}/sickrage/version.txt"
new_version = WebSession().get(git_version_url.format(('master', 'develop')['dev' in self.version])).text
if re.match('^[0-9]+.[0-9]+.[0-9]+(?[0-9])?$', new_version):
return new_version
return WebSession().get(git_version_url.format(('master', 'develop')['dev' in self.version])).text
except Exception:
return self._find_installed_version()
\ No newline at end of file
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment