@@ -187,14 +187,19 @@ def add_testcase(in_file: Path) -> None:
187
187
else :
188
188
util .warn (f"No answer file found for { f } , skipping." )
189
189
190
+ # handle languages (files and yaml have to be in sync)
191
+ yaml_path = export_dir / "problem.yaml"
192
+ yaml_data = read_yaml (yaml_path )
193
+ yaml_data ["name" ] = {language : problem .settings .name [language ] for language in languages }
194
+ for type in PdfType :
195
+ for file in export_dir .glob (str (type .path ("*" ))):
196
+ if file .suffixes [- 2 ] not in languages :
197
+ file .unlink ()
198
+
190
199
# drop explicit timelimit for kattis
191
200
if config .args .kattis :
192
- yaml_path = export_dir / "problem.yaml"
193
- yaml_data = read_yaml (yaml_path )
194
201
if "limits" in yaml_data and "time_limit" in yaml_data ["limits" ]:
195
202
ryaml_filter (yaml_data ["limits" ], "time_limit" )
196
- yaml_path .unlink ()
197
- write_yaml (yaml_data , yaml_path )
198
203
199
204
# substitute constants.
200
205
if problem .settings .constants :
@@ -243,9 +248,6 @@ def add_testcase(in_file: Path) -> None:
243
248
if config .args .legacy :
244
249
from ruamel .yaml .comments import CommentedMap
245
250
246
- # handle problem.yaml
247
- yaml_path = export_dir / "problem.yaml"
248
- yaml_data = read_yaml (yaml_path )
249
251
# drop format version -> legacy
250
252
if "problem_format_version" in yaml_data :
251
253
ryaml_filter (yaml_data , "problem_format_version" )
@@ -294,9 +296,6 @@ def add_testcase(in_file: Path) -> None:
294
296
)
295
297
if validator_flags :
296
298
yaml_data ["validator_flags" ] = validator_flags
297
- # write legacy style yaml
298
- yaml_path .unlink ()
299
- write_yaml (yaml_data , yaml_path )
300
299
301
300
# handle time limit
302
301
if not config .args .kattis :
@@ -341,6 +340,10 @@ def add_testcase(in_file: Path) -> None:
341
340
add_file (out , f )
342
341
shutil .rmtree (export_dir / d )
343
342
343
+ # handle yaml updates
344
+ yaml_path .unlink ()
345
+ write_yaml (yaml_data , yaml_path )
346
+
344
347
# Build .ZIP file.
345
348
message ("writing zip file" , "Zip" , output , color_type = MessageType .LOG )
346
349
try :
0 commit comments