diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2020-01-08 15:17:29 -0800 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2020-01-29 09:11:24 -0800 |
commit | 4cc890e70aa732e89b632cd16be4833a744135ed (patch) | |
tree | a36866b9836dbc164de4957d3a815fc23769c400 /mesonbuild/dependencies/misc.py | |
parent | a1f03881c1af843380cdd7caf7916902b5e1c3e1 (diff) | |
download | meson-4cc890e70aa732e89b632cd16be4833a744135ed.zip meson-4cc890e70aa732e89b632cd16be4833a744135ed.tar.gz meson-4cc890e70aa732e89b632cd16be4833a744135ed.tar.bz2 |
dependencies: Use DependencyFactory for cups
Diffstat (limited to 'mesonbuild/dependencies/misc.py')
-rw-r--r-- | mesonbuild/dependencies/misc.py | 43 |
1 files changed, 13 insertions, 30 deletions
diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index f39fb98..fd4dcd8 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -26,9 +26,8 @@ from ..mesonlib import listify from .base import ( DependencyException, DependencyMethods, ExternalDependency, - ExtraFrameworkDependency, PkgConfigDependency, - CMakeDependency, ConfigToolDependency, process_method_kw, - DependencyFactory, + PkgConfigDependency, CMakeDependency, ConfigToolDependency, + process_method_kw, DependencyFactory, ) class NetCDFDependency(ExternalDependency): @@ -330,36 +329,13 @@ class PcapDependencyConfigTool(ConfigToolDependency): return v -class CupsDependency(ExternalDependency): - def __init__(self, environment, kwargs): - super().__init__('cups', environment, kwargs) - - @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, 'cups', environment, kwargs)) - - if DependencyMethods.CONFIG_TOOL in methods: - candidates.append(functools.partial(ConfigToolDependency.factory, - 'cups', environment, None, - kwargs, ['cups-config'], - 'cups-config', CupsDependency.tool_finish_init)) +class CupsDependencyConfigTool(ConfigToolDependency): - if DependencyMethods.EXTRAFRAMEWORK in methods: - if mesonlib.is_osx(): - candidates.append(functools.partial( - ExtraFrameworkDependency, 'cups', environment, kwargs)) - - if DependencyMethods.CMAKE in methods: - candidates.append(functools.partial(CMakeDependency, 'Cups', environment, kwargs)) - - return candidates + tools = ['cups-config'] + tool_name = 'cups-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(['--ldflags', '--libs'], 'link_args') @@ -544,6 +520,13 @@ class CursesDependency(ExternalDependency): return [DependencyMethods.AUTO, DependencyMethods.PKGCONFIG] +cups_factory = DependencyFactory( + 'cups', + [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.EXTRAFRAMEWORK, DependencyMethods.CMAKE], + configtool_class=CupsDependencyConfigTool, + cmake_name='Cups', +) + pcap_factory = DependencyFactory( 'pcap', [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL], |