diff --git a/scripts/parse_toml.py b/scripts/parse_toml.py new file mode 100644 index 0000000..c0b7f86 --- /dev/null +++ b/scripts/parse_toml.py @@ -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] diff --git a/scripts/release.py b/scripts/release.py index b6c0d3f..ee44a89 100644 --- a/scripts/release.py +++ b/scripts/release.py @@ -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)