Bug fix: Hopefully finalize version numbering and Pesterchum update system
This commit is contained in:
parent
f9b8f3d0df
commit
28b0a5d2da
1 changed files with 22 additions and 12 deletions
34
version.py
34
version.py
|
@ -5,25 +5,27 @@ USER_TYPE = "dev"
|
||||||
|
|
||||||
_pcMajor = "3.14"
|
_pcMajor = "3.14"
|
||||||
_pcMinor = "2"
|
_pcMinor = "2"
|
||||||
_pcStatus = "1" # 0 = alpha
|
_pcStatus = "B" # A = alpha
|
||||||
# 1 = beta
|
# B = beta
|
||||||
# 2 = release candidate
|
# RC = release candidate
|
||||||
# 3 = public release
|
# None = public release
|
||||||
_pcRevision = "3"
|
_pcRevision = "3"
|
||||||
_pcVersion = ""
|
_pcVersion = ""
|
||||||
|
|
||||||
def pcVerCalc():
|
def pcVerCalc():
|
||||||
global _pcVersion
|
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):
|
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:
|
if not w:
|
||||||
print "Update check Failure: 3"; return
|
print "Update check Failure: 3"; return
|
||||||
full = ver[:ver.find(":")]
|
full = ver[:ver.find(":")]
|
||||||
return full,w.group(1),w.group(2),w.group(3),w.group(4),w.group(5)
|
return full,w.group(1),w.group(2),w.group(3),w.group(4),w.group(5)
|
||||||
|
|
||||||
|
|
||||||
def updateCheck():
|
def updateCheck():
|
||||||
data = urllib.urlencode({"type" : USER_TYPE})
|
data = urllib.urlencode({"type" : USER_TYPE})
|
||||||
try:
|
try:
|
||||||
|
@ -32,14 +34,22 @@ def updateCheck():
|
||||||
print "Update check Failure: 1"; return False,1
|
print "Update check Failure: 1"; return False,1
|
||||||
newest = f.read()
|
newest = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
if newest[0] == "<":
|
if not newest or newest[0] == "<":
|
||||||
print "Update check Failure: 2"; return False,2
|
print "Update check Failure: 2"; return False,2
|
||||||
try:
|
try:
|
||||||
(full, major, minor, status, revision, url) = verStrToNum(newest)
|
(full, major, minor, status, revision, url) = verStrToNum(newest)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
return False,3
|
return False,3
|
||||||
print full
|
print full
|
||||||
if full > _pcVersion:
|
if major <= _pcMajor:
|
||||||
print "A new version of Pesterchum is avaliable!"
|
if minor <= _pcMinor:
|
||||||
return full,url
|
if status:
|
||||||
return False,0
|
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
|
||||||
|
|
Loading…
Reference in a new issue