aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2024-08-29 13:09:05 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2024-08-29 13:09:05 +0300
commit0cd762d0ca4dbe2ea0be12c69c7f1a0b2da6c152 (patch)
tree10bb7872a196421c84fec992941b9cfdec063907
parent3c0de471228420c333bb98be35a28705d0ec063d (diff)
downloadmeson-deprecationdeadline.zip
meson-deprecationdeadline.tar.gz
meson-deprecationdeadline.tar.bz2
Can make deprecations into hard errors based on version.deprecationdeadline
-rw-r--r--mesonbuild/interpreter/interpreter.py2
-rw-r--r--mesonbuild/interpreterbase/decorators.py2
-rw-r--r--mesonbuild/mlog.py17
3 files changed, 18 insertions, 3 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py
index 92315ff..4d631cf 100644
--- a/mesonbuild/interpreter/interpreter.py
+++ b/mesonbuild/interpreter/interpreter.py
@@ -2298,7 +2298,7 @@ class Interpreter(InterpreterBase, HoldableObject):
if kwargs['install_dir'] is not None:
raise InterpreterException('install_headers: cannot specify both "install_dir" and "subdir". Use only "install_dir".')
if os.path.isabs(install_subdir):
- mlog.deprecation('Subdir keyword must not be an absolute path. This will be a hard error in the next release.')
+ mlog.deprecation('Subdir keyword must not be an absolute path.', error_since='1.6.99')
else:
install_subdir = ''
diff --git a/mesonbuild/interpreterbase/decorators.py b/mesonbuild/interpreterbase/decorators.py
index 6524aa9..fd8969b 100644
--- a/mesonbuild/interpreterbase/decorators.py
+++ b/mesonbuild/interpreterbase/decorators.py
@@ -699,7 +699,7 @@ class FeatureNew(FeatureCheckBase):
]
if self.extra_message:
args.append(self.extra_message)
- mlog.warning(*args, location=location)
+ mlog.deprecation(*args, location=location)
class FeatureDeprecated(FeatureCheckBase):
"""Checks for deprecated features"""
diff --git a/mesonbuild/mlog.py b/mesonbuild/mlog.py
index a8b0185..539788b 100644
--- a/mesonbuild/mlog.py
+++ b/mesonbuild/mlog.py
@@ -346,7 +346,22 @@ class _Logger:
once: bool = False, fatal: bool = True,
location: T.Optional[BaseNode] = None,
nested: bool = True, sep: T.Optional[str] = None,
- end: T.Optional[str] = None) -> None:
+ end: T.Optional[str] = None,
+ error_since: T.Optional[str] = None) -> None:
+ if error_since is not None:
+ from .coredata import version
+ from .mesonlib import version_compare
+ from .mesonlib import MesonException
+ cmpstr = '>=' + error_since
+ if version_compare(version, cmpstr):
+ self._log_error(_Severity.ERROR, *args, once=once, fatal=True, location=location,
+ nested=nested, sep=sep, end=end, is_error=True)
+ raise MesonException(f'\n This deprecated functionality became an error in Meson {version}.')
+
+ else:
+ args = args + (f'\n This will become a hard error in Meson version {version}.',)
+ self._log_error(_Severity.DEPRECATION, *args, once=once, fatal=fatal, location=location,
+ nested=nested, sep=sep, end=end, is_error=True)
return self._log_error(_Severity.DEPRECATION, *args, once=once, fatal=fatal, location=location,
nested=nested, sep=sep, end=end, is_error=True)