-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Expand file tree
/
Copy pathself_compile_info.py
More file actions
45 lines (30 loc) · 1.07 KB
/
self_compile_info.py
File metadata and controls
45 lines (30 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
"""Print list of files compiled when compiling self (mypy and mypyc)."""
import argparse
import sys
from typing import Any
import setuptools
import mypyc.build
class FakeExtension:
def __init__(self, *args: Any, **kwargs: Any) -> None:
pass
def fake_mypycify(args: list[str], **kwargs: Any) -> list[FakeExtension]:
for target in sorted(args):
if not target.startswith("-"):
print(target)
return [FakeExtension()]
def fake_setup(*args: Any, **kwargs: Any) -> Any:
pass
def main() -> None:
parser = argparse.ArgumentParser(
description="Print list of files compiled when compiling self. Run in repository root."
)
parser.parse_args()
# Prepare fake state for running setup.py.
mypyc.build.mypycify = fake_mypycify # type: ignore[assignment]
setuptools.Extension = FakeExtension # type: ignore[misc, assignment]
setuptools.setup = fake_setup
sys.argv = [sys.argv[0], "--use-mypyc"]
# Run setup.py at the root of the repository.
import setup # noqa: F401
if __name__ == "__main__":
main()