Skip to content

Commit

Permalink
Handle some API breaks between AppStream versions.
Browse files Browse the repository at this point in the history
Mint 22 will have 1.0.2, but the version in debian bookworm
is only 0.16.1.
  • Loading branch information
mtwebster committed May 2, 2024
1 parent 5897b70 commit 69e4e8d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions usr/lib/linuxmint/mintinstall/mintinstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,12 @@ def run(self):
# Add additional screenshots from AppStream
if len(self.application.installer.get_screenshots(self.pkginfo)) > 0:
for screenshot in self.pkginfo.screenshots:

image = screenshot.get_image(624, 351, self.scale_factor)

# compatibility with libappstream < 1.0.0
try:
image = screenshot.get_image(624, 351, self.scale_factor)
except TypeError:
image = screenshot.get_image(624, 351)

url = self.prefix_media_base_url(image.get_url())
if requests.head(url, timeout=5).status_code < 400:
Expand Down Expand Up @@ -2912,7 +2916,11 @@ def show_package(self, pkginfo, previous_page):
ascomp = self.installer.get_appstream_app_for_pkginfo(pkginfo)

if ascomp is not None:
dev_name = ascomp.get_developer().get_name()
# compatibility with libappstream < 1.0.0
try:
dev_name = ascomp.get_developer().get_name()
except AttributeError:
dev_name = ascomp.get_developer_name()
if dev_name is not None:
self.builder.get_object("application_dev_name").set_label(_("by %s" % dev_name))
else:
Expand Down

0 comments on commit 69e4e8d

Please sign in to comment.