feat: parse toml entrypoint

This commit is contained in:
aclist 2026-06-03 16:01:15 +09:00
parent 48cb062d90
commit 5776f4c49f
2 changed files with 17 additions and 6 deletions

13
scripts/parse_toml.py Normal file
View File

@ -0,0 +1,13 @@
from pprint import pprint
import tomllib
from pathlib import Path
root = Path(__file__).resolve().parents[1]
def get_entrypoint() -> None:
p = root.joinpath("pyproject.toml")
with open(p, "rb") as f:
t = tomllib.load(f)
name = t["project"]["name"]
return t["project"]["scripts"][name]

View File

@ -5,10 +5,10 @@ import tarfile
from pathlib import Path
from concat_licenses import concat_licenses
from concat_licenses import concat_license
from parse_toml import get_entrypoint
from prebuild import get_pyapp, rebuild_cpython
root = Path(__file__).resolve().parents[1]
output = root.joinpath("dist")
build_dir = root.joinpath("build")
@ -31,9 +31,7 @@ packaged_version = rebuild_cpython()
assert packaged_version == version
cpython = build_dir.joinpath("airgapped.tar.gz")
# TODO: parse pyproject directly
entrypoint = "dzgui.main:main"
entrypoint = get_entrypoint()
env = os.environ
env["PYAPP_PROJECT_VERSION"] = version
env["PYAPP_PROJECT_NAME"] = appname
@ -51,7 +49,7 @@ env["PYAPP_DISTRIBUTION_PYTHON_PATH"] = "python/bin/python3"
subfolder = output.joinpath(stem)
subfolder.mkdir(parents=True)
combined_licenses = concat_licenses()
combined_licenses = concat_license()
license_file = subfolder.joinpath("LICENSE")
license_file.write_text(combined_licenses)