39
39
import warnings
40
40
from collections .abc import Iterable , Iterator , Mapping
41
41
from pathlib import Path
42
- from typing import TYPE_CHECKING , Union
42
+ from typing import TYPE_CHECKING , NoReturn , Union
43
43
44
44
import setuptools
45
45
@@ -77,14 +77,14 @@ def __init__(self, specifiers) -> None:
77
77
78
78
79
79
class Distribution (setuptools .dist .Distribution ):
80
- def fetch_build_eggs (self , specifiers ):
80
+ def fetch_build_eggs (self , specifiers ) -> NoReturn :
81
81
specifier_list = list (parse_strings (specifiers ))
82
82
83
83
raise SetupRequirementsError (specifier_list )
84
84
85
85
@classmethod
86
86
@contextlib .contextmanager
87
- def patch (cls ):
87
+ def patch (cls ) -> Iterator [ None ] :
88
88
"""
89
89
Replace
90
90
distutils.dist.Distribution with this class
@@ -307,7 +307,7 @@ def _get_build_requires(
307
307
308
308
return requirements
309
309
310
- def run_setup (self , setup_script : str = 'setup.py' ):
310
+ def run_setup (self , setup_script : str = 'setup.py' ) -> None :
311
311
# Note that we can reuse our build directory between calls
312
312
# Correctness comes first, then optimization later
313
313
__file__ = os .path .abspath (setup_script )
@@ -330,10 +330,14 @@ def run_setup(self, setup_script: str = 'setup.py'):
330
330
"setup-py-deprecated.html" ,
331
331
)
332
332
333
- def get_requires_for_build_wheel (self , config_settings : _ConfigSettings = None ):
333
+ def get_requires_for_build_wheel (
334
+ self , config_settings : _ConfigSettings = None
335
+ ) -> list [str ]:
334
336
return self ._get_build_requires (config_settings , requirements = [])
335
337
336
- def get_requires_for_build_sdist (self , config_settings : _ConfigSettings = None ):
338
+ def get_requires_for_build_sdist (
339
+ self , config_settings : _ConfigSettings = None
340
+ ) -> list [str ]:
337
341
return self ._get_build_requires (config_settings , requirements = [])
338
342
339
343
def _bubble_up_info_directory (
@@ -364,7 +368,7 @@ def _find_info_directory(self, metadata_directory: StrPath, suffix: str) -> Path
364
368
365
369
def prepare_metadata_for_build_wheel (
366
370
self , metadata_directory : StrPath , config_settings : _ConfigSettings = None
367
- ):
371
+ ) -> str :
368
372
sys .argv = [
369
373
* sys .argv [:1 ],
370
374
* self ._global_args (config_settings ),
@@ -420,7 +424,7 @@ def build_wheel(
420
424
wheel_directory : StrPath ,
421
425
config_settings : _ConfigSettings = None ,
422
426
metadata_directory : StrPath | None = None ,
423
- ):
427
+ ) -> str :
424
428
def _build (cmd : list [str ]):
425
429
with suppress_known_deprecation ():
426
430
return self ._build_with_temp_dir (
@@ -445,7 +449,7 @@ def _build(cmd: list[str]):
445
449
446
450
def build_sdist (
447
451
self , sdist_directory : StrPath , config_settings : _ConfigSettings = None
448
- ):
452
+ ) -> str :
449
453
return self ._build_with_temp_dir (
450
454
['sdist' , '--formats' , 'gztar' ], '.tar.gz' , sdist_directory , config_settings
451
455
)
@@ -467,7 +471,7 @@ def build_editable(
467
471
wheel_directory : StrPath ,
468
472
config_settings : _ConfigSettings = None ,
469
473
metadata_directory : StrPath | None = None ,
470
- ):
474
+ ) -> str :
471
475
# XXX can or should we hide our editable_wheel command normally?
472
476
info_dir = self ._get_dist_info_dir (metadata_directory )
473
477
opts = ["--dist-info-dir" , info_dir ] if info_dir else []
@@ -479,12 +483,12 @@ def build_editable(
479
483
480
484
def get_requires_for_build_editable (
481
485
self , config_settings : _ConfigSettings = None
482
- ):
486
+ ) -> list [ str ] :
483
487
return self .get_requires_for_build_wheel (config_settings )
484
488
485
489
def prepare_metadata_for_build_editable (
486
490
self , metadata_directory : StrPath , config_settings : _ConfigSettings = None
487
- ):
491
+ ) -> str :
488
492
return self .prepare_metadata_for_build_wheel (
489
493
metadata_directory , config_settings
490
494
)
@@ -502,7 +506,7 @@ class _BuildMetaLegacyBackend(_BuildMetaBackend):
502
506
and will eventually be removed.
503
507
"""
504
508
505
- def run_setup (self , setup_script : str = 'setup.py' ):
509
+ def run_setup (self , setup_script : str = 'setup.py' ) -> None :
506
510
# In order to maintain compatibility with scripts assuming that
507
511
# the setup.py script is in a directory on the PYTHONPATH, inject
508
512
# '' into sys.path. (pypa/setuptools#1642)
0 commit comments