diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2022-06-07 13:11:09 +0300 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2022-06-07 18:17:03 +0300 |
commit | 46d04fa775587ed9ab22bd92d9211d5abb00b999 (patch) | |
tree | 7eed32188413aef5b10e5b9bf7583dc70026e31d | |
parent | 867e172bf9c1095c0939551398b83ce47647d18f (diff) |
Avoid false-positive in warning about replace-version:
Avoid warning about replace-version: listing an installable version when
the replacable version is a test: version (and a non-test version
exists), because the setup depsolver wil correctly downgrade in that
case.
-rwxr-xr-x | calm/package.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/calm/package.py b/calm/package.py index f75be15..482d042 100755 --- a/calm/package.py +++ b/calm/package.py @@ -698,14 +698,16 @@ def validate_packages(args, packages, valid_requires_extra=None): # warn if replace-versions lists a version which is less than # the current version (which is pointless as the current version # will replace it anyhow) - if packages[p].best_version: - if SetupVersion(rv) <= SetupVersion(packages[p].best_version): - logging.warning("package '%s' replace-versions: uselessly lists version '%s', which is <= current version" % (p, rv)) + bv = packages[p].best_version + if bv: + if SetupVersion(rv) <= SetupVersion(bv): + logging.warning("package '%s' replace-versions: uselessly lists version '%s', which is <= current version '%s'" % (p, rv, bv)) # warn if replace-versions lists a version which is also # available to install (as this doesn't work as expected) if rv in packages[p].version_hints: - logging.warning("package '%s' replace-versions: lists version '%s', which is also available to install" % (p, rv)) + if ('test' in packages[p].version_hints[rv]) == ('test' in packages[p].version_hints[bv]): + logging.warning("package '%s' replace-versions: lists version '%s', which is also available to install" % (p, rv)) # If the install tarball is empty, we should probably either be marked # obsolete (if we have no dependencies) or virtual (if we do) |