def get_installed_as(self): filename = os.path.join("./cache/installed/", self.id, "installer.ini") cfg = ConfigParser() cfg.optionxform = str # Pour conserver la casse cfg.read(filename) return cfg.get("Framakey", "InstalledAs", "explicit")
def _set_installed_as(self, installed_as): """ Modifie l'option InstalledAs dans le fichier installer.ini Arguments : installed_as : 'depend' si l'application a été installée en tant que dépendance, 'explicit' si l'application a été installée explicitement """ filename = os.path.join("./cache/installed/", self.id, "installer.ini") cfg = ConfigParser() cfg.optionxform = str # Pour conserver la casse cfg.read(filename) if not cfg.has_section("Framakey"): cfg.add_section("Framakey") cfg.set("Framakey", "InstalledAs", installed_as) with open(filename, "w") as f: cfg.write(f)