mirror of
https://github.com/mwpenny/portal64-still-alive.git
synced 2024-10-19 22:27:36 -04:00
e1e6a53aa6
No generation of dynamic model lists yet
33 lines
860 B
Python
33 lines
860 B
Python
#!/usr/bin/env python3
|
|
|
|
import subprocess
|
|
import os
|
|
import shlex
|
|
import sys
|
|
|
|
# Arguments to commands for converting assets are stored in text files
|
|
#
|
|
# This helper script allows calling the commands with the arguments from
|
|
# such files in a cross-platform way.
|
|
|
|
if __name__ == "__main__":
|
|
if len(sys.argv) < 4:
|
|
print("Runs a specified command with the given input and output file paths")
|
|
print("The command's arguments are read from a file")
|
|
print()
|
|
print(f"Usage: {sys.argv[0]} COMMAND INPUT_FILE ARGS_FILE [ARG]...")
|
|
sys.exit(1)
|
|
|
|
command, input_file, args_file, *additional_args = sys.argv[1:]
|
|
|
|
with open(args_file) as f:
|
|
args = shlex.split(f.read().strip())
|
|
|
|
rc = subprocess.run([
|
|
command,
|
|
input_file,
|
|
*args,
|
|
*additional_args
|
|
])
|
|
sys.exit(rc.returncode)
|