summaryrefslogtreecommitdiff
path: root/setuptools/command
diff options
context:
space:
mode:
authorHugo <hugovk@users.noreply.github.com>2020-01-08 19:10:11 +0200
committerHugo <hugovk@users.noreply.github.com>2020-01-08 19:10:11 +0200
commit796abd8dbec884cedf326cb5f85512a5d5648c4e (patch)
treecacbbdc28822b519f87b679a8262687421d13c01 /setuptools/command
parent7e97def47723303fafabe48b22168bbc11bb4821 (diff)
downloadpython-setuptools-git-796abd8dbec884cedf326cb5f85512a5d5648c4e.tar.gz
Fix for Python 4: replace unsafe six.PY3 with PY2
Diffstat (limited to 'setuptools/command')
-rw-r--r--setuptools/command/build_ext.py2
-rw-r--r--setuptools/command/develop.py2
-rw-r--r--setuptools/command/easy_install.py2
-rw-r--r--setuptools/command/egg_info.py2
-rw-r--r--setuptools/command/sdist.py2
-rw-r--r--setuptools/command/test.py4
-rw-r--r--setuptools/command/upload_docs.py4
7 files changed, 9 insertions, 9 deletions
diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py
index daa8e4fe..1b51e040 100644
--- a/setuptools/command/build_ext.py
+++ b/setuptools/command/build_ext.py
@@ -113,7 +113,7 @@ class build_ext(_build_ext):
if fullname in self.ext_map:
ext = self.ext_map[fullname]
use_abi3 = (
- six.PY3
+ not six.PY2
and getattr(ext, 'py_limited_api')
and get_abi3_suffix()
)
diff --git a/setuptools/command/develop.py b/setuptools/command/develop.py
index 009e4f93..b5619246 100644
--- a/setuptools/command/develop.py
+++ b/setuptools/command/develop.py
@@ -108,7 +108,7 @@ class develop(namespaces.DevelopInstaller, easy_install):
return path_to_setup
def install_for_development(self):
- if six.PY3 and getattr(self.distribution, 'use_2to3', False):
+ if not six.PY2 and getattr(self.distribution, 'use_2to3', False):
# If we run 2to3 we can not do this inplace:
# Ensure metadata is up-to-date
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 09066f8c..426301d6 100644
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -1567,7 +1567,7 @@ def get_exe_prefixes(exe_filename):
continue
if parts[0].upper() in ('PURELIB', 'PLATLIB'):
contents = z.read(name)
- if six.PY3:
+ if not six.PY2:
contents = contents.decode()
for pth in yield_lines(contents):
pth = pth.strip().replace('\\', '/')
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index 5d8f451e..a5c5a2fc 100644
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -266,7 +266,7 @@ class egg_info(InfoCommon, Command):
to the file.
"""
log.info("writing %s to %s", what, filename)
- if six.PY3:
+ if not six.PY2:
data = data.encode("utf-8")
if not self.dry_run:
f = open(filename, 'wb')
diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py
index a851453f..8c3438ea 100644
--- a/setuptools/command/sdist.py
+++ b/setuptools/command/sdist.py
@@ -207,7 +207,7 @@ class sdist(sdist_add_defaults, orig.sdist):
manifest = open(self.manifest, 'rb')
for line in manifest:
# The manifest must contain UTF-8. See #303.
- if six.PY3:
+ if not six.PY2:
try:
line = line.decode('UTF-8')
except UnicodeDecodeError:
diff --git a/setuptools/command/test.py b/setuptools/command/test.py
index c148b38d..f6470e9c 100644
--- a/setuptools/command/test.py
+++ b/setuptools/command/test.py
@@ -129,7 +129,7 @@ class test(Command):
@contextlib.contextmanager
def project_on_sys_path(self, include_dists=[]):
- with_2to3 = six.PY3 and getattr(self.distribution, 'use_2to3', False)
+ with_2to3 = not six.PY2 and getattr(self.distribution, 'use_2to3', False)
if with_2to3:
# If we run 2to3 we can not do this inplace:
@@ -240,7 +240,7 @@ class test(Command):
# Purge modules under test from sys.modules. The test loader will
# re-import them from the build location. Required when 2to3 is used
# with namespace packages.
- if six.PY3 and getattr(self.distribution, 'use_2to3', False):
+ if not six.PY2 and getattr(self.distribution, 'use_2to3', False):
module = self.test_suite.split('.')[0]
if module in _namespace_packages:
del_modules = []
diff --git a/setuptools/command/upload_docs.py b/setuptools/command/upload_docs.py
index 07aa564a..130a0cb6 100644
--- a/setuptools/command/upload_docs.py
+++ b/setuptools/command/upload_docs.py
@@ -24,7 +24,7 @@ from .upload import upload
def _encode(s):
- errors = 'surrogateescape' if six.PY3 else 'strict'
+ errors = 'strict' if six.PY2 else 'surrogateescape'
return s.encode('utf-8', errors)
@@ -153,7 +153,7 @@ class upload_docs(upload):
# set up the authentication
credentials = _encode(self.username + ':' + self.password)
credentials = standard_b64encode(credentials)
- if six.PY3:
+ if not six.PY2:
credentials = credentials.decode('ascii')
auth = "Basic " + credentials