Rely on /etc/os-release to get the release number..

This commit is contained in:
Alexandre Aubin 2018-06-12 00:29:52 +02:00
parent 201edd8c38
commit 1b55eacf9c

View file

@ -85,11 +85,13 @@ class MyMigration(Migration):
self.upgrade_yunohost_packages()
def debian_major_version(self):
# We rely on lsb_release instead of the python module "platform",
# because "platform" relies on uname, which on some weird setups does
# not behave correctly (still says running Jessie when lsb_release says
# Stretch...)
return int(check_output("lsb_release -r").split("\t")[1][0])
# The python module "platform" and lsb_release are not reliable because
# on some setup, they still return Release=8 even after upgrading to
# stretch ... (Apparently this is related to OVH overriding some stuff
# with /etc/lsb-release for instance -_-)
# Instead, we rely on /etc/os-release which should be the raw info from
# the distribution...
return int(check_output("grep VERSION_ID /etc/os-release | tr '\"' ' ' | cut -d ' ' -f2"))
def yunohost_major_version(self):
return int(get_installed_version("yunohost").split('.')[0])