From 9aff189e315ccbe3444c75aef412d311fa95fcd2 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Sun, 25 Dec 2022 02:19:14 -0500 Subject: add a hidden environment variable to make Meson complain hard on deprecations Useful for running the testsuite with this environment variable and catching obscure issues. Just like with the encoding warning later down, we have to do this inside meson itself, not externally injected. --- mesonbuild/mesonmain.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py index ca38f29..369b411 100644 --- a/mesonbuild/mesonmain.py +++ b/mesonbuild/mesonmain.py @@ -235,6 +235,13 @@ def set_meson_command(mainfile): mesonlib.set_meson_command(mainfile) def run(original_args, mainfile): + if os.environ.get('MESON_SHOW_DEPRECATIONS'): + # workaround for https://bugs.python.org/issue34624 + import warnings + for typ in [DeprecationWarning, SyntaxWarning, FutureWarning, PendingDeprecationWarning]: + warnings.filterwarnings('error', category=typ, module='mesonbuild') + warnings.filterwarnings('ignore', message=".*importlib-resources.*") + if sys.version_info >= (3, 10) and os.environ.get('MESON_RUNNING_IN_PROJECT_TESTS'): # workaround for https://bugs.python.org/issue34624 import warnings -- cgit v1.1