8000 mypy: fix all misc · pypa/distutils@f6a363e · GitHub
[go: up one dir, main page]

Skip to content

Commit f6a363e

Browse files
committed
mypy: fix all misc
1 parent 248ee13 commit f6a363e

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

distutils/cmd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ def make_archive(
504504
owner: str | None = None,
505505
group: str | None = None,
506506
) -> str:
507-
return archive_util.make_archive(
507+
return archive_util.make_archive( # type: ignore[misc] # Mypy bailed out
508508
base_name,
509509
format,
510510
root_dir,

distutils/dist.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -576,11 +576,10 @@ def _parse_command_opts(self, parser, args): # noqa: C901
576576
hasattr(cmd_class, 'user_options')
577577
and isinstance(cmd_class.user_options, list)
578578
):
579-
msg = (
580-
"command class %s must provide "
579+
raise DistutilsClassError(
580+
f"command class {cmd_class} must provide "
581581
"'user_options' attribute (a list of tuples)"
582582
)
583-
raise DistutilsClassError(msg % cmd_class)
584583

585584
# If the command class has a list of negative alias options,
586585
# merge it in with the global negative aliases.

d 10000 istutils/sysconfig.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,16 @@ def customize_compiler(compiler: CCompiler) -> None:
324324
'AR',
325325
'ARFLAGS',
326326
)
327+
assert isinstance(cc, str)
328+
assert isinstance(cxx, str)
329+
assert isinstance(cflags, str)
330+
assert isinstance(ccshared, str)
331+
assert isinstance(ldshared, str)
332+
assert isinstance(ldcxxshared, str)
333+
assert isinstance(shlib_suffix, str)
334+
assert isinstance(ar_flags, str)
335+
ar = os.environ.get('AR', ar)
336+
assert isinstance(ar, str)
327337

328338
cxxflags = cflags
329339

@@ -354,8 +364,6 @@ def customize_compiler(compiler: CCompiler) -> None:
354364
ldshared = _add_flags(ldshared, 'CPP')
355365
ldcxxshared = _add_flags(ldcxxshared, 'CPP')
356366

357-
ar = os.environ.get('AR', ar)
358-
359367
archiver = ar + ' ' + os.environ.get('ARFLAGS', ar_flags)
360368
cc_cmd = cc + ' ' + cflags
361369
cxx_cmd = cxx + ' ' + cxxflags
@@ -376,7 +384,7 @@ def customize_compiler(compiler: CCompiler) -> None:
376384
if 'RANLIB' in os.environ and compiler.executables.get('ranlib', None):
377385
compiler.set_executables(ranlib=os.environ['RANLIB'])
378386

379-
compiler.shared_lib_extension = shlib_suffix
387+
compiler.shared_lib_extension = shlib_suffix # type: ignore[misc] # Assigning to ClassVar
380388

381389

382390
def get_config_h_filename() -> str:
@@ -549,8 +557,8 @@ def expand_makefile_vars(s, vars):
549557
@overload
550558
def get_config_vars() -> dict[str, str | int]: ...
551559
@overload
552-
def get_config_vars(arg: str, /, *args: str) -> list[str | int]: ...
553-
def get_config_vars(*args: str) -> list[str | int] | dict[str, str | int]:
560+
def get_config_vars(arg: str, /, *args: str) -> list[str | int | None]: ...
561+
def get_config_vars(*args: str) -> list[str | int | None] | dict[str, str | int]:
554562
"""With no arguments, return a dictionary of all configuration
555563
variables relevant for the current platform. Generally this includes
556564
everything needed to build extensions and install both pure modules and

mypy.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ disable_error_code =
3131
func-returns-value,
3232
union-attr,
3333
str-bytes-safe,
34-
misc,
3534

3635
# stdlib's test module is not typed on typeshed
3736
[mypy-test.*]

0 commit comments

Comments
 (0)
0