aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2018-06-03 09:50:25 -0400
committerJason R. Coombs <jaraco@jaraco.com>2018-06-03 09:50:25 -0400
commitcca86c7f1d4040834c3265ccecdd9e21b4036df5 (patch)
tree6952f93a45a95659d36a93072e915688ca253a85
parent7068f1d4c86e6d8e705a2b77da6c5dcf6a8d7bcd (diff)
downloadexternal_python_setuptools-cca86c7f1d4040834c3265ccecdd9e21b4036df5.tar.gz
external_python_setuptools-cca86c7f1d4040834c3265ccecdd9e21b4036df5.tar.bz2
external_python_setuptools-cca86c7f1d4040834c3265ccecdd9e21b4036df5.zip
Use Python 3 syntax for new-style clasess
-rw-r--r--pkg_resources/__init__.py11
-rw-r--r--pkg_resources/tests/test_pkg_resources.py8
-rw-r--r--pkg_resources/tests/test_working_set.py4
-rw-r--r--setuptools/__init__.py4
-rwxr-xr-xsetuptools/command/develop.py4
-rwxr-xr-xsetuptools/command/easy_install.py4
-rw-r--r--setuptools/command/test.py4
-rw-r--r--setuptools/config.py5
-rwxr-xr-xsetuptools/package_index.py6
-rw-r--r--setuptools/py31compat.py5
-rw-r--r--setuptools/py33compat.py3
-rw-r--r--setuptools/tests/test_build_meta.py4
-rw-r--r--setuptools/tests/test_easy_install.py4
-rw-r--r--setuptools/tests/test_egg_info.py6
-rw-r--r--setuptools/tests/test_glibc.py4
-rw-r--r--setuptools/tests/test_manifest.py4
-rw-r--r--setuptools/tests/test_pep425tags.py6
-rw-r--r--setuptools/tests/test_wheel.py4
-rw-r--r--setuptools/wheel.py5
19 files changed, 68 insertions, 27 deletions
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index 91d00483..67015408 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -78,6 +78,9 @@ __import__('pkg_resources.extern.packaging.requirements')
__import__('pkg_resources.extern.packaging.markers')
+__metaclass__ = type
+
+
if (3, 0) < sys.version_info < (3, 4):
raise RuntimeError("Python 3.4 or later is required")
@@ -537,7 +540,7 @@ class IResourceProvider(IMetadataProvider):
"""List of resource names in the directory (like ``os.listdir()``)"""
-class WorkingSet(object):
+class WorkingSet:
"""A collection of active distributions on sys.path (or a similar list)"""
def __init__(self, entries=None):
@@ -944,7 +947,7 @@ class _ReqExtras(dict):
return not req.marker or any(extra_evals)
-class Environment(object):
+class Environment:
"""Searchable snapshot of distributions on a search path"""
def __init__(
@@ -2279,7 +2282,7 @@ EGG_NAME = re.compile(
).match
-class EntryPoint(object):
+class EntryPoint:
"""Object representing an advertised importable object"""
def __init__(self, name, module_name, attrs=(), extras=(), dist=None):
@@ -2433,7 +2436,7 @@ def _version_from_file(lines):
return safe_version(value.strip()) or None
-class Distribution(object):
+class Distribution:
"""Wrap an actual or potential sys.path entry w/metadata"""
PKG_INFO = 'PKG-INFO'
diff --git a/pkg_resources/tests/test_pkg_resources.py b/pkg_resources/tests/test_pkg_resources.py
index 7442b79f..079e83f8 100644
--- a/pkg_resources/tests/test_pkg_resources.py
+++ b/pkg_resources/tests/test_pkg_resources.py
@@ -23,6 +23,8 @@ try:
except NameError:
unicode = str
+__metaclass__ = type
+
def timestamp(dt):
"""
@@ -43,7 +45,7 @@ class EggRemover(unicode):
os.remove(self)
-class TestZipProvider(object):
+class TestZipProvider:
finalizers = []
ref_time = datetime.datetime(2013, 5, 12, 13, 25, 0)
@@ -132,7 +134,7 @@ class TestZipProvider(object):
manager.cleanup_resources()
-class TestResourceManager(object):
+class TestResourceManager:
def test_get_cache_path(self):
mgr = pkg_resources.ResourceManager()
path = mgr.get_cache_path('foo')
@@ -163,7 +165,7 @@ class TestIndependence:
subprocess.check_call(cmd)
-class TestDeepVersionLookupDistutils(object):
+class TestDeepVersionLookupDistutils:
@pytest.fixture
def env(self, tmpdir):
"""
diff --git a/pkg_resources/tests/test_working_set.py b/pkg_resources/tests/test_working_set.py
index 42ddcc86..217edd8b 100644
--- a/pkg_resources/tests/test_working_set.py
+++ b/pkg_resources/tests/test_working_set.py
@@ -9,6 +9,8 @@ import pkg_resources
from .test_resources import Metadata
+__metaclass__ = type
+
def strip_comments(s):
return '\n'.join(
@@ -54,7 +56,7 @@ def parse_distributions(s):
yield dist
-class FakeInstaller(object):
+class FakeInstaller:
def __init__(self, installable_dists):
self._installable_dists = installable_dists
diff --git a/setuptools/__init__.py b/setuptools/__init__.py
index 7da47fbe..ce55ec35 100644
--- a/setuptools/__init__.py
+++ b/setuptools/__init__.py
@@ -15,6 +15,8 @@ from setuptools.dist import Distribution, Feature
from setuptools.depends import Require
from . import monkey
+__metaclass__ = type
+
__all__ = [
'setup', 'Distribution', 'Feature', 'Command', 'Extension', 'Require',
'find_packages',
@@ -31,7 +33,7 @@ run_2to3_on_doctests = True
lib2to3_fixer_packages = ['lib2to3.fixes']
-class PackageFinder(object):
+class PackageFinder:
"""
Generate a list of all Python packages found within a directory
"""
diff --git a/setuptools/command/develop.py b/setuptools/command/develop.py
index 959c932a..fdc9fc43 100755
--- a/setuptools/command/develop.py
+++ b/setuptools/command/develop.py
@@ -12,6 +12,8 @@ from setuptools.command.easy_install import easy_install
from setuptools import namespaces
import setuptools
+__metaclass__ = type
+
class develop(namespaces.DevelopInstaller, easy_install):
"""Set up package for development"""
@@ -192,7 +194,7 @@ class develop(namespaces.DevelopInstaller, easy_install):
return easy_install.install_wrapper_scripts(self, dist)
-class VersionlessRequirement(object):
+class VersionlessRequirement:
"""
Adapt a pkg_resources.Distribution to simply return the project
name as the 'requirement' so that scripts will work across
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index a059a0bd..05508ceb 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -63,6 +63,8 @@ from pkg_resources import (
)
import pkg_resources.py31compat
+__metaclass__ = type
+
# Turn on PEP440Warnings
warnings.filterwarnings("default", category=pkg_resources.PEP440Warning)
@@ -2050,7 +2052,7 @@ class WindowsCommandSpec(CommandSpec):
split_args = dict(posix=False)
-class ScriptWriter(object):
+class ScriptWriter:
"""
Encapsulates behavior around writing entry point scripts for console and
gui apps.
diff --git a/setuptools/command/test.py b/setuptools/command/test.py
index 51aee1f7..dde0118c 100644
--- a/setuptools/command/test.py
+++ b/setuptools/command/test.py
@@ -16,6 +16,8 @@ from pkg_resources import (resource_listdir, resource_exists, normalize_path,
add_activation_listener, require, EntryPoint)
from setuptools import Command
+__metaclass__ = type
+
class ScanningLoader(TestLoader):
@@ -58,7 +60,7 @@ class ScanningLoader(TestLoader):
# adapted from jaraco.classes.properties:NonDataProperty
-class NonDataProperty(object):
+class NonDataProperty:
def __init__(self, fget):
self.fget = fget
diff --git a/setuptools/config.py b/setuptools/config.py
index d3f0b123..5f908cf1 100644
--- a/setuptools/config.py
+++ b/setuptools/config.py
@@ -11,6 +11,9 @@ from setuptools.extern.packaging.version import LegacyVersion, parse
from setuptools.extern.six import string_types
+__metaclass__ = type
+
+
def read_configuration(
filepath, find_others=False, ignore_option_errors=False):
"""Read given configuration file and returns options from it as a dict.
@@ -113,7 +116,7 @@ def parse_configuration(
return meta, options
-class ConfigHandler(object):
+class ConfigHandler:
"""Handles metadata supplied in configuration files."""
section_prefix = None
diff --git a/setuptools/package_index.py b/setuptools/package_index.py
index b6407be3..ed4162cd 100755
--- a/setuptools/package_index.py
+++ b/setuptools/package_index.py
@@ -26,6 +26,8 @@ from setuptools.py27compat import get_all_headers
from setuptools.py33compat import unescape
from setuptools.wheel import Wheel
+__metaclass__ = type
+
EGG_FRAGMENT = re.compile(r'^egg=([-A-Za-z0-9_.+!]+)$')
HREF = re.compile("""href\\s*=\\s*['"]?([^'"> ]+)""", re.I)
# this is here to fix emacs' cruddy broken syntax highlighting
@@ -235,7 +237,7 @@ def find_external_links(url, page):
yield urllib.parse.urljoin(url, htmldecode(match.group(1)))
-class ContentChecker(object):
+class ContentChecker:
"""
A null content checker that defines the interface for checking content
"""
@@ -980,7 +982,7 @@ def _encode_auth(auth):
return encoded.replace('\n', '')
-class Credential(object):
+class Credential:
"""
A username/password pair. Use like a namedtuple.
"""
diff --git a/setuptools/py31compat.py b/setuptools/py31compat.py
index 3aecf74e..1a0705ec 100644
--- a/setuptools/py31compat.py
+++ b/setuptools/py31compat.py
@@ -1,5 +1,8 @@
__all__ = []
+__metaclass__ = type
+
+
try:
# Python >=3.2
from tempfile import TemporaryDirectory
@@ -7,7 +10,7 @@ except ImportError:
import shutil
import tempfile
- class TemporaryDirectory(object):
+ class TemporaryDirectory:
"""
Very simple temporary directory context manager.
Will try to delete afterward, but will also ignore OS and similar
diff --git a/setuptools/py33compat.py b/setuptools/py33compat.py
index 2a73ebb3..87cf5398 100644
--- a/setuptools/py33compat.py
+++ b/setuptools/py33compat.py
@@ -10,11 +10,12 @@ except ImportError:
from setuptools.extern import six
from setuptools.extern.six.moves import html_parser
+__metaclass__ = type
OpArg = collections.namedtuple('OpArg', 'opcode arg')
-class Bytecode_compat(object):
+class Bytecode_compat:
def __init__(self, code):
self.code = code
diff --git a/setuptools/tests/test_build_meta.py b/setuptools/tests/test_build_meta.py
index 659c1a65..b39b7b8f 100644
--- a/setuptools/tests/test_build_meta.py
+++ b/setuptools/tests/test_build_meta.py
@@ -5,12 +5,14 @@ import pytest
from .files import build_files
from .textwrap import DALS
+__metaclass__ = type
+
futures = pytest.importorskip('concurrent.futures')
importlib = pytest.importorskip('importlib')
-class BuildBackendBase(object):
+class BuildBackendBase:
def __init__(self, cwd=None, env={}, backend_name='setuptools.build_meta'):
self.cwd = cwd
self.env = env
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 3fc7fdaf..345d283c 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -36,8 +36,10 @@ import pkg_resources
from . import contexts
from .textwrap import DALS
+__metaclass__ = type
-class FakeDist(object):
+
+class FakeDist:
def get_entry_map(self, group):
if group != 'console_scripts':
return {}
diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py
index a70a93a8..1a100266 100644
--- a/setuptools/tests/test_egg_info.py
+++ b/setuptools/tests/test_egg_info.py
@@ -16,12 +16,14 @@ from .files import build_files
from .textwrap import DALS
from . import contexts
+__metaclass__ = type
+
class Environment(str):
pass
-class TestEggInfo(object):
+class TestEggInfo:
setup_script = DALS("""
from setuptools import setup
@@ -181,7 +183,7 @@ class TestEggInfo(object):
)
invalid_marker = "<=>++"
- class RequiresTestHelper(object):
+ class RequiresTestHelper:
@staticmethod
def parametrize(*test_list, **format_dict):
diff --git a/setuptools/tests/test_glibc.py b/setuptools/tests/test_glibc.py
index 0a7cac0e..795fdc56 100644
--- a/setuptools/tests/test_glibc.py
+++ b/setuptools/tests/test_glibc.py
@@ -4,6 +4,8 @@ import pytest
from setuptools.glibc import check_glibc_version
+__metaclass__ = type
+
@pytest.fixture(params=[
"2.20",
@@ -23,7 +25,7 @@ def bad_string(request):
return request.param
-class TestGlibc(object):
+class TestGlibc:
def test_manylinux1_check_glibc_version(self, two_twenty):
"""
Test that the check_glibc_version function is robust against weird
diff --git a/setuptools/tests/test_manifest.py b/setuptools/tests/test_manifest.py
index 65eec7d9..c9533dda 100644
--- a/setuptools/tests/test_manifest.py
+++ b/setuptools/tests/test_manifest.py
@@ -18,6 +18,8 @@ from setuptools.tests.textwrap import DALS
import pytest
+__metaclass__ = type
+
py3_only = pytest.mark.xfail(six.PY2, reason="Test runs on Python 3 only")
@@ -157,7 +159,7 @@ def test_translated_pattern_mismatch(pattern_mismatch):
assert not translate_pattern(pattern).match(target)
-class TempDirTestCase(object):
+class TempDirTestCase:
def setup_method(self, method):
self.temp_dir = tempfile.mkdtemp()
self.old_cwd = os.getcwd()
diff --git a/setuptools/tests/test_pep425tags.py b/setuptools/tests/test_pep425tags.py
index 0f60e0ed..658784ac 100644
--- a/setuptools/tests/test_pep425tags.py
+++ b/setuptools/tests/test_pep425tags.py
@@ -4,8 +4,10 @@ from mock import patch
from setuptools import pep425tags
+__metaclass__ = type
-class TestPEP425Tags(object):
+
+class TestPEP425Tags:
def mock_get_config_var(self, **kwd):
"""
@@ -104,7 +106,7 @@ class TestPEP425Tags(object):
self.abi_tag_unicode('dm', {'Py_DEBUG': True, 'WITH_PYMALLOC': True})
-class TestManylinux1Tags(object):
+class TestManylinux1Tags:
@patch('setuptools.pep425tags.get_platform', lambda: 'linux_x86_64')
@patch('setuptools.glibc.have_compatible_glibc',
diff --git a/setuptools/tests/test_wheel.py b/setuptools/tests/test_wheel.py
index cf650868..6db5fa11 100644
--- a/setuptools/tests/test_wheel.py
+++ b/setuptools/tests/test_wheel.py
@@ -24,6 +24,8 @@ from .contexts import tempdir
from .files import build_files
from .textwrap import DALS
+__metaclass__ = type
+
WHEEL_INFO_TESTS = (
('invalid.whl', ValueError),
@@ -148,7 +150,7 @@ def _check_wheel_install(filename, install_dir, install_tree_includes,
assert requires_txt == dist.get_metadata('requires.txt').lstrip()
-class Record(object):
+class Record:
def __init__(self, id, **kwargs):
self._id = id
diff --git a/setuptools/wheel.py b/setuptools/wheel.py
index dc03bbc8..95a794a8 100644
--- a/setuptools/wheel.py
+++ b/setuptools/wheel.py
@@ -16,6 +16,9 @@ from setuptools import pep425tags
from setuptools.command.egg_info import write_requirements
+__metaclass__ = type
+
+
WHEEL_NAME = re.compile(
r"""^(?P<project_name>.+?)-(?P<version>\d.*?)
((-(?P<build>\d.*?))?-(?P<py_version>.+?)-(?P<abi>.+?)-(?P<platform>.+?)
@@ -52,7 +55,7 @@ def unpack(src_dir, dst_dir):
os.rmdir(dirpath)
-class Wheel(object):
+class Wheel:
def __init__(self, filename):
match = WHEEL_NAME(os.path.basename(filename))