Answer by pmhahn for How to compare Debian package versions?
As you already mentioned python-apt and python-debian, but it is 2022 by now and Python 2.7 is end-of-life, here's the Python 3 code for a Debian based system, where you have installed...
View ArticleAnswer by Jeremy Davis for How to compare Debian package versions?
python-debian can do this too. It's used in an almost identical way to python-apt:from debian import debian_support a = '1:1.3.10-0.3'b = '1.3.4-1'vc = debian_support.version_compare(a,b)if vc > 0:...
View ArticleAnswer by Martin Dorey for How to compare Debian package versions?
Perhaps because the title doesn't mention Python (though the tags do), Google brought me here when asking the same question but hoping for a bash answer. That seems to be:$ dpkg --compare-versions 11a...
View ArticleAnswer by unutbu for How to compare Debian package versions?
You could use apt_pkg.version_compare:import apt_pkgapt_pkg.init_system()a = '1:1.3.10-0.3'b = '1.3.4-1'vc = apt_pkg.version_compare(a,b)if vc > 0: print('version a > version b')elif vc == 0:...
View ArticleHow to compare Debian package versions?
I looked at python-apt and python-debian, and they don't seem to have functionality to compare package versions. Do I have to write my own, or is there something I can use?Ideally, it would look...
View Article