aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/dependencies/base.py5
-rw-r--r--mesonbuild/dependencies/misc.py37
-rw-r--r--test cases/frameworks/20 cups/meson.build5
3 files changed, 26 insertions, 21 deletions
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
index b2bf3b3..46d0a99 100644
--- a/mesonbuild/dependencies/base.py
+++ b/mesonbuild/dependencies/base.py
@@ -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
diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py
index 4a023e4..cae8842 100644
--- a/mesonbuild/dependencies/misc.py
+++ b/mesonbuild/dependencies/misc.py
@@ -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):
diff --git a/test cases/frameworks/20 cups/meson.build b/test cases/frameworks/20 cups/meson.build
index 6c9b6fe..11f6f63 100644
--- a/test cases/frameworks/20 cups/meson.build
+++ b/test cases/frameworks/20 cups/meson.build
@@ -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')