Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dvershinin committed Sep 22, 2023
1 parent 988813d commit 422480e
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion lastversion/GitHubRepoSession.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 3 additions & 0 deletions lastversion/GitLabRepoSession.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])

Expand Down
9 changes: 8 additions & 1 deletion lastversion/ProjectHolder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion lastversion/__about__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Package metadata"""
__version__ = '3.3.0'
__version__ = '3.3.1'
__self__ = "dvershinin/lastversion"
10 changes: 5 additions & 5 deletions lastversion/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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']:
Expand Down

0 comments on commit 422480e

Please sign in to comment.