#4869 compatibility with older versions of apt
This commit is contained in:
parent
409db94d90
commit
7e709ce714
1 changed files with 19 additions and 10 deletions
|
@ -177,20 +177,29 @@ def package_status(m, pkgname, version, cache, state):
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
has_files = False # older python-apt cannot be used to determine non-purged
|
has_files = False # older python-apt cannot be used to determine non-purged
|
||||||
|
|
||||||
|
try:
|
||||||
|
package_is_installed = ll_pkg.current_state == apt_pkg.CURSTATE_INSTALLED
|
||||||
|
except AttributeError: # python-apt 0.7.X has very weak low-level object
|
||||||
|
try:
|
||||||
|
# might not be necessary as python-apt post-0.7.X should have current_state property
|
||||||
|
package_is_installed = pkg.is_installed
|
||||||
|
except AttributeError:
|
||||||
|
# assume older version of python-apt is installed
|
||||||
|
package_is_installed = pkg.isInstalled
|
||||||
|
|
||||||
if version:
|
if version:
|
||||||
try :
|
try:
|
||||||
return ll_pkg.current_state == apt_pkg.CURSTATE_INSTALLED and \
|
installed_version = pkg.installed.version
|
||||||
fnmatch.fnmatch(pkg.installed.version, version), False, has_files
|
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
#assume older version of python-apt is installed
|
installed_version = pkg.installedVersion
|
||||||
return ll_pkg.current_state == apt_pkg.CURSTATE_INSTALLED and \
|
return package_is_installed and fnmatch.fnmatch(installed_version, version), False, has_files
|
||||||
fnmatch.fnmatch(pkg.installedVersion, version), False, has_files
|
|
||||||
else:
|
else:
|
||||||
try :
|
try:
|
||||||
return ll_pkg.current_state == apt_pkg.CURSTATE_INSTALLED, pkg.is_upgradable, has_files
|
package_is_upgradable = pkg.is_upgradable
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
#assume older version of python-apt is installed
|
# assume older version of python-apt is installed
|
||||||
return ll_pkg.current_state == apt_pkg.CURSTATE_INSTALLED, pkg.isUpgradable, has_files
|
package_is_upgradable = pkg.isUpgradable
|
||||||
|
return package_is_installed, package_is_upgradable, has_files
|
||||||
|
|
||||||
def expand_dpkg_options(dpkg_options_compressed):
|
def expand_dpkg_options(dpkg_options_compressed):
|
||||||
options_list = dpkg_options_compressed.split(',')
|
options_list = dpkg_options_compressed.split(',')
|
||||||
|
|
Loading…
Reference in a new issue