forked from JelleZijlstra/typeshed_client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_bundled.py
More file actions
executable file
·29 lines (24 loc) · 883 Bytes
/
update_bundled.py
File metadata and controls
executable file
·29 lines (24 loc) · 883 Bytes
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
#!/usr/bin/env python3
import shutil
import subprocess
import tempfile
from pathlib import Path
def update_bundled() -> None:
ts_client = Path("typeshed_client")
assert (
ts_client.is_dir()
), "this script must be run at the root of the typeshed_client repository"
bundled_ts_dir = ts_client / "typeshed"
if bundled_ts_dir.exists():
shutil.rmtree(bundled_ts_dir)
with tempfile.TemporaryDirectory() as temp_dir_str:
temp_dir = Path(temp_dir_str)
subprocess.check_call(
["git", "clone", "https://github.com/python/typeshed.git", "--depth", "1"],
cwd=temp_dir,
)
shutil.copytree(temp_dir / "typeshed" / "stdlib", bundled_ts_dir)
shutil.rmtree(bundled_ts_dir / "@tests")
subprocess.check_call(["git", "add", str(bundled_ts_dir)])
if __name__ == "__main__":
update_bundled()