Skip to content

Commit 4278bf5

Browse files
mike-scottgalak
authored andcommitted
scripts/dts: Fix for PyYAML 5.1 Loader changes
PyYAML 5.1 was just released and it doesn't support !include as previous versions do. This breaks our DTS bindings parsing. Let's fix our extract_dts_include.py script to work with both 3.13 and 5.1. Also, update the pyyaml requirement to >=3.13 to be sure we're compatible. Fixes: #14496 Signed-off-by: Michael Scott <[email protected]>
1 parent a907e69 commit 4278bf5

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

scripts/dts/extract_dts_includes.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ def load_bindings(root, binding_dirs):
338338
compats = []
339339

340340
# Add '!include foo.yaml' handling
341-
yaml.add_constructor('!include', yaml_include)
341+
yaml.Loader.add_constructor('!include', yaml_include)
342342

343343
loaded_yamls = set()
344344

@@ -367,7 +367,8 @@ def load_bindings(root, binding_dirs):
367367
compats.append(compat)
368368

369369
with open(file, 'r', encoding='utf-8') as yf:
370-
binding = merge_included_bindings(file, yaml.load(yf))
370+
binding = merge_included_bindings(file,
371+
yaml.load(yf, Loader=yaml.Loader))
371372

372373
if 'parent' in binding:
373374
bus_to_binding[binding['parent']['bus']][compat] = binding
@@ -429,7 +430,7 @@ def load_binding_file(fname):
429430
"!include statement: {}".format(fname, filepaths))
430431

431432
with open(filepaths[0], 'r', encoding='utf-8') as f:
432-
return yaml.load(f)
433+
return yaml.load(f, Loader=yaml.Loader)
433434

434435

435436
def yaml_inc_error(msg):

scripts/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ docutils==0.14
55
sphinx_rtd_theme
66
sphinxcontrib-svg2pdfconverter
77
junit2html
8-
PyYAML>=3.12
8+
PyYAML>=3.13
99
ply==3.10
1010
hub==2.0
1111
gitlint

0 commit comments

Comments
 (0)