mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-09 05:24:44 +01:00
update to not notify of debug build updates when version matches what's installed
This commit is contained in:
parent
75cd6c6693
commit
e31c7ae4f5
1 changed files with 30 additions and 8 deletions
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# Script meant to be installed on eehouse.org.
|
# Script meant to be installed on eehouse.org.
|
||||||
|
|
||||||
import logging, shelve, hashlib, sys, json, subprocess, glob, os, struct, random
|
import logging, shelve, hashlib, sys, json, subprocess, glob, os, struct, random, string
|
||||||
import mk_for_download, mygit
|
import mk_for_download, mygit
|
||||||
import xwconfig
|
import xwconfig
|
||||||
|
|
||||||
|
@ -161,10 +161,13 @@ def getDictSums():
|
||||||
openShelf()
|
openShelf()
|
||||||
return s_shelf[k_SUMS]
|
return s_shelf[k_SUMS]
|
||||||
|
|
||||||
def getOrderedApks( path ):
|
def getOrderedApks( path, debug ):
|
||||||
|
# logging.debug( "getOrderedApks(" + path + ")" )
|
||||||
apks = []
|
apks = []
|
||||||
|
|
||||||
pattern = path + "/XWords4-release_*android_beta_*.apk"
|
pattern = path
|
||||||
|
if debug: pattern += "/XWords4-debug-android_*.apk"
|
||||||
|
else: pattern += "/XWords4-release_*android_beta_*.apk"
|
||||||
|
|
||||||
files = ((os.stat(apk).st_mtime, apk) for apk in glob.glob(pattern))
|
files = ((os.stat(apk).st_mtime, apk) for apk in glob.glob(pattern))
|
||||||
for mtime, file in sorted(files, reverse=True):
|
for mtime, file in sorted(files, reverse=True):
|
||||||
|
@ -173,6 +176,14 @@ def getOrderedApks( path ):
|
||||||
|
|
||||||
return apks
|
return apks
|
||||||
|
|
||||||
|
def getVariantDir( name ):
|
||||||
|
result = ''
|
||||||
|
splits = string.split( name, '.' )
|
||||||
|
last = splits[-1]
|
||||||
|
if not last == 'xw4': result = last + '/'
|
||||||
|
# logging.debug( 'getVariantDir(' + name + ") => " + result )
|
||||||
|
return result
|
||||||
|
|
||||||
# public, but deprecated
|
# public, but deprecated
|
||||||
def curVersion( req, name, avers = 41, gvers = None, installer = None ):
|
def curVersion( req, name, avers = 41, gvers = None, installer = None ):
|
||||||
global k_versions
|
global k_versions
|
||||||
|
@ -218,12 +229,24 @@ def getApp( params, name ):
|
||||||
if k_NAME in params:
|
if k_NAME in params:
|
||||||
name = params[k_NAME]
|
name = params[k_NAME]
|
||||||
if name:
|
if name:
|
||||||
|
variantDir = getVariantDir( name )
|
||||||
# If we're a dev device, always push the latest
|
# If we're a dev device, always push the latest
|
||||||
if k_DEBUG in params and params[k_DEBUG]:
|
if k_DEBUG in params and params[k_DEBUG]:
|
||||||
url = k_urlbase + '/' + k_apkDir + 'XWords4-debug.apk'
|
dir = k_filebase + k_apkDir + variantDir
|
||||||
|
apks = getOrderedApks( dir, True )
|
||||||
|
if 0 < len(apks):
|
||||||
|
apk = apks[0]
|
||||||
|
logging.debug("got: " + apk)
|
||||||
|
curApk = params[k_GVERS] + '.apk'
|
||||||
|
if curApk in apk:
|
||||||
|
logging.debug( "already have " + curApk )
|
||||||
|
else:
|
||||||
|
url = k_urlbase + '/' + k_apkDir + variantDir + apk[len(dir):]
|
||||||
|
logging.debug("url: " + url)
|
||||||
result = {k_URL: url}
|
result = {k_URL: url}
|
||||||
|
logging.debug("DONE")
|
||||||
elif k_DEVOK in params and params[k_DEVOK]:
|
elif k_DEVOK in params and params[k_DEVOK]:
|
||||||
apks = getOrderedApks( k_filebase + k_apkDir )
|
apks = getOrderedApks( k_filebase + k_apkDir, False )
|
||||||
if 0 < len(apks):
|
if 0 < len(apks):
|
||||||
apk = apks[0]
|
apk = apks[0]
|
||||||
# Does path NOT contain name of installed file
|
# Does path NOT contain name of installed file
|
||||||
|
@ -439,7 +462,6 @@ def getUpdates( req, params ):
|
||||||
else:
|
else:
|
||||||
logging.debug( "NOT FOUND xlate info" )
|
logging.debug( "NOT FOUND xlate info" )
|
||||||
|
|
||||||
logging.debug( 'getUpdates done:', )
|
|
||||||
result = json.dumps( result )
|
result = json.dumps( result )
|
||||||
# logging.debug( result )
|
# logging.debug( result )
|
||||||
return result
|
return result
|
||||||
|
@ -494,7 +516,7 @@ def main():
|
||||||
if argc >= 4: usage()
|
if argc >= 4: usage()
|
||||||
path = ""
|
path = ""
|
||||||
if argc >= 3: path = sys.argv[2]
|
if argc >= 3: path = sys.argv[2]
|
||||||
apks = getOrderedApks( path )
|
apks = getOrderedApks( path, False )
|
||||||
if 0 == len(apks): print "No apks in", path
|
if 0 == len(apks): print "No apks in", path
|
||||||
for apk in apks:
|
for apk in apks:
|
||||||
print apk
|
print apk
|
||||||
|
|
Loading…
Reference in a new issue