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.
@@ -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
