edit extract_assets script to support freebsd (#520)

Co-authored-by: ezntek <ezntek@xflymusic.com>
This commit is contained in:
ezntek 2023-10-16 16:28:06 +08:00 committed by GitHub
parent 54cd27ccee
commit 2256c014c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 11 deletions

View File

@ -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