This repository has been archived by the owner on Nov 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpackage-table-extra.py
74 lines (66 loc) · 1.64 KB
/
package-table-extra.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
63
64
65
66
67
68
69
70
71
72
73
74
import os
plugins = {
"array": [
"array30",
"array30-large",
],
"boshiamy": [
"boshiamy"
],
"cangjie": [
"cangjie5",
"cangjie3",
"cangjie-large",
"scj6"
],
"cantonese": [
"cantonese",
"cantonhk",
"jyutping-table"
],
"quick": [
"quick5",
"quick3",
"quick-classic",
"easy-large"
],
"stroke": [
"t9",
"stroke5"
],
"wu": [
"wu"
],
"wubi86": [
"wubi-large"
],
"wubi98": [
"wubi98",
"wubi98-single",
"wubi98-large",
"wubi98-pinyin"
],
"zhengma": [
"zhengma",
"zhengma-large",
"zhengma-pinyin"
]
}
def ensure(command: str):
if os.system(command) != 0:
exit(1)
build_dir = os.getcwd()
# split table-extra to plugins and keep directory structures so the package script can be reused
for plugin, ims in plugins.items():
ensure(f"rm -rf {plugin}")
ensure(f"mkdir -p {plugin}/" + "tmp/data/share/fcitx5/{inputmethod,table}")
ensure(f"mkdir -p {plugin}/tmp/fcitx5")
# equivalent to f5m_split_data
for im in ims:
ensure(f"mv table-extra/tmp/fcitx5/share/fcitx5/inputmethod/{im}.conf {plugin}/tmp/data/share/fcitx5/inputmethod")
ensure(f"mv table-extra/tmp/fcitx5/share/fcitx5/table/{im}.main.dict {plugin}/tmp/data/share/fcitx5/table")
os.chdir(f"{plugin}/tmp/fcitx5")
ensure(f"python {build_dir}/../generate-descriptor.py {ims[0]}")
os.chdir("../data")
ensure(f"tar cjvf {build_dir}/{plugin}-any.tar.bz2 --no-xattrs *")
os.chdir(build_dir)