def make_build(args): """ пройтись рекурсивно по всем каталогам распарсить ямл найти ссылки на файлы скпоировать файлы подправить ссылки добавить в большой ямл """ output = [b"# zoo feed version 1.0\n"] # recursive walk in source folder for root, dirs, files in os.walk(args[0]): for f in files: # skip non-yaml files if not f.lower().endswith(".yaml"): continue # skip. files if f.lower().startswith("."): continue full_path = os.path.join(root, f) # load yaml data = parse_yaml(full_path) # process loaded yaml process_yaml(full_path, data, args[0], args[1]) # save processed yaml to string dumped_yaml = YamlHelper.dump_to_string(data) output.append(dumped_yaml) # save to result file result_path = os.path.join(args[1], "feed.yaml") write_all(result_path, b''.join(output))
def make_build(args): """ пройтись рекурсивно по всем каталогам распарсить ямл найти ссылки на файлы скпоировать файлы подправить ссылки добавить в большой ямл """ output = [] # recursive walk in source folder for root, dirs, files in os.walk(args.src): for f in files: # skip non-yaml files if not f.lower().endswith(".yaml"): continue # skip. files if f.lower().startswith("."): continue full_path = os.path.join(root, f) # load yaml data = parse_yaml(full_path) # process loaded yaml process_yaml(full_path, data, args.src, args.dest) # save processed yaml to string output.append(YamlHelper.dump_to_string(data)) # save to result file result_path = os.path.join(args.dest, "feed.yaml") write_all(result_path, ''.join(output))
def format(self): """ Форматирует настройки для вывода строкой как yaml. """ return YamlHelper.dump_to_string(self.get_state()).decode()