diff --git a/version.py b/version.py index 1f984a3..f176bcc 100644 --- a/version.py +++ b/version.py @@ -5,25 +5,27 @@ USER_TYPE = "dev" _pcMajor = "3.14" _pcMinor = "2" -_pcStatus = "1" # 0 = alpha - # 1 = beta - # 2 = release candidate - # 3 = public release +_pcStatus = "B" # A = alpha + # B = beta + # RC = release candidate + # None = public release _pcRevision = "3" _pcVersion = "" def pcVerCalc(): global _pcVersion - _pcVersion = "%s.%s.%s-%s" % (_pcMajor, _pcMinor, _pcStatus, _pcRevision) + if _pcStatus: + _pcVersion = "%s.%s-%s%s" % (_pcMajor, _pcMinor, _pcStatus, _pcRevision) + else: + _pcVersion = "%s.%s.%s" % (_pcMajor, _pcMinor, _pcRevision) def verStrToNum(ver): - w = re.match("(\d+\.?\d+)\.(\d+)\.?(\d*)-?(\d*):(\S+)", ver) + w = re.match("(\d+\.?\d+)\.(\d+)-?([A-Za-z]{0,2})\.?(\d*):(\S+)", ver) if not w: print "Update check Failure: 3"; return full = ver[:ver.find(":")] return full,w.group(1),w.group(2),w.group(3),w.group(4),w.group(5) - def updateCheck(): data = urllib.urlencode({"type" : USER_TYPE}) try: @@ -32,14 +34,22 @@ def updateCheck(): print "Update check Failure: 1"; return False,1 newest = f.read() f.close() - if newest[0] == "<": + if not newest or newest[0] == "<": print "Update check Failure: 2"; return False,2 try: (full, major, minor, status, revision, url) = verStrToNum(newest) except TypeError: return False,3 print full - if full > _pcVersion: - print "A new version of Pesterchum is avaliable!" - return full,url - return False,0 + if major <= _pcMajor: + if minor <= _pcMinor: + if status: + if status <= _pcStatus: + if revision <= _pcRevision: + return False,0 + else: + if not _pcStatus: + if revision <= _pcRevision: + return False,0 + print "A new version of Pesterchum is avaliable!" + return full,url