aboutsummaryrefslogtreecommitdiffstats
path: root/python/mach_bootstrap.py
diff options
context:
space:
mode:
authorMukilan Thiyagarajan <mukilan@igalia.com>2023-10-30 13:23:20 +0530
committerGitHub <noreply@github.com>2023-10-30 07:53:20 +0000
commit117cc1da6c3d47a7857471524bb4962bc9d885f0 (patch)
treef6a2ebc3b88cdf0d84db3d50d7add69bc1cec11f /python/mach_bootstrap.py
parent3fde61f2e51ca3653b86eaac6ca1f3f2bed3a2f2 (diff)
downloadservo-117cc1da6c3d47a7857471524bb4962bc9d885f0.tar.gz
servo-117cc1da6c3d47a7857471524bb4962bc9d885f0.zip
mach: use `importlib` module instead of `imp` (#30645)
* mach: use `importlib` module instead of `imp` `imp` module has been deprecated since python 3.4 and has been removed in 3.12. The recommended alternative is to use the `importlib` module that was introduced in python 3.1 This is required to fix the CI failures in macos builds since GitHub runner images for macos-13 now use python 3.12 Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> * mach: use `importlib` module instead of `imp` `imp` module has been deprecated since python 3.4 and has been removed in 3.12. The recommended alternative is to use the `importlib` module that was introduced in python 3.1 This is required to fix the CI failures in macos builds since GitHub runner images for macos-13 now use python 3.12 Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com> --------- Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Diffstat (limited to 'python/mach_bootstrap.py')
-rw-r--r--python/mach_bootstrap.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/python/mach_bootstrap.py b/python/mach_bootstrap.py
index 484cdb8a710..aed66995f2e 100644
--- a/python/mach_bootstrap.py
+++ b/python/mach_bootstrap.py
@@ -140,10 +140,10 @@ def _activate_virtualenv(topdir):
activate_path = os.path.join(virtualenv_path, script_dir, "activate_this.py")
need_pip_upgrade = False
if not (os.path.exists(virtualenv_path) and os.path.exists(activate_path)):
- import imp
+ import importlib
try:
- imp.find_module('virtualenv')
- except ImportError:
+ importlib.import_module('virtualenv')
+ except ModuleNotFoundError:
sys.exit("Python virtualenv is not installed. Please install it prior to running mach.")
_process_exec([python, "-m", "virtualenv", "-p", python, "--system-site-packages", virtualenv_path])