aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/dependencies/misc.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2017-10-19 10:53:10 -0700
committerDylan Baker <dylan@pnwbakers.com>2017-11-23 19:54:48 -0800
commita2f31821723d1e7bd445b73c58ec733c199be9d2 (patch)
treeaeda79c54044cbb8f82d7861871d5766992b78c1 /mesonbuild/dependencies/misc.py
parent8e53dec314901ce65d2ccfb6cb7011c1b3fef976 (diff)
downloadmeson-a2f31821723d1e7bd445b73c58ec733c199be9d2.zip
meson-a2f31821723d1e7bd445b73c58ec733c199be9d2.tar.gz
meson-a2f31821723d1e7bd445b73c58ec733c199be9d2.tar.bz2
Use ConfigToolDependency for cups
Diffstat (limited to 'mesonbuild/dependencies/misc.py')
-rw-r--r--mesonbuild/dependencies/misc.py37
1 files changed, 19 insertions, 18 deletions
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):