Open Bug 1722091 Opened 4 years ago Updated 6 days ago

Remove all Python behaviour where "sys.version_info" check is for Python < 3.9

Categories

(Firefox Build System :: Mach Core, task, P3)

task

Tracking

(Not tracked)

ASSIGNED

People

(Reporter: mhentges, Assigned: jocelyne.ah1, Mentored)

Details

(Keywords: good-first-bug, Whiteboard: [lang=python])

Attachments

(1 file)

We have a bunch of code that only runs for older Python versions. Now that Mach always runs with 3.6+, we should detect the version_info checks that are now dead code, and delete accordingly. This should simplify our codebase nicely.

Notes:

  • Careful for files that are used by Python 2 CI tasks. Some try runs associated with these changes would not go amiss.
  • While doing this ticket, leave third-party usages of sys.version_info alone. That'll be fixed when we upgrade vendored packages.
Keywords: good-first-bug
Priority: -- → P3

source code which sys.version_info < (3, 6): can be removed,
This code returns the command that some code requires Python 3.5 or greater.

if sys.version_info[0:2] < (3, 5):
print('run-task-wrapper requires Python 3.5+')
sys.exit(1)

Taegeon, would you like to give it a try?

Mentor: sledru
Whiteboard: [lang=python]

Hi Sylvestre,

I'm a new contributor and I'd like to work on this bug. I've already started looking into removing sys.version_info checks for Python < 3.9 in some files. Is it okay to check Python < 3.9 as mach is using 3.9 now? check here

Could I take this bug? I’ll make sure to avoid third-party code and test changes properly.
And I'm interested in discussing my findings.

Thanks!

Flags: needinfo?(sledru)

sounds good!

Flags: needinfo?(sledru)
Summary: Remove all Python behaviour where "sys.version_info" check is for Python < 3.6 → Remove all Python behaviour where "sys.version_info" check is for Python < 3.9

Picking this up as a good-first-bug, I found the work here already landed under bug 2018019 (already linked as "See also"), which resolved FIXED in Firefox 150 on 2026-02-27.

Per its comment 6, that stack:

  • replaced mozbuild.util.memoized_property with functools.cached_property
  • replaced mozbuild.util.memoize with functools.cache
  • removed both hand-rolled classes.

I confirmed in current mozilla-central that util.py no longer defines either, and there are no remaining first-party imports of them. This matches the direction in comments 9 and 10. The original kwargs ask (comment 0) is covered too, since functools.cache handles kwargs.

Looks like this can be closed as RESOLVED DUPLICATE of bug 2018019.

Apologies, this comment was posted here by mistake; it was meant for bug 1637820. Please disregard.

Assignee: nobody → jocelyne.ah1
Status: NEW → ASSIGNED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: