From 770395ed04e9214ba1ee99315d3fe781a2a711ae Mon Sep 17 00:00:00 2001 From: Avasam Date: Thu, 17 Oct 2024 16:39:57 -0400 Subject: [PATCH] Statically alias distutils-stubs to setuptools._distutils --- tools/update_distutils_stubs.py | 28 +++++++++++++++++++ typings/distutils-stubs/__init__.pyi | 1 + typings/distutils-stubs/_log.pyi | 1 + typings/distutils-stubs/_macos_compat.pyi | 1 + typings/distutils-stubs/_modified.pyi | 1 + typings/distutils-stubs/_msvccompiler.pyi | 1 + typings/distutils-stubs/archive_util.pyi | 1 + typings/distutils-stubs/ccompiler.pyi | 1 + typings/distutils-stubs/cmd.pyi | 1 + typings/distutils-stubs/command/__init__.pyi | 1 + .../command/_framework_compat.pyi | 1 + typings/distutils-stubs/command/bdist.pyi | 1 + .../distutils-stubs/command/bdist_dumb.pyi | 1 + typings/distutils-stubs/command/bdist_rpm.pyi | 1 + typings/distutils-stubs/command/build.pyi | 1 + .../distutils-stubs/command/build_clib.pyi | 1 + typings/distutils-stubs/command/build_ext.pyi | 1 + typings/distutils-stubs/command/build_py.pyi | 1 + .../distutils-stubs/command/build_scripts.pyi | 1 + typings/distutils-stubs/command/check.pyi | 1 + typings/distutils-stubs/command/clean.pyi | 1 + typings/distutils-stubs/command/config.pyi | 1 + typings/distutils-stubs/command/install.pyi | 1 + .../distutils-stubs/command/install_data.pyi | 1 + .../command/install_egg_info.pyi | 1 + .../command/install_headers.pyi | 1 + .../distutils-stubs/command/install_lib.pyi | 1 + .../command/install_scripts.pyi | 1 + typings/distutils-stubs/command/sdist.pyi | 1 + typings/distutils-stubs/compat/__init__.pyi | 1 + typings/distutils-stubs/compat/py38.pyi | 1 + typings/distutils-stubs/compat/py39.pyi | 1 + typings/distutils-stubs/core.pyi | 1 + typings/distutils-stubs/cygwinccompiler.pyi | 1 + typings/distutils-stubs/debug.pyi | 1 + typings/distutils-stubs/dep_util.pyi | 1 + typings/distutils-stubs/dir_util.pyi | 1 + typings/distutils-stubs/dist.pyi | 1 + typings/distutils-stubs/errors.pyi | 1 + typings/distutils-stubs/extension.pyi | 1 + typings/distutils-stubs/fancy_getopt.pyi | 1 + typings/distutils-stubs/file_util.pyi | 1 + typings/distutils-stubs/filelist.pyi | 1 + typings/distutils-stubs/log.pyi | 1 + typings/distutils-stubs/ruff.toml | 2 ++ typings/distutils-stubs/spawn.pyi | 1 + typings/distutils-stubs/sysconfig.pyi | 1 + typings/distutils-stubs/text_file.pyi | 1 + typings/distutils-stubs/unixccompiler.pyi | 1 + typings/distutils-stubs/util.pyi | 1 + typings/distutils-stubs/version.pyi | 1 + typings/distutils-stubs/versionpredicate.pyi | 1 + typings/distutils-stubs/zosccompiler.pyi | 1 + 53 files changed, 81 insertions(+) create mode 100644 tools/update_distutils_stubs.py create mode 100644 typings/distutils-stubs/__init__.pyi create mode 100644 typings/distutils-stubs/_log.pyi create mode 100644 typings/distutils-stubs/_macos_compat.pyi create mode 100644 typings/distutils-stubs/_modified.pyi create mode 100644 typings/distutils-stubs/_msvccompiler.pyi create mode 100644 typings/distutils-stubs/archive_util.pyi create mode 100644 typings/distutils-stubs/ccompiler.pyi create mode 100644 typings/distutils-stubs/cmd.pyi create mode 100644 typings/distutils-stubs/command/__init__.pyi create mode 100644 typings/distutils-stubs/command/_framework_compat.pyi create mode 100644 typings/distutils-stubs/command/bdist.pyi create mode 100644 typings/distutils-stubs/command/bdist_dumb.pyi create mode 100644 typings/distutils-stubs/command/bdist_rpm.pyi create mode 100644 typings/distutils-stubs/command/build.pyi create mode 100644 typings/distutils-stubs/command/build_clib.pyi create mode 100644 typings/distutils-stubs/command/build_ext.pyi create mode 100644 typings/distutils-stubs/command/build_py.pyi create mode 100644 typings/distutils-stubs/command/build_scripts.pyi create mode 100644 typings/distutils-stubs/command/check.pyi create mode 100644 typings/distutils-stubs/command/clean.pyi create mode 100644 typings/distutils-stubs/command/config.pyi create mode 100644 typings/distutils-stubs/command/install.pyi create mode 100644 typings/distutils-stubs/command/install_data.pyi create mode 100644 typings/distutils-stubs/command/install_egg_info.pyi create mode 100644 typings/distutils-stubs/command/install_headers.pyi create mode 100644 typings/distutils-stubs/command/install_lib.pyi create mode 100644 typings/distutils-stubs/command/install_scripts.pyi create mode 100644 typings/distutils-stubs/command/sdist.pyi create mode 100644 typings/distutils-stubs/compat/__init__.pyi create mode 100644 typings/distutils-stubs/compat/py38.pyi create mode 100644 typings/distutils-stubs/compat/py39.pyi create mode 100644 typings/distutils-stubs/core.pyi create mode 100644 typings/distutils-stubs/cygwinccompiler.pyi create mode 100644 typings/distutils-stubs/debug.pyi create mode 100644 typings/distutils-stubs/dep_util.pyi create mode 100644 typings/distutils-stubs/dir_util.pyi create mode 100644 typings/distutils-stubs/dist.pyi create mode 100644 typings/distutils-stubs/errors.pyi create mode 100644 typings/distutils-stubs/extension.pyi create mode 100644 typings/distutils-stubs/fancy_getopt.pyi create mode 100644 typings/distutils-stubs/file_util.pyi create mode 100644 typings/distutils-stubs/filelist.pyi create mode 100644 typings/distutils-stubs/log.pyi create mode 100644 typings/distutils-stubs/ruff.toml create mode 100644 typings/distutils-stubs/spawn.pyi create mode 100644 typings/distutils-stubs/sysconfig.pyi create mode 100644 typings/distutils-stubs/text_file.pyi create mode 100644 typings/distutils-stubs/unixccompiler.pyi create mode 100644 typings/distutils-stubs/util.pyi create mode 100644 typings/distutils-stubs/version.pyi create mode 100644 typings/distutils-stubs/versionpredicate.pyi create mode 100644 typings/distutils-stubs/zosccompiler.pyi diff --git a/tools/update_distutils_stubs.py b/tools/update_distutils_stubs.py new file mode 100644 index 0000000000..69f750398c --- /dev/null +++ b/tools/update_distutils_stubs.py @@ -0,0 +1,28 @@ +import os +import shutil +from pathlib import Path + +_vendored_distutils_path = Path(__file__).parent.parent / "setuptools" / "_distutils" +_distutils_stubs_path = Path(__file__).parent.parent / "typings" / "distutils-stubs" + + +def main(): + if _distutils_stubs_path.exists(): + shutil.rmtree(_distutils_stubs_path) + _distutils_stubs_path.mkdir(parents=True) + (_distutils_stubs_path / "ruff.toml").write_text('[lint]\nignore = ["F403"]') + for path in _vendored_distutils_path.rglob("*.py"): + relative_path = path.relative_to(_vendored_distutils_path) + if relative_path.parts[0] == "tests": + continue + stub_path = (_distutils_stubs_path / relative_path).with_suffix(".pyi") + stub_path.parent.mkdir(exist_ok=True) + module = ( + "setuptools._distutils." + + str(relative_path.with_suffix("")).replace(os.sep, ".") + ).removesuffix(".__init__") + stub_path.write_text(f"from {module} import *\n") + + +if __name__ == "__main__": + main() diff --git a/typings/distutils-stubs/__init__.pyi b/typings/distutils-stubs/__init__.pyi new file mode 100644 index 0000000000..c0c8ceb41b --- /dev/null +++ b/typings/distutils-stubs/__init__.pyi @@ -0,0 +1 @@ +from setuptools._distutils import * diff --git a/typings/distutils-stubs/_log.pyi b/typings/distutils-stubs/_log.pyi new file mode 100644 index 0000000000..6f51835749 --- /dev/null +++ b/typings/distutils-stubs/_log.pyi @@ -0,0 +1 @@ +from setuptools._distutils._log import * diff --git a/typings/distutils-stubs/_macos_compat.pyi b/typings/distutils-stubs/_macos_compat.pyi new file mode 100644 index 0000000000..78c1545c69 --- /dev/null +++ b/typings/distutils-stubs/_macos_compat.pyi @@ -0,0 +1 @@ +from setuptools._distutils._macos_compat import * diff --git a/typings/distutils-stubs/_modified.pyi b/typings/distutils-stubs/_modified.pyi new file mode 100644 index 0000000000..e916197a5a --- /dev/null +++ b/typings/distutils-stubs/_modified.pyi @@ -0,0 +1 @@ +from setuptools._distutils._modified import * diff --git a/typings/distutils-stubs/_msvccompiler.pyi b/typings/distutils-stubs/_msvccompiler.pyi new file mode 100644 index 0000000000..f2ead92dea --- /dev/null +++ b/typings/distutils-stubs/_msvccompiler.pyi @@ -0,0 +1 @@ +from setuptools._distutils._msvccompiler import * diff --git a/typings/distutils-stubs/archive_util.pyi b/typings/distutils-stubs/archive_util.pyi new file mode 100644 index 0000000000..115f305064 --- /dev/null +++ b/typings/distutils-stubs/archive_util.pyi @@ -0,0 +1 @@ +from setuptools._distutils.archive_util import * diff --git a/typings/distutils-stubs/ccompiler.pyi b/typings/distutils-stubs/ccompiler.pyi new file mode 100644 index 0000000000..e1770cfdf0 --- /dev/null +++ b/typings/distutils-stubs/ccompiler.pyi @@ -0,0 +1 @@ +from setuptools._distutils.ccompiler import * diff --git a/typings/distutils-stubs/cmd.pyi b/typings/distutils-stubs/cmd.pyi new file mode 100644 index 0000000000..235ca56809 --- /dev/null +++ b/typings/distutils-stubs/cmd.pyi @@ -0,0 +1 @@ +from setuptools._distutils.cmd import * diff --git a/typings/distutils-stubs/command/__init__.pyi b/typings/distutils-stubs/command/__init__.pyi new file mode 100644 index 0000000000..7091a6beb0 --- /dev/null +++ b/typings/distutils-stubs/command/__init__.pyi @@ -0,0 +1 @@ +from setuptools._distutils.command import * diff --git a/typings/distutils-stubs/command/_framework_compat.pyi b/typings/distutils-stubs/command/_framework_compat.pyi new file mode 100644 index 0000000000..b796512350 --- /dev/null +++ b/typings/distutils-stubs/command/_framework_compat.pyi @@ -0,0 +1 @@ +from setuptools._distutils.command._framework_compat import * diff --git a/typings/distutils-stubs/command/bdist.pyi b/typings/distutils-stubs/command/bdist.pyi new file mode 100644 index 0000000000..3445de9fbe --- /dev/null +++ b/typings/distutils-stubs/command/bdist.pyi @@ -0,0 +1 @@ +from setuptools._distutils.command.bdist import * diff --git a/typings/distutils-stubs/command/bdist_dumb.pyi b/typings/distutils-stubs/command/bdist_dumb.pyi new file mode 100644 index 0000000000..b6f3e0cde0 --- /dev/null +++ b/typings/distutils-stubs/command/bdist_dumb.pyi @@ -0,0 +1 @@ +from setuptools._distutils.command.bdist_dumb import * diff --git a/typings/distutils-stubs/command/bdist_rpm.pyi b/typings/distutils-stubs/command/bdist_rpm.pyi new file mode 100644 index 0000000000..32e88d493a --- /dev/null +++ b/typings/distutils-stubs/command/bdist_rpm.pyi @@ -0,0 +1 @@ +from setuptools._distutils.command.bdist_rpm import * diff --git a/typings/distutils-stubs/command/build.pyi b/typings/distutils-stubs/command/build.pyi new file mode 100644 index 0000000000..1fe7d1e734 --- /dev/null +++ b/typings/distutils-stubs/command/build.pyi @@ -0,0 +1 @@ +from setuptools._distutils.command.build import * diff --git a/typings/distutils-stubs/command/build_clib.pyi b/typings/distutils-stubs/command/build_clib.pyi new file mode 100644 index 0000000000..f60f41aa89 --- /dev/null +++ b/typings/distutils-stubs/command/build_clib.pyi @@ -0,0 +1 @@ +from setuptools._distutils.command.build_clib import * diff --git a/typings/distutils-stubs/command/build_ext.pyi b/typings/distutils-stubs/command/build_ext.pyi new file mode 100644 index 0000000000..c196715680 --- /dev/null +++ b/typings/distutils-stubs/command/build_ext.pyi @@ -0,0 +1 @@ +from setuptools._distutils.command.build_ext import * diff --git a/typings/distutils-stubs/command/build_py.pyi b/typings/distutils-stubs/command/build_py.pyi new file mode 100644 index 0000000000..0d97b743f7 --- /dev/null +++ b/typings/distutils-stubs/command/build_py.pyi @@ -0,0 +1 @@ +from setuptools._distutils.command.build_py import * diff --git a/typings/distutils-stubs/command/build_scripts.pyi b/typings/distutils-stubs/command/build_scripts.pyi new file mode 100644 index 0000000000..1b17f2d7f9 --- /dev/null +++ b/typings/distutils-stubs/command/build_scripts.pyi @@ -0,0 +1 @@ +from setuptools._distutils.command.build_scripts import * diff --git a/typings/distutils-stubs/command/check.pyi b/typings/distutils-stubs/command/check.pyi new file mode 100644 index 0000000000..327533ac37 --- /dev/null +++ b/typings/distutils-stubs/command/check.pyi @@ -0,0 +1 @@ +from setuptools._distutils.command.check import * diff --git a/typings/distutils-stubs/command/clean.pyi b/typings/distutils-stubs/command/clean.pyi new file mode 100644 index 0000000000..30df3d0c23 --- /dev/null +++ b/typings/distutils-stubs/command/clean.pyi @@ -0,0 +1 @@ +from setuptools._distutils.command.clean import * diff --git a/typings/distutils-stubs/command/config.pyi b/typings/distutils-stubs/command/config.pyi new file mode 100644 index 0000000000..ba2478249c --- /dev/null +++ b/typings/distutils-stubs/command/config.pyi @@ -0,0 +1 @@ +from setuptools._distutils.command.config import * diff --git a/typings/distutils-stubs/command/install.pyi b/typings/distutils-stubs/command/install.pyi new file mode 100644 index 0000000000..6ef0aca09e --- /dev/null +++ b/typings/distutils-stubs/command/install.pyi @@ -0,0 +1 @@ +from setuptools._distutils.command.install import * diff --git a/typings/distutils-stubs/command/install_data.pyi b/typings/distutils-stubs/command/install_data.pyi new file mode 100644 index 0000000000..039f8b41c9 --- /dev/null +++ b/typings/distutils-stubs/command/install_data.pyi @@ -0,0 +1 @@ +from setuptools._distutils.command.install_data import * diff --git a/typings/distutils-stubs/command/install_egg_info.pyi b/typings/distutils-stubs/command/install_egg_info.pyi new file mode 100644 index 0000000000..691c9e1398 --- /dev/null +++ b/typings/distutils-stubs/command/install_egg_info.pyi @@ -0,0 +1 @@ +from setuptools._distutils.command.install_egg_info import * diff --git a/typings/distutils-stubs/command/install_headers.pyi b/typings/distutils-stubs/command/install_headers.pyi new file mode 100644 index 0000000000..a5802710b0 --- /dev/null +++ b/typings/distutils-stubs/command/install_headers.pyi @@ -0,0 +1 @@ +from setuptools._distutils.command.install_headers import * diff --git a/typings/distutils-stubs/command/install_lib.pyi b/typings/distutils-stubs/command/install_lib.pyi new file mode 100644 index 0000000000..bfcfe358cb --- /dev/null +++ b/typings/distutils-stubs/command/install_lib.pyi @@ -0,0 +1 @@ +from setuptools._distutils.command.install_lib import * diff --git a/typings/distutils-stubs/command/install_scripts.pyi b/typings/distutils-stubs/command/install_scripts.pyi new file mode 100644 index 0000000000..3cebd55434 --- /dev/null +++ b/typings/distutils-stubs/command/install_scripts.pyi @@ -0,0 +1 @@ +from setuptools._distutils.command.install_scripts import * diff --git a/typings/distutils-stubs/command/sdist.pyi b/typings/distutils-stubs/command/sdist.pyi new file mode 100644 index 0000000000..50a8191637 --- /dev/null +++ b/typings/distutils-stubs/command/sdist.pyi @@ -0,0 +1 @@ +from setuptools._distutils.command.sdist import * diff --git a/typings/distutils-stubs/compat/__init__.pyi b/typings/distutils-stubs/compat/__init__.pyi new file mode 100644 index 0000000000..bbcbf9cc1f --- /dev/null +++ b/typings/distutils-stubs/compat/__init__.pyi @@ -0,0 +1 @@ +from setuptools._distutils.compat import * diff --git a/typings/distutils-stubs/compat/py38.pyi b/typings/distutils-stubs/compat/py38.pyi new file mode 100644 index 0000000000..11fe6e0854 --- /dev/null +++ b/typings/distutils-stubs/compat/py38.pyi @@ -0,0 +1 @@ +from setuptools._distutils.compat.py38 import * diff --git a/typings/distutils-stubs/compat/py39.pyi b/typings/distutils-stubs/compat/py39.pyi new file mode 100644 index 0000000000..0e3a777e26 --- /dev/null +++ b/typings/distutils-stubs/compat/py39.pyi @@ -0,0 +1 @@ +from setuptools._distutils.compat.py39 import * diff --git a/typings/distutils-stubs/core.pyi b/typings/distutils-stubs/core.pyi new file mode 100644 index 0000000000..2efbd52e1c --- /dev/null +++ b/typings/distutils-stubs/core.pyi @@ -0,0 +1 @@ +from setuptools._distutils.core import * diff --git a/typings/distutils-stubs/cygwinccompiler.pyi b/typings/distutils-stubs/cygwinccompiler.pyi new file mode 100644 index 0000000000..1784f31d60 --- /dev/null +++ b/typings/distutils-stubs/cygwinccompiler.pyi @@ -0,0 +1 @@ +from setuptools._distutils.cygwinccompiler import * diff --git a/typings/distutils-stubs/debug.pyi b/typings/distutils-stubs/debug.pyi new file mode 100644 index 0000000000..859405e8cb --- /dev/null +++ b/typings/distutils-stubs/debug.pyi @@ -0,0 +1 @@ +from setuptools._distutils.debug import * diff --git a/typings/distutils-stubs/dep_util.pyi b/typings/distutils-stubs/dep_util.pyi new file mode 100644 index 0000000000..22008d8cf7 --- /dev/null +++ b/typings/distutils-stubs/dep_util.pyi @@ -0,0 +1 @@ +from setuptools._distutils.dep_util import * diff --git a/typings/distutils-stubs/dir_util.pyi b/typings/distutils-stubs/dir_util.pyi new file mode 100644 index 0000000000..cfa9544975 --- /dev/null +++ b/typings/distutils-stubs/dir_util.pyi @@ -0,0 +1 @@ +from setuptools._distutils.dir_util import * diff --git a/typings/distutils-stubs/dist.pyi b/typings/distutils-stubs/dist.pyi new file mode 100644 index 0000000000..b6cdf2bd9f --- /dev/null +++ b/typings/distutils-stubs/dist.pyi @@ -0,0 +1 @@ +from setuptools._distutils.dist import * diff --git a/typings/distutils-stubs/errors.pyi b/typings/distutils-stubs/errors.pyi new file mode 100644 index 0000000000..28a21bf13e --- /dev/null +++ b/typings/distutils-stubs/errors.pyi @@ -0,0 +1 @@ +from setuptools._distutils.errors import * diff --git a/typings/distutils-stubs/extension.pyi b/typings/distutils-stubs/extension.pyi new file mode 100644 index 0000000000..95b5cf764d --- /dev/null +++ b/typings/distutils-stubs/extension.pyi @@ -0,0 +1 @@ +from setuptools._distutils.extension import * diff --git a/typings/distutils-stubs/fancy_getopt.pyi b/typings/distutils-stubs/fancy_getopt.pyi new file mode 100644 index 0000000000..80b723b5e5 --- /dev/null +++ b/typings/distutils-stubs/fancy_getopt.pyi @@ -0,0 +1 @@ +from setuptools._distutils.fancy_getopt import * diff --git a/typings/distutils-stubs/file_util.pyi b/typings/distutils-stubs/file_util.pyi new file mode 100644 index 0000000000..b8213261f9 --- /dev/null +++ b/typings/distutils-stubs/file_util.pyi @@ -0,0 +1 @@ +from setuptools._distutils.file_util import * diff --git a/typings/distutils-stubs/filelist.pyi b/typings/distutils-stubs/filelist.pyi new file mode 100644 index 0000000000..fe746bbdcf --- /dev/null +++ b/typings/distutils-stubs/filelist.pyi @@ -0,0 +1 @@ +from setuptools._distutils.filelist import * diff --git a/typings/distutils-stubs/log.pyi b/typings/distutils-stubs/log.pyi new file mode 100644 index 0000000000..c2da037722 --- /dev/null +++ b/typings/distutils-stubs/log.pyi @@ -0,0 +1 @@ +from setuptools._distutils.log import * diff --git a/typings/distutils-stubs/ruff.toml b/typings/distutils-stubs/ruff.toml new file mode 100644 index 0000000000..1947768bd7 --- /dev/null +++ b/typings/distutils-stubs/ruff.toml @@ -0,0 +1,2 @@ +[lint] +ignore = ["F403"] \ No newline at end of file diff --git a/typings/distutils-stubs/spawn.pyi b/typings/distutils-stubs/spawn.pyi new file mode 100644 index 0000000000..4432100c00 --- /dev/null +++ b/typings/distutils-stubs/spawn.pyi @@ -0,0 +1 @@ +from setuptools._distutils.spawn import * diff --git a/typings/distutils-stubs/sysconfig.pyi b/typings/distutils-stubs/sysconfig.pyi new file mode 100644 index 0000000000..9b50b49872 --- /dev/null +++ b/typings/distutils-stubs/sysconfig.pyi @@ -0,0 +1 @@ +from setuptools._distutils.sysconfig import * diff --git a/typings/distutils-stubs/text_file.pyi b/typings/distutils-stubs/text_file.pyi new file mode 100644 index 0000000000..783363c1b9 --- /dev/null +++ b/typings/distutils-stubs/text_file.pyi @@ -0,0 +1 @@ +from setuptools._distutils.text_file import * diff --git a/typings/distutils-stubs/unixccompiler.pyi b/typings/distutils-stubs/unixccompiler.pyi new file mode 100644 index 0000000000..fcbf9e1990 --- /dev/null +++ b/typings/distutils-stubs/unixccompiler.pyi @@ -0,0 +1 @@ +from setuptools._distutils.unixccompiler import * diff --git a/typings/distutils-stubs/util.pyi b/typings/distutils-stubs/util.pyi new file mode 100644 index 0000000000..b5723b79d9 --- /dev/null +++ b/typings/distutils-stubs/util.pyi @@ -0,0 +1 @@ +from setuptools._distutils.util import * diff --git a/typings/distutils-stubs/version.pyi b/typings/distutils-stubs/version.pyi new file mode 100644 index 0000000000..1cac35f206 --- /dev/null +++ b/typings/distutils-stubs/version.pyi @@ -0,0 +1 @@ +from setuptools._distutils.version import * diff --git a/typings/distutils-stubs/versionpredicate.pyi b/typings/distutils-stubs/versionpredicate.pyi new file mode 100644 index 0000000000..325f30a966 --- /dev/null +++ b/typings/distutils-stubs/versionpredicate.pyi @@ -0,0 +1 @@ +from setuptools._distutils.versionpredicate import * diff --git a/typings/distutils-stubs/zosccompiler.pyi b/typings/distutils-stubs/zosccompiler.pyi new file mode 100644 index 0000000000..b69c6320e4 --- /dev/null +++ b/typings/distutils-stubs/zosccompiler.pyi @@ -0,0 +1 @@ +from setuptools._distutils.zosccompiler import *