aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2022-03-08 19:08:17 -0500
committerEli Schwartz <eschwartz@archlinux.org>2022-03-24 02:07:02 -0400
commit9c7868e343ece2cbb5cbab9c27d7e54886b89fac (patch)
tree6d5e25930083804e6b10135f0ce382a97defbb66
parentdac212e1bba707b9ac67b48902d761ee7ca8fa04 (diff)
downloadmeson-9c7868e343ece2cbb5cbab9c27d7e54886b89fac.zip
meson-9c7868e343ece2cbb5cbab9c27d7e54886b89fac.tar.gz
meson-9c7868e343ece2cbb5cbab9c27d7e54886b89fac.tar.bz2
python 3 module: type-check all posargs
Yes, it's deprecated, but we can still stop people doing the wrong thing with it if they are still using it.
-rw-r--r--mesonbuild/modules/python3.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/mesonbuild/modules/python3.py b/mesonbuild/modules/python3.py
index f7600e2..1e7463c 100644
--- a/mesonbuild/modules/python3.py
+++ b/mesonbuild/modules/python3.py
@@ -16,7 +16,7 @@ import sysconfig
from .. import mesonlib
from . import ExtensionModule
-from ..interpreterbase import noKwargs, permittedKwargs, FeatureDeprecated, FeatureNew
+from ..interpreterbase import typed_pos_args, noPosargs, noKwargs, permittedKwargs, FeatureDeprecated, FeatureNew
from ..build import known_shmod_kwargs
from ..programs import ExternalProgram
@@ -52,6 +52,7 @@ class Python3Module(ExtensionModule):
kwargs['name_suffix'] = suffix
return self.interpreter.func_shared_module(None, args, kwargs)
+ @noPosargs
@noKwargs
def find_python(self, state, args, kwargs):
command = state.environment.lookup_binary_entry(mesonlib.MachineChoice.HOST, 'python3')
@@ -61,14 +62,14 @@ class Python3Module(ExtensionModule):
py3 = ExternalProgram('python3', mesonlib.python_command, silent=True)
return py3
+ @noPosargs
@noKwargs
def language_version(self, state, args, kwargs):
return sysconfig.get_python_version()
@noKwargs
+ @typed_pos_args('python3.sysconfig_path', str)
def sysconfig_path(self, state, args, kwargs):
- if len(args) != 1:
- raise mesonlib.MesonException('sysconfig_path() requires passing the name of path to get.')
path_name = args[0]
valid_names = sysconfig.get_path_names()
if path_name not in valid_names: