def install(self, pkg: ArchPackage, root_password: str, watcher: ProcessWatcher, skip_optdeps: bool = False) -> bool: clean_config = False if not self.local_config: self.local_config = read_config() clean_config = True if self.local_config['optimize'] and not os.path.exists( CUSTOM_MAKEPKG_FILE): watcher.change_substatus(self.i18n['arch.makepkg.optimizing']) ArchCompilationOptimizer(self.context.logger).optimize() res = self._install_from_aur(pkg.name, pkg.maintainer, root_password, ProcessHandler(watcher), dependency=False, skip_optdeps=skip_optdeps) if res: if os.path.exists(pkg.get_disk_data_path()): with open(pkg.get_disk_data_path()) as f: data = f.read() if data: data = json.loads(data) pkg.fill_cached_data(data) if clean_config: self.local_config = None return res
def write(pkg: ArchPackage): data = pkg.get_data_to_cache() Path(pkg.get_disk_cache_path()).mkdir(parents=True, exist_ok=True) with open(pkg.get_disk_data_path(), 'w+') as f: f.write(json.dumps(data))
def install(self, pkg: ArchPackage, root_password: str, watcher: ProcessWatcher, skip_optdeps: bool = False) -> bool: res = self._install_from_aur(pkg.name, pkg.maintainer, root_password, ProcessHandler(watcher), dependency=False, skip_optdeps=skip_optdeps) if res: if os.path.exists(pkg.get_disk_data_path()): with open(pkg.get_disk_data_path()) as f: data = f.read() if data: data = json.loads(data) pkg.fill_cached_data(data) return res
def write(pkg: ArchPackage, desktop_file: Optional[str] = None, command: Optional[str] = None, icon: Optional[str] = None, maintainer: Optional[str] = None, after_written: Optional[callable] = None): pkg.desktop_entry = desktop_file pkg.command = command pkg.icon_path = icon if maintainer and not pkg.maintainer: pkg.maintainer = maintainer Path(pkg.get_disk_cache_path()).mkdir(parents=True, exist_ok=True) data = pkg.get_data_to_cache() with open(pkg.get_disk_data_path(), 'w+') as f: f.write(json.dumps(data)) if after_written: after_written(pkg.name)