aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r--mesonbuild/interpreter.py30
1 files changed, 27 insertions, 3 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 0aa4b37..adb854e 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -34,13 +34,12 @@ from .interpreterbase import ObjectHolder
from .modules import ModuleReturnValue
from .cmake import CMakeInterpreter
-from pathlib import Path
+from pathlib import Path, PurePath
import os, shutil, uuid
-import re, shlex
+import re, shlex, copy
import subprocess
from collections import namedtuple
from itertools import chain
-from pathlib import PurePath
import functools
from typing import Sequence, List, Union, Optional, Dict, Any
@@ -413,6 +412,8 @@ class DependencyHolder(InterpreterObject, ObjectHolder):
'get_configtool_variable': self.configtool_method,
'get_variable': self.variable_method,
'partial_dependency': self.partial_dependency_method,
+ 'is_system': self.is_system_method,
+ 'as_system': self.as_system_method,
})
def found(self):
@@ -474,6 +475,27 @@ class DependencyHolder(InterpreterObject, ObjectHolder):
def variable_method(self, args, kwargs):
return self.held_object.get_variable(**kwargs)
+ @FeatureNew('dep.is_system', '0.52.0')
+ @noPosargs
+ @permittedKwargs({})
+ def is_system_method(self, args, kwargs):
+ return self.held_object.get_is_system()
+
+ @FeatureNew('dep.as_system', '0.52.0')
+ @permittedKwargs({})
+ def as_system_method(self, args, kwargs):
+ args = listify(args)
+ new_is_system = True
+ if len(args) > 1:
+ raise InterpreterException('as_system takes only one optional value')
+ if len(args) == 1:
+ if not isinstance(args[0], bool):
+ raise InterpreterException('as_system takes only a boolean value')
+ new_is_system = args[0]
+ new_dep = copy.deepcopy(self.held_object)
+ new_dep.is_system = new_is_system
+ return DependencyHolder(new_dep, self.subproject)
+
class ExternalProgramHolder(InterpreterObject, ObjectHolder):
def __init__(self, ep):
InterpreterObject.__init__(self)
@@ -1998,6 +2020,7 @@ permitted_kwargs = {'add_global_arguments': {'language', 'native'},
'version',
'private_headers',
'cmake_args',
+ 'is_system',
},
'declare_dependency': {'include_directories',
'link_with',
@@ -3049,6 +3072,7 @@ external dependencies (including libraries) must go to "dependencies".''')
elif name == 'openmp':
FeatureNew('OpenMP Dependency', '0.46.0').use(self.subproject)
+ @FeatureNewKwargs('dependency', '0.52.0', ['is_system'])
@FeatureNewKwargs('dependency', '0.50.0', ['not_found_message', 'cmake_module_path', 'cmake_args'])
@FeatureNewKwargs('dependency', '0.49.0', ['disabler'])
@FeatureNewKwargs('dependency', '0.40.0', ['method'])