37 lines
983 B
Python
37 lines
983 B
Python
import argparse
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
|
|
root_dir = sys.path[0]
|
|
|
|
|
|
def devupdate(args):
|
|
with subprocess.Popen(
|
|
[sys.executable, '-m', 'pip', 'install', '-r',
|
|
os.path.join(root_dir, 'dev-python-requirements.txt'), ],
|
|
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=1,
|
|
universal_newlines=True) as pip:
|
|
for line in pip.stdout:
|
|
print(line, end='', flush=True)
|
|
|
|
|
|
def run(args):
|
|
import scripts.run
|
|
scripts.run.ROOT_DIR = root_dir # TODO: FIXME
|
|
scripts.run.run(args)
|
|
|
|
|
|
parser = argparse.ArgumentParser()
|
|
subparsers = parser.add_subparsers(required=True)
|
|
run_parser = subparsers.add_parser(
|
|
'run', help='Run a test instance of locality'
|
|
)
|
|
run_parser.set_defaults(func=run)
|
|
devupdate_parser = subparsers.add_parser(
|
|
'devupdate', help='Install or update packages used by this script'
|
|
)
|
|
devupdate_parser.set_defaults(func=devupdate)
|
|
args = parser.parse_args()
|
|
args.func(args)
|