Add proxy script: python modules are annoying

This commit is contained in:
Midgard 2020-01-27 19:32:03 +01:00
parent 2db02b9326
commit 5049382bf1
Signed by: midgard
GPG key ID: 511C112F1331BBB4
2 changed files with 18 additions and 2 deletions

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
from tatsu.util import asjson
from app.hlds.parser import parse_files
from hlds.parser import parse_files
USAGE = """{0} [filename]...
@ -17,7 +17,7 @@ def main(filenames):
if filenames:
location_definitions = parse_files(filenames)
else:
from app.hlds.definitions import location_definitions
from hlds.definitions import location_definitions
print("\n\n".join(map(str, location_definitions)))

16
parse_hlds.sh Executable file
View file

@ -0,0 +1,16 @@
#!/bin/bash
set -euo pipefail
# args = map(lambda arg: arg if x[0] in "/-" else pwd+arg, sys.argv[1:])
args=()
for i in "$@"; do
# If argument is not an option and not an absolute path, it's a relative path: prepend current
# working directory
case "$i" in
/*|-*) args[${#args[@]}]="$i"; ;;
*) args[${#args[@]}]="$PWD/$i"; ;;
esac
done
cd "$(dirname "$0")/app"
exec ../venv/bin/python parse_hlds.py "${args[@]}"