Skip to content

Commit

Permalink
install-printerdriver: Improved check for need of adding driver's Deb…
Browse files Browse the repository at this point in the history
…ian repo
  • Loading branch information
tillkamppeter authored and twaugh committed Dec 10, 2014
1 parent f49c084 commit 282f500
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion install-printerdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,18 @@ def progress(progress, type, user_data):
try:
res = pk.resolve(PackageKitGlib.FilterEnum.NONE, [package],
None, lambda p, t, d: True, None)
repo_enable_needed = False
debugprint("pk.resolve succeeded")
except GLib.GError:
repo_enable_needed = True
debugprint("pk.resolve failed")
# cannot resolve, so we need to install the repo
package_ids = res.get_package_array()
if len(package_ids) <= 0:
debugprint("res.get_package_array() failed")
repo_enable_needed = True

if repo_enable_needed:
# Cannot resolve, so we need to install the repo
# add repository; see
# http://www.packagekit.org/gtk-doc/PackageKit-pk-client-sync.html#pk-client-repo-enable
debugprint("pk.repo_enable")
Expand Down

0 comments on commit 282f500

Please sign in to comment.