diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2016-09-07 16:25:06 +0300 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2016-09-07 16:25:06 +0300 |
commit | 2e76b3557432f1a3283ec9ad8ac9330be0cf6caf (patch) | |
tree | d6bdef2b20b690361757737c0c0ca6e3d3581893 | |
parent | fefa2aa0ef2a223327b75b4aab280a3df7a661d0 (diff) |
Move best_version identifcation after check that there are some versions
Selection of the best version should take place after assuring there are
some versions, in case there are none.
-rwxr-xr-x | calm/package.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/calm/package.py b/calm/package.py index 6dbceb4..e198c9e 100755 --- a/calm/package.py +++ b/calm/package.py @@ -483,13 +483,6 @@ def validate_packages(args, packages): if l in packages[p].override_hints: packages[p].stability[l] = packages[p].override_hints[l] - # 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: - packages[p].best_version = packages[p].stability['curr'] - else: - packages[p].best_version = sorted(packages[p].vermap.keys(), key=lambda v: SetupVersion(v), reverse=True)[0] - # the package must have some versions if not packages[p].stability: logging.error("package '%s' doesn't have any versions" % (p)) @@ -498,6 +491,13 @@ def validate_packages(args, packages): elif 'curr' not in packages[p].stability and 'curr' not in getattr(args, 'okmissing', []): logging.warning("package '%s' doesn't have a curr version" % (p)) + # 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: + packages[p].best_version = packages[p].stability['curr'] + else: + packages[p].best_version = sorted(packages[p].vermap.keys(), key=lambda v: SetupVersion(v), reverse=True)[0] + # If, for every stability level, the install tarball is empty and there # is no source tarball, we should probably be marked obsolete if not packages[p].skip: |