aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2019-09-29 20:43:22 +0200
committerDaniel Mensinger <daniel@mensinger-ka.de>2019-10-03 10:06:04 +0200
commite5c720ff607cdf3101de031ff3a36f434d77b0d1 (patch)
treed046c625dd7985a251473fcd40f550e26ac5c1a4
parentb1b8a7a7e356297741c3c8e5996928ff244578c8 (diff)
downloadmeson-e5c720ff607cdf3101de031ff3a36f434d77b0d1.zip
meson-e5c720ff607cdf3101de031ff3a36f434d77b0d1.tar.gz
meson-e5c720ff607cdf3101de031ff3a36f434d77b0d1.tar.bz2
Move generate_system_dependency to Dependency
-rw-r--r--mesonbuild/dependencies/base.py4
-rw-r--r--mesonbuild/interpreter.py5
2 files changed, 6 insertions, 3 deletions
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
index 5584fbc..1ccc343 100644
--- a/mesonbuild/dependencies/base.py
+++ b/mesonbuild/dependencies/base.py
@@ -222,6 +222,10 @@ class Dependency:
return default_value
raise DependencyException('No default provided for dependency {!r}, which is not pkg-config, cmake, or config-tool based.'.format(self))
+ def generate_system_dependency(self, is_system: bool) -> typing.Type['Dependency']:
+ new_dep = copy.deepcopy(self)
+ new_dep.is_system = is_system
+ return new_dep
class InternalDependency(Dependency):
def __init__(self, version, incdirs, compile_args, link_args, libraries, whole_libraries, sources, ext_deps):
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index adb854e..eb0eaf7 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -36,7 +36,7 @@ from .cmake import CMakeInterpreter
from pathlib import Path, PurePath
import os, shutil, uuid
-import re, shlex, copy
+import re, shlex
import subprocess
from collections import namedtuple
from itertools import chain
@@ -492,8 +492,7 @@ class DependencyHolder(InterpreterObject, ObjectHolder):
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
+ new_dep = self.held_object.generate_system_dependency(new_is_system)
return DependencyHolder(new_dep, self.subproject)
class ExternalProgramHolder(InterpreterObject, ObjectHolder):