This commit is contained in:
student_2333 2024-11-12 11:29:39 +08:00
parent f5ac064996
commit 66a4c2e9f8
No known key found for this signature in database
GPG Key ID: 665F083BEC56F2A6
5 changed files with 32 additions and 2 deletions

View File

@ -33,3 +33,5 @@ install-cpu = { composite = ["install-base", "install-cpu"] }
install-gpu = { composite = ["install-base", "install-gpu"] }
lock-base = { shell = "cd packages/nonebot-plugin-nailongremove-base && pdm lock && cd ../.." }
pub-all = { call = "scripts.pub_all:main" }

0
scripts/__init__.py Normal file
View File

10
scripts/pub_all.py Normal file
View File

@ -0,0 +1,10 @@
from .utils import PACKAGES_PATH, system_no_fail
def main():
for p in PACKAGES_PATH.iterdir():
system_no_fail("pdm", "publish", cwd=p)
if __name__ == "__main__":
main()

View File

@ -7,8 +7,8 @@ import httpx
import tomllib
from packaging.version import Version
ROOT_PATH = Path(__file__).parent.parent
PACKAGES_PATH = ROOT_PATH / "packages"
from .utils import PACKAGES_PATH
SUFFIX = ".template.toml"
TORCH_BASE = "https://download.pytorch.org"
TORCH_INDEX = f"{TORCH_BASE}/whl/cu124"

18
scripts/utils.py Normal file
View File

@ -0,0 +1,18 @@
from pathlib import Path
from subprocess import run
from typing import Any
ROOT_PATH = Path(__file__).parent.parent
PACKAGES_PATH = ROOT_PATH / "packages"
def system(*args: str, **kwargs: Any):
kwargs.setdefault("cwd", str(ROOT_PATH))
r = run(args, **kwargs) # noqa: S603
return r.returncode
def system_no_fail(*args: str, **kwargs: Any):
c = system(*args, **kwargs)
if c:
raise RuntimeError(f"command {args} failed with code {c}")