diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2022-07-14 15:09:28 -0700 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2022-08-17 16:25:36 -0400 |
commit | 429e7c1edc7ef76b728b624dbd3b68834c253117 (patch) | |
tree | 81ee792887f60a37992d4363f333a52cfd3e7f3c | |
parent | a78992dd81b4bd1673e4815ff26acd694ff77f68 (diff) | |
download | meson-429e7c1edc7ef76b728b624dbd3b68834c253117.zip meson-429e7c1edc7ef76b728b624dbd3b68834c253117.tar.gz meson-429e7c1edc7ef76b728b624dbd3b68834c253117.tar.bz2 |
interpreter: deprecate the ability import unstable modules as `unstable_*`
This was never meant to work, it's an implementation detail of using
`importlib.import_module` and that our modules used to be named
`unstable_` that this ever worked.
-rw-r--r-- | mesonbuild/interpreter/interpreter.py | 3 | ||||
-rw-r--r-- | test cases/common/253 module warnings/meson.build | 1 | ||||
-rw-r--r-- | test cases/common/253 module warnings/test.json | 3 |
3 files changed, 7 insertions, 0 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index 9cf88d7..5752d4c 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -617,6 +617,9 @@ class Interpreter(InterpreterBase, HoldableObject): # Some tests use "unstable_" instead of "unstable-", and that happens to work because # of implementation details if modname.startswith(('unstable-', 'unstable_')): + if modname.startswith('unstable_'): + mlog.deprecation(f'Importing unstable modules as "{modname}" instead of "{modname.replace("_", "-", 1)}"', + location=node) real_modname = modname[len('unstable') + 1:] # + 1 to handle the - or _ expect_unstable = True else: diff --git a/test cases/common/253 module warnings/meson.build b/test cases/common/253 module warnings/meson.build index 8397930..56e2055 100644 --- a/test cases/common/253 module warnings/meson.build +++ b/test cases/common/253 module warnings/meson.build @@ -3,6 +3,7 @@ project('module warnings', meson_version : '>= 0.56') import('python3') # deprecated module import('java') # new module import('unstable-keyval') # module that has been stabilized, import with unstable- +import('unstable_simd') # A module with the deprecated `unstable_foo` instead of `unstable-foo` ice = import('icestorm', required : false) assert(not ice.found(), 'unstable-icestorm module should not be importable as `simd`') diff --git a/test cases/common/253 module warnings/test.json b/test cases/common/253 module warnings/test.json index ec861cc..be31601 100644 --- a/test cases/common/253 module warnings/test.json +++ b/test cases/common/253 module warnings/test.json @@ -8,6 +8,9 @@ }, { "line": "test cases/common/253 module warnings/meson.build:5: WARNING: Project targets '>= 0.56' but uses feature deprecated since '0.56.0': module keyval has been stabilized. drop \"unstable-\" prefix from the module name" + }, + { + "line": "test cases/common/253 module warnings/meson.build:6: DEPRECATION: Importing unstable modules as \"unstable_simd\" instead of \"unstable-simd\"" } ] } |