aboutsummaryrefslogtreecommitdiff
path: root/src_doit
diff options
context:
space:
mode:
Diffstat (limited to 'src_doit')
-rw-r--r--src_doit/__init__.py62
1 files changed, 62 insertions, 0 deletions
diff --git a/src_doit/__init__.py b/src_doit/__init__.py
new file mode 100644
index 0000000..6773485
--- /dev/null
+++ b/src_doit/__init__.py
@@ -0,0 +1,62 @@
+from pathlib import Path
+
+from hat import json
+from hat.doit import common
+from hat.doit.py import (build_wheel,
+ run_flake8)
+
+
+__all__ = ['task_clean_all',
+ 'task_wheel',
+ 'task_check',
+ 'task_json_schema_repo']
+
+
+build_dir = Path('build')
+src_py_dir = Path('src_py')
+schemas_json_dir = Path('schemas_json')
+
+json_schema_repo_path = src_py_dir / 'hatter/json_schema_repo.json'
+
+
+def task_clean_all():
+ """Clean all"""
+ return {'actions': [(common.rm_rf, [build_dir,
+ json_schema_repo_path])]}
+
+
+def task_wheel():
+ """Build wheel"""
+
+ def build():
+ build_wheel(
+ src_dir=src_py_dir,
+ dst_dir=build_dir,
+ name='hatter',
+ description='Continuous integration server/executor',
+ url='https://github.com/bozokopic/hatter',
+ license=common.License.GPL3,
+ packages=['hatter'],
+ console_scripts=['hatter = hatter.main:main'])
+
+ return {'actions': [build],
+ 'task_dep': ['json_schema_repo']}
+
+
+def task_check():
+ """Check"""
+ return {'actions': [(run_flake8, [src_py_dir])]}
+
+
+def task_json_schema_repo():
+ """Generate JSON Schema Repository"""
+ src_paths = list(schemas_json_dir.rglob('*.yaml'))
+
+ def generate():
+ repo = json.SchemaRepository(*src_paths)
+ data = repo.to_json()
+ json.encode_file(data, json_schema_repo_path, indent=None)
+
+ return {'actions': [generate],
+ 'file_dep': src_paths,
+ 'targets': [json_schema_repo_path]}