Ensure that distutils and setuptools._distutils stay consistent (#11758)

This commit is contained in:
Sebastian Rittau
2024-04-14 15:41:59 +02:00
committed by GitHub
parent 3c678c997d
commit d3aa08188f
3 changed files with 17 additions and 0 deletions

View File

@@ -0,0 +1 @@
from setuptools._distutils._modified import *

View File

@@ -0,0 +1 @@
from setuptools._distutils.command.install_lib import *

View File

@@ -83,6 +83,20 @@ def check_stubs() -> None:
assert not py_files_present, error_message
def check_distutils() -> None:
"""Check whether all setuptools._distutils files are re-exported from distutils."""
def all_relative_paths_in_directory(path: Path) -> set[Path]:
return {pyi.relative_to(path) for pyi in path.rglob("*.pyi")}
all_setuptools_files = all_relative_paths_in_directory(Path("stubs", "setuptools", "setuptools", "_distutils"))
all_distutils_files = all_relative_paths_in_directory(Path("stubs", "setuptools", "distutils"))
assert all_setuptools_files and all_distutils_files, "Looks like this test might be out of date!"
extra_files = all_setuptools_files - all_distutils_files
joined = "\n".join(f" * {f}" for f in extra_files)
assert not extra_files, f"Files missing from distutils:\n{joined}"
def check_test_cases() -> None:
"""Check that the test_cases directory contains only the correct files."""
for _, testcase_dir in get_all_testcase_directories():
@@ -164,4 +178,5 @@ if __name__ == "__main__":
check_no_symlinks()
check_stdlib()
check_stubs()
check_distutils()
check_test_cases()