diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2020-01-08 15:20:24 -0800 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2020-01-29 09:11:24 -0800 |
commit | 70d28e453224626c2a47650e5c849d8808a504a0 (patch) | |
tree | 02078e9fc7f125873bb2ecea792bb13cdb0f4a8c | |
parent | 4cc890e70aa732e89b632cd16be4833a744135ed (diff) | |
download | meson-70d28e453224626c2a47650e5c849d8808a504a0.zip meson-70d28e453224626c2a47650e5c849d8808a504a0.tar.gz meson-70d28e453224626c2a47650e5c849d8808a504a0.tar.bz2 |
dependencies: Use DependencyFactory for libwmf
-rw-r--r-- | mesonbuild/dependencies/__init__.py | 4 | ||||
-rw-r--r-- | mesonbuild/dependencies/misc.py | 27 |
2 files changed, 12 insertions, 19 deletions
diff --git a/mesonbuild/dependencies/__init__.py b/mesonbuild/dependencies/__init__.py index 9d050f1..cf0d79a 100644 --- a/mesonbuild/dependencies/__init__.py +++ b/mesonbuild/dependencies/__init__.py @@ -24,7 +24,7 @@ from .dev import ValgrindDependency, gmock_factory, gtest_factory, llvm_factory from .coarrays import CoarrayDependency from .mpi import MPIDependency from .scalapack import ScalapackDependency -from .misc import (BlocksDependency, CursesDependency, NetCDFDependency, OpenMPDependency, ThreadDependency, LibWmfDependency, LibGCryptDependency, GpgmeDependency, ShadercDependency, cups_factory, pcap_factory, python3_factory) +from .misc import (BlocksDependency, CursesDependency, NetCDFDependency, OpenMPDependency, ThreadDependency, LibGCryptDependency, GpgmeDependency, ShadercDependency, cups_factory, libwmf_factory, pcap_factory, python3_factory) from .platform import AppleFrameworks from .ui import GLDependency, GnuStepDependency, Qt4Dependency, Qt5Dependency, SDL2Dependency, WxDependency, vulkan_factory @@ -54,7 +54,7 @@ packages.update({ 'threads': ThreadDependency, 'pcap': pcap_factory, 'cups': cups_factory, - 'libwmf': LibWmfDependency, + 'libwmf': libwmf_factory, 'libgcrypt': LibGCryptDependency, 'gpgme': GpgmeDependency, 'shaderc': ShadercDependency, diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index fd4dcd8..a26d553 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -347,26 +347,13 @@ class CupsDependencyConfigTool(ConfigToolDependency): return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.CMAKE] -class LibWmfDependency(ExternalDependency): - def __init__(self, environment, kwargs): - super().__init__('libwmf', environment, kwargs) +class LibWmfDependencyConfigTool(ConfigToolDependency): - @classmethod - def _factory(cls, environment, kwargs): - methods = process_method_kw(cls.get_methods(), kwargs) - candidates = [] - - if DependencyMethods.PKGCONFIG in methods: - candidates.append(functools.partial(PkgConfigDependency, 'libwmf', environment, kwargs)) - - if DependencyMethods.CONFIG_TOOL in methods: - candidates.append(functools.partial(ConfigToolDependency.factory, - 'libwmf', environment, None, kwargs, ['libwmf-config'], 'libwmf-config', LibWmfDependency.tool_finish_init)) - - return candidates + tools = ['libwmf-config'] + tool_name = 'libwmf-config' @staticmethod - def tool_finish_init(ctdep): + def finish_init(ctdep): ctdep.compile_args = ctdep.get_config_value(['--cflags'], 'compile_args') ctdep.link_args = ctdep.get_config_value(['--libs'], 'link_args') @@ -527,6 +514,12 @@ cups_factory = DependencyFactory( cmake_name='Cups', ) +libwmf_factory = DependencyFactory( + 'libwmf', + [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL], + configtool_class=LibWmfDependencyConfigTool, +) + pcap_factory = DependencyFactory( 'pcap', [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL], |