diff --git a/scripts/release.py b/scripts/release.py index b518270..e4768b2 100644 --- a/scripts/release.py +++ b/scripts/release.py @@ -3,32 +3,27 @@ import os import subprocess import tarfile -from importlib import metadata from pathlib import Path -from dzgui.const.constants import APP_NAME_LOWER - root = Path(__file__).resolve().parents[1] output = root.joinpath("dist") pyapp_dir = root.joinpath("pyapp-latest") builder = build.ProjectBuilder(root) -builder.build("wheel", output_directory=output) +wheel = builder.build("wheel", output_directory=output) +stem = Path(wheel).stem +tarname = f"{stem}.tar.gz" -interpreter = "py3" -arch = "none" -target = "any" -version = metadata.version(APP_NAME_LOWER) -wheelname = f"{APP_NAME_LOWER}-{version}-{interpreter}-{arch}-{target}.whl" -tarname = f"{APP_NAME_LOWER}-{version}.tar.gz" +metadata = stem.split("-") +appname = metadata[0] +version = metadata[1] -wheel = str(output.joinpath(wheelname)) entrypoint = "dzgui.main:main" env = os.environ env["PYAPP_PROJECT_VERSION"] = version -env["PYAPP_PROJECT_NAME"] = APP_NAME_LOWER +env["PYAPP_PROJECT_NAME"] = appname env["PYAPP_EXEC_SPEC"] = entrypoint env["PYAPP_PROJECT_PATH"] = wheel env["PYAPP_DISTRIBUTION_EMBED"] = "true" @@ -38,9 +33,9 @@ env["PYAPP_PASS_LOCATION"] = "true" proc = subprocess.run(["cargo", "build", "--release"], env=env, cwd=pyapp_dir) if proc.returncode == 0: output_exe = root.joinpath("pyapp-latest/target/release/pyapp") - release_exe = output.joinpath(APP_NAME_LOWER) + release_exe = output.joinpath(appname) output_exe.rename(release_exe) tarpath = output.joinpath(tarname) with tarfile.open(tarpath, "w:gz") as tar: - tar.add(release_exe, arcname=APP_NAME_LOWER) + tar.add(release_exe, arcname=appname) print(f"Wrote tarfile to '{tarpath}'")