From d765ccacd15348d93be657687ab910f7da107f8e Mon Sep 17 00:00:00 2001 From: "Nathan A. Feger" Date: Wed, 13 Jun 2012 13:57:47 -0500 Subject: [PATCH] Add support for older version of python-apt --- apt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apt b/apt index d91c8188d3d..0d31f0ff30d 100755 --- a/apt +++ b/apt @@ -74,9 +74,17 @@ def package_status(pkgname, version, cache): except KeyError: fail_json(msg="No package matching '%s' is available" % pkgname) if version: - return pkg.is_installed and pkg.installed.version == version, False + try : + return pkg.is_installed and pkg.installed.version == version, False + except AttributeError: + #assume older version of python-apt is installed + return pkg.isInstalled and pkg.installedVersion == version, False else: - return pkg.is_installed, pkg.is_upgradable + try : + return pkg.is_installed, pkg.is_upgradable + except AttributeError: + #assume older version of python-apt is installed + return pkg.isInstalled, pkg.isUpgradable def install(pkgspec, cache, upgrade=False, default_release=None): name, version = package_split(pkgspec)