Skip to content

Commit

Permalink
Fix formatting and imports for Python 3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p committed Nov 4, 2024
1 parent 89068c6 commit a608158
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 28 deletions.
7 changes: 1 addition & 6 deletions setuptools/_importlib.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import importlib.resources as resources # noqa: F401
import sys

if sys.version_info < (3, 10):
import importlib_metadata as metadata # pragma: no cover
else:
import importlib.metadata as metadata # noqa: F401


if sys.version_info < (3, 9):
import importlib_resources as resources # pragma: no cover
else:
import importlib.resources as resources # noqa: F401
4 changes: 2 additions & 2 deletions setuptools/glob.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import fnmatch
import os
import re
from collections.abc import Iterator
from typing import TYPE_CHECKING, AnyStr, Iterable, overload
from collections.abc import Iterable, Iterator
from typing import TYPE_CHECKING, AnyStr, overload

if TYPE_CHECKING:
from _typeshed import BytesPath, StrOrBytesPath, StrPath
Expand Down
49 changes: 29 additions & 20 deletions setuptools/tests/test_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,14 +564,17 @@ def test_wheel_install(params):
install_tree = params.get('install_tree')
file_defs = params.get('file_defs', {})
setup_kwargs = params.get('setup_kwargs', {})
with build_wheel(
name=project_name,
version=version,
install_requires=install_requires,
extras_require=extras_require,
extra_file_defs=file_defs,
**setup_kwargs,
) as filename, tempdir() as install_dir:
with (
build_wheel(
name=project_name,
version=version,
install_requires=install_requires,
extras_require=extras_require,
extra_file_defs=file_defs,
**setup_kwargs,
) as filename,
tempdir() as install_dir,
):
_check_wheel_install(
filename, install_dir, install_tree, project_name, version, requires_txt
)
Expand All @@ -580,10 +583,13 @@ def test_wheel_install(params):
def test_wheel_install_pep_503():
project_name = 'Foo_Bar' # PEP 503 canonicalized name is "foo-bar"
version = '1.0'
with build_wheel(
name=project_name,
version=version,
) as filename, tempdir() as install_dir:
with (
build_wheel(
name=project_name,
version=version,
) as filename,
tempdir() as install_dir,
):
new_filename = filename.replace(project_name, canonicalize_name(project_name))
shutil.move(filename, new_filename)
_check_wheel_install(
Expand Down Expand Up @@ -687,14 +693,17 @@ def build_wheel(extra_file_defs=None, **kwargs):
file_defs = params.get('file_defs', {})
setup_kwargs = params.get('setup_kwargs', {})

with build_wheel(
name=project_name,
version=version,
install_requires=[],
extras_require={},
extra_file_defs=file_defs,
**setup_kwargs,
) as filename, tempdir() as install_dir:
with (
build_wheel(
name=project_name,
version=version,
install_requires=[],
extras_require={},
extra_file_defs=file_defs,
**setup_kwargs,
) as filename,
tempdir() as install_dir,
):
_check_wheel_install(
filename, install_dir, install_tree, project_name, version, None
)
Expand Down

0 comments on commit a608158

Please sign in to comment.