summaryrefslogtreecommitdiff
path: root/make.py
blob: d37beb59f35d4bddbf94e7a5544f582d6b143235 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# This file is part of machinis <https://github.com/Fuwn/machinis>.
#
# All rights reserved
#
# Copyright (C) 2022-2022 Fuwn <[email protected]>
# SPDX-License-Identifier: UNLICENSED

# type: ignore

import subprocess
import sys

import sane

CC: str = {"win32": "python"}.get(sys.platform, "python3")
POETRY: str = {"win32": "poetry.bat"}.get(sys.platform, "poetry")


@sane.recipe()
def run():
    subprocess.run(f"{POETRY} run {CC} -m machinis")


@sane.recipe()
def fmt():
    subprocess.run(f"{POETRY} run black . -q")


@sane.recipe()
def sort():
    subprocess.run(f"{POETRY} run isort machinis make.py")


@sane.recipe()
def typing():
    subprocess.run(f"{POETRY} run mypy . --strict --no-error-summary")


@sane.recipe()
def spelling():
    subprocess.run(f"{POETRY} run codespell machinis make.py")


@sane.recipe()
def safety():
    subprocess.run(f"{POETRY} run safety check --bare")  # --full-report


@sane.recipe(recipe_deps=["fmt", "sort", "typing", "spelling", "safety"])
def check():
    pass


sane.sane_run(run)