From 3aeac6b00e1c12e08b4ff3672e031341064eef59 Mon Sep 17 00:00:00 2001 From: ezntek Date: Sun, 2 Apr 2023 19:37:04 +0800 Subject: [PATCH] edit extract_assets script to support freebsd --- extract_assets.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/extract_assets.py b/extract_assets.py index bb529348..1a99a2ce 100755 --- a/extract_assets.py +++ b/extract_assets.py @@ -2,14 +2,13 @@ import sys import os import json - +import platform def read_asset_map(): with open("assets.json") as f: ret = json.load(f) return ret - def read_local_asset_list(f): if f is None: return [] @@ -18,7 +17,6 @@ def read_local_asset_list(f): ret.append(line.strip()) return ret - def asset_needs_update(asset, version): if version <= 5 and asset == "textures/spooky/bbh_textures.00800.rgba16.png": return True @@ -34,7 +32,6 @@ def asset_needs_update(asset, version): return True return False - def remove_file(fname): os.remove(fname) print("deleting", fname) @@ -43,7 +40,6 @@ def remove_file(fname): except OSError: pass - def clean_assets(local_asset_file): assets = set(read_asset_map().keys()) assets.update(read_local_asset_list(local_asset_file)) @@ -55,7 +51,6 @@ def clean_assets(local_asset_file): except FileNotFoundError: pass - def main(): # In case we ever need to change formats of generated files, we keep a # revision ID in the local asset file. @@ -153,9 +148,14 @@ def main(): sys.exit(1) # Make sure tools exist - subprocess.check_call( - ["make", "-s", "-C", "tools/", "n64graphics", "skyconv", "mio0", "aifc_decode"] - ) + if platform.system() == "FreeBSD": + subprocess.check_call( + ["gmake", "-s", "-C", "tools/", "n64graphics", "skyconv", "mio0", "aifc_decode"] + ) + else: + subprocess.check_call( + ["make", "-s", "-C", "tools/", "n64graphics", "skyconv", "mio0", "aifc_decode"] + ) # Go through the assets in roughly alphabetical order (but assets in the same # mio0 file still go together). @@ -282,5 +282,4 @@ def main(): with open(".assets-local.txt", "w") as f: f.write(output) - -main() +main() if __name__ == "__main__" else None \ No newline at end of file