-
Notifications
You must be signed in to change notification settings - Fork 4
/
entrypoint.py
62 lines (48 loc) · 1.83 KB
/
entrypoint.py
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
55
56
57
58
59
60
61
62
"""
Python script to be called by a GitHub action.
This serves as the entrypoint to all Blueprint actions.
"""
from argparse import ArgumentParser
from sys import exit as sys_exit
from typing import Callable
ap = ArgumentParser()
ap.add_argument('--build-readme', action='store_true')
ap.add_argument('--lint-blueprints', action='store_true')
ap.add_argument('--notify-discord', action='store_true')
ap.add_argument('--parse-submission', action='store_true')
ap.add_argument('--parse-set-submission', action='store_true')
ap.add_argument('--resize-images', action='store_true')
ap.add_argument('--update-database', action='store_true')
args = ap.parse_args()
# Functions to run
sequence: list[Callable] = []
if args.parse_submission:
from src.build.parse_submission import parse_and_create_blueprint
sequence.append(parse_and_create_blueprint)
if args.parse_set_submission:
from src.build.parse_submission import parse_blueprint_set
sequence.append(parse_blueprint_set)
if args.lint_blueprints:
from src.build.lint_blueprints import lint_blueprints
sequence.append(lint_blueprints)
if args.update_database:
from src.build.update_database import update_database
sequence.append(update_database)
if args.resize_images:
from src.build.resize_images import resize_images
sequence.append(resize_images)
if args.build_readme:
from src.build.build_series_readme import build_series_readme
from src.build.build_master_readme import build_master_readme
sequence.append(build_series_readme)
sequence.append(build_master_readme)
if args.notify_discord:
from src.build.notify_discord import notify_discord
sequence.append(notify_discord)
for function in sequence:
try:
function()
except Exception as exc:
print(f'Some error occured: {exc}')
print(f'Exiting')
sys_exit(1)