+ self._writeHwFiles(self.sources_dir, self.hwdir)
+ # Set properly the autoenabled parameters
+ self._setupAutoenabledParameters()
+ # Copy all the configuration files
+ self._writeCfgFiles(self.sources_dir, self.cfgdir)
+ # Destination wizard mk file
+ self._writeWizardMkFile(os.path.join(self.prjdir, os.path.basename(self.prjdir) + "_wiz.mk"))
+
+ def _newCustomBertosProject(self):
+ # Create/write/copy the common things
+ self._newBertosProject()
+ # Destination user mk file
+ self._writeUserMkFile(os.path.join(self.prjdir, os.path.basename(self.prjdir) + ".mk"))
+ # Destination main.c file
+ self._writeMainFile(self.prjdir + "/main.c")
+ # Create project files for selected plugins
+ self._createProjectFiles()
+
+ def _newBertosProjectFromPreset(self):
+ # Create/write/copy the common things
+ self._newBertosProject()
+
+ # Copy all the files and dirs except cfg/hw/*_wiz.mk
+ self._writeCustomSrcFiles()
+
+ if self.infos["EMPTY_MAIN"]:
+ # Create and empty main.c file only if the user check the box
+ self._writeMainFile(self.prjdir + "/main.c")
+
+ # Create project files for selected plugins
+ self._createProjectFiles()
+
+ def _editBertosProject(self):
+ # Write the project file
+ self._writeProjectFile(os.path.join(self.maindir, "project.bertos"))
+ # VERSION file
+ self._writeVersionFile(os.path.join(self.maindir, "VERSION"))
+ # Destination makefile
+ self._writeMakefile(os.path.join(self.maindir, "Makefile"))
+ # Merge sources
+ self._mergeSources(self.sources_dir, self.srcdir, self.old_srcdir)
+ # Copy all the hw files
+ self._writeHwFiles(self.sources_dir, self.hwdir)
+ # Set properly the autoenabled parameters
+ self._setupAutoenabledParameters()
+ # Copy all the configuration files
+ self._writeCfgFiles(self.sources_dir, self.cfgdir)
+ # Destination wizard mk file
+ self._writeWizardMkFile(os.path.join(self.prjdir, os.path.basename(self.prjdir) + "_wiz.mk"))
+ # Create project files for selected plugins
+ self._createProjectFiles()
+
+ def _createProjectFiles(self):
+ # Files for selected plugins
+ relevants_files = {}
+ for plugin in self.infos["OUTPUT"]:
+ module = loadPlugin(plugin)
+ relevants_files[plugin] = module.createProject(self)
+ self.infos["RELEVANT_FILES"] = relevants_files
+
+ def _writeVersionFile(self, filename):
+ version_file = open(os.path.join(const.DATA_DIR, "vtemplates/VERSION"), "r").read()
+ open(filename, "w").write(versionFileGenerator(self, version_file))
+
+ def _writeProjectFile(self, filename):
+ f = open(filename, "w")
+ f.write(projectFileGenerator(self))
+ f.close()
+
+ def _writeMakefile(self, filename):
+ makefile = open(os.path.join(const.DATA_DIR, "mktemplates/Makefile"), "r").read()
+ makefile = makefileGenerator(self, makefile)
+ open(filename, "w").write(makefile)
+
+ def _writeUserMkFile(self, filename):
+ makefile = open(os.path.join(const.DATA_DIR, "mktemplates/template.mk"), "r").read()
+ # Deadly performances loss was here :(
+ makefile = userMkGenerator(self, makefile)
+ open(filename, "w").write(makefile)
+
+ def _writeWizardMkFile(self, filename):
+ makefile = open(os.path.join(const.DATA_DIR, "mktemplates/template_wiz.mk"), "r").read()
+ makefile = mkGenerator(self, makefile)
+ open(filename, "w").write(makefile)
+
+ def _writeMainFile(self, filename):
+ main = open(os.path.join(const.DATA_DIR, "srctemplates/main.c"), "r").read()
+ open(filename, "w").write(main)
+
+ def _writeHwFiles(self, source_dir, destination_dir):