hotdoc module: use typed_pos_args to check positional arguments

We cannot use typed_kwargs though, because we allow fully arbitrary
kwargs and pass them as arguments to the hotdoc program.
pull/10096/head
Eli Schwartz 3 years ago
parent 71a5db0a03
commit c827462593
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 10
      mesonbuild/modules/hotdoc.py

@ -23,7 +23,7 @@ from mesonbuild.coredata import MesonException
from . import ModuleReturnValue
from . import ExtensionModule
from ..dependencies import Dependency, InternalDependency
from ..interpreterbase import FeatureNew, InvalidArguments, noPosargs, noKwargs
from ..interpreterbase import FeatureNew, InvalidArguments, noPosargs, noKwargs, typed_pos_args
from ..interpreter import CustomTargetHolder
from ..programs import ExternalProgram
@ -413,14 +413,12 @@ class HotDocModule(ExtensionModule):
})
@noKwargs
@typed_pos_args('hotdoc.has_extensions', varargs=str, min_varargs=1)
def has_extensions(self, state, args, kwargs):
return self.hotdoc.run_hotdoc([f'--has-extension={extension}' for extension in args]) == 0
return self.hotdoc.run_hotdoc([f'--has-extension={extension}' for extension in args[0]]) == 0
@typed_pos_args('hotdoc.generate_doc', str)
def generate_doc(self, state, args, kwargs):
if len(args) != 1:
raise MesonException('One positional argument is'
' required for the project name.')
project_name = args[0]
builder = HotdocTargetBuilder(project_name, state, self.hotdoc, self.interpreter, kwargs)
target, install_script = builder.make_targets()

Loading…
Cancel
Save