Skip to content
Permalink
dea346ba82
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Latest commit d9f8401 Jan 26, 2020 History
0 contributors

Users who have contributed to this file

executable file 80 lines (63 sloc) 1.55 KB
#!/usr/bin/env python3
from stop import stop
from utils.settings import BASE_DIR, load_config
from utils.functions import exec_in_xmldb, run
from pathlib import Path
import subprocess
import shlex
import os
import shutil
from time import sleep
XMLDB_WAIT_TIME=20
def init_xml_db( config ):
try:
subprocess.check_call(
shlex.split( "docker-compose up -d xmldb" ),
)
print( "wait {}s for the xml database to get ready... :-P".format( XMLDB_WAIT_TIME ) )
sleep( XMLDB_WAIT_TIME )
exec_in_xmldb(
"--recurse-dirs",
"--parse", "{RES_DIR_IN_CONTAINER}/xml".format(
RES_DIR_IN_CONTAINER = config['RES_DIR_IN_CONTAINER']
)
)
except:
subprocess.check_call(
shlex.split( "docker-compose down" ),
)
def copy_dir(src, dst):
print( "'{}' -> '{}'".format( src, dst ) )
if Path(dst).exists():
shutil.rmtree(
dst
)
shutil.copytree(
src=src,
dst=dst
)
if __name__ == '__main__':
from argparse import ArgumentParser
config = load_config()
parser = ArgumentParser(
description="run the webserver"
)
parser.add_argument(
"--build",
action = "store_true"
)
parser.add_argument(
"CMD",
nargs="*"
)
args = parser.parse_args()
stop(
env = config
)
CMD= vars(args)['CMD']
run(
env=config,
build = args.build,
cmd=CMD
)
init_xml_db( config )