From 422480e0f43045cc3726488cf1770bd58f606190 Mon Sep 17 00:00:00 2001 From: Danila Vershinin Date: Fri, 22 Sep 2023 21:34:41 +0700 Subject: [PATCH] Fixes --- CHANGELOG.md | 4 ++++ lastversion/GitHubRepoSession.py | 3 ++- lastversion/GitLabRepoSession.py | 3 +++ lastversion/ProjectHolder.py | 9 ++++++++- lastversion/__about__.py | 2 +- lastversion/utils.py | 10 +++++----- 6 files changed, 23 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b24ba451..37039e8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog All notable changes to this project will be documented in this file. +## [3.3.1] - 2023-09-22 +### Fixed +* Fixed AppImage installation #107 + ## [3.3.0] - 2023-09-19 ### Added * Ability to fetch `--source` URLs for SourceForge projects diff --git a/lastversion/GitHubRepoSession.py b/lastversion/GitHubRepoSession.py index bda6c16e..202169cd 100644 --- a/lastversion/GitHubRepoSession.py +++ b/lastversion/GitHubRepoSession.py @@ -506,7 +506,8 @@ def get_releases_feed_entries(self): def enrich_release_info(self, release): """Enrich release info with data from repo.""" - release['install_name'] = self.name + if release: + release['install_name'] = self.name return release def get_latest(self, pre_ok=False, major=None): diff --git a/lastversion/GitLabRepoSession.py b/lastversion/GitLabRepoSession.py index 0507df3e..b1cb796e 100644 --- a/lastversion/GitLabRepoSession.py +++ b/lastversion/GitLabRepoSession.py @@ -103,6 +103,9 @@ def get_assets(self, release, short_urls, assets_filter=None): if assets_filter and not re.search(assets_filter, asset['name']): continue if not assets_filter and asset_does_not_belong_to_machine(asset['name']): + log.info( + 'Skipping asset %s as it does not belong to this machine.', asset['name'] + ) continue urls.append(asset['url']) diff --git a/lastversion/ProjectHolder.py b/lastversion/ProjectHolder.py index e25c1ecb..98ac2e2b 100644 --- a/lastversion/ProjectHolder.py +++ b/lastversion/ProjectHolder.py @@ -255,9 +255,13 @@ def sanitize_version(self, version_s, pre_ok=False, major=None): version_s = s[0] log.info("Sanitized tag name value to %s.", version_s) # 1.10.x is a dev release without a clear version, so even pre ok will not get it - if not version_s.endswith('.x'): + #if not version_s.endswith('.x'): + try: # we know regex is a valid version format, so no need to try catch res = Version(version_s) + except InvalidVersion: + log.info("Failed to parse %s as Version.", version_s) + continue if res: # Satisfy on the first matched version-like string, e.g. 5.2.6-3.12 break @@ -328,6 +332,9 @@ def get_assets(self, release, short_urls, assets_filter=None): if assets_filter and not re.search(assets_filter, asset['name']): continue if not assets_filter and asset_does_not_belong_to_machine(asset['name']): + log.info( + 'Asset %s does not belong to this machine, skipping', asset['name'] + ) continue urls.append(asset['browser_download_url']) else: diff --git a/lastversion/__about__.py b/lastversion/__about__.py index 46777275..ccf9dedd 100644 --- a/lastversion/__about__.py +++ b/lastversion/__about__.py @@ -1,3 +1,3 @@ """Package metadata""" -__version__ = '3.3.0' +__version__ = '3.3.1' __self__ = "dvershinin/lastversion" diff --git a/lastversion/utils.py b/lastversion/utils.py index 43370105..2c952de5 100644 --- a/lastversion/utils.py +++ b/lastversion/utils.py @@ -37,8 +37,7 @@ class BadProjectError(Exception): 'deb': ['ubuntu', 'debian'], 'rpm': ['rhel', 'centos', 'fedora', 'amazon', 'cloudlinux'], 'apk': ['alpine'], - 'dmg': ['darwin'], - 'AppImage': ['linux'] + 'dmg': ['darwin'] } # matches *start* of sys.platform value to words in asset name @@ -80,9 +79,10 @@ def asset_does_not_belong_to_machine(asset_name): return True if sys.platform.startswith('linux'): # Weeding out non-matching Linux distros - for ext, ext_distros in extension_distros.items(): - if asset_name.endswith("." + ext) and distro.id() not in ext_distros: - return True + if asset_ext != 'AppImage': + for ext, ext_distros in extension_distros.items(): + if asset_name.endswith("." + ext) and distro.id() not in ext_distros: + return True # weed out non-64 bit stuff from x86_64 bit OS # caution: may be false positive with 32-bit Python on 64-bit OS if platform.machine() in ['x86_64', 'AMD64']: