tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit c6424f58b3465dc251c17d94cf07ad6bc495ca68
parent 4d32532f512840ad040da8c0845181c8fbff6d63
Author: Julien Cristau <jcristau@mozilla.com>
Date:   Tue,  7 Oct 2025 09:26:05 +0000

Bug 1992719 - stop using deprecated distro.linux_distribution. r=jmaher,firefox-build-system-reviewers,glandium

Differential Revision: https://phabricator.services.mozilla.com/D267598

Diffstat:
Mpython/mozboot/mozboot/bootstrap.py | 6++----
Mpython/mozboot/mozboot/debian.py | 3+--
Mpython/mozbuild/mozbuild/telemetry.py | 3+--
Mtesting/mozbase/mozinfo/mozinfo/mozinfo.py | 15+++------------
4 files changed, 7 insertions(+), 20 deletions(-)

diff --git a/python/mozboot/mozboot/bootstrap.py b/python/mozboot/mozboot/bootstrap.py @@ -256,9 +256,8 @@ class Bootstrapper: if sys.platform.startswith("linux"): # distro package provides reliable ids for popular distributions so # we use those instead of the full distribution name - dist_id, version, codename = distro.linux_distribution( - full_distribution_name=False - ) + dist_id = distro.id() + version = distro.version() if dist_id in FEDORA_DISTROS: cls = CentOSFedoraBootstrapper @@ -266,7 +265,6 @@ class Bootstrapper: elif dist_id in DEBIAN_DISTROS: cls = DebianBootstrapper args["distro"] = dist_id - args["codename"] = codename elif dist_id in ("gentoo", "funtoo"): cls = GentooBootstrapper elif dist_id in ("solus"): diff --git a/python/mozboot/mozboot/debian.py b/python/mozboot/mozboot/debian.py @@ -10,13 +10,12 @@ from mozboot.linux_common import LinuxBootstrapper class DebianBootstrapper(LinuxBootstrapper, BaseBootstrapper): - def __init__(self, distro, version, dist_id, codename, **kwargs): + def __init__(self, distro, version, dist_id, **kwargs): BaseBootstrapper.__init__(self, **kwargs) self.distro = distro self.version = version self.dist_id = dist_id - self.codename = codename def suggest_install_pip3(self): print( diff --git a/python/mozbuild/mozbuild/telemetry.py b/python/mozbuild/mozbuild/telemetry.py @@ -145,8 +145,7 @@ def filter_args(command, argv, topsrcdir, topobjdir, cwd=None): def get_distro_and_version(): if sys.platform.startswith("linux"): - dist, version, _ = distro.linux_distribution(full_distribution_name=False) - return dist, version + return distro.id(), distro.version() elif sys.platform.startswith("darwin"): return "macos", platform.mac_ver()[0] elif sys.platform.startswith("win32") or sys.platform.startswith("msys"): diff --git a/testing/mozbase/mozinfo/mozinfo/mozinfo.py b/testing/mozbase/mozinfo/mozinfo/mozinfo.py @@ -75,17 +75,10 @@ elif system.startswith(("MINGW", "MSYS_NT")): info["os"] = "win" os_version = version = unknown elif system == "Linux": - # Attempt to use distro package to determine Linux distribution first. - # Failing that, fall back to use the platform method. - # Note that platform.linux_distribution() will be deprecated as of 3.8 - # and this block will be removed once support for 2.7/3.5 is dropped. - try: - from distro import linux_distribution - except ImportError: - from platform import linux_distribution + import distro - output = linux_distribution() - (distribution, os_version, codename) = tuple(str(item.title()) for item in output) + distribution = distro.name().title() + os_version = distro.version().title() if not processor: processor = machine @@ -93,8 +86,6 @@ elif system == "Linux": distribution = "lfs" if not os_version: os_version = release - if not codename: - codename = "unknown" version = "%s %s" % (distribution, os_version) if os.environ.get("WAYLAND_DISPLAY"):