diff options
| author | Daniel Watkins <daniel.watkins@canonical.com> | 2017-08-15 10:05:27 -0400 |
|---|---|---|
| committer | Daniel Watkins <daniel.watkins@canonical.com> | 2017-08-15 10:05:27 -0400 |
| commit | bae0abcafa5f67a3d403db4376b9ecbe5b8d0f19 (patch) | |
| tree | 979fe63889442cdd2a02caf4927fd6fc7e45dd6f | |
| parent | 58819cbcee9fc668f0e96dd9ef45f890f32a6f14 (diff) | |
| parent | bf21f2470068ab9535d9e28b1df3fc51fb46a04c (diff) | |
Handle missing six.viewkeys in trusty [a=Odd_Bloke][r=philroche,tribaal]
https://code.launchpad.net/~daniel-thewatkins/vmbuilder/mfdiff/+merge/329034 bzr-revno: 20
| -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 |
