#NEWLINE# def find_external_dependency( name , environment , kwargs ) : #NEWLINE# #INDENT# required = kwargs . get ( 'required' , True ) #NEWLINE# if ( not isinstance ( required , bool ) ) : #NEWLINE# #INDENT# raise DependencyException ( 'Keyword "required" must be a boolean.' ) #NEWLINE# #UNINDENT# lname = name . lower ( ) #NEWLINE# if ( lname in packages ) : #NEWLINE# #INDENT# dep = packages [ lname ] ( environment , kwargs ) #NEWLINE# if ( required and ( not dep . found ( ) ) ) : #NEWLINE# #INDENT# raise DependencyException ( ( 'Dependency "%s" not found' % name ) ) #NEWLINE# #UNINDENT# return dep #NEWLINE# #UNINDENT# pkg_exc = None #NEWLINE# pkgdep = None #NEWLINE# try : #NEWLINE# #INDENT# pkgdep = PkgConfigDependency ( name , environment , kwargs ) #NEWLINE# if pkgdep . found ( ) : #NEWLINE# #INDENT# return pkgdep #NEWLINE# #UNINDENT# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# pkg_exc = e #NEWLINE# #UNINDENT# if mesonlib . is_osx ( ) : #NEWLINE# #INDENT# fwdep = ExtraFrameworkDependency ( name , required ) #NEWLINE# if ( required and ( not fwdep . found ( ) ) ) : #NEWLINE# #INDENT# raise DependencyException ( ( 'Dependency "%s" not found' % name ) ) #NEWLINE# #UNINDENT# return fwdep #NEWLINE# #UNINDENT# if ( pkg_exc is not None ) : #NEWLINE# #INDENT# raise pkg_exc #NEWLINE# #UNINDENT# mlog . log ( 'Dependency' , mlog . bold ( name ) , 'found:' , mlog . red ( 'NO' ) ) #NEWLINE# return pkgdep