Skip to content

Commit 301b54d

Browse files
committed
Fix command being split for comments
These fields are not supposed to be changed, must be transferred over as is
1 parent 3f52a1c commit 301b54d

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

checkbox-ng/checkbox_ng/launcher/translator.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
from plainbox.impl.secure.rfc822 import load_rfc822_records
99

1010

11+
def identity(value):
12+
return value
13+
14+
1115
def multiline_text(value):
1216
# no more trailing spaces
1317
lines = (x.rstrip() for x in value.splitlines())
@@ -261,6 +265,10 @@ def translate_options(value):
261265

262266

263267
field_translators = {
268+
"command": identity,
269+
"Depends": identity,
270+
"Suggests": identity,
271+
"Recommends": identity,
264272
"id": commentable_value,
265273
"unit": commentable_value,
266274
"name": commentable_value,
@@ -269,17 +277,13 @@ def translate_options(value):
269277
"plugin": commentable_value,
270278
"category_id": commentable_value,
271279
"user": commentable_value,
272-
"command": commentable_value,
273280
"value-type": commentable_value,
274281
"template-resource": commentable_value,
275282
"template-unit": commentable_value,
276283
"template-id": commentable_value,
277284
"template-engine": commentable_value,
278285
"entry_point": commentable_value,
279286
"file_extension": commentable_value,
280-
"Depends": commentable_value,
281-
"Suggests": commentable_value,
282-
"Recommends": commentable_value,
283287
"os-version-id": commentable_value,
284288
"group": commentable_value,
285289
"description": multiline_text,
@@ -414,16 +418,17 @@ def invoked(self, ctx):
414418
documents = []
415419

416420
yaml = YAML()
421+
yaml.width = 120
422+
yaml.default_flow_style = False
423+
yaml.representer.add_representer(str, multiline_str_representer)
424+
yaml.indent(mapping=2, sequence=4, offset=2)
425+
417426
for unit_dict in loaded:
418427
documents.append(translate_unit(unit_dict.data))
419428

420429
header_comment = get_header_comment(text)
421430
if header_comment:
422431
documents[0].yaml_set_start_comment(header_comment)
423432

424-
yaml.width = 120
425-
yaml.default_flow_style = False
426-
yaml.representer.add_representer(str, multiline_str_representer)
427-
yaml.indent(mapping=2, sequence=4, offset=2)
428433
with path.with_suffix(".yaml").open("w+") as f:
429434
yaml.dump_all(documents, f)

0 commit comments

Comments
 (0)