Always assume purged for older python-apt
Older python-apt modules don't export Package.installed_files and there seems to be no other way to figure out if a package is removed-but-not-purged, so we just always assume it's purged. Signed-off-by: martin f. krafft <madduck@madduck.net>
This commit is contained in:
parent
3d1db80fe0
commit
a52f531c5b
1 changed files with 5 additions and 1 deletions
|
@ -152,7 +152,11 @@ def package_status(m, pkgname, version, cache, state):
|
||||||
m.fail_json(msg="No package matching '%s' is available" % pkgname)
|
m.fail_json(msg="No package matching '%s' is available" % pkgname)
|
||||||
else:
|
else:
|
||||||
return False, False, False
|
return False, False, False
|
||||||
has_files = len(pkg.installed_files) > 0
|
try:
|
||||||
|
has_files = len(pkg.installed_files) > 0
|
||||||
|
except AttributeError:
|
||||||
|
has_files = False # older python-apt cannot be used to determine non-purged
|
||||||
|
|
||||||
if version:
|
if version:
|
||||||
try :
|
try :
|
||||||
return pkg.is_installed and fnmatch.fnmatch(pkg.installed.version, version), False, has_files
|
return pkg.is_installed and fnmatch.fnmatch(pkg.installed.version, version), False, has_files
|
||||||
|
|
Loading…
Reference in a new issue