Files
Triforce-Source/tests/test_appimage_licenses.py
ruckus7382sfgsgdf 4fa4f9188b Triforce v0.8.0
Evil HD (SMAA Ultra, 16x filtering, full textures, ambient occlusion with bounce light, sunlight shafts, foliage drawn 4x as far, the remastered texture pack's loader and the launcher's download of it), FSR 3.1 frame generation for every GPU, Intel XeSS, FSR 4 model choice, ReShade presets, Auto (this PC), HUD placement, the options menu in 13 languages, a second input for every control, hold to toggle, DualSense speaker and haptics, NFC from the player's own dumps, the above-60 fps game fixes, the Debug tab's flight and Inventory fixes, the launcher's full settings, and over 250 fixes.
2026-11-25 10:21:32 -06:00

63 lines
3.6 KiB
Python

"""The AppImage carries the licences of the third-party parts compiled into hookshot_vk.so: Dear ImGui (MIT), zstd (BSD) and
the Libertinus fonts (OFL), each with its PROVENANCE.md. Runs the real copy block of scripts/linux/appimage.sh into a temporary
folder; nothing is built.
python -I -B tests/test_appimage_licenses.py
"""
import os
import subprocess
import sys
import tempfile
import unittest
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
WANT = {
"licenses/imgui/LICENSE.txt": "third_party/imgui/LICENSE.txt",
"licenses/imgui/PROVENANCE.md": "third_party/imgui/PROVENANCE.md",
"licenses/zstd/LICENSE": "third_party/zstd/LICENSE",
"licenses/zstd/PROVENANCE.md": "third_party/zstd/PROVENANCE.md",
"licenses/libertinus/OFL.txt": "third_party/fonts/libertinus/OFL.txt",
"licenses/libertinus/PROVENANCE.md": "third_party/fonts/PROVENANCE.md",
"licenses/fidelityfx/LICENSE.md": "third_party/fidelityfx/LICENSE.md", # ((Triforce) 11-20: FSR 4's headers in the image)
"licenses/fidelityfx-sdk/LICENSE.txt": "third_party/fidelityfx-sdk/LICENSE.txt", # ((Triforce) 11-24: FSR 3.1's shaders
"licenses/fidelityfx-sdk/PROVENANCE.md": "third_party/fidelityfx-sdk/PROVENANCE.md",
"licenses/reshade_fx/LICENSE.md": "third_party/reshade_fx/LICENSE.md", # ((Triforce) the ReShade presets' compiler
"licenses/reshade_fx/PROVENANCE.md": "third_party/reshade_fx/PROVENANCE.md",
"licenses/stb_image/LICENSE": "third_party/stb_image/LICENSE",
"licenses/stb_image/PROVENANCE.md": "third_party/stb_image/PROVENANCE.md",
}
class AppImageLicences(unittest.TestCase):
# (the AppImage is made on Linux; Windows runners have no usable bash for the script's block)
@unittest.skipUnless(sys.platform.startswith("linux"), "the AppImage is made on Linux")
def test_copied(self):
script = (ROOT / "scripts/linux/appimage.sh").read_text(encoding="utf-8")
start = script.index("# ---- the licences of the third-party parts compiled into hookshot_vk.so")
end = script.index("# ---- end of the licences ----", start)
with tempfile.TemporaryDirectory(prefix="hookshot-appimage-licences-") as folder:
env = dict(os.environ, T=folder)
result = subprocess.run(["bash", "-eu", "-o", "pipefail", "-c", script[start:end]], cwd=ROOT, env=env,
capture_output=True, text=True)
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
for shipped, source in WANT.items():
self.assertEqual((Path(folder) / shipped).read_bytes(), (ROOT / source).read_bytes(), shipped)
def test_block_after_the_deps_licences(self):
# (cp -a of the deps' licences into an existing folder would nest it: this block must come after)
script = (ROOT / "scripts/linux/appimage.sh").read_text(encoding="utf-8")
self.assertLess(script.index('cp -a "$DEPS/licenses" "$T/licenses"'),
script.index("# ---- the licences of the third-party parts compiled into hookshot_vk.so"))
def test_vk_third_party_covered(self):
# (every third_party folder the Vulkan back end compiles in, from nx2/build.py, has its licence shipped)
build = (ROOT / "nx2/build.py").read_text(encoding="utf-8") + (ROOT / "nx2/ui_fonts.py").read_text(encoding="utf-8")
for part, licence in (("imgui", "licenses/imgui/"), ("zstd", "licenses/zstd/"), ("fonts", "licenses/libertinus/")):
if '"third_party", "%s"' % part in build:
self.assertTrue(any(k.startswith(licence) for k in WANT), part)
if __name__ == "__main__":
unittest.main()