summaryrefslogtreecommitdiffstats
path: root/python/mach
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 15:12:12 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 15:12:12 +0000
commita7c14e2f29831f4bc5eb18e23e55eb6f7a4e3431 (patch)
tree54617b4f5f04ee87a2c9e3b97cc88b8626859124 /python/mach
parentReleasing progress-linux version 115.7.0esr-1~deb12u1progress7u1. (diff)
downloadfirefox-esr-a7c14e2f29831f4bc5eb18e23e55eb6f7a4e3431.tar.xz
firefox-esr-a7c14e2f29831f4bc5eb18e23e55eb6f7a4e3431.zip
Merging upstream version 115.8.0esr.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'python/mach')
-rw-r--r--python/mach/mach/main.py8
-rw-r--r--python/mach/mach/test/test_entry_point.py4
2 files changed, 7 insertions, 5 deletions
diff --git a/python/mach/mach/main.py b/python/mach/mach/main.py
index 9ab880341d..6c32ce2058 100644
--- a/python/mach/mach/main.py
+++ b/python/mach/mach/main.py
@@ -8,16 +8,18 @@
import argparse
import codecs
import errno
-import imp
import logging
import os
import sys
import traceback
+import types
import uuid
from collections.abc import Iterable
from pathlib import Path
from typing import Dict, List, Union
+from mozfile import load_source
+
from .base import (
CommandContext,
FailedCommandError,
@@ -267,13 +269,13 @@ To see more help for a specific command, run:
# Ensure parent module is present otherwise we'll (likely) get
# an error due to unknown parent.
if "mach.commands" not in sys.modules:
- mod = imp.new_module("mach.commands")
+ mod = types.ModuleType("mach.commands")
sys.modules["mach.commands"] = mod
module_name = f"mach.commands.{uuid.uuid4().hex}"
try:
- imp.load_source(module_name, str(path))
+ load_source(module_name, str(path))
except IOError as e:
if e.errno != errno.ENOENT:
raise
diff --git a/python/mach/mach/test/test_entry_point.py b/python/mach/mach/test/test_entry_point.py
index 1129eba476..11aa083cda 100644
--- a/python/mach/mach/test/test_entry_point.py
+++ b/python/mach/mach/test/test_entry_point.py
@@ -1,8 +1,8 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# 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 sys
+import types
from pathlib import Path
from unittest.mock import patch
@@ -38,7 +38,7 @@ class TestEntryPoints(TestBase):
# Ensure parent module is present otherwise we'll (likely) get
# an error due to unknown parent.
if "mach.commands" not in sys.modules:
- mod = imp.new_module("mach.commands")
+ mod = types.ModuleType("mach.commands")
sys.modules["mach.commands"] = mod
mock.return_value = [Entry([self.provider_dir])]