|
45 | 45 |
|
46 | 46 | # type-only import because of mutual dependence between these modules |
47 | 47 | from .cmd import Command |
| 48 | + from .extension import Extension |
48 | 49 |
|
49 | 50 | _CommandT = TypeVar("_CommandT", bound="Command") |
50 | 51 | _OptionsList: TypeAlias = list[ |
@@ -220,18 +221,18 @@ def __init__(self, attrs: MutableMapping[str, Any] | None = None) -> None: # no |
220 | 221 | # These options are really the business of various commands, rather |
221 | 222 | # than of the Distribution itself. We provide aliases for them in |
222 | 223 | # Distribution as a convenience to the developer. |
223 | | - self.packages = None |
| 224 | + self.packages: list[str] | None = None |
224 | 225 | self.package_data: dict[str, list[str]] = {} |
225 | | - self.package_dir = None |
226 | | - self.py_modules = None |
| 226 | + self.package_dir: dict[str, str] | None = None |
| 227 | + self.py_modules: list[str] | None = None |
227 | 228 | self.libraries = None |
228 | 229 | self.headers = None |
229 | | - self.ext_modules = None |
| 230 | + self.ext_modules: list[Extension] | None = None |
230 | 231 | self.ext_package = None |
231 | 232 | self.include_dirs = None |
232 | 233 | self.extra_path = None |
233 | 234 | self.scripts = None |
234 | | - self.data_files = None |
| 235 | + self.data_files: list[str | tuple] | None = None |
235 | 236 | self.password = '' |
236 | 237 |
|
237 | 238 | # And now initialize bookkeeping stuff that can't be supplied by |
@@ -1024,25 +1025,25 @@ def run_command(self, command: str) -> None: |
1024 | 1025 | # -- Distribution query methods ------------------------------------ |
1025 | 1026 |
|
1026 | 1027 | def has_pure_modules(self) -> bool: |
1027 | | - return len(self.packages or self.py_modules or []) > 0 |
| 1028 | + return bool(self.packages or self.py_modules) |
1028 | 1029 |
|
1029 | 1030 | def has_ext_modules(self) -> bool: |
1030 | | - return self.ext_modules and len(self.ext_modules) > 0 |
| 1031 | + return bool(self.ext_modules) |
1031 | 1032 |
|
1032 | 1033 | def has_c_libraries(self) -> bool: |
1033 | | - return self.libraries and len(self.libraries) > 0 |
| 1034 | + return bool(self.libraries) |
1034 | 1035 |
|
1035 | 1036 | def has_modules(self) -> bool: |
1036 | 1037 | return self.has_pure_modules() or self.has_ext_modules() |
1037 | 1038 |
|
1038 | 1039 | def has_headers(self) -> bool: |
1039 | | - return self.headers and len(self.headers) > 0 |
| 1040 | + return bool(self.headers) |
1040 | 1041 |
|
1041 | 1042 | def has_scripts(self) -> bool: |
1042 | | - return self.scripts and len(self.scripts) > 0 |
| 1043 | + return bool(self.scripts) |
1043 | 1044 |
|
1044 | 1045 | def has_data_files(self) -> bool: |
1045 | | - return self.data_files and len(self.data_files) > 0 |
| 1046 | + return bool(self.data_files) |
1046 | 1047 |
|
1047 | 1048 | def is_pure(self) -> bool: |
1048 | 1049 | return ( |
|
0 commit comments