[units.wesnoth.org] Make WML parsing timeout a commandline argument.
This commit is contained in:
parent
51d3dc1dc6
commit
ee047e7ce9
2 changed files with 15 additions and 7 deletions
|
@ -3,12 +3,13 @@
|
|||
set -e -u
|
||||
|
||||
# set them in the environment
|
||||
# VERSION=1.10
|
||||
# PORT=1.10.x
|
||||
# VERSION=1.12
|
||||
# PORT=1.12.x
|
||||
|
||||
# must run from the correct directory
|
||||
DIR="$(dirname $0)"
|
||||
|
||||
TIMEOUT=${TIMEOUT:-20}
|
||||
SOURCES=/usr/src/wesnoth
|
||||
ADDONS=$DIR/addons
|
||||
EXE=$DIR/build/wesnoth
|
||||
|
@ -21,7 +22,7 @@ OUT="elias@192.168.1.2:/srv/www/html/units/$VERSION"
|
|||
TRANS=$DIR/translations
|
||||
BUILD=$DIR/build
|
||||
# always using the master version
|
||||
TOOLS=$SOURCES/master/data/tools
|
||||
TOOLS=${TOOLS:-$SOURCES/master/data/tools}
|
||||
export TEMP=$DIR/temp
|
||||
|
||||
mkdir -p $CONFIG/data/add-ons
|
||||
|
@ -35,16 +36,16 @@ rm -rf $TEMP/*
|
|||
|
||||
# we only need the parser, but have to build the game executable for that
|
||||
echo BUILDING
|
||||
make -C $BUILD wesnoth > /dev/null 2>&1 || true
|
||||
make -C $BUILD mo-update > /dev/null 2>&1
|
||||
#make -C $BUILD wesnoth > /dev/null 2>&1 || true
|
||||
#make -C $BUILD mo-update > /dev/null 2>&1
|
||||
|
||||
# later can just rebuild updated campaigns, but for now rebuild everything
|
||||
rm -f $DIR/overview.txt
|
||||
|
||||
echo DOWNLOADING
|
||||
$TOOLS/wesnoth_addon_manager -p $PORT -d '.*' -c $ADDONS > $LOG/wesnoth_addon_manager.txt 2>&1 &&
|
||||
#$TOOLS/wesnoth_addon_manager -p $PORT -d '.*' -c $ADDONS > $LOG/wesnoth_addon_manager.txt 2>&1 &&
|
||||
echo WORKING
|
||||
python -u $TOOLS/wmlunits -t $TRANS -D $DATA -o $TMPOUT -w $EXE -C $CONFIG -a $ADDONS -L $DIR/overview.txt -B $DIR/overview.txt > $LOG/wmlunits.txt 2>&1 &&
|
||||
python -u $TOOLS/wmlunits -t $TRANS -D $DATA -o $TMPOUT -w $EXE -C $CONFIG -a $ADDONS -L $DIR/overview.txt -B $DIR/overview.txt -T $TIMEOUT # > $LOG/wmlunits.txt 2>&1 &&
|
||||
rsync -vaz --delete $TMPOUT/ $OUT > $LOG/rsync.txt 2>&1 &&
|
||||
rm -rf $TEMP/* &&
|
||||
rm -rf $TMPOUT
|
||||
|
|
|
@ -540,6 +540,7 @@ if __name__ == '__main__':
|
|||
|
||||
global options
|
||||
global image_collector
|
||||
global TIMEOUT
|
||||
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("-C", "--config-dir",
|
||||
|
@ -559,6 +560,9 @@ if __name__ == '__main__':
|
|||
ap.add_argument("-t", "--transdir",
|
||||
help="Specify the directory with gettext message catalogues. " +
|
||||
"Defaults to ./translations.", default="translations")
|
||||
ap.add_argument("-T", "--timeout",
|
||||
help="Use the timeout iven in seconds when parsing WML, default is 20 " +
|
||||
"seconds.")
|
||||
ap.add_argument("-r", "--reparse", action="store_true",
|
||||
help="Reparse everything.")
|
||||
ap.add_argument("-a", "--addons",
|
||||
|
@ -588,6 +592,9 @@ if __name__ == '__main__':
|
|||
if options.output:
|
||||
options.output = os.path.expanduser(options.output)
|
||||
|
||||
if options.timeout:
|
||||
TIMEOUT = int(options.timeout)
|
||||
|
||||
if not options.wesnoth:
|
||||
options.wesnoth = "wesnoth"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue