for section_key in config: section_config = config[section_key] if section_key not in sections: raise RuntimeError("config key {} not in sections".format(section_key)) if section_key == 'target': for target in section_config: configure_section(targets[target], section_config[target]) else: configure_section(sections[section_key], section_config) # Now that we've built up our `config.toml`, write it all out in the same # order that we read it in. p("") p("writing `config.toml` in current directory") with bootstrap.output('config.toml') as f: for section in section_order: if section == 'target': for target in targets: for line in targets[target]: f.write(line + "\n") else: for line in sections[section]: f.write(line + "\n") with bootstrap.output('Makefile') as f: contents = os.path.join(rust_dir, 'src', 'bootstrap', 'mk', 'Makefile.in') contents = open(contents).read() contents = contents.replace("$(CFG_SRC_DIR)", rust_dir + '/') contents = contents.replace("$(CFG_PYTHON)", sys.executable) f.write(contents)
for section_key in config: section_config = config[section_key] if section_key not in sections: raise RuntimeError("config key {} not in sections".format(section_key)) if section_key == 'target': for target in section_config: configure_section(targets[target], section_config[target]) else: configure_section(sections[section_key], section_config) # Now that we've built up our `config.toml`, write it all out in the same # order that we read it in. p("") p("writing `config.toml` in current directory") with bootstrap.output('config.toml') as f: for section in section_order: if section == 'target': for target in targets: for line in targets[target]: f.write(line + "\n") else: for line in sections[section]: f.write(line + "\n") with bootstrap.output('Makefile') as f: contents = os.path.join(rust_dir, 'src', 'bootstrap', 'mk', 'Makefile.in') contents = open(contents).read() contents = contents.replace("$(CFG_SRC_DIR)", rust_dir + '/') contents = contents.replace("$(CFG_PYTHON)", sys.executable) f.write(contents)