8 from debian_linux.kconfig import *
10 def merge(output, configs, overrides):
11 kconfig = KconfigFile()
14 for key, value in overrides.iteritems():
15 kconfig.set(key, value)
16 file(output, "w").write(str(kconfig))
18 def opt_callback_dict(option, opt, value, parser):
19 match = re.match('^\s*(\S+)=(\S+)\s*$', value)
21 raise optparse.OptionValueError('not key=value')
23 data = getattr(parser.values, dest)
24 data[match.group(1)] = match.group(2)
26 if __name__ == '__main__':
27 parser = optparse.OptionParser(usage = "%prog [OPTION]... FILE...")
28 parser.add_option('-o', '--override',
30 callback=opt_callback_dict,
33 help="Override option",
35 options, args = parser.parse_args()
37 merge(args[0], args[1:], options.overrides)