Open Bug 1212502 Opened 4 years ago Updated 11 months ago

Prepare in mozinfo for platform.linux_distribution() going away in python 3.7

Categories

(Testing :: Mozbase, defect)

defect
Not set

Tracking

(Not tracked)

People

(Reporter: aceman, Unassigned)

Details

The function linux_distribution() in the platform.py of Python seems to be going away in Python 3.7

See:
https://docs.python.org/3/library/platform.html#platform.linux_distribution and https://docs.python.org/3/whatsnew/3.5.html?highlight=linux_distribution

Also, in python 2.7 the function is returning empty distro/version on distros that have the /etc directory not world readable (only executable/enterable). See bug 1117543. Yes, this should be fixed in platform.py (for 2.7) but it seems they no longer accept fixes for this code (see final comments of https://bugs.python.org/issue1322).

So I propose to prepare to find other solution for finding this info if mozinfo and tests really need to know the distro version being run.
The timetable for the build system and Firefox automation supporting Python 3 is likely measured in years.
As per the python documentation, platform.linux_distribution() will be removed in python 3.8.

A pip package 'distro' has been named as an alternative: https://stackoverflow.com/questions/49554443/platform-linux-distribution-deprecated-what-are-the-alternatives

Looks like this is a drop-in replacement for the platform.linux_distribution() call.
You need to log in before you can comment on or make changes to this bug.