summaryrefslogtreecommitdiff
path: root/generate.py
blob: 26781d3f7467a6037cbb4b4f803c497bacf727ae (plain)
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
#!/usr/bin/env python3


import shutil
import subprocess
import sys
import pathlib


SCRIPT = pathlib.Path(__file__).resolve()
ROOT = SCRIPT.parent


def main() -> None:
    maybe_flutter = shutil.which("flutter")
    if maybe_flutter is None:
        print("Could not find `flutter` executable.")
        sys.exit(1)
    flutter = pathlib.Path(maybe_flutter).resolve()

    # fmt: off
    command = (
        str(flutter),
        "create",
        "--description", "'Sia app'",
        "--org", "eu.xengineering",
        "--project-name", "sia_app",
        "--platforms", "linux,android",
        "--empty",
        str(ROOT),
    )
    # fmt: on

    print(f"Running '{command_to_str(command)}'")

    subprocess.run(command, shell=False, check=True)


def command_to_str(command: tuple[str, ...]) -> str:
    retval = ""

    for index, element in enumerate(command):
        if index > 0:
            retval += " "

        retval += element

    return retval


if __name__ == "__main__":
    main()