forked from subframe7536/maple-font
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask.py
More file actions
87 lines (70 loc) · 2.54 KB
/
task.py
File metadata and controls
87 lines (70 loc) · 2.54 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/env python3
import argparse
from os import path
import shutil
def main():
parser = argparse.ArgumentParser(description="Task script for Maple Font")
command = parser.add_subparsers(dest="command", help="Total tasks")
nerdfont_parser = command.add_parser("nerd-font", help="Build Nerd-Font base font")
nerdfont_parser.add_argument(
"--no-update",
action="store_true",
help="Do not check version and update if available",
)
feature_parser = command.add_parser("fea", help="Build fea files")
feature_parser.add_argument(
"--output", type=str, default="./source/features", help="Output directory"
)
feature_parser.add_argument(
"--cn",
action="store_true",
help="Generate features that contains CN features, remove exists CN feature files if not set",
)
release_parser = command.add_parser("release", help="Release new version")
release_parser.add_argument(
"tag",
type=str,
help="The tag to build the release for, e.g. 7.0 or v7.0",
)
release_parser.add_argument(
"beta",
nargs="?",
type=str,
help="Beta tag name, e.g. 3 or beta3",
)
release_parser.add_argument(
"--dry",
action="store_true",
help="Dry run",
)
page_parser = command.add_parser("page", help="Update landing page data")
page_parser.add_argument("--commit", action="store_true", help="Commit changes")
args = parser.parse_args()
if args.command == "nerd-font":
from source.py.task.nerdfont import nerd_font
nerd_font(args.no_update)
elif args.command == "fea":
from source.py.task.fea import fea
fea(args.output, args.cn)
elif args.command == "release":
from source.py.task.release import release
release(args.tag, args.beta, args.dry)
elif args.command == "page":
from source.py.task.page import page
page("./maple-font-page", "./fonts/Variable", args.commit)
else:
print("Test only")
from source.py.in_browser import main
zip_path = "./fonts/archive/MapleMono-NF-CN-unhinted.zip"
if not path.exists(zip_path):
print("No zip file, please run `uv run build --archive` first")
return
test_path = zip_path.replace(".zip", "-test.zip")
shutil.copy(zip_path, test_path)
main(
test_path,
zip_path.replace(".zip", "-result.zip"),
{"cv01": "1", "cv02": "1"},
)
if __name__ == "__main__":
main()