summaryrefslogtreecommitdiff
path: root/cli.py
diff options
context:
space:
mode:
authorJuergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com>2016-08-29 17:53:46 +0200
committerJuergen Ryannel <juergen.bocklage-ryannel@pelagicore.com>2016-11-30 10:01:19 +0100
commit25b6022bf379f0a79b807dcb427ff9fd596196fa (patch)
tree39e884c4f9b9e7d3d0b7fc6cc588fdacbedfceee /cli.py
parent55bfc734a8de2dfd658e39e0be2c7713f52b4e3c (diff)
downloadqtivi-qface-25b6022bf379f0a79b807dcb427ff9fd596196fa.tar.gz
Add YAML configuration files
Diffstat (limited to 'cli.py')
-rwxr-xr-xcli.py27
1 files changed, 26 insertions, 1 deletions
diff --git a/cli.py b/cli.py
index d7067d6..b5148ea 100755
--- a/cli.py
+++ b/cli.py
@@ -5,6 +5,11 @@ from watchdog.events import FileSystemEventHandler
from watchdog.observers import Observer
from pathlib import Path
import time
+import os
+import yaml
+
+
+os.environ['PYTHONPATH'] = os.getcwd()
def sh(cmd, all=False):
@@ -31,6 +36,7 @@ def test():
def test_ci():
sh('python3 -m pytest -v -s -l')
+
class RunTestChangeHandler(FileSystemEventHandler):
def __init__(self, clickContext):
super(RunTestChangeHandler).__init__()
@@ -46,10 +52,13 @@ class RunTestChangeHandler(FileSystemEventHandler):
@cli.command()
@click.pass_context
def test_monitor(ctx):
+ sh('python3 -m pytest -v -s -l')
while True:
event_handler = RunTestChangeHandler(ctx)
observer = Observer()
- observer.schedule(event_handler, '.', recursive=True)
+ observer.schedule(event_handler, './tests', recursive=False)
+ observer.schedule(event_handler, './examples', recursive=False)
+ observer.schedule(event_handler, './qface/idl', recursive=False)
observer.start()
try:
while True:
@@ -90,5 +99,21 @@ def generator_monitor(script):
observer.stop()
observer.join()
+
+@cli.command()
+@click.option('--runner', type=click.File('r'))
+@click.option('--generator', type=click.Path(exists=True))
+@click.option('--input', type=click.Path(exists=True))
+@click.option('--output', type=click.Path(exists=True))
+def generate(runner, generator, input, output):
+ if runner:
+ config = yaml.load(runner)
+ generator = config['generator']
+ input = config['input']
+ output = config['output']
+ input = Path(input).absolute()
+ output = Path(output).absolute()
+ sh('python3 ./generator/{0}/{0}.py --input {1} --output {2}'.format(generator, input, output))
+
if __name__ == '__main__':
cli()