diff --git a/.travis.yml b/.travis.yml index 9eb3a59d..4ca7d9b0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,13 +28,13 @@ script: jobs: include: - stage: verify - env: DISTRO=fedora:rawhide PYTHON="2" + env: DISTRO=fedora:latest PYTHON="2" script: - source ./.travis/lib-util.sh - util::docker-run $DISTRO ./.travis/verify.sh - stage: verify - env: DISTRO=fedora:rawhide PYTHON="3" + env: DISTRO=fedora:latest PYTHON="3" script: - source ./.travis/lib-util.sh - util::docker-run $DISTRO ./.travis/verify.sh @@ -54,10 +54,10 @@ jobs: env: DISTRO=centos:7 PYTHON="2" # el7 doesn't do python3 modules - stage: test - env: DISTRO=fedora:rawhide PYTHON="3" + env: DISTRO=fedora:latest PYTHON="3" - stage: test - env: DISTRO=fedora:rawhide PYTHON="2" + env: DISTRO=fedora:latest PYTHON="2" - stage: test env: PYTHON="2" KRB5_VER="heimdal" PYENV="2.7.14" @@ -75,7 +75,7 @@ jobs: - stage: deploy latest docs script: skip env: - - DISTRO=fedora:rawhide + - DISTRO=fedora:latest - PYTHON="3" - secure: L5SpEj5+no20PWwC9Y/XNhAfmUvYiuykwSMa/YyqvUuBjdizzpZcHr7Ego5nMdM1TniTxj4pSTM+GbM0FHCzNmAINSRh9g/D3hheRqlRBacqR0XwC9ZZRvkKvtzwnLh4vYWiauq4AoDeR5U6tkEcay6LjE57iMQcLjcKYBc+Eos= before_deploy: @@ -93,7 +93,7 @@ jobs: - stage: deploy script: skip env: - - DISTRO=fedora:rawhide + - DISTRO=fedora:latest - PYTHON="3" - secure: L5SpEj5+no20PWwC9Y/XNhAfmUvYiuykwSMa/YyqvUuBjdizzpZcHr7Ego5nMdM1TniTxj4pSTM+GbM0FHCzNmAINSRh9g/D3hheRqlRBacqR0XwC9ZZRvkKvtzwnLh4vYWiauq4AoDeR5U6tkEcay6LjE57iMQcLjcKYBc+Eos= before_deploy: diff --git a/gssapi/names.py b/gssapi/names.py index 551e22f4..ee7a1db1 100644 --- a/gssapi/names.py +++ b/gssapi/names.py @@ -1,5 +1,3 @@ -import collections - import six from gssapi.raw import names as rname @@ -7,6 +5,12 @@ from gssapi.raw import named_tuples as tuples from gssapi import _utils +if six.PY2: + from collections import MutableMapping, Iterable +else: + from collections.abc import MutableMapping, Iterable + + rname_rfc6680 = _utils.import_gssapi_extension('rfc6680') rname_rfc6680_comp_oid = _utils.import_gssapi_extension('rfc6680_comp_oid') @@ -313,7 +317,7 @@ def attributes(self): return self._attr_obj -class _NameAttributeMapping(collections.MutableMapping): +class _NameAttributeMapping(MutableMapping): """Provides dict-like access to RFC 6680 Name attributes.""" def __init__(self, name): @@ -345,7 +349,7 @@ def __setitem__(self, key, value): complete = False if (isinstance(value, (six.string_types, bytes)) or - not isinstance(value, collections.Iterable)): + not isinstance(value, Iterable)): # NB(directxman12): this allows us to easily assign a single # value, since that's a common case value = [value] diff --git a/gssapi/raw/ext_dce.pyx b/gssapi/raw/ext_dce.pyx index e23bb899..c4e68e17 100644 --- a/gssapi/raw/ext_dce.pyx +++ b/gssapi/raw/ext_dce.pyx @@ -9,12 +9,18 @@ from gssapi.raw.sec_contexts cimport SecurityContext from gssapi.raw.misc import GSSError from gssapi.raw import types as gssapi_types from gssapi.raw.named_tuples import IOVUnwrapResult, WrapResult, UnwrapResult -from collections import namedtuple, Sequence +from collections import namedtuple from enum import IntEnum import six from gssapi.raw._enum_extensions import ExtendableEnum +if six.PY2: + from collections import Sequence +else: + from collections.abc import Sequence + + cdef extern from "python_gssapi_ext.h": # NB(directxman12): this wiki page has a different argument order # than the header file, and uses size_t instead of int diff --git a/gssapi/raw/types.pyx b/gssapi/raw/types.pyx index e2cca247..68d6af12 100644 --- a/gssapi/raw/types.pyx +++ b/gssapi/raw/types.pyx @@ -13,6 +13,11 @@ import numbers import operator import six +if six.PY2: + from collections import MutableSet +else: + from collections.abc import MutableSet + class NameType(object): """ @@ -106,7 +111,7 @@ class MechType(object): # these are added in by the individual mechanism files on import -class GenericFlagSet(collections.MutableSet): +class GenericFlagSet(MutableSet): """A set backed by a 32-bit integer This is a set backed by a 32 bit integer. diff --git a/gssapi/tests/test_raw.py b/gssapi/tests/test_raw.py index 12b467d9..c24e48c8 100644 --- a/gssapi/tests/test_raw.py +++ b/gssapi/tests/test_raw.py @@ -1,9 +1,9 @@ -import collections import copy import os import socket import unittest +import six import should_be.all # noqa import gssapi.raw as gb @@ -11,6 +11,11 @@ import k5test.unit as ktu import k5test as kt +if six.PY2: + from collections import Set +else: + from collections.abc import Set + TARGET_SERVICE_NAME = b'host' FQDN = socket.getfqdn().encode('utf-8') @@ -355,7 +360,7 @@ def test_inquire_context(self): mech_type.should_be(gb.MechType.kerberos) flags.shouldnt_be_none() - flags.should_be_a(collections.Set) + flags.should_be_a(Set) flags.shouldnt_be_empty() local_est.should_be_a(bool) @@ -1084,7 +1089,7 @@ def test_basic_init_default_ctx(self): out_mech_type.should_be(gb.MechType.kerberos) - out_req_flags.should_be_a(collections.Set) + out_req_flags.should_be_a(Set) out_req_flags.should_be_at_least_length(2) out_token.shouldnt_be_empty() @@ -1139,7 +1144,7 @@ def test_basic_accept_context_no_acceptor_creds(self): out_token.shouldnt_be_empty() - out_req_flags.should_be_a(collections.Set) + out_req_flags.should_be_a(Set) out_req_flags.should_be_at_least_length(2) out_ttl.should_be_greater_than(0) @@ -1167,7 +1172,7 @@ def test_basic_accept_context(self): out_token.shouldnt_be_empty() - out_req_flags.should_be_a(collections.Set) + out_req_flags.should_be_a(Set) out_req_flags.should_be_at_least_length(2) out_ttl.should_be_greater_than(0) diff --git a/tox.ini b/tox.ini index 5074e76e..cb9a385a 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ # and then run "tox" from this directory. [tox] -envlist = py27,py33,py34,py35 +envlist = py27,py33,py34,py35,py36,py37 [testenv] whitelist_externals=bash