summaryrefslogtreecommitdiffstats
path: root/testing/mozbase/mozfile
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 15:11:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 15:11:27 +0000
commitf3bcaf9f88aad2c423ebcd61121562f9834187d4 (patch)
treef22238c29b57707b645a350940e3e9bdf3ce1f5d /testing/mozbase/mozfile
parentAdding debian version 115.7.0esr-1~deb12u1. (diff)
downloadfirefox-esr-f3bcaf9f88aad2c423ebcd61121562f9834187d4.tar.xz
firefox-esr-f3bcaf9f88aad2c423ebcd61121562f9834187d4.zip
Merging upstream version 115.8.0esr.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/mozbase/mozfile')
-rw-r--r--testing/mozbase/mozfile/mozfile/mozfile.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/testing/mozbase/mozfile/mozfile/mozfile.py b/testing/mozbase/mozfile/mozfile/mozfile.py
index 1f4ffa74af..20d56fe4b2 100644
--- a/testing/mozbase/mozfile/mozfile/mozfile.py
+++ b/testing/mozbase/mozfile/mozfile/mozfile.py
@@ -22,6 +22,7 @@ __all__ = [
"extract",
"is_url",
"load",
+ "load_source",
"copy_contents",
"match",
"move",
@@ -629,6 +630,19 @@ def load(resource):
return urllib.request.urlopen(resource)
+# see https://docs.python.org/3/whatsnew/3.12.html#imp
+def load_source(modname, filename):
+ import importlib.machinery
+ import importlib.util
+
+ loader = importlib.machinery.SourceFileLoader(modname, filename)
+ spec = importlib.util.spec_from_file_location(modname, filename, loader=loader)
+ module = importlib.util.module_from_spec(spec)
+ sys.modules[module.__name__] = module
+ loader.exec_module(module)
+ return module
+
+
# We can't depend on mozpack.path here, so copy the 'match' function over.
re_cache = {}