Closed Bug 1601684 Opened 4 years ago Closed 3 years ago

platform.linux_distribution used by Firefox's bootstrap.py is removed in Python 3.8

Categories

(Firefox Build System :: Bootstrap Configuration, defect, P3)

70 Branch
All
Linux
defect

Tracking

(firefox74 fixed)

RESOLVED FIXED
mozilla74
Tracking Status
firefox74 --- fixed

People

(Reporter: ipickering2, Assigned: jaso35)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0

Steps to reproduce:

Attempt to run bootstrap.py as instructed by the Linux build preparation steps for Firefox (https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Simple_Firefox_build/Linux_and_MacOS_build_preparation):

python bootstrap.py --vcs=git

Actual results:

$ python bootstrap.py --vcs=git /mnt/hibiki/build/gecko2 %
Traceback (most recent call last):
File "bootstrap.py", line 194, in <module>
sys.exit(main(sys.argv))
File "bootstrap.py", line 183, in main
dasboot = cls(choice=options.application_choice, no_interactive=options.no_interactive,
File "/tmp/tmp5lugvfon/mozboot/bootstrap.py", line 248, in init
AttributeError: module 'platform' has no attribute 'linux_distribution'

This is because platform.linux_distribution() was removed in Python 3.8.

Upstream Python issue: https://bugs.python.org/issue28167

Expected results:

The bootstrap should have proceeded without any Python errors.

The bootstrap will succeed if Python 2 is used instead of Python 3.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Bootstrap Configuration
Product: Firefox → Firefox Build System

This should be analogous to bug 1212502.

We have this in openSUSE Bugzilla as a bug, and the only recommendation we had is to use distro module from PyPI, and particularly its function distro.linux_distribution() which deals with all the craziness of /etc/os-release and its friends.

I am running into the same issue trying to bootstrap using python 3.8 on Arch Linux:

$ python bootstrap.py 
Traceback (most recent call last):
  File "bootstrap.py", line 193, in <module>
    sys.exit(main(sys.argv))
  File "bootstrap.py", line 182, in main
    dasboot = cls(choice=options.application_choice, no_interactive=options.no_interactive,
  File "/tmp/tmpiq90z5z0/mozboot/bootstrap.py", line 256, in __init__
AttributeError: module 'platform' has no attribute 'linux_distribution'

testing/mozbase/mozinfo also uses the distro package so i think this might be a good solution. However platform.linux_distribution() and distro.linux_distribution() are not expected to be completely identical. This probably needs some testing.

Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Unspecified → Linux
Hardware: Unspecified → All

I tried my hand at this.
Since we cannot rely on any other packages to be present and don't want to contaminate the system environment, I'm bootstrapping into a virtual environment and install the distro package there.
Afterwards the bootstrap script is recursively run again in the new environment using distro.linux_distribution(full_distribution_name=False) to check for the relevant distro ids.

Assignee: nobody → jaso35
Status: NEW → ASSIGNED
Pushed by apavel@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/34f53b4b2284
use distro package to provide platform information r=firefox-build-system-reviewers,mshal
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla74
You need to log in before you can comment on or make changes to this bug.