Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/cygwin-apps/calm.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2020-02-02 17:48:43 +0300
committerJon Turney <jon.turney@dronecode.org.uk>2020-02-02 17:48:43 +0300
commit17775b37f6af508335f0ce74758da0263c1e05f8 (patch)
tree8bfb576ce6e8b8482dc5f482ea8a103e1a70eff8
parenta56dc7c1e10f84c33795f1c873046b04562c0834 (diff)
Avoid KeyError exception if obsoleted package isn't present
-rwxr-xr-xcalm/package.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/calm/package.py b/calm/package.py
index d100044..a3bf328 100755
--- a/calm/package.py
+++ b/calm/package.py
@@ -540,12 +540,16 @@ def validate_packages(args, packages):
o = o.strip()
o = re.sub(r'(.*) +\(.*\)', r'\1', o)
- for (ov, ohints) in packages[o].version_hints.items():
- if 'depends' in ohints:
- depends = ohints['depends'].split(',')
- depends = [d for d in depends if d != p]
- packages[o].version_hints[ov]['depends'] = ','.join(depends)
- logging.debug("removed obsoleting '%s' from the depends: of package '%s'" % (p, o))
+ if o in packages:
+ for (ov, ohints) in packages[o].version_hints.items():
+ if 'depends' in ohints:
+ depends = ohints['depends'].split(',')
+ if p in depends:
+ depends = [d for d in depends if d != p]
+ packages[o].version_hints[ov]['depends'] = ','.join(depends)
+ logging.debug("removed obsoleting '%s' from the depends: of package '%s'" % (p, o))
+ else:
+ logging.debug("can't ensure package '%s' doesn't depends: on obsoleting '%s'" % (o, p))
packages[p].vermap = {}
is_empty = {}