Use ConfigToolDependency for cups

pull/2512/head
Dylan Baker 7 years ago
parent 8e53dec314
commit a2f3182172
  1. 5
      mesonbuild/dependencies/base.py
  2. 37
      mesonbuild/dependencies/misc.py
  3. 5
      test cases/frameworks/20 cups/meson.build

@ -48,8 +48,6 @@ class DependencyMethods(Enum):
SYSTEM = 'system'
# Detect using pcap-config
PCAPCONFIG = 'pcap-config'
# Detect using cups-config
CUPSCONFIG = 'cups-config'
# Detect using libwmf-config
LIBWMFCONFIG = 'libwmf-config'
# This is only supported on OSX - search the frameworks directory by name.
@ -60,6 +58,7 @@ class DependencyMethods(Enum):
CONFIG_TOOL = 'config-tool'
# For backewards compatibility
SDLCONFIG = 'sdlconfig'
CUPSCONFIG = 'cups-config'
class Dependency:
@ -79,7 +78,7 @@ class Dependency:
# This sets per-too config methods which are deprecated to to the new
# generic CONFIG_TOOL value.
if method in [DependencyMethods.SDLCONFIG]:
if method in [DependencyMethods.SDLCONFIG, DependencyMethods.CUPSCONFIG]:
mlog.warning(textwrap.dedent("""\
Configuration method {} has been deprecated in favor of
'config-tool'. This will be removed in a future version of

@ -1,4 +1,4 @@
# Copyright 2013-2017 The Meson development team
# Copyright 2013-2017 The Meson development team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -728,9 +728,9 @@ class PcapDependency(ExternalDependency):
class CupsDependency(ExternalDependency):
def __init__(self, environment, kwargs):
super().__init__('cups', environment, None, kwargs)
kwargs['required'] = False
if DependencyMethods.PKGCONFIG in self.methods:
try:
kwargs['required'] = False
pcdep = PkgConfigDependency('cups', environment, kwargs)
if pcdep.found():
self.type_name = 'pkgconfig'
@ -741,20 +741,20 @@ class CupsDependency(ExternalDependency):
return
except Exception as e:
mlog.debug('cups not found via pkgconfig. Trying next, error was:', str(e))
if DependencyMethods.CUPSCONFIG in self.methods:
cupsconf = shutil.which('cups-config')
if cupsconf:
stdo = Popen_safe(['cups-config', '--cflags'])[1]
self.compile_args = stdo.strip().split()
stdo = Popen_safe(['cups-config', '--libs'])[1]
self.link_args = stdo.strip().split()
stdo = Popen_safe(['cups-config', '--version'])[1]
self.version = stdo.strip().split()
self.is_found = True
mlog.log('Dependency', mlog.bold('cups'), 'found:',
mlog.green('YES'), '(%s)' % cupsconf)
return
mlog.debug('Could not find cups-config binary, trying next.')
if DependencyMethods.CONFIG_TOOL in self.methods:
try:
ctdep = ConfigToolDependency.factory(
'cups', environment, None, kwargs, ['cups-config'], 'cups-config')
if ctdep.found():
self.config = ctdep.config
self.type_name = 'config-tool'
self.version = ctdep.version
self.compile_args = ctdep.get_config_value(['--cflags'], 'compile_args')
self.link_args = ctdep.get_config_value(['--libs'], 'link_args')
self.is_found = True
return
except Exception as e:
mlog.debug('cups not found via cups-config. Trying next, error was:', str(e))
if DependencyMethods.EXTRAFRAMEWORK in self.methods:
if mesonlib.is_osx():
fwdep = ExtraFrameworkDependency('cups', False, None, self.env,
@ -769,9 +769,10 @@ class CupsDependency(ExternalDependency):
def get_methods(self):
if mesonlib.is_osx():
return [DependencyMethods.PKGCONFIG, DependencyMethods.CUPSCONFIG, DependencyMethods.EXTRAFRAMEWORK]
return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.EXTRAFRAMEWORK]
else:
return [DependencyMethods.PKGCONFIG, DependencyMethods.CUPSCONFIG]
return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL]
class LibWmfDependency(ExternalDependency):

@ -5,3 +5,8 @@ cups_dep = dependency('cups', version : '>=1.4')
e = executable('cups_prog', 'cups_prog.c', dependencies : cups_dep)
test('cupstest', e)
# ensure we can find the cups dependency via the legacy and modern config-tool
# options
dep = dependency('cups', version : '>=1.4', method : 'cups-config')
dep = dependency('cups', version : '>=1.4', method : 'config-tool')

Loading…
Cancel
Save