Skip to content

Commit f2c90d7

Browse files
Update packager config factory
1 parent 98c03e2 commit f2c90d7

File tree

2 files changed

+59
-8
lines changed

2 files changed

+59
-8
lines changed

scripts/RemoteTech-Complete.json

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
{
55
"copy_list": [
66
"*.md",
7-
"*.txt"
7+
"*.txt",
8+
"*.cfg"
89
],
910
"dst_dir": null,
1011
"exception_list": [],
@@ -21,7 +22,16 @@
2122
"package_name": "RemoteTech-Antennas"
2223
},
2324
"RemoteTech-Common": {
24-
"copyable_directories": [],
25+
"copyable_directories": [
26+
{
27+
"copy_list": [
28+
"*.md"
29+
],
30+
"dst_dir": null,
31+
"exception_list": [],
32+
"src_dir": "."
33+
}
34+
],
2535
"modules": [
2636
{
2737
"dst_dir": "Plugins",
@@ -32,6 +42,14 @@
3242
},
3343
"RemoteTech-Delay": {
3444
"copyable_directories": [
45+
{
46+
"copy_list": [
47+
"*.md"
48+
],
49+
"dst_dir": null,
50+
"exception_list": [],
51+
"src_dir": "."
52+
},
3553
{
3654
"copy_list": [],
3755
"dst_dir": null,
@@ -48,7 +66,16 @@
4866
"package_name": "RemoteTech-Delay"
4967
},
5068
"RemoteTech-Transmitter": {
51-
"copyable_directories": [],
69+
"copyable_directories": [
70+
{
71+
"copy_list": [
72+
"*.md"
73+
],
74+
"dst_dir": null,
75+
"exception_list": [],
76+
"src_dir": "."
77+
}
78+
],
5279
"modules": [
5380
{
5481
"dst_dir": "Plugins",

scripts/packager_config.py

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,13 @@ def encode(file_path: str):
120120

121121
rt_antennas = PackageEntry("RemoteTech-Antennas", False)
122122

123-
# copy file in root dir
123+
# copy files in root dir
124124
rt_antennas_dir = Directory(".")
125-
patterns = ["*.md", "*.txt"]
125+
patterns = ["*.md", "*.txt", "*.cfg"]
126126
rt_antennas_dir.copy_list.extend(patterns)
127+
rt_antennas.add_copyable_directory(rt_antennas_dir)
127128

128129
# copy parts directory
129-
rt_antennas.add_copyable_directory(rt_antennas_dir)
130130
rt_antennas_parts = Directory("Parts")
131131
rt_antennas.add_copyable_directory(rt_antennas_parts)
132132

@@ -137,22 +137,45 @@ def encode(file_path: str):
137137
#
138138

139139
rt_common = PackageEntry("RemoteTech-Common")
140+
141+
# copy files in root dir
142+
rt_common_dir = Directory(".")
143+
patterns = ["*.md"]
144+
rt_common_dir.copy_list.extend(patterns)
145+
rt_common.add_copyable_directory(rt_common_dir)
146+
140147
package_dict[rt_common.package_name] = rt_common
141148

142149
#
143150
# RemoteTech-Delay
144151
#
145152

146153
rt_delay = PackageEntry("RemoteTech-Delay")
154+
155+
# copy files in root dir
156+
rt_delay_dir = Directory(".")
157+
patterns = ["*.md"]
158+
rt_delay_dir.copy_list.extend(patterns)
159+
rt_delay.add_copyable_directory(rt_delay_dir)
160+
161+
# copy texture directory
147162
delay_textures = Directory("Textures")
148163
rt_delay.add_copyable_directory(delay_textures)
164+
149165
package_dict[rt_delay.package_name] = rt_delay
150166

151167
#
152168
# RemoteTech-Transmitter
153169
#
154170

155171
rt_transmitter = PackageEntry("RemoteTech-Transmitter")
172+
173+
# copy files in root dir
174+
rt_transmitter_dir = Directory(".")
175+
patterns = ["*.md"]
176+
rt_transmitter_dir.copy_list.extend(patterns)
177+
rt_transmitter.add_copyable_directory(rt_transmitter_dir)
178+
156179
package_dict[rt_transmitter.package_name] = rt_transmitter
157180

158181
with open(file_path, "w") as f:
@@ -165,7 +188,8 @@ def main(args):
165188
if config_type == "encode":
166189
encode(DEFAULT_CONFIG_FILE)
167190
elif config_type == "decode":
168-
decode(DEFAULT_CONFIG_FILE)
191+
package_dict = decode(DEFAULT_CONFIG_FILE)
192+
# no uses of decoded JSON content are identified yet
169193
else:
170194
print("[-] Error: unknown config type: {}".format(config_type))
171195

@@ -179,7 +203,7 @@ def main(args):
179203
"-c", "--config-type", action="store", dest="config_type",
180204
choices={"encode", "decode"}, default="encode",
181205
help="Config type [default: encode]:\n\tencode (build config file)"
182-
"\n\tdecode (print current file).")
206+
"\n\tdecode (read config file).")
183207

184208
parsed_args = parser.parse_args()
185209

0 commit comments

Comments
 (0)