diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2018-01-26 00:08:19 +0300 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2018-01-26 00:08:19 +0300 |
commit | 7422f60f16f6d9182bc172cd68e958b1f9d0f615 (patch) | |
tree | a836b4b2e197d391fd9b198d72a3b8277dea58ee | |
parent | ba59c8e0ce0aebc933aa0e51724d6e8f6e2f1378 (diff) |
Avoid exceptions following curr: selecting a non-existent version
-rwxr-xr-x | calm/package.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/calm/package.py b/calm/package.py index e50d7bb..ee3a377 100755 --- a/calm/package.py +++ b/calm/package.py @@ -616,6 +616,10 @@ def validate_packages(args, packages): continue cv = packages[p].stability['curr'] + + if cv not in packages[p].vermap: + continue + if cv != v: if packages[p].vermap[v]['mtime'] == packages[p].vermap[cv]['mtime']: # don't consider an equal mtime to be more recent @@ -634,7 +638,7 @@ def validate_packages(args, packages): # identify a 'best' version to take certain information from: this is # the curr version, if we have one, otherwise, the highest version. - if 'curr' in packages[p].stability: + if ('curr' in packages[p].stability) and (packages[p].stability['curr'] in packages[p].vermap): packages[p].best_version = packages[p].stability['curr'] elif len(packages[p].vermap): packages[p].best_version = sorted(packages[p].vermap.keys(), key=lambda v: SetupVersion(v), reverse=True)[0] |