mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-08 05:24:39 +01:00
merge
This commit is contained in:
commit
85bd8ec2d4
1 changed files with 28 additions and 8 deletions
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/python
|
||||
# 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 xwconfig
|
||||
|
||||
|
@ -161,10 +161,13 @@ def getDictSums():
|
|||
openShelf()
|
||||
return s_shelf[k_SUMS]
|
||||
|
||||
def getOrderedApks( path ):
|
||||
def getOrderedApks( path, debug ):
|
||||
# logging.debug( "getOrderedApks(" + path + ")" )
|
||||
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))
|
||||
for mtime, file in sorted(files, reverse=True):
|
||||
|
@ -173,6 +176,14 @@ def getOrderedApks( path ):
|
|||
|
||||
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
|
||||
def curVersion( req, name, avers = 41, gvers = None, installer = None ):
|
||||
global k_versions
|
||||
|
@ -218,12 +229,22 @@ def getApp( params, name ):
|
|||
if k_NAME in params:
|
||||
name = params[k_NAME]
|
||||
if name:
|
||||
variantDir = getVariantDir( name )
|
||||
# If we're a dev device, always push the latest
|
||||
if k_DEBUG in params and params[k_DEBUG]:
|
||||
url = k_urlbase + '/' + k_apkDir + 'XWords4-debug.apk'
|
||||
result = {k_URL: url}
|
||||
dir = k_filebase + k_apkDir + variantDir
|
||||
apks = getOrderedApks( dir, True )
|
||||
if 0 < len(apks):
|
||||
apk = apks[0]
|
||||
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}
|
||||
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):
|
||||
apk = apks[0]
|
||||
# Does path NOT contain name of installed file
|
||||
|
@ -439,7 +460,6 @@ def getUpdates( req, params ):
|
|||
else:
|
||||
logging.debug( "NOT FOUND xlate info" )
|
||||
|
||||
logging.debug( 'getUpdates done:', )
|
||||
result = json.dumps( result )
|
||||
# logging.debug( result )
|
||||
return result
|
||||
|
@ -494,7 +514,7 @@ def main():
|
|||
if argc >= 4: usage()
|
||||
path = ""
|
||||
if argc >= 3: path = sys.argv[2]
|
||||
apks = getOrderedApks( path )
|
||||
apks = getOrderedApks( path, False )
|
||||
if 0 == len(apks): print "No apks in", path
|
||||
for apk in apks:
|
||||
print apk
|
||||
|
|
Loading…
Reference in a new issue