Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions distutils/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import re
import sys
import warnings
from collections.abc import Iterable, MutableMapping
from collections.abc import Iterable, Mapping, MutableMapping
from email import message_from_file
from typing import (
IO,
Expand Down Expand Up @@ -223,17 +223,17 @@ def __init__(self, attrs: MutableMapping[str, Any] | None = None) -> None: # no
# Distribution as a convenience to the developer.
self.packages: list[str] | None = None
self.package_data: dict[str, list[str]] = {}
self.package_dir: dict[str, str] | None = None
self.package_dir: Mapping[str, str] | None = None
self.py_modules: list[str] | None = None
self.libraries = None
self.headers = None
self.libraries: list[tuple[str, dict[str, Any]]] | None = None
self.headers: list[str] | None = None
self.ext_modules: list[Extension] | None = None
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typeshed typed this as Sequence, but as far as I can see

self.extensions = self.distribution.ext_modules

and
def check_extensions_list(self, extensions) -> None: # noqa: C901
"""Ensure that the list of extensions (presumably provided as a
command option 'extensions') is valid, i.e. it is a list of
Extension objects. We also support the old-style list of 2-tuples,
where the tuples are (ext_name, build_info), which are converted to
Extension instances here.
Raise DistutilsSetupError if the structure is invalid anywhere;
just returns otherwise.
"""
if not isinstance(extensions, list):
raise DistutilsSetupError(
"'ext_modules' option must be a list of Extension instances"
)

means it has to be a list.

self.ext_package = None
self.include_dirs = None
self.ext_package: str | None = None
self.include_dirs: list[str] | None = None
self.extra_path = None
self.scripts = None
self.data_files: list[str | tuple] | None = None
self.password = ''
self.scripts: list[str] | None = None
self.data_files: list[tuple[str, list[str]]] | None = None
self.password: str = ''

# And now initialize bookkeeping stuff that can't be supplied by
# the caller at all. 'command_obj' maps command names to
Expand Down Expand Up @@ -262,7 +262,7 @@ def __init__(self, attrs: MutableMapping[str, Any] | None = None) -> None: # no
# specifically. Note that this order guarantees that aliased
# command options will override any supplied redundantly
# through the general options dictionary.
options = attrs.get('options')
options: Mapping[str, Mapping[str, str]] | None = attrs.get('options')
if options is not None:
del attrs['options']
for command, cmd_options in options.items():
Expand Down
Loading