from mako.template import Template
from xml.etree import ElementTree
+import argparse
import os
-import sys
def dbg(str):
if False:
self.engines.append(Engine(engine))
class DriConf(object):
- def __init__(self, xmlpath):
+ def __init__(self, xmlpaths):
self.devices = []
- root = ElementTree.parse(xmlpath).getroot()
+ for xmlpath in xmlpaths:
+ root = ElementTree.parse(xmlpath).getroot()
- for device in root.findall('device'):
- self.devices.append(Device(device))
+ for device in root.findall('device'):
+ self.devices.append(Device(device))
template = """\
};
"""
-xml = sys.argv[1]
-dst = sys.argv[2]
+parser = argparse.ArgumentParser()
+parser.add_argument('drirc',
+ nargs=argparse.ONE_OR_MORE,
+ help='drirc *.conf file(s) to statically include')
+parser.add_argument('header',
+ help='C header file to output the static configuration to')
+args = parser.parse_args()
+
+xml = args.drirc
+dst = args.header
with open(dst, 'wb') as f:
f.write(Template(template, output_encoding='utf-8').render(driconf=DriConf(xml)))
files_xmlconfig += custom_target(
'driconf_static.h',
- input: ['driconf_static.py', '00-mesa-defaults.conf'],
+ input: ['driconf_static.py'] + files_drirc,
output: 'driconf_static.h',
command: [
- prog_python, '@INPUT0@', '@INPUT1@', '@OUTPUT@'
+ prog_python, '@INPUT@', '@OUTPUT@',
],
)