def main(): mentors_data = Mentors() mentors_data.load(options.mentors) tasks = Tasks([], mentors_data=mentors_data, issues_dir = options.issues_dir) tasks.load(options.task_list) categories = tasks.categories difficulties = tasks.difficulties templ = Template(filename=options.template, output_encoding='utf-8') output = templ.render(tasks=tasks, categories=categories, difficulties=difficulties) with open(options.output_file, "w") as f: f.write(output) logging.info("") logging.info("File '%s' is generated." % options.output_file)
def main(): if options.recreate and os.path.exists(options.output_file): a = raw_input("Are you sure you want to delete '%s' file? : yes/[no] > " % options.output_file) if a != "yes": options.recreate = False if not ask_create_dir(options.output_file, False): sys.exit() mentors_data = Mentors() mentors_data.load(options.mentors) source_tasks = Tasks([], mentors_data=mentors_data, issues_dir = options.issues_dir) source_tasks.load(options.task_list) if os.path.exists(options.output_file) and not options.recreate: update_tasks = Tasks() update_tasks.load(options.output_file) update_tasks.update(source_tasks) else: update_tasks = source_tasks for task in update_tasks: _id = None try: _id = task.Id except: pass if not _id: _id = task.serach_issue_id() if _id: task["Id"] = _id update_tasks.extend_fieldnames(['Id']) update_tasks.save(options.output_file)