docs: concatenate licenses

This commit is contained in:
aclist 2026-06-03 15:12:48 +09:00
parent bddf792280
commit f4b653e9dd
3 changed files with 17 additions and 11 deletions

View File

@ -1,8 +1,3 @@
Additional licenses to git submodules not explicitly shipped with the source code:
python-a2s: https://raw.githubusercontent.com/Yepoleb/python-a2s/refs/heads/master/LICENSE
dayzquery: https://raw.githubusercontent.com/Yepoleb/dayzquery/refs/heads/master/LICENSE
GNU GENERAL PUBLIC LICENSE GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007 Version 3, 29 June 2007

View File

@ -1,14 +1,16 @@
from pathlib import Path from pathlib import Path
def concat_license() -> str: def concat_license() -> str:
combined = ""
root = Path(__file__).resolve().parents[1] root = Path(__file__).resolve().parents[1]
licenses = root.joinpath("licenses") licenses = root.joinpath("licenses")
combined = "" self_license = root.joinpath("LICENSE")
combined += "--- DZGUI application license ---\n\n"
combined += self_license.read_text()
for _dir in licenses.iterdir(): for _dir in licenses.iterdir():
docs = _dir.glob("*.md") docs = _dir.glob("*")
doc = list(docs)[0] doc = list(docs)[0]
header = f"\n--- The verbatim license for bundled dependency '{_dir.name}' follows ---\n\n" header = f"\n--- The verbatim license for bundled dependency '{_dir.name}' follows ---\n\n"
combined += header combined += header
combined += doc.read_text() combined += doc.read_text()
return combined return combined

View File

@ -5,6 +5,7 @@ import tarfile
from pathlib import Path from pathlib import Path
from concat_licenses import concat_license
from prebuild import get_pyapp, rebuild_cpython from prebuild import get_pyapp, rebuild_cpython
@ -44,17 +45,25 @@ env["PYAPP_FULL_ISOLATION"] = "true"
env["PYAPP_DISTRIBUTION_PATH"] = str(cpython) env["PYAPP_DISTRIBUTION_PATH"] = str(cpython)
env["PYAPP_DISTRIBUTION_PYTHON_PATH"] = "python/bin/python3" env["PYAPP_DISTRIBUTION_PYTHON_PATH"] = "python/bin/python3"
subfolder = output.joinpath(stem)
subfolder.mkdir(parents=True)
combined_licenses = concat_licenses()
license_file = subfolder.joinpath("LICENSE")
license_file.write_text(combined_licenses)
proc = subprocess.run(["cargo", "build", "--release"], env=env, cwd=pyapp_dir) proc = subprocess.run(["cargo", "build", "--release"], env=env, cwd=pyapp_dir)
if proc.returncode == 0: if proc.returncode == 0:
output_exe = build_dir.joinpath("pyapp-latest/target/release/pyapp") output_exe = build_dir.joinpath("pyapp-latest/target/release/pyapp")
release_exe = output.joinpath(appname) release_exe = subfolder.joinpath(appname)
output_exe.rename(release_exe) output_exe.rename(release_exe)
tarpath = output.joinpath(tarname) tarpath = output.joinpath(tarname)
with tarfile.open(tarpath, "w:gz") as tar: with tarfile.open(tarpath, "w:gz") as tar:
info = tar.gettarinfo(release_exe) info = tar.gettarinfo(subfile)
info.uname = appname info.uname = appname
info.name = appname info.name = appname
with open(release_exe, "rb") as f: with open(subfolder, "rb") as f:
tar.addfile(info, f) tar.addfile(info, f)
print(f"Wrote tarfile to '{tarpath}'") print(f"Wrote tarfile to '{tarpath}'")