Skip to content

Commit

Permalink
Use six module for accessing collections.abc
Browse files Browse the repository at this point in the history
  • Loading branch information
dolfinus committed Aug 21, 2020
1 parent b85a5e5 commit 4d57008
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ typing>=3.6,<3.7;python_version=='3.4'
typing>=3.6,<3.7;python_version=='3.3'
setuptools<=44.1;python_version<"3"
typing>=3.7;python_version<"3"
six>=1.13.0
8 changes: 2 additions & 6 deletions setuptools_git_versioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
from setuptools.dist import Distribution
from distutils.errors import DistutilsSetupError
from typing import List, Optional, Any

try:
from collections.abc import Mapping
except ImportError:
from collections import Mapping
from six.moves import collections_abc

DEFAULT_TEMPLATE = "{tag}" # type: str
DEFAULT_DEV_TEMPLATE = "{tag}.dev{ccount}+git.{sha}" # type: str
Expand Down Expand Up @@ -84,7 +80,7 @@ def parse_config(dist, _, value): # type: (Distribution, Any, Any) -> None
else:
raise DistutilsSetupError("Can't be False")

if not isinstance(value, Mapping):
if not isinstance(value, collections_abc.Mapping):
raise DistutilsSetupError("Config in the wrong format")

template = value.get('template', DEFAULT_TEMPLATE)
Expand Down

0 comments on commit 4d57008

Please sign in to comment.