aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-01-18 21:27:52 +0200
committerGitHub <noreply@github.com>2017-01-18 21:27:52 +0200
commit577a9b40d58929a6d11a50159c194ff6c98a7728 (patch)
tree5e7ab601de10ddf4cc3d64e2c1fde2b7eb7fc22c
parent550761d97b8ee2239f0eb24b9cce3fa9a4091a9a (diff)
parent705612f7cf2a757cc7f8b056b330cce47f9ed0de (diff)
downloadmeson-577a9b40d58929a6d11a50159c194ff6c98a7728.zip
meson-577a9b40d58929a6d11a50159c194ff6c98a7728.tar.gz
meson-577a9b40d58929a6d11a50159c194ff6c98a7728.tar.bz2
Merge pull request #1312 from centricular/print-pkgdep-error-osx
Fix pkg-config error handling on OS X
-rw-r--r--mesonbuild/dependencies.py18
-rw-r--r--mesonbuild/mesonlib.py6
2 files changed, 12 insertions, 12 deletions
diff --git a/mesonbuild/dependencies.py b/mesonbuild/dependencies.py
index f6db323..97aec7e 100644
--- a/mesonbuild/dependencies.py
+++ b/mesonbuild/dependencies.py
@@ -30,8 +30,7 @@ from . import mesonlib
from .environment import detect_cpu_family, for_windows
class DependencyException(MesonException):
- def __init__(self, *args, **kwargs):
- MesonException.__init__(self, *args, **kwargs)
+ '''Exceptions raised while trying to find dependencies'''
class Dependency:
def __init__(self, type_name='unknown'):
@@ -170,17 +169,18 @@ class PkgConfigDependency(Dependency):
if not self.silent:
mlog.log(*found_msg)
if self.required:
- raise DependencyException(
- 'Invalid version of a dependency, needed %s %s found %s.' %
- (name, not_found, self.modversion))
+ m = 'Invalid version of dependency, need {!r} {!r} found {!r}.'
+ raise DependencyException(m.format(name, not_found, self.modversion))
return
found_msg += [mlog.green('YES'), self.modversion]
- if not self.silent:
- mlog.log(*found_msg)
# Fetch cargs to be used while using this dependency
self._set_cargs()
# Fetch the libraries and library paths needed for using this
self._set_libs()
+ # Print the found message only at the very end because fetching cflags
+ # and libs can also fail if other needed pkg-config files aren't found.
+ if not self.silent:
+ mlog.log(*found_msg)
def __repr__(self):
s = '<{0} {1}: {2} {3}>'
@@ -1444,7 +1444,9 @@ def find_external_dependency(name, environment, kwargs):
if mesonlib.is_osx():
fwdep = ExtraFrameworkDependency(name, required)
if required and not fwdep.found():
- raise DependencyException('Dependency "%s" not found' % name)
+ m = 'Dependency {!r} not found, tried Extra Frameworks ' \
+ 'and Pkg-Config:\n\n' + str(pkg_exc)
+ raise DependencyException(m.format(name))
return fwdep
if pkg_exc is not None:
raise pkg_exc
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py
index 305d945..2587d6f 100644
--- a/mesonbuild/mesonlib.py
+++ b/mesonbuild/mesonlib.py
@@ -19,12 +19,10 @@ import platform, subprocess, operator, os, shutil, re
from glob import glob
class MesonException(Exception):
- def __init__(self, *args, **kwargs):
- Exception.__init__(self, *args, **kwargs)
+ '''Exceptions thrown by Meson'''
class EnvironmentException(MesonException):
- def __init__(self, *args, **kwargs):
- super().__init__(*args, **kwargs)
+ '''Exceptions thrown while processing and creating the build environment'''
class File:
def __init__(self, is_built, subdir, fname):