python-distro / distro

A much more elaborate replacement for removed Python's `platform.linux_distribution()` method
https://distro.readthedocs.io/
Apache License 2.0
265 stars 66 forks source link

Supports `debian_version` file content for `version(best=True)` calls #333

Closed HorlogeSkynet closed 2 years ago

HorlogeSkynet commented 2 years ago

Dear @python-distro/maintainers,


From ansible/ansible#77928 and #332, it appeared that Debian >= 9 do not ship anymore the MINOR SemVer segment in lsb_release "distribution release" output. This means that setting best=True cannot be used to retrieve it, and thus version(best=True) behaves differently across Debian < 10 and Debian >= 10.

This patch implements /etc/debian_version file parsing to workaround this issue, on "Debian-like" distributions.


Many thanks, bye :wave:

HorlogeSkynet commented 2 years ago

Hi @HorlogeSkynet I like the general direction +1, please see two comments on details below:

Hey @hartwork ! Thanks for your quick feedback, see my replies to your comments :wink: