From 3edacd75f49e798c6b4f6757f69d290cc8b4e526 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Sat, 12 Mar 2022 11:02:16 -0300 Subject: [PATCH] [arch] fix: exception when trying to retrieve the PKGBUILD of a package without a base defined (info) --- CHANGELOG.md | 4 ++++ bauh/gems/arch/mapper.py | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fcb4f1d1..b47a19a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,6 +69,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - AppImage - info: displaying attributes related to the installation after the application has been removed (search) +- Arch: + - AUR: + - info: exception when trying to retrieve the PKGBUILD of a package without a base defined + - UI - some package icons would not appear if there is no URL associated with them diff --git a/bauh/gems/arch/mapper.py b/bauh/gems/arch/mapper.py index ce1cd365..39025102 100644 --- a/bauh/gems/arch/mapper.py +++ b/bauh/gems/arch/mapper.py @@ -71,10 +71,13 @@ class AURDataMapper: with open(cached_pkgbuild) as f: pkg.pkgbuild = f.read() else: - res = self.http_client.get(pkg.get_pkg_build_url()) + url = pkg.get_pkg_build_url() - if res and res.status_code == 200 and res.text: - pkg.pkgbuild = res.text + if url: + res = self.http_client.get(url) + + if res and res.status_code == 200 and res.text: + pkg.pkgbuild = res.text def map_api_data(self, apidata: dict, pkgs_installed: Optional[dict], categories: dict) -> ArchPackage: data = pkgs_installed.get(apidata.get('Name')) if pkgs_installed else None