diff options
author | Elliott Sales de Andrade <quantum.analyst@gmail.com> | 2017-08-05 16:44:39 -0400 |
---|---|---|
committer | Elliott Sales de Andrade <quantum.analyst@gmail.com> | 2017-08-05 16:44:39 -0400 |
commit | d9f01ffcea142cdd9bf2bbf1f9213e40efc189b5 (patch) | |
tree | 48a0ec80bfd02d97893cc60a5aca90b5cd646f48 /mesonbuild | |
parent | edb260b4f4e79433f38bdda11bc84fa5ee56b080 (diff) | |
download | meson-d9f01ffcea142cdd9bf2bbf1f9213e40efc189b5.zip meson-d9f01ffcea142cdd9bf2bbf1f9213e40efc189b5.tar.gz meson-d9f01ffcea142cdd9bf2bbf1f9213e40efc189b5.tar.bz2 |
Disallow language keyword for unsupported deps.
Also, document it in the manual.
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/dependencies/__init__.py | 5 | ||||
-rw-r--r-- | mesonbuild/dependencies/base.py | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/mesonbuild/dependencies/__init__.py b/mesonbuild/dependencies/__init__.py index fb57e3d..c16b92e 100644 --- a/mesonbuild/dependencies/__init__.py +++ b/mesonbuild/dependencies/__init__.py @@ -15,7 +15,7 @@ from .base import ( # noqa: F401 Dependency, DependencyException, DependencyMethods, ExternalProgram, ExternalDependency, ExternalLibrary, ExtraFrameworkDependency, InternalDependency, - PkgConfigDependency, find_external_dependency, get_dep_identifier, packages) + PkgConfigDependency, find_external_dependency, get_dep_identifier, packages, _packages_accept_language) from .dev import GMockDependency, GTestDependency, LLVMDependency, ValgrindDependency from .misc import (BoostDependency, MPIDependency, Python3Dependency, ThreadDependency) from .platform import AppleFrameworks @@ -47,3 +47,6 @@ packages.update({ 'wxwidgets': WxDependency, 'vulkan': VulkanDependency, }) +_packages_accept_language.update({ + 'mpi', +}) diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py index f98de44..1f18c52 100644 --- a/mesonbuild/dependencies/base.py +++ b/mesonbuild/dependencies/base.py @@ -26,8 +26,9 @@ from .. import mesonlib from ..mesonlib import MesonException, Popen_safe, flatten, version_compare_many -# This must be defined in this file to avoid cyclical references. +# These must be defined in this file to avoid cyclical references. packages = {} +_packages_accept_language = set() class DependencyException(MesonException): @@ -610,10 +611,15 @@ def find_external_dependency(name, env, kwargs): raise DependencyException('Keyword "method" must be a string.') lname = name.lower() if lname in packages: + if lname not in _packages_accept_language and 'language' in kwargs: + raise DependencyException('%s dependency does not accept "language" keyword argument' % (lname, )) dep = packages[lname](env, kwargs) if required and not dep.found(): raise DependencyException('Dependency "%s" not found' % name) return dep + if 'language' in kwargs: + # Remove check when PkgConfigDependency supports language. + raise DependencyException('%s dependency does not accept "language" keyword argument' % (lname, )) pkg_exc = None pkgdep = None try: |