scripts/dts/extract_dts_includes.py: Cleanup yaml file finding

Cleanup how we find the yaml files for device tree bindings.  Move to a
recursive dir search of the dts/ dir.  This will be useful for
supporting re-organizing of the yaml files to match binding dir
structure.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2017-10-23 02:32:15 -05:00 committed by Kumar Gala
commit 03fb9ff5f9
2 changed files with 7 additions and 15 deletions

View file

@ -978,12 +978,12 @@ define filechk_generated_dts_board.h
if test -e $(ZEPHYR_BASE)/dts/$(ARCH)/$(BOARD_NAME).fixup; then \ if test -e $(ZEPHYR_BASE)/dts/$(ARCH)/$(BOARD_NAME).fixup; then \
$(ZEPHYR_BASE)/scripts/dts/extract_dts_includes.py \ $(ZEPHYR_BASE)/scripts/dts/extract_dts_includes.py \
-d dts/$(ARCH)/$(BOARD_NAME).dts_compiled \ -d dts/$(ARCH)/$(BOARD_NAME).dts_compiled \
-y $(ZEPHYR_BASE)/dts/$(ARCH)/yaml \ -y $(ZEPHYR_BASE)/dts \
-f $(ZEPHYR_BASE)/dts/$(ARCH)/$(BOARD_NAME).fixup; \ -f $(ZEPHYR_BASE)/dts/$(ARCH)/$(BOARD_NAME).fixup; \
else \ else \
$(ZEPHYR_BASE)/scripts/dts/extract_dts_includes.py \ $(ZEPHYR_BASE)/scripts/dts/extract_dts_includes.py \
-d dts/$(ARCH)/$(BOARD_NAME).dts_compiled \ -d dts/$(ARCH)/$(BOARD_NAME).dts_compiled \
-y $(ZEPHYR_BASE)/dts/$(ARCH)/yaml; \ -y $(ZEPHYR_BASE)/dts; \
fi; \ fi; \
) )
endef endef
@ -991,7 +991,7 @@ define filechk_generated_dts_board.conf
(echo "# WARNING. THIS FILE IS AUTO-GENERATED. DO NOT MODIFY!"; \ (echo "# WARNING. THIS FILE IS AUTO-GENERATED. DO NOT MODIFY!"; \
$(ZEPHYR_BASE)/scripts/dts/extract_dts_includes.py \ $(ZEPHYR_BASE)/scripts/dts/extract_dts_includes.py \
-d dts/$(ARCH)/$(BOARD_NAME).dts_compiled \ -d dts/$(ARCH)/$(BOARD_NAME).dts_compiled \
-y $(ZEPHYR_BASE)/dts/$(ARCH)/yaml -k; \ -y $(ZEPHYR_BASE)/dts -k; \
) )
endef endef
else else

View file

@ -4,7 +4,7 @@
import sys import sys
from os import listdir from os import listdir
import os import os, fnmatch
import re import re
import yaml import yaml
import argparse import argparse
@ -743,17 +743,9 @@ def main():
# scan YAML files and find the ones we are interested in # scan YAML files and find the ones we are interested in
yaml_files = [] yaml_files = []
for filename in listdir(args.yaml): for root, dirnames, filenames in os.walk(args.yaml):
if re.match('.*\.yaml\Z', filename): for filename in fnmatch.filter(filenames, '*.yaml'):
yaml_files.append(os.path.realpath(args.yaml + '/' + filename)) yaml_files.append(os.path.join(root, filename))
# scan common YAML files and find the ones we are interested in
zephyrbase = os.environ.get('ZEPHYR_BASE')
if zephyrbase is not None:
for filename in listdir(zephyrbase + '/dts/common/yaml'):
if re.match('.*\.yaml\Z', filename):
yaml_files.append(os.path.realpath(
zephyrbase + '/dts/common/yaml/' + filename))
yaml_list = {} yaml_list = {}
file_load_list = set() file_load_list = set()