+ self._writeHwFiles(self.bertos_srcdir, self.hwdir)
+ # Destination user mk file
+ self._writeUserMkFile()
+ # 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/*.mk
+ self._writeCustomSrcFiles()
+
+ # Copy the hw files
+ self._writeAllPresetHwFiles(self.src_hwdir, self.hwdir)
+
+ # Copyt the new *_user.mk file
+ self._writeUserMkFileFromPreset()
+
+ # Create project files for selected plugins
+ self._createProjectFiles()
+
+ def _editBertosProject(self):
+ # Write the project file
+ self._writeProjectFile(os.path.join(self.maindir, "project.bertos"))
+ if not self.is_preset:
+ # Generate this files only if the project isn't a preset
+ # VERSION file
+ self._writeVersionFile(os.path.join(self.maindir, "VERSION"))
+ # Destination makefile
+ self._writeMakefile()
+ # Merge sources
+ self._mergeSources(self.bertos_maindir, self.srcdir, self.old_srcdir)
+ # Copy all the hw files
+ self._writeHwFiles(self.bertos_srcdir, self.hwdir)
+
+ # Destination wizard mk file (it seems that this file need to be
+ # rewritten also if the project is a preset)...
+ self._writeWizardMkFile()
+
+ # Set properly the autoenabled parameters
+ self._setupAutoenabledParameters()
+ # Copy all the configuration files
+ self._writeCfgFiles(self.bertos_srcdir, self.cfgdir)
+ if not self.is_preset:
+ # Create project files for selected plugins only if the project isn't a preset
+ 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):
+ if not self.edit or self.old_srcdir:
+ 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):
+ bertos_utils.makefileGenerator(self)
+
+ def _writeUserMkFile(self):
+ bertos_utils.userMkGenerator(self)
+
+ def _writeUserMkFileFromPreset(self):
+ bertos_utils.userMkGeneratorFromPreset(self)
+
+ def _writeWizardMkFile(self):
+ bertos_utils.mkGenerator(self)
+
+ 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):