Skip to content

Commit

Permalink
Fix AppImage installation
Browse files Browse the repository at this point in the history
  • Loading branch information
dvershinin committed Sep 16, 2023
1 parent 302281c commit 40607d2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
5 changes: 3 additions & 2 deletions lastversion/Version.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ def is_prerelease(self):

@property
def even(self):
"""Check if this is an even minor version"""
return self.minor and not self.minor % 2

def sem_extract_base(self, level=None):
Expand All @@ -233,9 +234,9 @@ def sem_extract_base(self, level=None):
# get major
return Version(str(self.major))
if level == 'minor':
return Version("{}.{}".format(self.major, self.minor))
return Version(f"{self.major}.{self.minor}")
if level == 'patch':
return Version("{}.{}.{}".format(self.major, self.minor, self.micro))
return Version(f"{self.major}.{self.minor}.{self.micro}")
return self

def __str__(self):
Expand Down
4 changes: 3 additions & 1 deletion lastversion/lastversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,9 @@ def main(argv=None):
if args.action == 'install':
app_images = [asset for asset in res['assets'] if asset.endswith('.AppImage')]
if app_images:
return install_app_image(app_images[0], install_name=res.get('install_name', args.repo))
return install_app_image(
app_images[0], install_name=res.get('install_name', args.repo)
)
rpms = [asset for asset in res['assets'] if asset.endswith('.rpm')]
if not rpms:
log.error('No assets found to install')
Expand Down
7 changes: 3 additions & 4 deletions lastversion/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def asset_does_not_belong_to_machine(asset_name):
Returns:
"""

# replace underscore with dash so that our shiny word boundary regexes won't break
asset_name = asset_name.replace('_', '-')
asset_ext = os.path.splitext(asset_name)[1].lstrip('.')
Expand Down Expand Up @@ -130,7 +129,6 @@ def extract_appimage_desktop_file(appimage_path):
str: Path to the extracted desktop file
"""

temp_dir = tempfile.mkdtemp()

# Extract the contents of the AppImage file to a temporary directory
Expand All @@ -149,8 +147,9 @@ def extract_appimage_desktop_file(appimage_path):
# Install the .desktop file
if desktop_file:
# if xdg-desktop-menu is not available, we can't install the .desktop file
if shutil.which("xdg-desktop-menu"):
subprocess.call(["xdg-desktop-menu", "install", desktop_file])
xdg_desktop_menu_path = shutil.which("xdg-desktop-menu")
if xdg_desktop_menu_path:
subprocess.call([xdg_desktop_menu_path, "install", desktop_file])
else:
log.warning("xdg-desktop-menu is not available, can't install the .desktop file")

Expand Down

0 comments on commit 40607d2

Please sign in to comment.