+def presetInfo(preset_dir):
+ """
+ Return the preset-relevant info contined into the project_file.
+ """
+ preset_info = pickle.loads(open(os.path.join(preset_dir, "project.bertos"), "r").read())
+ try:
+ description = open(os.path.join(preset_dir, "description"), "r").read()
+ except IOError:
+ # No description file found.
+ description = ""
+ relevant_info = {
+ "CPU_NAME": preset_info.get("CPU_NAME"),
+ "SELECTED_FREQ": preset_info.get("SELECTED_FREQ"),
+ "WIZARD_VERSION": preset_info.get("WIZARD_VERSION", None),
+ "PRESET_NAME": preset_info.get("PROJECT_NAME"),
+ "PRESET_DESCRIPTION": description.decode("utf-8"),
+ }
+ return relevant_info
+