From cc4ba3b063f14943579ffbfe416828590f70ae0a Mon Sep 17 00:00:00 2001 From: "bozo.kopic" Date: Tue, 22 Mar 2022 01:31:27 +0100 Subject: WIP major rewrite --- src_doit/__init__.py | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src_doit/__init__.py (limited to 'src_doit') 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]} -- cgit v1.2.3-70-g09d2