Prepare in mozinfo for platform.linux_distribution() going away in python 3.7
Categories
(Testing :: Mozbase, defect)
Tracking
(firefox72 fixed)
Tracking | Status | |
---|---|---|
firefox72 | --- | fixed |
People
(Reporter: aceman, Assigned: egao)
References
Details
Attachments
(3 files)
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.
Comment 1•9 years ago
|
||
The timetable for the build system and Firefox automation supporting Python 3 is likely measured in years.
Assignee | ||
Comment 2•6 years ago
|
||
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.
Pushed by ahalberstadt@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ca117d13ca06 Switch mozinfo to using the 'distro' package to get linux distribution info r=ahal
Comment 5•5 years ago
|
||
Backed out changeset ca117d13ca06 (bug 1212502) for Windows 2012 build bustage. CLOSED TREE
Log:
https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=272428044&repo=autoland&lineNumber=535
Push with failures:
https://treeherder.mozilla.org/#/jobs?repo=autoland&revision=ca117d13ca06564e2fff9ee869cae602d9623fd3
Backout:
https://hg.mozilla.org/integration/autoland/rev/c10b61a2f3aca668c5964f7290252596275c1fb2
Assignee | ||
Comment 6•5 years ago
|
||
:ahal - I can take over this if you need someone to work on this.
Assignee | ||
Comment 8•5 years ago
|
||
Filed https://bugzilla.mozilla.org/show_bug.cgi?id=1590843 to have distro==1.4.0
uploaded to our internal pypi server at pypi.pub.build.mozilla.org
.
Assignee | ||
Updated•5 years ago
|
I didn't get a lot of time to test things, but it seemed like the distro package returned actual information for more distributions than platform.linux_distribution did. Hopefully that doesn't mess up test expectations or anything.
Comment 10•5 years ago
|
||
Hey Wes, I guess we didn't really ask.. If you'd still like to work on this please feel free!
I'm not in a position to continue working on this, just commenting on something I observed while I was.
Assignee | ||
Comment 12•5 years ago
|
||
(In reply to Wes Kocher (:KWierso) from comment #9)
I didn't get a lot of time to test things, but it seemed like the distro package returned actual information for more distributions than platform.linux_distribution did. Hopefully that doesn't mess up test expectations or anything.
I'm fairly confident that distro
will be a suitable drop-in replacement. It fixes some of the bugs that exist for platform.linux_distribution()
on non-Linux platforms as well, so that's a plus.
I'll adjust test harnesses and/or expectations that mess up when the switch to distro
is made.
p.s. :KWierso - thanks for getting this started.
Assignee | ||
Comment 13•5 years ago
|
||
Thanks to :jlund for uploading distro==1.4.0 to our internal pypi mirror.
I've submitted a new try run to see if this would resolve the issues seen on macosx, linux and windows.
Assignee | ||
Comment 14•5 years ago
|
||
So it looks like uploading distro
to the internal pypi mirror wasn't the solution:
linux64/opt mochitest-e10s-3:
[task 2019-10-29T22:18:18.103Z] + /builds/worker/bin/run-mozharness
[task 2019-10-29T22:18:18.108Z] Running: python2.7 /builds/worker/workspace/mozharness/scripts/desktop_unittest.py --config-file /builds/worker/workspace/mozharness/configs/unittests/linux_unittest.py --config-file /builds/worker/workspace/mozharness/configs/remove_executables.py --mochitest-suite=mochitest-plain-chunked --setpref=media.peerconnection.mtransport_process=false --setpref=network.process.enabled=false --total-chunk=5 --this-chunk=3 --download-symbols=ondemand
[task 2019-10-29T22:18:18.280Z] Traceback (most recent call last):
[task 2019-10-29T22:18:18.281Z] File "/builds/worker/workspace/mozharness/scripts/desktop_unittest.py", line 31, in <module>
[task 2019-10-29T22:18:18.281Z] from mozharness.base.script import PreScriptAction
[task 2019-10-29T22:18:18.282Z] File "/builds/worker/workspace/mozharness/mozharness/base/script.py", line 57, in <module>
[task 2019-10-29T22:18:18.282Z] import mozinfo
[task 2019-10-29T22:18:18.283Z] File "/builds/worker/workspace/mozharness/mozinfo/__init__.py", line 57, in <module>
[task 2019-10-29T22:18:18.284Z] from . import mozinfo
[task 2019-10-29T22:18:18.285Z] File "/builds/worker/workspace/mozharness/mozinfo/mozinfo.py", line 18, in <module>
[task 2019-10-29T22:18:18.286Z] import distro as distribution
[task 2019-10-29T22:18:18.286Z] ImportError: No module named distro
windows10-64:
[task 2019-10-29T21:51:36.635Z] executing ['c:/mozilla-build/python/python.exe', './build/src/testing/mozharness/scripts/fx_desktop_build.py', '--config', 'builds/releng_base_firefox.py', '--config', 'builds/taskcluster_base_windows.py', '--config', 'builds/taskcluster_base_win64.py', '--branch', 'try', '--work-dir', 'z:\\task_1572385108\\build', '--get-secrets', '--build', '--append-env-variables-from-configs']
[task 2019-10-29T21:51:36.810Z] Traceback (most recent call last):
[task 2019-10-29T21:51:36.810Z] File "./build/src/testing/mozharness/scripts/fx_desktop_build.py", line 23, in <module>
[task 2019-10-29T21:51:36.810Z] import mozharness.base.script as script
[task 2019-10-29T21:51:36.810Z] File "Z:\task_1572385108\build\src\testing\mozharness\mozharness\base\script.py", line 57, in <module>
[task 2019-10-29T21:51:36.810Z] import mozinfo
[task 2019-10-29T21:51:36.810Z] File "Z:\task_1572385108\build\src\testing\mozbase\mozinfo\mozinfo\__init__.py", line 57, in <module>
[task 2019-10-29T21:51:36.810Z] from . import mozinfo
[task 2019-10-29T21:51:36.810Z] File "Z:\task_1572385108\build\src\testing\mozbase\mozinfo\mozinfo\mozinfo.py", line 18, in <module>
[task 2019-10-29T21:51:36.810Z] import distro as distribution
[task 2019-10-29T21:51:36.810Z] ImportError: No module named distro
[fetches 2019-10-29T21:51:36.813Z] removing Z:/task_1572385108/fetches
Assignee | ||
Comment 15•5 years ago
|
||
Figured out the solution, it was hiding in plain sight the whole time - distro
package has issues with Windows and (I did not observe but) MacOSX.
Workaround was to import distro
in the Linux-specific if/else in mozinfo.py
. This would permit Windows and MacOSX builds/tests to continue running as intended.
Comment 16•5 years ago
|
||
Pushed by egao@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d2d9fe01fc33 Switch mozinfo to using the 'distro' package to get linux distribution info r=ahal,KWierso
Comment 17•5 years ago
|
||
bugherder |
Assignee | ||
Comment 19•5 years ago
|
||
(In reply to Ted Campbell [:tcampbell] from comment #18)
This seems to have re-introduced Bug 1518762.
:tcampbell - could you please clarify? Is there a treeherder push where I can see some failure logs, or is this observed locally?
Comment 20•5 years ago
|
||
This happens in local builds on machines with linux kernel 4.18+. The very first line of output when I run |./mach build|.
It should be possible to just apply the same patch from Bug 1518762 again. According to that, this is fixed in upstream psutil 5.5.0 but that is more recent than what we vendor.
Assignee | ||
Comment 21•5 years ago
|
||
Thanks for info. I'll try to set up a local virutal machine and try it out.
Comment 22•5 years ago
|
||
No need to test it out. Just revert the change to psutil your patch introduced.
This happens because we manually modified psutil
awhile back and now anytime anyone runs ./mach vendor
those manual changes get undone. I should have caught this in the review, sorry. We should also make sure there's a bug on file to prevent this from happening again (ideally by updating our vendored copy of psutil).
Assignee | ||
Comment 23•5 years ago
|
||
Assignee | ||
Comment 24•5 years ago
|
||
I've put up a patch to manually revert the changes introduced in the patch to the file third_party/python/psutil/psutil/_pslinux.py
.
I'll also put in the tracker a bug to update the vendored copy of psutil
to prevent this from happening in the future.
Comment 25•5 years ago
|
||
Pushed by egao@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/bc351b05e0d0 revert _pslinux.py file to initially vendored state r=ahal
Updated•5 years ago
|
Updated•5 years ago
|
Comment 26•5 years ago
|
||
bugherder |
Comment 27•5 years ago
|
||
bugherder landing |
Assignee | ||
Comment 28•5 years ago
|
||
Comment 29•5 years ago
|
||
Pushed by egao@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b611a31d62cc bump mozinfo version up to 1.2.0 in preparation for upload to pypi r=gbrown
Comment 30•5 years ago
|
||
bugherder |
Description
•