aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/interpreter/interpreter.py81
-rw-r--r--mesonbuild/modules/cuda.py (renamed from mesonbuild/modules/unstable_cuda.py)0
-rw-r--r--mesonbuild/modules/external_project.py (renamed from mesonbuild/modules/unstable_external_project.py)0
-rw-r--r--mesonbuild/modules/icestorm.py (renamed from mesonbuild/modules/unstable_icestorm.py)0
-rw-r--r--mesonbuild/modules/rust.py (renamed from mesonbuild/modules/unstable_rust.py)0
-rw-r--r--mesonbuild/modules/simd.py (renamed from mesonbuild/modules/unstable_simd.py)0
-rw-r--r--mesonbuild/modules/wayland.py (renamed from mesonbuild/modules/unstable_wayland.py)0
7 files changed, 50 insertions, 31 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py
index fef8f4b..9cf88d7 100644
--- a/mesonbuild/interpreter/interpreter.py
+++ b/mesonbuild/interpreter/interpreter.py
@@ -599,26 +599,6 @@ class Interpreter(InterpreterBase, HoldableObject):
dep = df.lookup(kwargs, force_fallback=True)
self.build.stdlibs[for_machine][l] = dep
- def _import_module(self, modname: str, required: bool, node: mparser.BaseNode) -> NewExtensionModule:
- if modname in self.modules:
- return self.modules[modname]
- try:
- module = importlib.import_module('mesonbuild.modules.' + modname)
- except ImportError:
- if required:
- raise InvalidArguments(f'Module "{modname}" does not exist')
- ext_module = NotFoundExtensionModule(modname)
- else:
- ext_module = module.initialize(self)
- assert isinstance(ext_module, (ExtensionModule, NewExtensionModule))
- self.build.modules.append(modname)
- if ext_module.INFO.added:
- FeatureNew.single_use(f'module {ext_module.INFO.name}', ext_module.INFO.added, self.subproject, location=node)
- if ext_module.INFO.deprecated:
- FeatureDeprecated.single_use(f'module {ext_module.INFO.name}', ext_module.INFO.deprecated, self.subproject, location=node)
- self.modules[modname] = ext_module
- return ext_module
-
@typed_pos_args('import', str)
@typed_kwargs(
'import',
@@ -633,17 +613,56 @@ class Interpreter(InterpreterBase, HoldableObject):
if disabled:
return NotFoundExtensionModule(modname)
- if modname.startswith('unstable-'):
- plainname = modname.split('-', 1)[1]
- try:
- # check if stable module exists
- mod = self._import_module(plainname, required, node)
- mlog.warning(f'Module {modname} is now stable, please use the {plainname} module instead.')
- return mod
- except InvalidArguments:
- mlog.warning(f'Module {modname} has no backwards or forwards compatibility and might not exist in future releases.', location=node)
- modname = 'unstable_' + plainname
- return self._import_module(modname, required, node)
+ expect_unstable = False
+ # Some tests use "unstable_" instead of "unstable-", and that happens to work because
+ # of implementation details
+ if modname.startswith(('unstable-', 'unstable_')):
+ real_modname = modname[len('unstable') + 1:] # + 1 to handle the - or _
+ expect_unstable = True
+ else:
+ real_modname = modname
+
+ if real_modname in self.modules:
+ return self.modules[real_modname]
+ try:
+ module = importlib.import_module(f'mesonbuild.modules.{real_modname}')
+ except ImportError:
+ if required:
+ raise InvalidArguments(f'Module "{modname}" does not exist')
+ ext_module = NotFoundExtensionModule(real_modname)
+ else:
+ ext_module = module.initialize(self)
+ assert isinstance(ext_module, (ExtensionModule, NewExtensionModule))
+ self.build.modules.append(real_modname)
+ if ext_module.INFO.added:
+ FeatureNew.single_use(f'module {ext_module.INFO.name}', ext_module.INFO.added, self.subproject, location=node)
+ if ext_module.INFO.deprecated:
+ FeatureDeprecated.single_use(f'module {ext_module.INFO.name}', ext_module.INFO.deprecated, self.subproject, location=node)
+ if expect_unstable and not ext_module.INFO.unstable and ext_module.INFO.stabilized is None:
+ raise InvalidArguments(f'Module {ext_module.INFO.name} has never been unstable, remove "unstable-" prefix.')
+ if ext_module.INFO.stabilized is not None:
+ if expect_unstable:
+ FeatureDeprecated.single_use(
+ f'module {ext_module.INFO.name} has been stabilized',
+ ext_module.INFO.stabilized, self.subproject,
+ 'drop "unstable-" prefix from the module name',
+ location=node)
+ else:
+ FeatureNew.single_use(
+ f'module {ext_module.INFO.name} as stable module',
+ ext_module.INFO.stabilized, self.subproject,
+ f'Consider either adding "unstable-" to the module name, or updating the meson required version to ">= {ext_module.INFO.stabilized}"',
+ location=node)
+ elif ext_module.INFO.unstable:
+ if not expect_unstable:
+ if required:
+ raise InvalidArguments(f'Module "{ext_module.INFO.name}" has not been stabilized, and must be imported as unstable-{ext_module.INFO.name}')
+ ext_module = NotFoundExtensionModule(real_modname)
+ else:
+ mlog.warning(f'Module {ext_module.INFO.name} has no backwards or forwards compatibility and might not exist in future releases.', location=node)
+
+ self.modules[real_modname] = ext_module
+ return ext_module
@typed_pos_args('files', varargs=str)
@noKwargs
diff --git a/mesonbuild/modules/unstable_cuda.py b/mesonbuild/modules/cuda.py
index b31459f..b31459f 100644
--- a/mesonbuild/modules/unstable_cuda.py
+++ b/mesonbuild/modules/cuda.py
diff --git a/mesonbuild/modules/unstable_external_project.py b/mesonbuild/modules/external_project.py
index 1fd4911..1fd4911 100644
--- a/mesonbuild/modules/unstable_external_project.py
+++ b/mesonbuild/modules/external_project.py
diff --git a/mesonbuild/modules/unstable_icestorm.py b/mesonbuild/modules/icestorm.py
index c579148..c579148 100644
--- a/mesonbuild/modules/unstable_icestorm.py
+++ b/mesonbuild/modules/icestorm.py
diff --git a/mesonbuild/modules/unstable_rust.py b/mesonbuild/modules/rust.py
index 792195e..792195e 100644
--- a/mesonbuild/modules/unstable_rust.py
+++ b/mesonbuild/modules/rust.py
diff --git a/mesonbuild/modules/unstable_simd.py b/mesonbuild/modules/simd.py
index a33022d..a33022d 100644
--- a/mesonbuild/modules/unstable_simd.py
+++ b/mesonbuild/modules/simd.py
diff --git a/mesonbuild/modules/unstable_wayland.py b/mesonbuild/modules/wayland.py
index aab07d4..aab07d4 100644
--- a/mesonbuild/modules/unstable_wayland.py
+++ b/mesonbuild/modules/wayland.py