[PATCH rtems-docs] common/latex.py: use distro module for python3.5 and up
Vijay Kumar Banerjee
vijay at rtems.org
Thu Apr 1 00:03:24 UTC 2021
On Wed, Mar 31, 2021 at 4:19 PM Chris Johns <chrisj at rtems.org> wrote:
>
> Do we need to support platform as well? I have lost track of which Python we
> need build doco. I suspect it is only 3.
platform.dist is deprecated since 3.5 and removed in 3.7, so this was
certainly a piece of code that would fail with python>= 3.7, which
made me think that maybe python2 is still being used to build docs so
kept the platform import.
>
> Chris
>
> On 24/3/21 7:05 am, Vijay Kumar Banerjee wrote:
> > ---
> > common/latex.py | 7 +++++--
> > 1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/common/latex.py b/common/latex.py
> > index a042510..a1b3917 100644
> > --- a/common/latex.py
> > +++ b/common/latex.py
> > @@ -3,8 +3,11 @@
> > #
> >
> > import os
> > -import platform
> > import re
> > +try:
> > + from distro import linux_distribution
> > +except:
> > + from platform import linux_distribution
> >
> > package_test_preamble = ['\\newif\\ifsphinxKeepOldNames \\sphinxKeepOldNamestrue',
> > '\documentclass[a4paper,11pt,english]{report}']
> > @@ -82,7 +85,7 @@ def tex_test(test):
> > def host_name():
> > uname = os.uname()
> > if uname[0] == 'Linux':
> > - distro = platform.dist()
> > + distro = linux_distribution()
> > name = '%s/%s' % (uname[0], distro[0])
> > version = distro[1]
> > else:
> >
More information about the devel
mailing list