diff options
| author | Daniel Watkins <daniel.watkins@canonical.com> | 2017-08-15 09:26:43 -0400 | 
|---|---|---|
| committer | Daniel Watkins <daniel.watkins@canonical.com> | 2017-08-15 09:26:43 -0400 | 
| commit | bf21f2470068ab9535d9e28b1df3fc51fb46a04c (patch) | |
| tree | 979fe63889442cdd2a02caf4927fd6fc7e45dd6f | |
| parent | 58819cbcee9fc668f0e96dd9ef45f890f32a6f14 (diff) | |
Handle missing six.viewkeys in trusty
This just pulls in the specific lines of code from six which are missing, so that we don't hit ImportErrors when trying to use mfdiff on trusty. bzr-revno: 19.1.1
| -rwxr-xr-x | mfdiff | 13 | 
1 files changed, 12 insertions, 1 deletions
| @@ -39,7 +39,18 @@ from optparse import OptionParser  import apt  import requests  from debian.changelog import Changelog -from six import iteritems, viewkeys +from six import PY3, iteritems + +try: + from six import viewkeys +except ImportError: + # The version of six in trusty doesn't have viewkeys, so pull in the six + # code from a more recent version if we can't get it directly from six. + import operator + if PY3: + viewkeys = operator.methodcaller("keys") + else: + viewkeys = operator.methodcaller("viewkeys")  try:  from apt import VersionCompare as version_compare | 
