def copy_files(self): """ Copy non-generated files into the output directory """ try: for file in self.language_plugin.get_files_to_copy(): shutil.copy(os.path.join(self.plugin_files_directory, file), os.path.join(self.output_directory, file)) except Exception as e: rethrow_formatted(e, "while copying files")
def create_directories(self): """ Create sub-directories in the output directory """ try: if not os.path.exists(self.output_directory): raise Exception("Output directory not found") for directory_name in self.language_plugin.get_output_directories(): real_directory_name = os.path.join(self.output_directory, directory_name) if not os.path.exists(real_directory_name): os.mkdir(real_directory_name) except Exception as e: rethrow_formatted(e, "while creating directories")
def create_directories(self): """ Create sub-directories in the output directory """ try: if not os.path.exists(self.output_directory): raise Exception("Output directory not found") for directory_name in self.language_plugin.get_output_directories( ): real_directory_name = os.path.join(self.output_directory, directory_name) if not os.path.exists(real_directory_name): os.mkdir(real_directory_name) except Exception as e: rethrow_formatted(e, "while creating directories")
def generate_files(self): """ Create generated files in the output directory and call back into the plugin to process tokens """ try: for template_file, output_file in self.language_plugin.get_files_to_generate(): real_template_file = os.path.join(self.plugin_files_directory, template_file) real_output_file = os.path.join(self.output_directory, output_file) template_token = TemplateToken(template_file) for stream, token, indent in FileTemplate(real_template_file, real_output_file): template_token.token = token template_token.stream = stream template_token.indent = indent self.language_plugin.process(template_token) except Exception as e: rethrow_formatted(e, "while generating files")
def generate_files(self): """ Create generated files in the output directory and call back into the plugin to process tokens """ try: for template_file, output_file in self.language_plugin.get_files_to_generate( ): real_template_file = os.path.join(self.plugin_files_directory, template_file) real_output_file = os.path.join(self.output_directory, output_file) template_token = TemplateToken(template_file) for stream, token, indent in FileTemplate( real_template_file, real_output_file): template_token.token = token template_token.stream = stream template_token.indent = indent self.language_plugin.process(template_token) except Exception as e: rethrow_formatted(e, "while generating files")