summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2017-09-28 18:39:46 +0200
committerKali Kaneko <kali@leap.se>2017-09-28 18:39:46 +0200
commit896ec52bb1a1f9489cf531bd245c0f6b4c2e2773 (patch)
tree52e211ea84ba257512e619fde989703b59af9a88 /src
parentd71305cb962b927b318d1c40f31fade324b8ca34 (diff)
[bug] fix incompatibility with six==1.11.0
add the version of with_metaclass found in six==1.10.0 See https://github.com/SecurityInnovation/PGPy/issues/217 - Resolves: #8672
Diffstat (limited to 'src')
-rw-r--r--src/leap/mx/vendor/pgpy/types.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/leap/mx/vendor/pgpy/types.py b/src/leap/mx/vendor/pgpy/types.py
index b549434..af03e31 100644
--- a/src/leap/mx/vendor/pgpy/types.py
+++ b/src/leap/mx/vendor/pgpy/types.py
@@ -38,12 +38,25 @@ __all__ = ['Armorable',
'Fingerprint',
'SorteDeque']
+# XXX port of six's with_metaclass in 1.10.0, see PGPy/issues/217
+
+def with_metaclass(meta, *bases):
+ """Create a base class with a metaclass."""
+ # This requires a bit of explanation: the basic idea is to make a dummy
+ # metaclass for one level of class instantiation that replaces itself with
+ # the actual metaclass.
+ class metaclass(meta):
+
+ def __new__(cls, name, this_bases, d):
+ return meta(name, bases, d)
+ return type.__new__(metaclass, 'temporary_class', (), {})
+
if six.PY2:
FileNotFoundError = IOError
re.ASCII = 0
-class Armorable(six.with_metaclass(abc.ABCMeta)):
+class Armorable(with_metaclass(abc.ABCMeta)):
__crc24_init__ = 0x0B704CE
__crc24_poly__ = 0x1864CFB
@@ -241,7 +254,7 @@ class ParentRef(object):
self._parent = None
-class PGPObject(six.with_metaclass(abc.ABCMeta, object)):
+class PGPObject(with_metaclass(abc.ABCMeta, object)):
__metaclass__ = abc.ABCMeta
@staticmethod
@@ -543,7 +556,7 @@ class MetaDispatchable(abc.ABCMeta):
return obj
-class Dispatchable(six.with_metaclass(MetaDispatchable, PGPObject)):
+class Dispatchable(with_metaclass(MetaDispatchable, PGPObject)):
__metaclass__ = MetaDispatchable
@abc.abstractproperty