-
-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathpackage.py
More file actions
66 lines (49 loc) · 1.86 KB
/
Copy pathpackage.py
File metadata and controls
66 lines (49 loc) · 1.86 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import contextlib
import shutil
import sys
from pathlib import Path
from subprocess import run
if __name__ == "__main__" and not __package__:
file = Path(__file__).resolve()
parent, top = file.parent, file.parents[1]
if str(top) not in sys.path:
sys.path.append(str(top))
with contextlib.suppress(ValueError):
sys.path.remove(str(parent))
__package__ = "scripts"
from scripts.tools import get_version
def main() -> None:
dist_path = Path("./dist").absolute()
if not dist_path.exists():
dist_path.mkdir()
packages = [f"{path}" for path in Path("./packages").iterdir() if (path / "pyproject.toml").exists()]
for package in packages:
run(
f"hatch -e hatch-build build {dist_path}",
shell=True,
cwd=package,
check=False,
).check_returncode()
run(f"hatch -e hatch-build build {dist_path}", shell=True, check=False).check_returncode()
shutil.rmtree("./bundled/libs", ignore_errors=True)
run(
"pip --disable-pip-version-check install -U -t ./bundled/libs --no-cache-dir --implementation py "
"--only-binary=:all: --no-binary=:none: -r ./bundled_requirements.txt",
shell=True,
check=False,
).check_returncode()
run(
"pip --disable-pip-version-check "
f"install -U -t ./bundled/libs --no-cache-dir --implementation py --no-deps {' '.join(packages)} .",
shell=True,
check=False,
).check_returncode()
run(
f"npx vsce package {'--pre-release' if get_version().prerelease else ''} -o ./dist",
shell=True,
check=False,
).check_returncode()
shutil.rmtree("./intellij-client/build", ignore_errors=True)
run("gradle buildPlugin --console=plain", shell=True, check=False, cwd="intellij-client").check_returncode()
if __name__ == "__main__":
main()