Skip to content

Commit e7c0804

Browse files
committed
Trivial fixes
1 parent 2ce2037 commit e7c0804

File tree

6 files changed

+27
-6
lines changed

6 files changed

+27
-6
lines changed

setuptools/command/build.py

+6
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,15 @@ def finalize_options(self):
9898

9999
def initialize_options(self):
100100
"""(Required by the original :class:`setuptools.Command` interface)"""
101+
...
101102

102103
def finalize_options(self):
103104
"""(Required by the original :class:`setuptools.Command` interface)"""
105+
...
104106

105107
def run(self):
106108
"""(Required by the original :class:`setuptools.Command` interface)"""
109+
...
107110

108111
def get_source_files(self) -> List[str]:
109112
"""
@@ -115,6 +118,7 @@ def get_source_files(self) -> List[str]:
115118
with all the files necessary to build the distribution.
116119
All files should be strings relative to the project root directory.
117120
"""
121+
...
118122

119123
def get_outputs(self) -> List[str]:
120124
"""
@@ -128,6 +132,7 @@ def get_outputs(self) -> List[str]:
128132
in ``get_output_mapping()`` plus files that are generated during the build
129133
and don't correspond to any source file already present in the project.
130134
"""
135+
...
131136

132137
def get_output_mapping(self) -> Dict[str, str]:
133138
"""
@@ -138,3 +143,4 @@ def get_output_mapping(self) -> Dict[str, str]:
138143
Destination files should be strings in the form of
139144
``"{build_lib}/destination/file/path"``.
140145
"""
146+
...

setuptools/command/easy_install.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"""
1212

1313
from glob import glob
14+
from typing import TYPE_CHECKING, Optional, Union
1415
from distutils.util import get_platform
1516
from distutils.util import convert_path, subst_vars
1617
from distutils.errors import (
@@ -78,6 +79,8 @@
7879
from .._path import ensure_directory
7980
from ..extern.jaraco.text import yield_lines
8081

82+
if TYPE_CHECKING:
83+
_FileDescriptorOrPath = Union[int, str, bytes, os.PathLike[str], os.PathLike[bytes]]
8184

8285
# Turn on PEP440Warnings
8386
warnings.filterwarnings("default", category=pkg_resources.PEP440Warning)
@@ -2016,7 +2019,13 @@ def is_python_script(script_text, filename):
20162019
from os import chmod as _chmod
20172020
except ImportError:
20182021
# Jython compatibility
2019-
def _chmod(*args):
2022+
def _chmod(
2023+
path: "_FileDescriptorOrPath",
2024+
mode: int,
2025+
*,
2026+
dir_fd: Optional[int] = None,
2027+
follow_symlinks: bool = True,
2028+
) -> None:
20202029
pass
20212030

20222031

setuptools/command/upload_docs.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def has_sphinx(self):
5050
and metadata.entry_points(group='distutils.commands', name='build_sphinx')
5151
)
5252

53-
sub_commands = [('build_sphinx', has_sphinx)]
53+
sub_commands = [('build_sphinx', has_sphinx)] # type: ignore[list-item] # distutils stubs issue w/ Python 3.12
5454

5555
def initialize_options(self):
5656
upload.initialize_options(self)

setuptools/config/pyprojecttoml.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,10 @@ def _obtain(self, dist: "Distribution", field: str, package_dir: Mapping[str, st
296296
def _obtain_version(self, dist: "Distribution", package_dir: Mapping[str, str]):
297297
# Since plugins can set version, let's silently skip if it cannot be obtained
298298
if "version" in self.dynamic and "version" in self.dynamic_cfg:
299-
return _expand.version(self._obtain(dist, "version", package_dir))
299+
return _expand.version(
300+
# We already do an early check for the presence of "version"
301+
self._obtain(dist, "version", package_dir) # pyright: ignore[reportArgumentType]
302+
)
300303
return None
301304

302305
def _obtain_readme(self, dist: "Distribution") -> Optional[Dict[str, str]]:
@@ -306,9 +309,10 @@ def _obtain_readme(self, dist: "Distribution") -> Optional[Dict[str, str]]:
306309
dynamic_cfg = self.dynamic_cfg
307310
if "readme" in dynamic_cfg:
308311
return {
312+
# We already do an early check for the presence of "readme"
309313
"text": self._obtain(dist, "readme", {}),
310314
"content-type": dynamic_cfg["readme"].get("content-type", "text/x-rst"),
311-
}
315+
} # pyright: ignore[reportReturnType]
312316

313317
self._ensure_previously_set(dist, "readme")
314318
return None

setuptools/msvc.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@
1919
import platform
2020
import itertools
2121
import subprocess
22+
from typing import TYPE_CHECKING
2223
import distutils.errors
2324
from setuptools.extern.more_itertools import unique_everseen
2425

25-
if platform.system() == 'Windows':
26+
# https://github.com/python/mypy/issues/8166
27+
if not TYPE_CHECKING and platform.system() == 'Windows':
2628
import winreg
2729
from os import environ
2830
else:

setuptools/sandbox.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
else:
2020
_os = sys.modules[os.name]
2121
try:
22-
_file = file
22+
_file = file # type: ignore[name-defined] # Check for global variable
2323
except NameError:
2424
_file = None
2525
_open = open

0 commit comments

Comments
 (0)