MCPcopy Index your code
hub / github.com/cirosantilli/linux-kernel-module-cheat / write_configs

Method write_configs

shell_helpers.py:272–286  ·  view source on GitHub ↗

Append extra KEY=val configs into the given config file.

(self, config_path, configs, config_fragments=None, mode='a')

Source from the content-addressed store, hash-verified

270 os.unlink(path)
271
272 def write_configs(self, config_path, configs, config_fragments=None, mode='a'):
273 '''
274 Append extra KEY=val configs into the given config file.
275 '''
276 if config_fragments is None:
277 config_fragments = []
278 for config_fragment in config_fragments:
279 self.print_cmd(['cat', config_fragment, '>>', config_path])
280 if not self.dry_run:
281 with open(config_path, 'a') as config_file:
282 for config_fragment in config_fragments:
283 with open(config_fragment, 'r') as config_fragment_file:
284 for line in config_fragment_file:
285 config_file.write(line)
286 self.write_string_to_file(config_path, '\n'.join(configs), mode=mode)
287
288 def write_string_to_file(self, path, string, mode='w'):
289 if mode == 'a':

Callers

nothing calls this directly

Calls 3

print_cmdMethod · 0.95
write_string_to_fileMethod · 0.95
joinMethod · 0.80

Tested by

no test coverage detected