Skip to content

Commit c5fa403

Browse files
committed
More distutils workarounds
1 parent 2b3112e commit c5fa403

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

mypy.ini

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
strict = False
66

77
# Early opt-in even when strict = False
8-
warn_unused_ignores = True
8+
# warn_unused_ignores = True # Disabled until we have distutils stubs for Python 3.12+
99
warn_redundant_casts = True
1010
enable_error_code = ignore-without-code
1111

@@ -34,12 +34,14 @@ exclude = (?x)(
3434
# Duplicate module name
3535
| ^pkg_resources/tests/data/my-test-package-source/setup.py$
3636
)
37-
38-
# DistributionMetadata.license_files and DistributionMetadata.license_file
39-
# are dynamically patched in setuptools/_core_metadata.py
40-
# and no DistributionMetadata subclass exists in setuptools
4137
[mypy-setuptools.*]
42-
disable_error_code = attr-defined
38+
disable_error_code =
39+
# DistributionMetadata.license_files and DistributionMetadata.license_file
40+
# are dynamically patched in setuptools/_core_metadata.py
41+
# and no DistributionMetadata subclass exists in setuptools
42+
attr-defined,
43+
# See issue described below about distutils across Python versions
44+
has-type,
4345

4446
# - pkg_resources tests create modules that won't exists statically before the test is run.
4547
# Let's ignore all "import-not-found" since, if an import really wasn't found, then the test would fail.

setuptools/errors.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@
3030
BaseError = _distutils_errors.DistutilsError
3131

3232

33-
class InvalidConfigError(OptionError):
33+
class InvalidConfigError(OptionError): # type: ignore[valid-type, misc] # distutils imports are `Any` on python 3.12+
3434
"""Error used for invalid configurations."""
3535

3636

37-
class RemovedConfigError(OptionError):
37+
class RemovedConfigError(OptionError): # type: ignore[valid-type, misc] # distutils imports are `Any` on python 3.12+
3838
"""Error used for configurations that were deprecated and removed."""
3939

4040

41-
class RemovedCommandError(BaseError, RuntimeError):
41+
class RemovedCommandError(BaseError, RuntimeError): # type: ignore[valid-type, misc] # distutils imports are `Any` on python 3.12+
4242
"""Error used for commands that have been removed in setuptools.
4343
4444
Since ``setuptools`` is built on ``distutils``, simply removing a command
@@ -48,7 +48,7 @@ class RemovedCommandError(BaseError, RuntimeError):
4848
"""
4949

5050

51-
class PackageDiscoveryError(BaseError, RuntimeError):
51+
class PackageDiscoveryError(BaseError, RuntimeError): # type: ignore[valid-type, misc] # distutils imports are `Any` on python 3.12+
5252
"""Impossible to perform automatic discovery of packages and/or modules.
5353
5454
The current project layout or given discovery options can lead to problems when

0 commit comments

Comments
 (0)