From fcea19dfd2c426bac0456da850e7c12258e4b9eb Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 8 Apr 2024 17:11:26 +0200 Subject: Adding upstream version 115.8.0esr. Signed-off-by: Daniel Baumann --- tools/browsertime/mach_commands.py | 4 ++-- tools/lint/clippy.yml | 2 +- tools/moztreedocs/mach_commands.py | 6 ++---- tools/power/mach_commands.py | 5 ++--- tools/tryselect/test/test_mozharness_integration.py | 20 +++++++++++--------- 5 files changed, 18 insertions(+), 19 deletions(-) (limited to 'tools') diff --git a/tools/browsertime/mach_commands.py b/tools/browsertime/mach_commands.py index 4850c82b75..68e9e3d5e7 100644 --- a/tools/browsertime/mach_commands.py +++ b/tools/browsertime/mach_commands.py @@ -81,9 +81,9 @@ def silence(): def node_path(command_context): import platform - from distutils.version import StrictVersion from mozbuild.nodeutil import find_node_executable + from packaging.version import Version state_dir = command_context._mach_context.state_dir cache_path = os.path.join(state_dir, "browsertime", "node-16") @@ -97,7 +97,7 @@ def node_path(command_context): ) # Check standard locations first - node_exe = find_node_executable(min_version=StrictVersion(MIN_NODE_VERSION)) + node_exe = find_node_executable(min_version=Version(MIN_NODE_VERSION)) if node_exe and (node_exe[0] is not None): return os.path.abspath(node_exe[0]) if not os.path.exists(cache_path): diff --git a/tools/lint/clippy.yml b/tools/lint/clippy.yml index f735295d40..8eb8b60da9 100644 --- a/tools/lint/clippy.yml +++ b/tools/lint/clippy.yml @@ -101,7 +101,7 @@ clippy: # the version of cargo-clippy is: # clippy 0.1.65 (2019147 2022-09-19) # we use the date instead to facilitate the check - # replacing - by . because Python StrictVersion expects this + # replacing - by . because Python packaging.version.Version expects this min_clippy_version: 2022.09.19 type: external payload: clippy:lint diff --git a/tools/moztreedocs/mach_commands.py b/tools/moztreedocs/mach_commands.py index 6f44c65c20..84bdaf79fb 100644 --- a/tools/moztreedocs/mach_commands.py +++ b/tools/moztreedocs/mach_commands.py @@ -21,6 +21,7 @@ import yaml from mach.decorators import Command, CommandArgument, SubCommand from mach.registrar import Registrar from mozbuild.util import memoize +from mozfile import load_source here = os.path.abspath(os.path.dirname(__file__)) topsrcdir = os.path.abspath(os.path.dirname(os.path.dirname(here))) @@ -363,11 +364,8 @@ def toggle_no_autodoc(): @memoize def _read_project_properties(): - import imp - path = os.path.normpath(manager().conf_py_path) - with open(path, "r") as fh: - conf = imp.load_module("doc_conf", fh, path, (".py", "r", imp.PY_SOURCE)) + conf = load_source("doc_conf", path) # Prefer the Mozilla project name, falling back to Sphinx's # default variable if it isn't defined. diff --git a/tools/power/mach_commands.py b/tools/power/mach_commands.py index 956dcdf440..117a96e1c7 100644 --- a/tools/power/mach_commands.py +++ b/tools/power/mach_commands.py @@ -2,16 +2,15 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -from distutils.version import StrictVersion - from mach.decorators import Command, CommandArgument +from packaging.version import Version def is_osx_10_10_or_greater(cls): import platform release = platform.mac_ver()[0] - return release and StrictVersion(release) >= StrictVersion("10.10") + return release and Version(release) >= Version("10.10") # Get system power consumption and related measurements. diff --git a/tools/tryselect/test/test_mozharness_integration.py b/tools/tryselect/test/test_mozharness_integration.py index 984f8de25b..abeaaf370e 100644 --- a/tools/tryselect/test/test_mozharness_integration.py +++ b/tools/tryselect/test/test_mozharness_integration.py @@ -2,12 +2,12 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -import imp import json import os import mozunit import pytest +from mozfile import load_source from tryselect.tasks import build, resolve_tests_by_suite MOZHARNESS_SCRIPTS = { @@ -55,10 +55,10 @@ uses). def get_mozharness_test_paths(name): - scriptdir = os.path.join(build.topsrcdir, "testing", "mozharness", "scripts") - - files = imp.find_module(name, [scriptdir]) - mod = imp.load_module("scripts.{}".format(name), *files) + scriptdir = os.path.join(build.topsrcdir, "testing", "mozharness") + mod = load_source( + "scripts." + name, os.path.join(scriptdir, "scripts", name + ".py") + ) class_name = MOZHARNESS_SCRIPTS[name]["class_name"] cls = getattr(mod, class_name) @@ -82,13 +82,15 @@ def all_suites(): def generate_suites_from_config(path): - configdir = os.path.join(build.topsrcdir, "testing", "mozharness", "configs") - parent, name = os.path.split(path) name = os.path.splitext(name)[0] - files = imp.find_module("{}".format(name), [os.path.join(configdir, parent)]) - mod = imp.load_module("config.{}".format(name), *files) + configdir = os.path.join( + build.topsrcdir, "testing", "mozharness", "configs", parent + ) + + mod = load_source(name, os.path.join(configdir, name + ".py")) + config = mod.config for category in sorted(config["suite_definitions"]): -- cgit v1.2.3