From ae4214475289aa6ca2c8a628b6582ed6cc864259 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Wed, 19 Jun 2013 10:56:43 +0200 Subject: [PATCH] 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 --- library/packaging/apt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/library/packaging/apt b/library/packaging/apt index a882c43c4a..49a3d7f9ab 100644 --- a/library/packaging/apt +++ b/library/packaging/apt @@ -152,7 +152,11 @@ def package_status(m, pkgname, version, cache, state): m.fail_json(msg="No package matching '%s' is available" % pkgname) else: 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: try : return pkg.is_installed and fnmatch.fnmatch(pkg.installed.version, version), False, has_files