Changeset ae9faa2 in rtems-source-builder


Ignore:
Timestamp:
Apr 27, 2020, 7:15:27 PM (6 months ago)
Author:
Anders Montonen <Anders.Montonen@…>
Branches:
5, master
Children:
d5ad667
Parents:
0c7965c
git-author:
Anders Montonen <Anders.Montonen@…> (04/27/20 19:15:27)
git-committer:
Chris Johns <chrisj@…> (04/27/20 22:49:25)
Message:

sb/linux.py: Workaround for Python >= 3.8

The platform.dist() interface has been deprecated since Python 3.5, and
has been removed in Python 3.8.

Fixes:
Traceback (most recent call last):

File "/home/anders/work/rtems/rsb/source-builder/sb/options.py", line 682, in load

overrides = linux.load()

File "/home/anders/work/rtems/rsb/source-builder/sb/linux.py", line 60, in load

distro = platform.dist()[0]

AttributeError?: module 'platform' has no attribute 'dist'

Signed-off-by: Anders Montonen <Anders.Montonen@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source-builder/sb/linux.py

    r0c7965c rae9faa2  
    5656        }
    5757
    58     # Works for LSB distros
    59     try:
    60         distro = platform.dist()[0]
    61         distro_ver = float(platform.dist()[1])
    62     except ValueError:
    63         # Non LSB distro found, use failover"
    64         pass
     58    # platform.dist() was removed in Python 3.8
     59    if hasattr(platform, 'dist'):
     60        # Works for LSB distros
     61        try:
     62            distro = platform.dist()[0]
     63            distro_ver = float(platform.dist()[1])
     64        except ValueError:
     65         # Non LSB distro found, use failover"
     66         pass
     67    else:
     68         distro = ''
    6569
    6670    # Non LSB - fail over to issue
Note: See TracChangeset for help on using the changeset viewer.