[elbe-devel] [PATCH 1/1] Try package distro if platform

Torben Hohn torben.hohn at linutronix.de
Fri Feb 7 09:03:23 CET 2020


On Wed, Feb 05, 2020 at 09:12:03PM +0100, Bastian Germann wrote:
> Am 03.02.20 um 15:27 schrieb Olivier Dion:
> > 
> > On 2020-02-03T04:13:29-0500, Bastian Germann <bage at linutronix.de> wrote:
> > 
> >> Am 03.02.20 um 02:24 schrieb Olivier Dion:
> >> > platform.linux_distribution is deprecated since 3.5 and > removed in
> >> > 3.8, see >
> >> <https://docs.python.org/2/library/platform.html#platform.linux_distribution>.
> >>
> >> >
> >> > Since this is only the case with Py3, the distro package was > added to
> >> > the dependencies of python3-elbe-common.
> > 
> >> Isn't there a simple way to get the information without importing an
> >> additional package?
> > 
> > I would like that solution too.  The official doc says to use a package
> > like distro, however it would be possible to do it ourself.  Looking at
> > the original package.linux_distribution, it searchs for files in /etc to
> > find the distro version.
> 
> We only use the two first elements of the return value. We use it only
> in one place, which is `elbe --version` output.
> 
> It was add in d2674f30e138178a6f5e80174ffcaf807e5112b8 three years ago.
> 
> I would suggest just dropping the system version from the output or
> replace it with platform.version().

lets just revert d2674f30e138178a6f5e80174ffcaf807e5112b8

> 
> > 
> >> > Signed-off-by: Olivier Dion <dion at linutronix.de>
> >> > ---
> >> >  debian/control      | 1 +
> >> >  elbepack/version.py | 6 +++++-
> >> >  2 files changed, 6 insertions(+), 1 deletion(-)
> >> >
> >> > diff --git a/debian/control b/debian/control
> >> > index e11754a71..363d2032e 100644
> >> > --- a/debian/control
> >> > +++ b/debian/control
> >> > @@ -83,6 +83,7 @@ Depends: ${misc:Depends},
> >> >    elbe-schema (= ${binary:Version}),
> >> >    python3-elbe-bin (= ${binary:Version}),
> >> >    python3,
> >> > +  python3-distro,
> >> >    python3-lxml,
> >> >    python3-apt,
> >> >    python3-gpg,
> >> > diff --git a/elbepack/version.py b/elbepack/version.py
> >> > index 0dfe7cddb..b9da8820d 100644
> >> > --- a/elbepack/version.py
> >> > +++ b/elbepack/version.py
> >> > @@ -4,7 +4,11 @@
> >> >  #
> >> >  # SPDX-License-Identifier: GPL-3.0-or-later
> >> >
> >> > -from platform import linux_distribution
> >> > +# platform.linux_distribution is deprecated since 3.5 and > removed
> >> in 3.8
> >> > +try:
> >> > +    from platform import linux_distribution
> >> > +except ImportError:
> >> > +    from distro import linux_distribution
> >> >
> >> >  from elbepack.directories import pack_dir
> >> >
> >> >
> > 
> > 
> > -- 
> > Olivier Dion
> > Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen

-- 
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Hinweise zum Datenschutz finden Sie hier (Informations on data privacy 
can be found here): https://linutronix.de/kontakt/Datenschutz.php

Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen | 
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700 
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner



More information about the elbe-devel mailing list