-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.py
39 lines (34 loc) · 1.03 KB
/
build.py
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
from os import getenv
from pathlib import Path
from subprocess import Popen
from sys import argv, stdout, stderr, stdin
packages = argv[1:] or [""]
if "bevy" in packages:
packages.remove("bevy")
packages.append("")
path = Path().parent
bevy_path = path / "bevy"
for package in packages:
package_toml = bevy_path / package / "pyproject.toml"
if not package_toml.is_file():
print(f"\u001b[31mERROR: {package_toml} was not found\u001b[0m")
continue
if (path / "pyproject.toml").exists():
(path / "pyproject.toml").unlink()
package_toml.link_to(path / "pyproject.toml")
if input(f"Publish {package}? [Y|N]").casefold() == "y":
process = Popen(
[
"poetry",
"publish",
"--build",
"-u",
getenv("PYPI_USERNAME"),
"-p",
getenv("PYPI_PASSWORD"),
],
stdout=stdout,
stderr=stderr,
stdin=stdin,
)
process.wait()