support all valid versionCode values, i.e. Java Integer values

versionCode can be any Java Integer value, from Integer.MAX_VALUE
(2147483648) to Integer.MIN_VALUE (-2147483647)
This commit is contained in:
Hans-Christoph Steiner 2016-10-13 16:50:31 +02:00
parent f90adcc912
commit 5faef55d67

View file

@ -1444,12 +1444,15 @@ def main():
else: else:
archapks = [] archapks = []
# less than the valid range of versionCode, i.e. Java's Integer.MIN_VALUE
UNSET_VERSION_CODE = -0x100000000
# Some information from the apks needs to be applied up to the application # Some information from the apks needs to be applied up to the application
# level. When doing this, we use the info from the most recent version's apk. # level. When doing this, we use the info from the most recent version's apk.
# We deal with figuring out when the app was added and last updated at the # We deal with figuring out when the app was added and last updated at the
# same time. # same time.
for appid, app in apps.items(): for appid, app in apps.items():
bestver = 0 bestver = UNSET_VERSION_CODE
for apk in apks + archapks: for apk in apks + archapks:
if apk['id'] == appid: if apk['id'] == appid:
if apk['versioncode'] > bestver: if apk['versioncode'] > bestver:
@ -1467,7 +1470,7 @@ def main():
if not app.lastupdated: if not app.lastupdated:
logging.debug("Don't know when " + appid + " was last updated") logging.debug("Don't know when " + appid + " was last updated")
if bestver == 0: if bestver == UNSET_VERSION_CODE:
if app.Name is None: if app.Name is None:
app.Name = app.AutoName or appid app.Name = app.AutoName or appid
app.icon = None app.icon = None