From 4d57008dc8a1e876d152d828c34c8a8fe10c3f6d Mon Sep 17 00:00:00 2001 From: Martynov Maxim Date: Fri, 21 Aug 2020 11:09:23 +0300 Subject: [PATCH] Use six module for accessing collections.abc --- requirements.txt | 1 + setuptools_git_versioning.py | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/requirements.txt b/requirements.txt index 2f1b452..66b140d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/setuptools_git_versioning.py b/setuptools_git_versioning.py index bf862dc..6632122 100644 --- a/setuptools_git_versioning.py +++ b/setuptools_git_versioning.py @@ -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 @@ -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)