scripts: extract_dts_include: update to match new bindings path

Following move of dts bindings from common/yaml to bindings,
update yaml file search routine.

Signed-Off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit is contained in:
Erwan Gouriou 2017-11-17 10:44:21 +01:00 committed by Kumar Gala
commit 568fc9d91f

View file

@ -135,11 +135,13 @@ class Loader(yaml.Loader):
def extractFile(self, filename):
filepath = os.path.join(os.path.dirname(self._root), filename)
if not os.path.isfile(filepath):
# we need to look in common directory
# take path and back up 2 directories and tack on '/common/yaml'
# we need to look in bindings/* directories
# take path and back up 1 directory and parse in '/bindings/*'
filepath = os.path.dirname(self._root).split('/')
filepath = '/'.join(filepath[:-2])
filepath = os.path.join(filepath + '/common/yaml', filename)
filepath = '/'.join(filepath[:-1])
for root, dirnames, file in os.walk(filepath):
if fnmatch.filter(file, filename):
filepath = os.path.join(root, filename)
with open(filepath, 'r') as f:
return yaml.load(f, Loader)