summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 15:11:26 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 15:11:26 +0000
commitfcea19dfd2c426bac0456da850e7c12258e4b9eb (patch)
treea31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /tools
parentAdding upstream version 115.7.0esr. (diff)
downloadfirefox-esr-fcea19dfd2c426bac0456da850e7c12258e4b9eb.tar.xz
firefox-esr-fcea19dfd2c426bac0456da850e7c12258e4b9eb.zip
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/browsertime/mach_commands.py4
-rw-r--r--tools/lint/clippy.yml2
-rw-r--r--tools/moztreedocs/mach_commands.py6
-rw-r--r--tools/power/mach_commands.py5
-rw-r--r--tools/tryselect/test/test_mozharness_integration.py20
5 files changed, 18 insertions, 19 deletions
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"]):