summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rwxr-xr-xcli.py27
-rw-r--r--tuner_cpp.yml3
3 files changed, 30 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 7e93f73..30b022b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
__pycache__
out
.idea
+output
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()
diff --git a/tuner_cpp.yml b/tuner_cpp.yml
new file mode 100644
index 0000000..5f902d8
--- /dev/null
+++ b/tuner_cpp.yml
@@ -0,0 +1,3 @@
+generator: qtcpp
+input: input
+output: output