dependencies: Use DependencyFactory for gpgme

pull/6540/head
Dylan Baker 5 years ago
parent 69835a7c53
commit 773cc7b4b0
  1. 4
      mesonbuild/dependencies/__init__.py
  2. 29
      mesonbuild/dependencies/misc.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, GpgmeDependency, ShadercDependency, cups_factory, libgcrypt_factory, libwmf_factory, pcap_factory, python3_factory)
from .misc import (BlocksDependency, CursesDependency, NetCDFDependency, OpenMPDependency, ThreadDependency, ShadercDependency, cups_factory, gpgme_factory, libgcrypt_factory, libwmf_factory, pcap_factory, python3_factory)
from .platform import AppleFrameworks
from .ui import GLDependency, GnuStepDependency, Qt4Dependency, Qt5Dependency, SDL2Dependency, WxDependency, vulkan_factory
@ -56,7 +56,7 @@ packages.update({
'cups': cups_factory,
'libwmf': libwmf_factory,
'libgcrypt': libgcrypt_factory,
'gpgme': GpgmeDependency,
'gpgme': gpgme_factory,
'shaderc': ShadercDependency,
# From platform:

@ -378,28 +378,13 @@ class LibGCryptDependencyConfigTool(ConfigToolDependency):
return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL]
class GpgmeDependency(ExternalDependency):
def __init__(self, environment, kwargs):
super().__init__('gpgme', 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, 'gpgme', environment, kwargs))
if DependencyMethods.CONFIG_TOOL in methods:
candidates.append(functools.partial(ConfigToolDependency.factory,
'gpgme', environment, None, kwargs, ['gpgme-config'],
'gpgme-config',
GpgmeDependency.tool_finish_init))
class GpgmeDependencyConfigTool(ConfigToolDependency):
return candidates
tools = ['gpgme-config']
tool_name = 'gpg-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')
ctdep.version = ctdep.get_config_value(['--version'], 'version')[0]
@ -499,6 +484,12 @@ cups_factory = DependencyFactory(
cmake_name='Cups',
)
gpgme_factory = DependencyFactory(
'gpgme',
[DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL],
configtool_class=GpgmeDependencyConfigTool,
)
libgcrypt_factory = DependencyFactory(
'libgcrypt',
[DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL],

Loading…
Cancel
Save