diff options
author | Paul Ganssle <paul@ganssle.io> | 2018-07-10 11:16:04 -0400 |
---|---|---|
committer | Paul Ganssle <paul@ganssle.io> | 2018-07-10 11:52:56 -0400 |
commit | dc9fcbd5ef343321cf29ce1e34f454dadeb59dd2 (patch) | |
tree | de69de5d676db9caae927332b29738992bd0d4b8 | |
parent | 54ce65990c26ff68750ae682b6bacd5eed7d56ba (diff) | |
download | external_python_setuptools-dc9fcbd5ef343321cf29ce1e34f454dadeb59dd2.tar.gz external_python_setuptools-dc9fcbd5ef343321cf29ce1e34f454dadeb59dd2.tar.bz2 external_python_setuptools-dc9fcbd5ef343321cf29ce1e34f454dadeb59dd2.zip |
Switch over to using six.PY{2,3} when possible
-rw-r--r-- | pkg_resources/py31compat.py | 4 | ||||
-rw-r--r-- | setuptools/command/bdist_egg.py | 2 | ||||
-rw-r--r-- | setuptools/extern/__init__.py | 2 | ||||
-rw-r--r-- | setuptools/pep425tags.py | 6 |
4 files changed, 9 insertions, 5 deletions
diff --git a/pkg_resources/py31compat.py b/pkg_resources/py31compat.py index fd4b6fd0..a381c424 100644 --- a/pkg_resources/py31compat.py +++ b/pkg_resources/py31compat.py @@ -2,6 +2,8 @@ import os import errno import sys +from .extern import six + def _makedirs_31(path, exist_ok=False): try: @@ -15,7 +17,7 @@ def _makedirs_31(path, exist_ok=False): # and exists_ok considerations are disentangled. # See https://github.com/pypa/setuptools/pull/1083#issuecomment-315168663 needs_makedirs = ( - sys.version_info.major == 2 or + six.PY2 or (3, 4) <= sys.version_info < (3, 4, 1) ) makedirs = _makedirs_31 if needs_makedirs else os.makedirs diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py index 14530729..9f8df917 100644 --- a/setuptools/command/bdist_egg.py +++ b/setuptools/command/bdist_egg.py @@ -411,7 +411,7 @@ def scan_module(egg_dir, base, name, stubs): return True # Extension module pkg = base[len(egg_dir) + 1:].replace(os.sep, '.') module = pkg + (pkg and '.' or '') + os.path.splitext(name)[0] - if sys.version_info.major == 2: + if six.PY2: skip = 8 # skip magic & date elif sys.version_info < (3, 7): skip = 12 # skip magic & date & file size diff --git a/setuptools/extern/__init__.py b/setuptools/extern/__init__.py index 52785a03..cb2fa329 100644 --- a/setuptools/extern/__init__.py +++ b/setuptools/extern/__init__.py @@ -48,7 +48,7 @@ class VendorImporter: # on later Python versions to cause relative imports # in the vendor package to resolve the same modules # as those going through this importer. - if sys.version_info.major >= 3: + if sys.version_info >= (3, ): del sys.modules[extant] return mod except ImportError: diff --git a/setuptools/pep425tags.py b/setuptools/pep425tags.py index a86a0d18..8bf4277d 100644 --- a/setuptools/pep425tags.py +++ b/setuptools/pep425tags.py @@ -12,6 +12,8 @@ import sysconfig import warnings from collections import OrderedDict +from .extern import six + from . import glibc _osx_arch_pat = re.compile(r'(.+)_(\d+)_(\d+)_(.+)') @@ -97,8 +99,8 @@ def get_abi_tag(): lambda: sys.maxunicode == 0x10ffff, expected=4, warn=(impl == 'cp' and - sys.version_info.major == 2)) \ - and sys.version_info.major == 2: + six.PY2)) \ + and six.PY2: u = 'u' abi = '%s%s%s%s%s' % (impl, get_impl_ver(), d, m, u) elif soabi and soabi.startswith('cpython-'): |