aboutsummaryrefslogtreecommitdiff
path: root/src_doit/__init__.py
diff options
context:
space:
mode:
authorbozo.kopic <bozo@kopic.xyz>2021-07-28 01:43:55 +0200
committerbozo.kopic <bozo@kopic.xyz>2021-07-29 00:01:57 +0200
commit1e874e790c12839695761a654b44fb427149a353 (patch)
tree6942441ac511ec1417b2434b111101fa8d7f7e68 /src_doit/__init__.py
init
Diffstat (limited to 'src_doit/__init__.py')
-rw-r--r--src_doit/__init__.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/src_doit/__init__.py b/src_doit/__init__.py
new file mode 100644
index 0000000..e2999f2
--- /dev/null
+++ b/src_doit/__init__.py
@@ -0,0 +1,56 @@
+from pathlib import Path
+import subprocess
+import sys
+
+from . import common
+
+from .js import * # NOQA
+from .py import * # NOQA
+from . import js
+from . import py
+
+
+__all__ = ['task_clean_all',
+ 'task_build',
+ 'task_test',
+ *js.__all__,
+ *py.__all__]
+
+
+build_dir = Path('build')
+pytest_dir = Path('test_pytest')
+
+
+def task_clean_all():
+ """Clean all"""
+ return {'actions': [(common.rm_rf, [build_dir,
+ js.dst_dir,
+ py.json_schema_repo_path])]}
+
+
+def task_build():
+ """Build"""
+
+ def build():
+ subprocess.run([sys.executable, 'setup.py', '-q', 'bdist_wheel'],
+ cwd=str(build_dir),
+ check=True)
+
+ return {'actions': [build],
+ 'task_dep': ['py_build']}
+
+
+def task_test():
+ """Test"""
+
+ def run(args):
+ js.dst_dir.mkdir(parents=True, exist_ok=True)
+ subprocess.run([sys.executable, '-m', 'pytest',
+ '-s', '-p', 'no:cacheprovider',
+ *(args or [])],
+ cwd=str(pytest_dir),
+ check=True)
+
+ return {'actions': [run],
+ 'pos_arg': 'args',
+ 'task_dep': ['py_json_schema_repo']}