diff --git a/docs/conf.py b/docs/conf.py
index 38899e5334..0a82ff2fe2 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -100,19 +100,17 @@
# Preserve authored syntax for defaults
autodoc_preserve_defaults = True
-intersphinx_mapping.update(
- {
- 'pip': ('https://pip.pypa.io/en/latest', None),
- 'build': ('https://pypa-build.readthedocs.io/en/latest', None),
- 'PyPUG': ('https://packaging.python.org/en/latest/', None),
- 'packaging': ('https://packaging.pypa.io/en/latest/', None),
- 'twine': ('https://twine.readthedocs.io/en/stable/', None),
- 'importlib-resources': (
- 'https://importlib-resources.readthedocs.io/en/latest',
- None,
- ),
- }
-)
+intersphinx_mapping.update({
+ 'pip': ('https://pip.pypa.io/en/latest', None),
+ 'build': ('https://pypa-build.readthedocs.io/en/latest', None),
+ 'PyPUG': ('https://packaging.python.org/en/latest/', None),
+ 'packaging': ('https://packaging.pypa.io/en/latest/', None),
+ 'twine': ('https://twine.readthedocs.io/en/stable/', None),
+ 'importlib-resources': (
+ 'https://importlib-resources.readthedocs.io/en/latest',
+ None,
+ ),
+})
# Add support for linking usernames
github_url = 'https://github.com'
diff --git a/pkg_resources/tests/test_resources.py b/pkg_resources/tests/test_resources.py
index 608c67aeeb..c90584a882 100644
--- a/pkg_resources/tests/test_resources.py
+++ b/pkg_resources/tests/test_resources.py
@@ -255,12 +255,10 @@ def test_marker_evaluation_with_extras(self):
ws = WorkingSet([])
Foo = Distribution.from_filename(
"/foo_dir/Foo-1.2.dist-info",
- metadata=Metadata(
- (
- "METADATA",
- "Provides-Extra: baz\n" "Requires-Dist: quux; extra=='baz'",
- )
- ),
+ metadata=Metadata((
+ "METADATA",
+ "Provides-Extra: baz\n" "Requires-Dist: quux; extra=='baz'",
+ )),
)
ad.add(Foo)
assert list(ws.resolve(parse_requirements("Foo"), ad)) == [Foo]
@@ -275,13 +273,11 @@ def test_marker_evaluation_with_extras_normlized(self):
ws = WorkingSet([])
Foo = Distribution.from_filename(
"/foo_dir/Foo-1.2.dist-info",
- metadata=Metadata(
- (
- "METADATA",
- "Provides-Extra: baz-lightyear\n"
- "Requires-Dist: quux; extra=='baz-lightyear'",
- )
- ),
+ metadata=Metadata((
+ "METADATA",
+ "Provides-Extra: baz-lightyear\n"
+ "Requires-Dist: quux; extra=='baz-lightyear'",
+ )),
)
ad.add(Foo)
assert list(ws.resolve(parse_requirements("Foo"), ad)) == [Foo]
@@ -295,15 +291,13 @@ def test_marker_evaluation_with_multiple_extras(self):
ws = WorkingSet([])
Foo = Distribution.from_filename(
"/foo_dir/Foo-1.2.dist-info",
- metadata=Metadata(
- (
- "METADATA",
- "Provides-Extra: baz\n"
- "Requires-Dist: quux; extra=='baz'\n"
- "Provides-Extra: bar\n"
- "Requires-Dist: fred; extra=='bar'\n",
- )
- ),
+ metadata=Metadata((
+ "METADATA",
+ "Provides-Extra: baz\n"
+ "Requires-Dist: quux; extra=='baz'\n"
+ "Provides-Extra: bar\n"
+ "Requires-Dist: fred; extra=='bar'\n",
+ )),
)
ad.add(Foo)
quux = Distribution.from_filename("/foo_dir/quux-1.0.dist-info")
@@ -326,15 +320,13 @@ def test_marker_evaluation_with_extras_loop(self):
)
c = Distribution.from_filename(
"/foo_dir/c-1.0.dist-info",
- metadata=Metadata(
- (
- "METADATA",
- "Provides-Extra: a\n"
- "Requires-Dist: b;extra=='a'\n"
- "Provides-Extra: b\n"
- "Requires-Dist: foo;extra=='b'",
- )
- ),
+ metadata=Metadata((
+ "METADATA",
+ "Provides-Extra: a\n"
+ "Requires-Dist: b;extra=='a'\n"
+ "Provides-Extra: b\n"
+ "Requires-Dist: foo;extra=='b'",
+ )),
)
foo = Distribution.from_filename("/foo_dir/foo-0.1.dist-info")
for dist in (a, b, c, foo):
@@ -572,26 +564,22 @@ def testOptionsAndHashing(self):
assert set(r1.extras) == set(("foo", "bar"))
assert set(r2.extras) == set(("foo", "bar"))
assert hash(r1) == hash(r2)
- assert hash(r1) == hash(
- (
- "twisted",
- None,
- packaging.specifiers.SpecifierSet(">=1.2"),
- frozenset(["foo", "bar"]),
- None,
- )
- )
+ assert hash(r1) == hash((
+ "twisted",
+ None,
+ packaging.specifiers.SpecifierSet(">=1.2"),
+ frozenset(["foo", "bar"]),
+ None,
+ ))
assert hash(
Requirement.parse("Twisted @ https://localhost/twisted.zip")
- ) == hash(
- (
- "twisted",
- "https://localhost/twisted.zip",
- packaging.specifiers.SpecifierSet(),
- frozenset(),
- None,
- )
- )
+ ) == hash((
+ "twisted",
+ "https://localhost/twisted.zip",
+ packaging.specifiers.SpecifierSet(),
+ frozenset(),
+ None,
+ ))
def testVersionEquality(self):
r1 = Requirement.parse("foo==0.3a2")
diff --git a/pkg_resources/tests/test_working_set.py b/pkg_resources/tests/test_working_set.py
index 435d3c6beb..f8e60e752a 100644
--- a/pkg_resources/tests/test_working_set.py
+++ b/pkg_resources/tests/test_working_set.py
@@ -19,7 +19,7 @@ def strip_comments(s):
def parse_distributions(s):
- '''
+ """
Parse a series of distribution specs of the form:
{project_name}-{version}
[optional, indented requirements specification]
@@ -36,7 +36,7 @@ def parse_distributions(s):
- project_name=foo, version=0.2
- project_name=bar, version=1.0,
requires=['foo>=3.0', 'baz; extra=="feature"']
- '''
+ """
s = s.strip()
for spec in re.split(r'\n(?=[^\s])', s):
if not spec:
@@ -113,7 +113,7 @@ def parametrize_test_working_set_resolve(*test_list):
@parametrize_test_working_set_resolve(
- '''
+ """
# id
noop
@@ -126,8 +126,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved
# resolved [replace conflicting]
- ''',
- '''
+ """,
+ """
# id
already_installed
@@ -144,8 +144,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
foo-3.0
- ''',
- '''
+ """,
+ """
# id
installable_not_installed
@@ -163,8 +163,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
foo-3.0
- ''',
- '''
+ """,
+ """
# id
not_installable
@@ -180,8 +180,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
DistributionNotFound
- ''',
- '''
+ """,
+ """
# id
no_matching_version
@@ -198,8 +198,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
DistributionNotFound
- ''',
- '''
+ """,
+ """
# id
installable_with_installed_conflict
@@ -217,8 +217,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
foo-3.5
- ''',
- '''
+ """,
+ """
# id
not_installable_with_installed_conflict
@@ -235,8 +235,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
DistributionNotFound
- ''',
- '''
+ """,
+ """
# id
installed_with_installed_require
@@ -257,8 +257,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
foo-3.9
baz-0.1
- ''',
- '''
+ """,
+ """
# id
installed_with_conflicting_installed_require
@@ -277,8 +277,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
DistributionNotFound
- ''',
- '''
+ """,
+ """
# id
installed_with_installable_conflicting_require
@@ -299,8 +299,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
baz-0.1
foo-2.9
- ''',
- '''
+ """,
+ """
# id
installed_with_installable_require
@@ -321,8 +321,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
foo-3.9
baz-0.1
- ''',
- '''
+ """,
+ """
# id
installable_with_installed_require
@@ -343,8 +343,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
foo-3.9
baz-0.1
- ''',
- '''
+ """,
+ """
# id
installable_with_installable_require
@@ -365,8 +365,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
foo-3.9
baz-0.1
- ''',
- '''
+ """,
+ """
# id
installable_with_conflicting_installable_require
@@ -387,8 +387,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
baz-0.1
foo-2.9
- ''',
- '''
+ """,
+ """
# id
conflicting_installables
@@ -407,8 +407,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
VersionConflict
- ''',
- '''
+ """,
+ """
# id
installables_with_conflicting_requires
@@ -431,8 +431,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
VersionConflict
- ''',
- '''
+ """,
+ """
# id
installables_with_conflicting_nested_requires
@@ -459,8 +459,8 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
VersionConflict
- ''',
- '''
+ """,
+ """
# id
wanted_normalized_name_installed_canonical
@@ -477,7 +477,7 @@ def parametrize_test_working_set_resolve(*test_list):
# resolved [replace conflicting]
foo.bar-3.6
- ''',
+ """,
)
def test_working_set_resolve(
installed_dists,
diff --git a/setuptools/_core_metadata.py b/setuptools/_core_metadata.py
index 6c904c3c77..4bf3c7c947 100644
--- a/setuptools/_core_metadata.py
+++ b/setuptools/_core_metadata.py
@@ -3,6 +3,7 @@
See: https://packaging.python.org/en/latest/specifications/core-metadata/
"""
+
import os
import stat
import textwrap
diff --git a/setuptools/_normalization.py b/setuptools/_normalization.py
index aa9274f093..8d4731eb60 100644
--- a/setuptools/_normalization.py
+++ b/setuptools/_normalization.py
@@ -2,6 +2,7 @@
Helpers for normalization as expected in wheel/sdist/module file names
and core metadata
"""
+
import re
from pathlib import Path
from typing import Union
diff --git a/setuptools/_reqs.py b/setuptools/_reqs.py
index 7d7130d50e..9f83437033 100644
--- a/setuptools/_reqs.py
+++ b/setuptools/_reqs.py
@@ -24,13 +24,11 @@ def parse_strings(strs: _StrOrIter) -> Iterator[str]:
@overload
-def parse(strs: _StrOrIter) -> Iterator[Requirement]:
- ...
+def parse(strs: _StrOrIter) -> Iterator[Requirement]: ...
@overload
-def parse(strs: _StrOrIter, parser: Callable[[str], _T]) -> Iterator[_T]:
- ...
+def parse(strs: _StrOrIter, parser: Callable[[str], _T]) -> Iterator[_T]: ...
def parse(strs, parser=parse_req):
diff --git a/setuptools/build_meta.py b/setuptools/build_meta.py
index 6da80d70b8..80ccceff3c 100644
--- a/setuptools/build_meta.py
+++ b/setuptools/build_meta.py
@@ -128,7 +128,7 @@ def _file_with_extension(directory, extension):
def _open_setup_script(setup_script):
if not os.path.exists(setup_script):
# Supply a default setup.py
- return io.StringIO(u"from setuptools import setup; setup()")
+ return io.StringIO("from setuptools import setup; setup()")
return getattr(tokenize, 'open', open)(setup_script)
diff --git a/setuptools/command/_requirestxt.py b/setuptools/command/_requirestxt.py
index 32bae2c4b4..7b732b11ab 100644
--- a/setuptools/command/_requirestxt.py
+++ b/setuptools/command/_requirestxt.py
@@ -6,6 +6,7 @@
See https://setuptools.pypa.io/en/latest/deprecated/python_eggs.html#requires-txt
"""
+
import io
from collections import defaultdict
from itertools import filterfalse
diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py
index bdece56bc9..e0947c6624 100644
--- a/setuptools/command/bdist_egg.py
+++ b/setuptools/command/bdist_egg.py
@@ -232,9 +232,11 @@ def run(self): # noqa: C901 # is too complex (14) # FIXME
remove_tree(self.bdist_dir, dry_run=self.dry_run)
# Add to 'Distribution.dist_files' so that the "upload" command works
- getattr(self.distribution, 'dist_files', []).append(
- ('bdist_egg', get_python_version(), self.egg_output)
- )
+ getattr(self.distribution, 'dist_files', []).append((
+ 'bdist_egg',
+ get_python_version(),
+ self.egg_output,
+ ))
def zap_pyfiles(self):
log.info("Removing .py files from temporary directory")
diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py
index 9a80781cf4..2e1954ab0f 100644
--- a/setuptools/command/build_ext.py
+++ b/setuptools/command/build_ext.py
@@ -37,9 +37,9 @@ def _customize_compiler_for_shlib(compiler):
tmp = _CONFIG_VARS.copy()
try:
# XXX Help! I don't have any idea whether these are right...
- _CONFIG_VARS[
- 'LDSHARED'
- ] = "gcc -Wl,-x -dynamiclib -undefined dynamic_lookup"
+ _CONFIG_VARS['LDSHARED'] = (
+ "gcc -Wl,-x -dynamiclib -undefined dynamic_lookup"
+ )
_CONFIG_VARS['CCSHARED'] = " -dynamiclib"
_CONFIG_VARS['SO'] = ".dylib"
customize_compiler(compiler)
@@ -341,33 +341,30 @@ def _write_stub_file(self, stub_file: str, ext: Extension, compile=False):
if not self.dry_run:
f = open(stub_file, 'w')
f.write(
- '\n'.join(
- [
- "def __bootstrap__():",
- " global __bootstrap__, __file__, __loader__",
- " import sys, os, pkg_resources, importlib.util"
- + if_dl(", dl"),
- " __file__ = pkg_resources.resource_filename"
- "(__name__,%r)" % os.path.basename(ext._file_name),
- " del __bootstrap__",
- " if '__loader__' in globals():",
- " del __loader__",
- if_dl(" old_flags = sys.getdlopenflags()"),
- " old_dir = os.getcwd()",
- " try:",
- " os.chdir(os.path.dirname(__file__))",
- if_dl(" sys.setdlopenflags(dl.RTLD_NOW)"),
- " spec = importlib.util.spec_from_file_location(",
- " __name__, __file__)",
- " mod = importlib.util.module_from_spec(spec)",
- " spec.loader.exec_module(mod)",
- " finally:",
- if_dl(" sys.setdlopenflags(old_flags)"),
- " os.chdir(old_dir)",
- "__bootstrap__()",
- "", # terminal \n
- ]
- )
+ '\n'.join([
+ "def __bootstrap__():",
+ " global __bootstrap__, __file__, __loader__",
+ " import sys, os, pkg_resources, importlib.util" + if_dl(", dl"),
+ " __file__ = pkg_resources.resource_filename"
+ "(__name__,%r)" % os.path.basename(ext._file_name),
+ " del __bootstrap__",
+ " if '__loader__' in globals():",
+ " del __loader__",
+ if_dl(" old_flags = sys.getdlopenflags()"),
+ " old_dir = os.getcwd()",
+ " try:",
+ " os.chdir(os.path.dirname(__file__))",
+ if_dl(" sys.setdlopenflags(dl.RTLD_NOW)"),
+ " spec = importlib.util.spec_from_file_location(",
+ " __name__, __file__)",
+ " mod = importlib.util.module_from_spec(spec)",
+ " spec.loader.exec_module(mod)",
+ " finally:",
+ if_dl(" sys.setdlopenflags(old_flags)"),
+ " os.chdir(old_dir)",
+ "__bootstrap__()",
+ "", # terminal \n
+ ])
)
f.close()
if compile:
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 5d6fd5ca71..897ec6ad9b 100644
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -245,31 +245,25 @@ def finalize_options(self): # noqa: C901 # is too complex (25) # FIXME
self.config_vars = dict(sysconfig.get_config_vars())
- self.config_vars.update(
- {
- 'dist_name': self.distribution.get_name(),
- 'dist_version': self.distribution.get_version(),
- 'dist_fullname': self.distribution.get_fullname(),
- 'py_version': py_version,
- 'py_version_short': (
- f'{sys.version_info.major}.{sys.version_info.minor}'
- ),
- 'py_version_nodot': f'{sys.version_info.major}{sys.version_info.minor}',
- 'sys_prefix': self.config_vars['prefix'],
- 'sys_exec_prefix': self.config_vars['exec_prefix'],
- # Only python 3.2+ has abiflags
- 'abiflags': getattr(sys, 'abiflags', ''),
- 'platlibdir': getattr(sys, 'platlibdir', 'lib'),
- }
- )
+ self.config_vars.update({
+ 'dist_name': self.distribution.get_name(),
+ 'dist_version': self.distribution.get_version(),
+ 'dist_fullname': self.distribution.get_fullname(),
+ 'py_version': py_version,
+ 'py_version_short': (f'{sys.version_info.major}.{sys.version_info.minor}'),
+ 'py_version_nodot': f'{sys.version_info.major}{sys.version_info.minor}',
+ 'sys_prefix': self.config_vars['prefix'],
+ 'sys_exec_prefix': self.config_vars['exec_prefix'],
+ # Only python 3.2+ has abiflags
+ 'abiflags': getattr(sys, 'abiflags', ''),
+ 'platlibdir': getattr(sys, 'platlibdir', 'lib'),
+ })
with contextlib.suppress(AttributeError):
# only for distutils outside stdlib
- self.config_vars.update(
- {
- 'implementation_lower': install._get_implementation().lower(),
- 'implementation': install._get_implementation(),
- }
- )
+ self.config_vars.update({
+ 'implementation_lower': install._get_implementation().lower(),
+ 'implementation': install._get_implementation(),
+ })
# pypa/distutils#113 Python 3.9 compat
self.config_vars.setdefault(
@@ -668,7 +662,7 @@ def check_editable(self, spec):
@contextlib.contextmanager
def _tmpdir(self):
- tmpdir = tempfile.mkdtemp(prefix=u"easy_install-")
+ tmpdir = tempfile.mkdtemp(prefix="easy_install-")
try:
# cast to str as workaround for #709 and #710 and #712
yield str(tmpdir)
@@ -1028,9 +1022,9 @@ def install_exe(self, dist_filename, tmpdir):
f.close()
script_dir = os.path.join(_egg_info, 'scripts')
# delete entry-point scripts to avoid duping
- self.delete_blockers(
- [os.path.join(script_dir, args[0]) for args in ScriptWriter.get_args(dist)]
- )
+ self.delete_blockers([
+ os.path.join(script_dir, args[0]) for args in ScriptWriter.get_args(dist)
+ ])
# Build .egg file from tmpdir
bdist_egg.make_zipfile(
egg_path,
@@ -1433,24 +1427,20 @@ def get_site_dirs():
if sys.platform in ('os2emx', 'riscos'):
sitedirs.append(os.path.join(prefix, "Lib", "site-packages"))
elif os.sep == '/':
- sitedirs.extend(
- [
- os.path.join(
- prefix,
- "lib",
- "python{}.{}".format(*sys.version_info),
- "site-packages",
- ),
- os.path.join(prefix, "lib", "site-python"),
- ]
- )
- else:
- sitedirs.extend(
- [
+ sitedirs.extend([
+ os.path.join(
prefix,
- os.path.join(prefix, "lib", "site-packages"),
- ]
- )
+ "lib",
+ "python{}.{}".format(*sys.version_info),
+ "site-packages",
+ ),
+ os.path.join(prefix, "lib", "site-python"),
+ ])
+ else:
+ sitedirs.extend([
+ prefix,
+ os.path.join(prefix, "lib", "site-packages"),
+ ])
if sys.platform != 'darwin':
continue
@@ -1678,9 +1668,11 @@ def save(self):
last_paths.remove(path)
# also, re-check that all paths are still valid before saving them
for path in self.paths[:]:
- if path not in last_paths and not path.startswith(
- ('import ', 'from ', '#')
- ):
+ if path not in last_paths and not path.startswith((
+ 'import ',
+ 'from ',
+ '#',
+ )):
absolute_path = os.path.join(self.basedir, path)
if not os.path.exists(absolute_path):
self.paths.remove(path)
diff --git a/setuptools/command/editable_wheel.py b/setuptools/command/editable_wheel.py
index 79c839f8f0..73fa9fff52 100644
--- a/setuptools/command/editable_wheel.py
+++ b/setuptools/command/editable_wheel.py
@@ -384,14 +384,13 @@ def _select_strategy(
class EditableStrategy(Protocol):
- def __call__(self, wheel: "WheelFile", files: List[str], mapping: Dict[str, str]):
- ...
+ def __call__(
+ self, wheel: "WheelFile", files: List[str], mapping: Dict[str, str]
+ ): ...
- def __enter__(self):
- ...
+ def __enter__(self): ...
- def __exit__(self, _exc_type, _exc_value, _traceback):
- ...
+ def __exit__(self, _exc_type, _exc_value, _traceback): ...
class _StaticPth:
@@ -413,8 +412,7 @@ def __enter__(self):
_logger.warning(msg + _LENIENT_WARNING)
return self
- def __exit__(self, _exc_type, _exc_value, _traceback):
- ...
+ def __exit__(self, _exc_type, _exc_value, _traceback): ...
class _LinkTree(_StaticPth):
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index 7c7f57aaf8..7169f33535 100644
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -700,9 +700,9 @@ def warn_depends_obsolete(cmd, basename, filename):
def write_toplevel_names(cmd, basename, filename):
- pkgs = dict.fromkeys(
- [k.split('.', 1)[0] for k in cmd.distribution.iter_distribution_names()]
- )
+ pkgs = dict.fromkeys([
+ k.split('.', 1)[0] for k in cmd.distribution.iter_distribution_names()
+ ])
cmd.write_file("top-level names", filename, '\n'.join(sorted(pkgs)) + '\n')
diff --git a/setuptools/config/__init__.py b/setuptools/config/__init__.py
index ffea394436..fcc7d008d6 100644
--- a/setuptools/config/__init__.py
+++ b/setuptools/config/__init__.py
@@ -1,6 +1,7 @@
"""For backward compatibility, expose main functions from
``setuptools.config.setupcfg``
"""
+
from functools import wraps
from typing import Callable, TypeVar, cast
diff --git a/setuptools/config/_apply_pyprojecttoml.py b/setuptools/config/_apply_pyprojecttoml.py
index 80318d5d0b..b562f91759 100644
--- a/setuptools/config/_apply_pyprojecttoml.py
+++ b/setuptools/config/_apply_pyprojecttoml.py
@@ -7,6 +7,7 @@
**PRIVATE MODULE**: API reserved for setuptools internal usage only.
"""
+
import logging
import os
from collections.abc import Mapping
diff --git a/setuptools/config/expand.py b/setuptools/config/expand.py
index 1bc71de546..b48fc1187e 100644
--- a/setuptools/config/expand.py
+++ b/setuptools/config/expand.py
@@ -17,6 +17,7 @@
**PRIVATE MODULE**: API reserved for setuptools internal usage only.
"""
+
import ast
import importlib
import os
diff --git a/setuptools/config/pyprojecttoml.py b/setuptools/config/pyprojecttoml.py
index 379ef222f9..52040be49a 100644
--- a/setuptools/config/pyprojecttoml.py
+++ b/setuptools/config/pyprojecttoml.py
@@ -8,6 +8,7 @@
For simple scenarios, you can also try parsing the file directly
with the help of ``tomllib`` or ``tomli``.
"""
+
import logging
import os
from contextlib import contextmanager
diff --git a/setuptools/config/setupcfg.py b/setuptools/config/setupcfg.py
index 1a0e4154b9..44a2876c06 100644
--- a/setuptools/config/setupcfg.py
+++ b/setuptools/config/setupcfg.py
@@ -8,6 +8,7 @@
For simple scenarios, you can also try parsing the file directly
with the help of ``configparser``.
"""
+
import contextlib
import functools
import os
@@ -694,9 +695,9 @@ def parse_section_packages__find(self, section_options):
valid_keys = ['where', 'include', 'exclude']
- find_kwargs = dict(
- [(k, v) for k, v in section_data.items() if k in valid_keys and v]
- )
+ find_kwargs = dict([
+ (k, v) for k, v in section_data.items() if k in valid_keys and v
+ ])
where = find_kwargs.get('where')
if where is not None:
diff --git a/setuptools/dist.py b/setuptools/dist.py
index 222e8a7623..c9c8c77515 100644
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -87,7 +87,7 @@ def check_nsp(dist, attr, value):
SetuptoolsDeprecationWarning.emit(
"The namespace_packages parameter is deprecated.",
"Please replace its usage with implicit namespaces (PEP 420).",
- see_docs="references/keywords.html#keyword-namespace-packages"
+ see_docs="references/keywords.html#keyword-namespace-packages",
# TODO: define due_date, it may break old packages that are no longer
# maintained (e.g. sphinxcontrib extensions) when installed from source.
# Warning officially introduced in May 2022, however the deprecation
diff --git a/setuptools/glob.py b/setuptools/glob.py
index 647b9bc6ed..8dbf34972d 100644
--- a/setuptools/glob.py
+++ b/setuptools/glob.py
@@ -160,7 +160,7 @@ def escape(pathname):
# Metacharacters do not work in the drive part and shouldn't be escaped.
drive, pathname = os.path.splitdrive(pathname)
if isinstance(pathname, bytes):
- pathname = magic_check_bytes.sub(br'[\1]', pathname)
+ pathname = magic_check_bytes.sub(rb'[\1]', pathname)
else:
pathname = magic_check.sub(r'[\1]', pathname)
return drive + pathname
diff --git a/setuptools/msvc.py b/setuptools/msvc.py
index a910a64b68..be373d176e 100644
--- a/setuptools/msvc.py
+++ b/setuptools/msvc.py
@@ -93,21 +93,17 @@ def _msvc14_find_vc2017():
# Workaround for `-requiresAny` (only available on VS 2017 > 15.6)
with contextlib.suppress(CalledProcessError, OSError, UnicodeDecodeError):
path = (
- subprocess.check_output(
- [
- join(
- root, "Microsoft Visual Studio", "Installer", "vswhere.exe"
- ),
- "-latest",
- "-prerelease",
- "-requires",
- component,
- "-property",
- "installationPath",
- "-products",
- "*",
- ]
- )
+ subprocess.check_output([
+ join(root, "Microsoft Visual Studio", "Installer", "vswhere.exe"),
+ "-latest",
+ "-prerelease",
+ "-requires",
+ component,
+ "-property",
+ "installationPath",
+ "-products",
+ "*",
+ ])
.decode(encoding="mbcs", errors="strict")
.strip()
)
@@ -694,9 +690,9 @@ def find_programdata_vs_vers(self):
listdir(join(vs_path, r'VC\Tools\MSVC'))
# Store version and path
- vs_versions[
- self._as_float_version(state['installationVersion'])
- ] = vs_path
+ vs_versions[self._as_float_version(state['installationVersion'])] = (
+ vs_path
+ )
except (OSError, KeyError):
# Skip if "state.json" file is missing or bad format
diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py
index 017c897b86..757074166a 100644
--- a/setuptools/sandbox.py
+++ b/setuptools/sandbox.py
@@ -408,23 +408,21 @@ def _remap_pair(self, operation, src, dst, *args, **kw):
class DirectorySandbox(AbstractSandbox):
"""Restrict operations to a single subdirectory - pseudo-chroot"""
- write_ops = dict.fromkeys(
- [
- "open",
- "chmod",
- "chown",
- "mkdir",
- "remove",
- "unlink",
- "rmdir",
- "utime",
- "lchown",
- "chroot",
- "mkfifo",
- "mknod",
- "tempnam",
- ]
- )
+ write_ops = dict.fromkeys([
+ "open",
+ "chmod",
+ "chown",
+ "mkdir",
+ "remove",
+ "unlink",
+ "rmdir",
+ "utime",
+ "lchown",
+ "chroot",
+ "mkfifo",
+ "mknod",
+ "tempnam",
+ ])
_exception_patterns = []
"exempt writing to paths that match the pattern"
diff --git a/setuptools/tests/config/downloads/preload.py b/setuptools/tests/config/downloads/preload.py
index 64b3f1c8d5..d559beff33 100644
--- a/setuptools/tests/config/downloads/preload.py
+++ b/setuptools/tests/config/downloads/preload.py
@@ -7,6 +7,7 @@
to make sure the `setup.cfg` examples are downloaded before starting the tests.
"""
+
import sys
from pathlib import Path
diff --git a/setuptools/tests/config/test_apply_pyprojecttoml.py b/setuptools/tests/config/test_apply_pyprojecttoml.py
index 7905aa9ab6..6935523987 100644
--- a/setuptools/tests/config/test_apply_pyprojecttoml.py
+++ b/setuptools/tests/config/test_apply_pyprojecttoml.py
@@ -3,6 +3,7 @@
To run these tests offline, please have a look on ``./downloads/preload.py``
"""
+
import io
import re
import tarfile
diff --git a/setuptools/tests/config/test_setupcfg.py b/setuptools/tests/config/test_setupcfg.py
index 23fc0d0b47..d2bb1212dc 100644
--- a/setuptools/tests/config/test_setupcfg.py
+++ b/setuptools/tests/config/test_setupcfg.py
@@ -357,13 +357,11 @@ def test_usupported_section(self, tmpdir):
dist.parse_config_files()
def test_classifiers(self, tmpdir):
- expected = set(
- [
- 'Framework :: Django',
- 'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.5',
- ]
- )
+ expected = set([
+ 'Framework :: Django',
+ 'Programming Language :: Python :: 3',
+ 'Programming Language :: Python :: 3.5',
+ ])
# From file.
_, config = fake_env(tmpdir, '[metadata]\n' 'classifiers = file: classifiers\n')
@@ -488,15 +486,20 @@ def test_basic(self, tmpdir):
assert dist.packages == ['pack_a', 'pack_b.subpack']
assert dist.namespace_packages == ['pack1', 'pack2']
assert dist.scripts == ['bin/one.py', 'bin/two.py']
- assert dist.dependency_links == (
- ['http://some.com/here/1', 'http://some.com/there/2']
- )
- assert dist.install_requires == (
- ['docutils>=0.3', 'pack==1.1,==1.3', 'hey']
- )
- assert dist.setup_requires == (
- ['docutils>=0.3', 'spack ==1.1, ==1.3', 'there']
- )
+ assert dist.dependency_links == ([
+ 'http://some.com/here/1',
+ 'http://some.com/there/2',
+ ])
+ assert dist.install_requires == ([
+ 'docutils>=0.3',
+ 'pack==1.1,==1.3',
+ 'hey',
+ ])
+ assert dist.setup_requires == ([
+ 'docutils>=0.3',
+ 'spack ==1.1, ==1.3',
+ 'there',
+ ])
assert dist.tests_require == ['mock==0.7.2', 'pytest']
assert dist.python_requires == '>=1.0, !=2.8'
assert dist.py_modules == ['module1', 'module2']
@@ -541,15 +544,20 @@ def test_multiline(self, tmpdir):
assert dist.packages == ['pack_a', 'pack_b.subpack']
assert dist.namespace_packages == ['pack1', 'pack2']
assert dist.scripts == ['bin/one.py', 'bin/two.py']
- assert dist.dependency_links == (
- ['http://some.com/here/1', 'http://some.com/there/2']
- )
- assert dist.install_requires == (
- ['docutils>=0.3', 'pack==1.1,==1.3', 'hey']
- )
- assert dist.setup_requires == (
- ['docutils>=0.3', 'spack ==1.1, ==1.3', 'there']
- )
+ assert dist.dependency_links == ([
+ 'http://some.com/here/1',
+ 'http://some.com/there/2',
+ ])
+ assert dist.install_requires == ([
+ 'docutils>=0.3',
+ 'pack==1.1,==1.3',
+ 'hey',
+ ])
+ assert dist.setup_requires == ([
+ 'docutils>=0.3',
+ 'spack ==1.1, ==1.3',
+ 'there',
+ ])
assert dist.tests_require == ['mock==0.7.2', 'pytest']
def test_package_dir_fail(self, tmpdir):
@@ -593,9 +601,11 @@ def test_find_directive(self, tmpdir):
dir_sub_two, _ = make_package_dir('sub_two', dir_package)
with get_dist(tmpdir) as dist:
- assert set(dist.packages) == set(
- ['fake_package', 'fake_package.sub_two', 'fake_package.sub_one']
- )
+ assert set(dist.packages) == set([
+ 'fake_package',
+ 'fake_package.sub_two',
+ 'fake_package.sub_one',
+ ])
config.write(
'[options]\n'
diff --git a/setuptools/tests/fixtures.py b/setuptools/tests/fixtures.py
index c2dd9df2fb..629daf93d4 100644
--- a/setuptools/tests/fixtures.py
+++ b/setuptools/tests/fixtures.py
@@ -77,17 +77,15 @@ def setuptools_sdist(tmp_path_factory, request):
if dist:
return dist
- subprocess.check_output(
- [
- sys.executable,
- "-m",
- "build",
- "--sdist",
- "--outdir",
- str(tmp),
- str(request.config.rootdir),
- ]
- )
+ subprocess.check_output([
+ sys.executable,
+ "-m",
+ "build",
+ "--sdist",
+ "--outdir",
+ str(tmp),
+ str(request.config.rootdir),
+ ])
return next(tmp.glob("*.tar.gz"))
@@ -104,17 +102,15 @@ def setuptools_wheel(tmp_path_factory, request):
if dist:
return dist
- subprocess.check_output(
- [
- sys.executable,
- "-m",
- "build",
- "--wheel",
- "--outdir",
- str(tmp),
- str(request.config.rootdir),
- ]
- )
+ subprocess.check_output([
+ sys.executable,
+ "-m",
+ "build",
+ "--wheel",
+ "--outdir",
+ str(tmp),
+ str(request.config.rootdir),
+ ])
return next(tmp.glob("*.whl"))
diff --git a/setuptools/tests/integration/helpers.py b/setuptools/tests/integration/helpers.py
index d7d43bd606..824dfdfe1a 100644
--- a/setuptools/tests/integration/helpers.py
+++ b/setuptools/tests/integration/helpers.py
@@ -4,6 +4,7 @@
with setuptools, and ``run`` will always try to be as verbose as possible to
facilitate debugging.
"""
+
import os
import subprocess
import tarfile
@@ -17,7 +18,7 @@ def run(cmd, env=None):
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True,
- env={**os.environ, **(env or {})}
+ env={**os.environ, **(env or {})},
# ^-- allow overwriting instead of discarding the current env
)
diff --git a/setuptools/tests/integration/test_pip_install_sdist.py b/setuptools/tests/integration/test_pip_install_sdist.py
index e0e892cdb8..3467a5ec07 100644
--- a/setuptools/tests/integration/test_pip_install_sdist.py
+++ b/setuptools/tests/integration/test_pip_install_sdist.py
@@ -10,6 +10,7 @@
and the associated maintenance cost (changes in the way these packages define
their build process may require changes in the tests).
"""
+
import json
import os
import shutil
diff --git a/setuptools/tests/script-with-bom.py b/setuptools/tests/script-with-bom.py
index 93d28f1600..c074d263c4 100644
--- a/setuptools/tests/script-with-bom.py
+++ b/setuptools/tests/script-with-bom.py
@@ -1 +1 @@
-result = 'passed'
+result = 'passed'
diff --git a/setuptools/tests/test_bdist_deprecations.py b/setuptools/tests/test_bdist_deprecations.py
index 61f4e9a4cb..9690e2bf50 100644
--- a/setuptools/tests/test_bdist_deprecations.py
+++ b/setuptools/tests/test_bdist_deprecations.py
@@ -1,5 +1,6 @@
"""develop tests
"""
+
import sys
from unittest import mock
diff --git a/setuptools/tests/test_bdist_egg.py b/setuptools/tests/test_bdist_egg.py
index 45dd070967..8f11a51b2d 100644
--- a/setuptools/tests/test_bdist_egg.py
+++ b/setuptools/tests/test_bdist_egg.py
@@ -1,5 +1,6 @@
"""develop tests
"""
+
import os
import re
import zipfile
diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py
index 7fd09687e1..ed3bb6f665 100644
--- a/setuptools/tests/test_build_ext.py
+++ b/setuptools/tests/test_build_ext.py
@@ -98,13 +98,11 @@ def dist_with_example(self):
ext3 = Extension("ext3", ["c-extension/ext3.c"])
path.build(files)
- dist = Distribution(
- {
- "script_name": "%test%",
- "ext_modules": [ext1, ext2, ext3],
- "package_dir": {"": "src"},
- }
- )
+ dist = Distribution({
+ "script_name": "%test%",
+ "ext_modules": [ext1, ext2, ext3],
+ "package_dir": {"": "src"},
+ })
return dist
def test_get_outputs(self, tmpdir_cwd, monkeypatch):
diff --git a/setuptools/tests/test_core_metadata.py b/setuptools/tests/test_core_metadata.py
index fe9d4c5c31..6a52130112 100644
--- a/setuptools/tests/test_core_metadata.py
+++ b/setuptools/tests/test_core_metadata.py
@@ -334,7 +334,7 @@ def test_parity_with_metadata_from_pypa_wheel(tmp_path):
ini2toml[lite]>=0.9
""",
"other": [],
- }
+ },
)
# Generate a PKG-INFO file using setuptools
dist = Distribution(attrs)
diff --git a/setuptools/tests/test_dist.py b/setuptools/tests/test_dist.py
index 0caaef6578..609932a9b3 100644
--- a/setuptools/tests/test_dist.py
+++ b/setuptools/tests/test_dist.py
@@ -31,11 +31,11 @@ def sdist_with_index(distname, version):
with dist_dir.join('index.html').open('w') as fp:
fp.write(
DALS(
- '''
+ """
{dist_sdist}
- '''
+ """
).format(dist_sdist=dist_sdist)
)
@@ -44,16 +44,16 @@ def sdist_with_index(distname, version):
with tmpdir.join('setup.cfg').open('w') as fp:
fp.write(
DALS(
- '''
+ """
[easy_install]
index_url = {index_url}
- '''
+ """
).format(index_url=index_url)
)
- reqs = '''
+ reqs = """
barbazquux-runner
barbazquux
- '''.split()
+ """.split()
with tmpdir.as_cwd():
dist = Distribution()
dist.parse_config_files()
diff --git a/setuptools/tests/test_dist_info.py b/setuptools/tests/test_dist_info.py
index a76dbeb3f2..dbc35ba0b7 100644
--- a/setuptools/tests/test_dist_info.py
+++ b/setuptools/tests/test_dist_info.py
@@ -1,5 +1,6 @@
"""Test .dist-info style distributions.
"""
+
import pathlib
import re
import shutil
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index d71e01586c..d0b95e09ea 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -294,9 +294,9 @@ def test_script_install(self, sdist_script, tmpdir, monkeypatch):
@pytest.mark.filterwarnings('ignore:Unbuilt egg')
class TestPTHFileWriter:
def test_add_from_cwd_site_sets_dirty(self):
- '''a pth file manager should set dirty
+ """a pth file manager should set dirty
if a distribution is in site but also the cwd
- '''
+ """
pth = PthDistributions('does-not_exist', [os.getcwd()])
assert not pth.dirty
pth.add(PRDistribution(os.getcwd()))
@@ -742,9 +742,7 @@ def make_dependency_sdist(dist_path, distname, version):
version={version!r},
py_modules=[{name!r}],
)
- """.format(
- name=distname, version=version
- )
+ """.format(name=distname, version=version)
),
),
(
@@ -790,10 +788,10 @@ def test_setup_requires_honors_pip_env(self, mock_index, monkeypatch):
with open(test_setup_cfg, 'w') as fp:
fp.write(
DALS(
- '''
+ """
[easy_install]
index_url = https://pypi.org/legacy/
- '''
+ """
)
)
test_setup_py = os.path.join(test_pkg, 'setup.py')
@@ -823,20 +821,20 @@ def test_setup_requires_with_pep508_url(self, mock_index, monkeypatch):
assert len(mock_index.requests) == 0
def test_setup_requires_with_allow_hosts(self, mock_index):
- '''The `allow-hosts` option in not supported anymore.'''
+ """The `allow-hosts` option in not supported anymore."""
files = {
'test_pkg': {
'setup.py': DALS(
- '''
+ """
from setuptools import setup
setup(setup_requires='python-xlib')
- '''
+ """
),
'setup.cfg': DALS(
- '''
+ """
[easy_install]
allow_hosts = *
- '''
+ """
),
}
}
@@ -849,7 +847,7 @@ def test_setup_requires_with_allow_hosts(self, mock_index):
assert len(mock_index.requests) == 0
def test_setup_requires_with_python_requires(self, monkeypatch, tmpdir):
- '''Check `python_requires` is honored.'''
+ """Check `python_requires` is honored."""
monkeypatch.setenv(str('PIP_RETRIES'), str('0'))
monkeypatch.setenv(str('PIP_TIMEOUT'), str('0'))
monkeypatch.setenv(str('PIP_NO_INDEX'), str('1'))
@@ -869,7 +867,7 @@ def test_setup_requires_with_python_requires(self, monkeypatch, tmpdir):
index = tmpdir / 'index.html'
index.write_text(
DALS(
- '''
+ """
Links for dep
@@ -880,7 +878,7 @@ def test_setup_requires_with_python_requires(self, monkeypatch, tmpdir):
data-requires-python="{dep_2_0_python_requires}">{dep_2_0_sdist}
- '''
+ """
).format(
dep_1_0_url=dep_1_0_url,
dep_1_0_sdist=dep_1_0_sdist,
@@ -928,21 +926,21 @@ def test_setup_requires_with_find_links_in_setup_cfg(
dependency_links = []
fp.write(
DALS(
- '''
+ """
from setuptools import installer, setup
setup(setup_requires='python-xlib==42',
dependency_links={dependency_links!r})
- '''
+ """
).format(dependency_links=dependency_links)
)
with open(test_setup_cfg, 'w') as fp:
fp.write(
DALS(
- '''
+ """
[easy_install]
index_url = {index_url}
find_links = {find_links}
- '''
+ """
).format(
index_url=os.path.join(temp_dir, 'index'),
find_links=temp_dir,
@@ -951,11 +949,11 @@ def test_setup_requires_with_find_links_in_setup_cfg(
run_setup(test_setup_py, [str('--version')])
def test_setup_requires_with_transitive_extra_dependency(self, monkeypatch):
- '''
+ """
Use case: installing a package with a build dependency on
an already installed `dep[extra]`, which in turn depends
on `extra_dep` (whose is not already installed).
- '''
+ """
with contexts.save_pkg_resources_state():
with contexts.tempdir() as temp_dir:
# Create source distribution for `extra_dep`.
@@ -990,10 +988,10 @@ def test_setup_requires_with_transitive_extra_dependency(self, monkeypatch):
with open(test_setup_py, 'w') as fp:
fp.write(
DALS(
- '''
+ """
from setuptools import installer, setup
setup(setup_requires='dep[extra]')
- '''
+ """
)
)
# Check...
@@ -1004,10 +1002,10 @@ def test_setup_requires_with_transitive_extra_dependency(self, monkeypatch):
run_setup(test_setup_py, [str('--version')])
def test_setup_requires_with_distutils_command_dep(self, monkeypatch):
- '''
+ """
Use case: ensure build requirements' extras
are properly installed and activated.
- '''
+ """
with contexts.save_pkg_resources_state():
with contexts.tempdir() as temp_dir:
# Create source distribution for `extra_dep`.
@@ -1074,10 +1072,10 @@ class epcmd(build_py):
with open(test_setup_py, 'w') as fp:
fp.write(
DALS(
- '''
+ """
from setuptools import installer, setup
setup(setup_requires='dep[extra]')
- '''
+ """
)
)
# Check...
@@ -1395,7 +1393,7 @@ def test_use_correct_python_version_string(tmpdir, tmpdir_cwd, monkeypatch):
def test_editable_user_and_build_isolation(setup_context, monkeypatch, tmp_path):
- '''`setup.py develop` should honor `--user` even under build isolation'''
+ """`setup.py develop` should honor `--user` even under build isolation"""
# == Arrange ==
# Pretend that build isolation was enabled
diff --git a/setuptools/tests/test_editable_install.py b/setuptools/tests/test_editable_install.py
index eeffcf1962..43beb2954b 100644
--- a/setuptools/tests/test_editable_install.py
+++ b/setuptools/tests/test_editable_install.py
@@ -638,19 +638,19 @@ def test_case_sensitivity(self, tmp_path):
sys.modules.pop("foo", None)
self.install_finder(template)
- with pytest.raises(ImportError, match="\'FOO\'"):
+ with pytest.raises(ImportError, match="'FOO'"):
import_module("FOO")
- with pytest.raises(ImportError, match="\'foo\\.LOWERCASE\'"):
+ with pytest.raises(ImportError, match="'foo\\.LOWERCASE'"):
import_module("foo.LOWERCASE")
- with pytest.raises(ImportError, match="\'foo\\.bar\\.Lowercase\'"):
+ with pytest.raises(ImportError, match="'foo\\.bar\\.Lowercase'"):
import_module("foo.bar.Lowercase")
- with pytest.raises(ImportError, match="\'foo\\.BAR\'"):
+ with pytest.raises(ImportError, match="'foo\\.BAR'"):
import_module("foo.BAR.lowercase")
- with pytest.raises(ImportError, match="\'FOO\'"):
+ with pytest.raises(ImportError, match="'FOO'"):
import_module("FOO.bar.lowercase")
mod = import_module("foo.lowercase")
@@ -691,13 +691,13 @@ def test_namespace_case_sensitivity(self, tmp_path):
bar = import_module("ns.othername.foo.bar")
assert bar.c == 42
- with pytest.raises(ImportError, match="\'NS\'"):
+ with pytest.raises(ImportError, match="'NS'"):
import_module("NS.othername.foo")
- with pytest.raises(ImportError, match="\'ns\\.othername\\.FOO\\'"):
+ with pytest.raises(ImportError, match="'ns\\.othername\\.FOO\\'"):
import_module("ns.othername.FOO")
- with pytest.raises(ImportError, match="\'ns\\.othername\\.foo\\.BAR\\'"):
+ with pytest.raises(ImportError, match="'ns\\.othername\\.foo\\.BAR\\'"):
import_module("ns.othername.foo.BAR")
def test_intermediate_packages(self, tmp_path):
diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py
index 614fca7a23..af7d2f8295 100644
--- a/setuptools/tests/test_egg_info.py
+++ b/setuptools/tests/test_egg_info.py
@@ -37,19 +37,17 @@ def env():
subs = 'home', 'lib', 'scripts', 'data', 'egg-base'
env.paths = dict((dirname, os.path.join(env_dir, dirname)) for dirname in subs)
list(map(os.mkdir, env.paths.values()))
- path.build(
- {
- env.paths['home']: {
- '.pydistutils.cfg': DALS(
- """
+ path.build({
+ env.paths['home']: {
+ '.pydistutils.cfg': DALS(
+ """
[egg_info]
egg-base = %(egg-base)s
"""
- % env.paths
- )
- }
+ % env.paths
+ )
}
- )
+ })
yield env
@@ -68,17 +66,15 @@ class TestEggInfo:
)
def _create_project(self):
- path.build(
- {
- 'setup.py': self.setup_script,
- 'hello.py': DALS(
- """
+ path.build({
+ 'setup.py': self.setup_script,
+ 'hello.py': DALS(
+ """
def run():
print('hello')
"""
- ),
- }
- )
+ ),
+ })
@staticmethod
def _extract_mv_version(pkg_info_lines: List[str]) -> Tuple[int, int]:
@@ -128,17 +124,15 @@ def test_egg_info_save_version_info_setup_defaults(self, tmpdir_cwd, env):
the file should remain unchanged.
"""
setup_cfg = os.path.join(env.paths['home'], 'setup.cfg')
- path.build(
- {
- setup_cfg: DALS(
- """
+ path.build({
+ setup_cfg: DALS(
+ """
[egg_info]
tag_build =
tag_date = 0
"""
- ),
- }
- )
+ ),
+ })
dist = Distribution()
ei = egg_info(dist)
ei.initialize_options()
@@ -207,12 +201,10 @@ def test_license_is_a_string(self, tmpdir_cwd, env):
"""
)
- path.build(
- {
- 'setup.py': setup_script,
- 'setup.cfg': setup_config,
- }
- )
+ path.build({
+ 'setup.py': setup_script,
+ 'setup.cfg': setup_config,
+ })
# This command should fail with a ValueError, but because it's
# currently configured to use a subprocess, the actual traceback
@@ -245,18 +237,16 @@ def test_rebuilt(self, tmpdir_cwd, env):
def test_manifest_template_is_read(self, tmpdir_cwd, env):
self._create_project()
- path.build(
- {
- 'MANIFEST.in': DALS(
- """
+ path.build({
+ 'MANIFEST.in': DALS(
+ """
recursive-include docs *.rst
"""
- ),
- 'docs': {
- 'usage.rst': "Run 'hi'",
- },
- }
- )
+ ),
+ 'docs': {
+ 'usage.rst': "Run 'hi'",
+ },
+ })
self._run_egg_info_command(tmpdir_cwd, env)
egg_info_dir = os.path.join('.', 'foo.egg-info')
sources_txt = os.path.join(egg_info_dir, 'SOURCES.txt')
@@ -264,23 +254,18 @@ def test_manifest_template_is_read(self, tmpdir_cwd, env):
assert 'docs/usage.rst' in f.read().split('\n')
def _setup_script_with_requires(self, requires, use_setup_cfg=False):
- setup_script = (
- DALS(
- '''
+ setup_script = DALS(
+ """
from setuptools import setup
setup(name='foo', zip_safe=False, %s)
- '''
- )
- % ('' if use_setup_cfg else requires)
- )
+ """
+ ) % ('' if use_setup_cfg else requires)
setup_config = requires if use_setup_cfg else ''
- path.build(
- {
- 'setup.py': setup_script,
- 'setup.cfg': setup_config,
- }
- )
+ path.build({
+ 'setup.py': setup_script,
+ 'setup.cfg': setup_config,
+ })
mismatch_marker = "python_version<'{this_ver}'".format(
this_ver=sys.version_info[0],
@@ -343,7 +328,7 @@ def parametrize(*test_list, **format_dict):
# requires block (when used in setup.cfg)
#
# expected contents of requires.txt
- '''
+ """
install_requires_deterministic
install_requires=["wheel>=0.5", "pytest"]
@@ -355,8 +340,8 @@ def parametrize(*test_list, **format_dict):
wheel>=0.5
pytest
- ''',
- '''
+ """,
+ """
install_requires_ordered
install_requires=["pytest>=3.0.2,!=10.9999"]
@@ -366,8 +351,8 @@ def parametrize(*test_list, **format_dict):
pytest>=3.0.2,!=10.9999
pytest!=10.9999,>=3.0.2
- ''',
- '''
+ """,
+ """
install_requires_with_marker
install_requires=["barbazquux;{mismatch_marker}"],
@@ -378,8 +363,8 @@ def parametrize(*test_list, **format_dict):
[:{mismatch_marker_alternate}]
barbazquux
- ''',
- '''
+ """,
+ """
install_requires_with_extra
{'cmd': ['egg_info']}
@@ -390,8 +375,8 @@ def parametrize(*test_list, **format_dict):
barbazquux [test]
barbazquux[test]
- ''',
- '''
+ """,
+ """
install_requires_with_extra_and_marker
install_requires=["barbazquux [test]; {mismatch_marker}"],
@@ -402,8 +387,8 @@ def parametrize(*test_list, **format_dict):
[:{mismatch_marker_alternate}]
barbazquux[test]
- ''',
- '''
+ """,
+ """
setup_requires_with_markers
setup_requires=["barbazquux;{mismatch_marker}"],
@@ -412,8 +397,8 @@ def parametrize(*test_list, **format_dict):
setup_requires =
barbazquux; {mismatch_marker}
- ''',
- '''
+ """,
+ """
tests_require_with_markers
{'cmd': ['test'], 'output': "Ran 0 tests in"}
@@ -423,8 +408,8 @@ def parametrize(*test_list, **format_dict):
tests_require =
barbazquux; {mismatch_marker}
- ''',
- '''
+ """,
+ """
extras_require_with_extra
{'cmd': ['egg_info']}
@@ -435,8 +420,8 @@ def parametrize(*test_list, **format_dict):
[extra]
barbazquux[test]
- ''',
- '''
+ """,
+ """
extras_require_with_extra_and_marker_in_req
extras_require={{"extra": ["barbazquux [test]; {mismatch_marker}"]}},
@@ -449,9 +434,9 @@ def parametrize(*test_list, **format_dict):
[extra:{mismatch_marker_alternate}]
barbazquux[test]
- ''',
+ """,
# FIXME: ConfigParser does not allow : in key names!
- '''
+ """
extras_require_with_marker
extras_require={{":{mismatch_marker}": ["barbazquux"]}},
@@ -462,8 +447,8 @@ def parametrize(*test_list, **format_dict):
[:{mismatch_marker}]
barbazquux
- ''',
- '''
+ """,
+ """
extras_require_with_marker_in_req
extras_require={{"extra": ["barbazquux; {mismatch_marker}"]}},
@@ -476,8 +461,8 @@ def parametrize(*test_list, **format_dict):
[extra:{mismatch_marker_alternate}]
barbazquux
- ''',
- '''
+ """,
+ """
extras_require_with_empty_section
extras_require={{"empty": []}},
@@ -486,7 +471,7 @@ def parametrize(*test_list, **format_dict):
empty =
[empty]
- ''',
+ """,
# Format arguments.
invalid_marker=invalid_marker,
mismatch_marker=mismatch_marker,
@@ -559,7 +544,7 @@ def test_provides_extra(self, tmpdir_cwd, env):
def test_doesnt_provides_extra(self, tmpdir_cwd, env):
self._setup_script_with_requires(
- '''install_requires=["spam ; python_version<'3.6'"]'''
+ """install_requires=["spam ; python_version<'3.6'"]"""
)
environ = os.environ.copy().update(
HOME=env.paths['home'],
@@ -788,7 +773,7 @@ def test_setup_cfg_license_file(self, tmpdir_cwd, env, files, license_in_sources
),
'MANIFEST.in': "exclude LICENSE-XYZ",
'LICENSE-ABC': "ABC license",
- 'LICENSE-XYZ': "XYZ license"
+ 'LICENSE-XYZ': "XYZ license",
# manifest is overwritten by license_files
},
['LICENSE-ABC', 'LICENSE-XYZ'],
@@ -901,7 +886,7 @@ def test_setup_cfg_license_files(
"""
),
'LICENSE-ABC': "ABC license",
- 'LICENSE-XYZ': "XYZ license"
+ 'LICENSE-XYZ': "XYZ license",
# license_file is still singular
},
[],
@@ -939,7 +924,7 @@ def test_setup_cfg_license_files(
),
'LICENSE-ABC': "ABC license",
'LICENSE-PQR': "PQR license",
- 'LICENSE-XYZ': "XYZ license"
+ 'LICENSE-XYZ': "XYZ license",
# duplicate license
},
['LICENSE-ABC', 'LICENSE-PQR', 'LICENSE-XYZ'],
@@ -957,7 +942,7 @@ def test_setup_cfg_license_files(
),
'LICENSE-ABC': "ABC license",
'LICENSE-PQR': "PQR license",
- 'LICENSE-XYZ': "XYZ license"
+ 'LICENSE-XYZ': "XYZ license",
# combined subset
},
['LICENSE-ABC', 'LICENSE-XYZ'],
@@ -974,7 +959,7 @@ def test_setup_cfg_license_files(
LICENSE-PQR
"""
),
- 'LICENSE-PQR': "Test license"
+ 'LICENSE-PQR': "Test license",
# with invalid licenses
},
['LICENSE-PQR'],
@@ -994,7 +979,7 @@ def test_setup_cfg_license_files(
'MANIFEST.in': "exclude LICENSE-ABC\nexclude LICENSE-PQR",
'LICENSE-ABC': "ABC license",
'LICENSE-PQR': "PQR license",
- 'LICENSE-XYZ': "XYZ license"
+ 'LICENSE-XYZ': "XYZ license",
# manifest is overwritten
},
['LICENSE-ABC', 'LICENSE-PQR', 'LICENSE-XYZ'],
@@ -1059,22 +1044,20 @@ def test_setup_cfg_license_file_license_files(
def test_license_file_attr_pkg_info(self, tmpdir_cwd, env):
"""All matched license files should have a corresponding License-File."""
self._create_project()
- path.build(
- {
- "setup.cfg": DALS(
- """
+ path.build({
+ "setup.cfg": DALS(
+ """
[metadata]
license_files =
NOTICE*
LICENSE*
"""
- ),
- "LICENSE-ABC": "ABC license",
- "LICENSE-XYZ": "XYZ license",
- "NOTICE": "included",
- "IGNORE": "not include",
- }
- )
+ ),
+ "LICENSE-ABC": "ABC license",
+ "LICENSE-XYZ": "XYZ license",
+ "NOTICE": "included",
+ "IGNORE": "not include",
+ })
environment.run_setup_py(
cmd=['egg_info'],
@@ -1281,18 +1264,16 @@ def _run_egg_info_command(self, tmpdir_cwd, env, cmd=None, output=None):
def test_egg_info_tag_only_once(self, tmpdir_cwd, env):
self._create_project()
- path.build(
- {
- 'setup.cfg': DALS(
- """
+ path.build({
+ 'setup.cfg': DALS(
+ """
[egg_info]
tag_build = dev
tag_date = 0
tag_svn_revision = 0
"""
- ),
- }
- )
+ ),
+ })
self._run_egg_info_command(tmpdir_cwd, env)
egg_info_dir = os.path.join('.', 'foo.egg-info')
with open(os.path.join(egg_info_dir, 'PKG-INFO')) as pkginfo_file:
diff --git a/setuptools/tests/test_find_packages.py b/setuptools/tests/test_find_packages.py
index 92da882d09..7af5bb76cb 100644
--- a/setuptools/tests/test_find_packages.py
+++ b/setuptools/tests/test_find_packages.py
@@ -1,4 +1,5 @@
"""Tests for automatic package discovery"""
+
import os
import sys
import shutil
@@ -30,8 +31,7 @@ def can_symlink():
def has_symlink():
bad_symlink = (
# Windows symlink directory detection is broken on Python 3.2
- platform.system() == 'Windows'
- and sys.version_info[:2] == (3, 2)
+ platform.system() == 'Windows' and sys.version_info[:2] == (3, 2)
)
return can_symlink() and not bad_symlink
diff --git a/setuptools/tests/test_find_py_modules.py b/setuptools/tests/test_find_py_modules.py
index dc7ff41edc..9d4b0edb61 100644
--- a/setuptools/tests/test_find_py_modules.py
+++ b/setuptools/tests/test_find_py_modules.py
@@ -1,4 +1,5 @@
"""Tests for automatic discovery of modules"""
+
import os
import pytest
diff --git a/setuptools/tests/test_glob.py b/setuptools/tests/test_glob.py
index 42b3c43a21..bdccba6c24 100644
--- a/setuptools/tests/test_glob.py
+++ b/setuptools/tests/test_glob.py
@@ -10,7 +10,7 @@
('', b'', []),
('', '', []),
(
- '''
+ """
appveyor.yml
CHANGES.rst
LICENSE
@@ -19,12 +19,12 @@
README.rst
setup.cfg
setup.py
- ''',
+ """,
'*.rst',
('CHANGES.rst', 'README.rst'),
),
(
- '''
+ """
appveyor.yml
CHANGES.rst
LICENSE
@@ -33,7 +33,7 @@
README.rst
setup.cfg
setup.py
- ''',
+ """,
b'*.rst',
(b'CHANGES.rst', b'README.rst'),
),
diff --git a/setuptools/tests/test_manifest.py b/setuptools/tests/test_manifest.py
index 33b85d0644..33d3250893 100644
--- a/setuptools/tests/test_manifest.py
+++ b/setuptools/tests/test_manifest.py
@@ -256,44 +256,38 @@ def test_include_multiple(self):
"""Include with multiple patterns."""
ml = make_local_path
self.make_manifest("include app/*.txt app/static/*")
- files = default_files | set(
- [
- ml('app/a.txt'),
- ml('app/b.txt'),
- ml('app/static/app.js'),
- ml('app/static/app.js.map'),
- ml('app/static/app.css'),
- ml('app/static/app.css.map'),
- ]
- )
+ files = default_files | set([
+ ml('app/a.txt'),
+ ml('app/b.txt'),
+ ml('app/static/app.js'),
+ ml('app/static/app.js.map'),
+ ml('app/static/app.css'),
+ ml('app/static/app.css.map'),
+ ])
assert files == self.get_files()
def test_graft(self):
"""Include the whole app/static/ directory."""
ml = make_local_path
self.make_manifest("graft app/static")
- files = default_files | set(
- [
- ml('app/static/app.js'),
- ml('app/static/app.js.map'),
- ml('app/static/app.css'),
- ml('app/static/app.css.map'),
- ]
- )
+ files = default_files | set([
+ ml('app/static/app.js'),
+ ml('app/static/app.js.map'),
+ ml('app/static/app.css'),
+ ml('app/static/app.css.map'),
+ ])
assert files == self.get_files()
def test_graft_glob_syntax(self):
"""Include the whole app/static/ directory."""
ml = make_local_path
self.make_manifest("graft */static")
- files = default_files | set(
- [
- ml('app/static/app.js'),
- ml('app/static/app.js.map'),
- ml('app/static/app.css'),
- ml('app/static/app.css.map'),
- ]
- )
+ files = default_files | set([
+ ml('app/static/app.js'),
+ ml('app/static/app.js.map'),
+ ml('app/static/app.css'),
+ ml('app/static/app.css.map'),
+ ])
assert files == self.get_files()
def test_graft_global_exclude(self):
@@ -316,15 +310,13 @@ def test_global_include(self):
global-include *.rst *.js *.css
"""
)
- files = default_files | set(
- [
- '.hidden.rst',
- 'testing.rst',
- ml('app/c.rst'),
- ml('app/static/app.js'),
- ml('app/static/app.css'),
- ]
- )
+ files = default_files | set([
+ '.hidden.rst',
+ 'testing.rst',
+ ml('app/c.rst'),
+ ml('app/static/app.js'),
+ ml('app/static/app.css'),
+ ])
assert files == self.get_files()
def test_graft_prune(self):
@@ -384,27 +376,25 @@ def test_process_template_line(self):
ml = make_local_path
# simulated file list
- self.make_files(
- [
- 'foo.tmp',
- 'ok',
- 'xo',
- 'four.txt',
- 'buildout.cfg',
- # filelist does not filter out VCS directories,
- # it's sdist that does
- ml('.hg/last-message.txt'),
- ml('global/one.txt'),
- ml('global/two.txt'),
- ml('global/files.x'),
- ml('global/here.tmp'),
- ml('f/o/f.oo'),
- ml('dir/graft-one'),
- ml('dir/dir2/graft2'),
- ml('dir3/ok'),
- ml('dir3/sub/ok.txt'),
- ]
- )
+ self.make_files([
+ 'foo.tmp',
+ 'ok',
+ 'xo',
+ 'four.txt',
+ 'buildout.cfg',
+ # filelist does not filter out VCS directories,
+ # it's sdist that does
+ ml('.hg/last-message.txt'),
+ ml('global/one.txt'),
+ ml('global/two.txt'),
+ ml('global/files.x'),
+ ml('global/here.tmp'),
+ ml('f/o/f.oo'),
+ ml('dir/graft-one'),
+ ml('dir/dir2/graft2'),
+ ml('dir3/ok'),
+ ml('dir3/sub/ok.txt'),
+ ])
MANIFEST_IN = DALS(
"""\
diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py
index 02870639d3..704a07f61d 100644
--- a/setuptools/tests/test_packageindex.py
+++ b/setuptools/tests/test_packageindex.py
@@ -21,9 +21,7 @@ def test_regex(self):
Name
(md5)
- """.lstrip().format(
- **locals()
- )
+ """.lstrip().format(**locals())
assert setuptools.package_index.PYPI_MD5.match(doc)
def test_bad_url_bad_port(self):
diff --git a/setuptools/tests/test_sandbox.py b/setuptools/tests/test_sandbox.py
index 4cbae2b679..4b3cfa9ad2 100644
--- a/setuptools/tests/test_sandbox.py
+++ b/setuptools/tests/test_sandbox.py
@@ -1,5 +1,6 @@
"""develop tests
"""
+
import os
import types
diff --git a/setuptools/tests/test_sdist.py b/setuptools/tests/test_sdist.py
index ead2f34e91..0adec70f04 100644
--- a/setuptools/tests/test_sdist.py
+++ b/setuptools/tests/test_sdist.py
@@ -765,14 +765,11 @@ def test_build_subcommand_source_files(self, source_dir):
build.sub_commands = [*build.sub_commands, ("build_custom", None)]
class build_custom(Command):
- def initialize_options(self):
- ...
+ def initialize_options(self): ...
- def finalize_options(self):
- ...
+ def finalize_options(self): ...
- def run(self):
- ...
+ def run(self): ...
def get_source_files(self):
return ['.myfile~']
diff --git a/setuptools/tests/test_virtualenv.py b/setuptools/tests/test_virtualenv.py
index d02993fd6b..b84702aa70 100644
--- a/setuptools/tests/test_virtualenv.py
+++ b/setuptools/tests/test_virtualenv.py
@@ -155,22 +155,20 @@ def sdist(distname, version):
""",
}}
)
- '''.format(
- dependency_links=dependency_links
- )
+ '''.format(dependency_links=dependency_links)
)
)
with tmpdir.join('test.py').open('w') as fp:
fp.write(
DALS(
- '''
+ """
import foobar
import bits
import bobs
import pieces
open('success', 'w').close()
- '''
+ """
)
)
diff --git a/setuptools/tests/test_wheel.py b/setuptools/tests/test_wheel.py
index 114b2e91f7..03fb05d2f4 100644
--- a/setuptools/tests/test_wheel.py
+++ b/setuptools/tests/test_wheel.py
@@ -92,12 +92,12 @@ def build_wheel(extra_file_defs=None, **kwargs):
file_defs = {
'setup.py': (
DALS(
- '''
+ """
# -*- coding: utf-8 -*-
from setuptools import setup
import setuptools
setup(**%r)
- '''
+ """
)
% kwargs
).encode('utf-8'),
@@ -184,14 +184,12 @@ def __repr__(self):
setup_kwargs=dict(
packages=['foo'],
),
- install_tree=flatten_tree(
- {
- 'foo-1.0-py{py_version}.egg': {
- 'EGG-INFO': ['PKG-INFO', 'RECORD', 'WHEEL', 'top_level.txt'],
- 'foo': ['__init__.py'],
- }
+ install_tree=flatten_tree({
+ 'foo-1.0-py{py_version}.egg': {
+ 'EGG-INFO': ['PKG-INFO', 'RECORD', 'WHEEL', 'top_level.txt'],
+ 'foo': ['__init__.py'],
}
- ),
+ }),
),
dict(
id='utf-8',
@@ -203,28 +201,26 @@ def __repr__(self):
id='data',
file_defs={
'data.txt': DALS(
- '''
+ """
Some data...
- '''
+ """
),
},
setup_kwargs=dict(
data_files=[('data_dir', ['data.txt'])],
),
- install_tree=flatten_tree(
- {
- 'foo-1.0-py{py_version}.egg': {
- 'EGG-INFO': ['PKG-INFO', 'RECORD', 'WHEEL', 'top_level.txt'],
- 'data_dir': ['data.txt'],
- }
+ install_tree=flatten_tree({
+ 'foo-1.0-py{py_version}.egg': {
+ 'EGG-INFO': ['PKG-INFO', 'RECORD', 'WHEEL', 'top_level.txt'],
+ 'data_dir': ['data.txt'],
}
- ),
+ }),
),
dict(
id='extension',
file_defs={
'extension.c': DALS(
- '''
+ """
#include "Python.h"
#if PY_MAJOR_VERSION >= 3
@@ -264,7 +260,7 @@ def __repr__(self):
return module;
#endif
}
- '''
+ """
),
},
setup_kwargs=dict(
@@ -274,140 +270,132 @@ def __repr__(self):
)
],
),
- install_tree=flatten_tree(
- {
- 'foo-1.0-py{py_version}-{platform}.egg': [
- 'extension{shlib_ext}',
- {
- 'EGG-INFO': [
- 'PKG-INFO',
- 'RECORD',
- 'WHEEL',
- 'top_level.txt',
- ]
- },
- ]
- }
- ),
+ install_tree=flatten_tree({
+ 'foo-1.0-py{py_version}-{platform}.egg': [
+ 'extension{shlib_ext}',
+ {
+ 'EGG-INFO': [
+ 'PKG-INFO',
+ 'RECORD',
+ 'WHEEL',
+ 'top_level.txt',
+ ]
+ },
+ ]
+ }),
),
dict(
id='header',
file_defs={
'header.h': DALS(
- '''
- '''
+ """
+ """
),
},
setup_kwargs=dict(
headers=['header.h'],
),
- install_tree=flatten_tree(
- {
- 'foo-1.0-py{py_version}.egg': [
- 'header.h',
- {
- 'EGG-INFO': [
- 'PKG-INFO',
- 'RECORD',
- 'WHEEL',
- 'top_level.txt',
- ]
- },
- ]
- }
- ),
+ install_tree=flatten_tree({
+ 'foo-1.0-py{py_version}.egg': [
+ 'header.h',
+ {
+ 'EGG-INFO': [
+ 'PKG-INFO',
+ 'RECORD',
+ 'WHEEL',
+ 'top_level.txt',
+ ]
+ },
+ ]
+ }),
),
dict(
id='script',
file_defs={
'script.py': DALS(
- '''
+ """
#/usr/bin/python
print('hello world!')
- '''
+ """
),
'script.sh': DALS(
- '''
+ """
#/bin/sh
echo 'hello world!'
- '''
+ """
),
},
setup_kwargs=dict(
scripts=['script.py', 'script.sh'],
),
- install_tree=flatten_tree(
- {
- 'foo-1.0-py{py_version}.egg': {
- 'EGG-INFO': [
- 'PKG-INFO',
- 'RECORD',
- 'WHEEL',
- 'top_level.txt',
- {'scripts': ['script.py', 'script.sh']},
- ]
- }
+ install_tree=flatten_tree({
+ 'foo-1.0-py{py_version}.egg': {
+ 'EGG-INFO': [
+ 'PKG-INFO',
+ 'RECORD',
+ 'WHEEL',
+ 'top_level.txt',
+ {'scripts': ['script.py', 'script.sh']},
+ ]
}
- ),
+ }),
),
dict(
id='requires1',
install_requires='foobar==2.0',
- install_tree=flatten_tree(
- {
- 'foo-1.0-py{py_version}.egg': {
- 'EGG-INFO': [
- 'PKG-INFO',
- 'RECORD',
- 'WHEEL',
- 'requires.txt',
- 'top_level.txt',
- ]
- }
+ install_tree=flatten_tree({
+ 'foo-1.0-py{py_version}.egg': {
+ 'EGG-INFO': [
+ 'PKG-INFO',
+ 'RECORD',
+ 'WHEEL',
+ 'requires.txt',
+ 'top_level.txt',
+ ]
}
- ),
+ }),
requires_txt=DALS(
- '''
+ """
foobar==2.0
- '''
+ """
),
),
dict(
id='requires2',
- install_requires='''
+ install_requires="""
bar
foo<=2.0; %r in sys_platform
- '''
+ """
% sys.platform,
requires_txt=DALS(
- '''
+ """
bar
foo<=2.0
- '''
+ """
),
),
dict(
id='requires3',
- install_requires='''
+ install_requires="""
bar; %r != sys_platform
- '''
+ """
% sys.platform,
),
dict(
id='requires4',
- install_requires='''
+ install_requires="""
foo
- ''',
+ """,
extras_require={
'extra': 'foobar>3',
},
requires_txt=DALS(
- '''
+ """
foo
[extra]
foobar>3
- '''
+ """
),
),
dict(
@@ -416,29 +404,29 @@ def __repr__(self):
'extra': 'foobar; %r != sys_platform' % sys.platform,
},
requires_txt=DALS(
- '''
+ """
[extra]
- '''
+ """
),
),
dict(
id='requires_ensure_order',
- install_requires='''
+ install_requires="""
foo
bar
baz
qux
- ''',
+ """,
extras_require={
- 'extra': '''
+ 'extra': """
foobar>3
barbaz>4
bazqux>5
quxzap>6
- ''',
+ """,
},
requires_txt=DALS(
- '''
+ """
foo
bar
baz
@@ -449,7 +437,7 @@ def __repr__(self):
barbaz>4
bazqux>5
quxzap>6
- '''
+ """
),
),
dict(
@@ -463,28 +451,26 @@ def __repr__(self):
namespace_packages=['foo'],
packages=['foo.bar'],
),
- install_tree=flatten_tree(
- {
- 'foo-1.0-py{py_version}.egg': [
- 'foo-1.0-py{py_version}-nspkg.pth',
- {
- 'EGG-INFO': [
- 'PKG-INFO',
- 'RECORD',
- 'WHEEL',
- 'namespace_packages.txt',
- 'top_level.txt',
- ]
- },
- {
- 'foo': [
- '__init__.py',
- {'bar': ['__init__.py']},
- ]
- },
- ]
- }
- ),
+ install_tree=flatten_tree({
+ 'foo-1.0-py{py_version}.egg': [
+ 'foo-1.0-py{py_version}-nspkg.pth',
+ {
+ 'EGG-INFO': [
+ 'PKG-INFO',
+ 'RECORD',
+ 'WHEEL',
+ 'namespace_packages.txt',
+ 'top_level.txt',
+ ]
+ },
+ {
+ 'foo': [
+ '__init__.py',
+ {'bar': ['__init__.py']},
+ ]
+ },
+ ]
+ }),
),
dict(
id='empty_namespace_package',
@@ -499,27 +485,25 @@ def __repr__(self):
namespace_packages=['foobar'],
packages=['foobar'],
),
- install_tree=flatten_tree(
- {
- 'foo-1.0-py{py_version}.egg': [
- 'foo-1.0-py{py_version}-nspkg.pth',
- {
- 'EGG-INFO': [
- 'PKG-INFO',
- 'RECORD',
- 'WHEEL',
- 'namespace_packages.txt',
- 'top_level.txt',
- ]
- },
- {
- 'foobar': [
- '__init__.py',
- ]
- },
- ]
- }
- ),
+ install_tree=flatten_tree({
+ 'foo-1.0-py{py_version}.egg': [
+ 'foo-1.0-py{py_version}-nspkg.pth',
+ {
+ 'EGG-INFO': [
+ 'PKG-INFO',
+ 'RECORD',
+ 'WHEEL',
+ 'namespace_packages.txt',
+ 'top_level.txt',
+ ]
+ },
+ {
+ 'foobar': [
+ '__init__.py',
+ ]
+ },
+ ]
+ }),
),
dict(
id='data_in_package',
@@ -528,9 +512,9 @@ def __repr__(self):
'__init__.py': '',
'data_dir': {
'data.txt': DALS(
- '''
+ """
Some data...
- '''
+ """
),
},
}
@@ -539,26 +523,24 @@ def __repr__(self):
packages=['foo'],
data_files=[('foo/data_dir', ['foo/data_dir/data.txt'])],
),
- install_tree=flatten_tree(
- {
- 'foo-1.0-py{py_version}.egg': {
- 'EGG-INFO': [
- 'PKG-INFO',
- 'RECORD',
- 'WHEEL',
- 'top_level.txt',
- ],
- 'foo': [
- '__init__.py',
- {
- 'data_dir': [
- 'data.txt',
- ]
- },
- ],
- }
+ install_tree=flatten_tree({
+ 'foo-1.0-py{py_version}.egg': {
+ 'EGG-INFO': [
+ 'PKG-INFO',
+ 'RECORD',
+ 'WHEEL',
+ 'top_level.txt',
+ ],
+ 'foo': [
+ '__init__.py',
+ {
+ 'data_dir': [
+ 'data.txt',
+ ]
+ },
+ ],
}
- ),
+ }),
),
)
@@ -583,7 +565,7 @@ def test_wheel_install(params):
install_requires=install_requires,
extras_require=extras_require,
extra_file_defs=file_defs,
- **setup_kwargs
+ **setup_kwargs,
) as filename, tempdir() as install_dir:
_check_wheel_install(
filename, install_dir, install_tree, project_name, version, requires_txt
@@ -641,12 +623,12 @@ def build_wheel(extra_file_defs=None, **kwargs):
file_defs = {
'setup.py': (
DALS(
- '''
+ """
# -*- coding: utf-8 -*-
from setuptools import setup
import setuptools
setup(**%r)
- '''
+ """
)
% kwargs
).encode('utf-8'),
@@ -666,34 +648,32 @@ def build_wheel(extra_file_defs=None, **kwargs):
id='script',
file_defs={
'script.py': DALS(
- '''
+ """
#/usr/bin/python
print('hello world!')
- '''
+ """
),
'script.sh': DALS(
- '''
+ """
#/bin/sh
echo 'hello world!'
- '''
+ """
),
},
setup_kwargs=dict(
scripts=['script.py', 'script.sh'],
),
- install_tree=flatten_tree(
- {
- 'foo-1.0-py{py_version}.egg': {
- 'EGG-INFO': [
- 'PKG-INFO',
- 'RECORD',
- 'WHEEL',
- 'top_level.txt',
- {'scripts': ['script.py', 'script.sh']},
- ]
- }
+ install_tree=flatten_tree({
+ 'foo-1.0-py{py_version}.egg': {
+ 'EGG-INFO': [
+ 'PKG-INFO',
+ 'RECORD',
+ 'WHEEL',
+ 'top_level.txt',
+ {'scripts': ['script.py', 'script.sh']},
+ ]
}
- ),
+ }),
)
project_name = params.get('name', 'foo')
@@ -708,7 +688,7 @@ def build_wheel(extra_file_defs=None, **kwargs):
install_requires=[],
extras_require={},
extra_file_defs=file_defs,
- **setup_kwargs
+ **setup_kwargs,
) as filename, tempdir() as install_dir:
_check_wheel_install(
filename, install_dir, install_tree, project_name, version, None
diff --git a/setuptools/tests/test_windows_wrappers.py b/setuptools/tests/test_windows_wrappers.py
index 4089634213..3f321386f1 100644
--- a/setuptools/tests/test_windows_wrappers.py
+++ b/setuptools/tests/test_windows_wrappers.py
@@ -11,6 +11,7 @@
the script they are to wrap and with the same name as the script they
are to wrap.
"""
+
import pathlib
import sys
import platform
diff --git a/setuptools/wheel.py b/setuptools/wheel.py
index c6eabddc1f..9861b5cf1c 100644
--- a/setuptools/wheel.py
+++ b/setuptools/wheel.py
@@ -38,7 +38,7 @@ def _get_supported_tags():
def unpack(src_dir, dst_dir):
- '''Move everything under `src_dir` to `dst_dir`, and delete the former.'''
+ """Move everything under `src_dir` to `dst_dir`, and delete the former."""
for dirpath, dirnames, filenames in os.walk(src_dir):
subdir = os.path.relpath(dirpath, src_dir)
for f in filenames:
@@ -83,7 +83,7 @@ def __init__(self, filename):
setattr(self, k, v)
def tags(self):
- '''List tags (py_version, abi, platform) supported by this wheel.'''
+ """List tags (py_version, abi, platform) supported by this wheel."""
return itertools.product(
self.py_version.split('.'),
self.abi.split('.'),
@@ -91,7 +91,7 @@ def tags(self):
)
def is_compatible(self):
- '''Is the wheel compatible with the current platform?'''
+ """Is the wheel compatible with the current platform?"""
return next((True for t in self.tags() if t in _get_supported_tags()), False)
def egg_name(self):
@@ -115,7 +115,7 @@ def get_dist_info(self, zf):
raise ValueError("unsupported wheel format. .dist-info not found")
def install_as_egg(self, destination_eggdir):
- '''Install wheel as an egg directory.'''
+ """Install wheel as an egg directory."""
with zipfile.ZipFile(self.filename) as zf:
self._install_as_egg(destination_eggdir, zf)