How to use pkg_config method in fMBT

Best Python code snippet using fMBT_python

pkg.configure

Source:pkg.configure Github

copy

Full Screen

...3# This Source Code Form is subject to the terms of the Mozilla Public4# License, v. 2.0. If a copy of the MPL was not distributed with this5# file, You can obtain one at http://mozilla.org/MPL/2.0/.6@depends('--enable-compile-environment')7def pkg_config(compile_env):8 if compile_env:9 return ('pkg-config',)10pkg_config = check_prog('PKG_CONFIG', pkg_config, allow_missing=True)11@depends_if(pkg_config)12@checking('for pkg-config version')13@imports('subprocess')14def pkg_config_version(pkg_config):15 return Version(check_cmd_output(pkg_config, '--version').rstrip())16# Locates the given module using pkg-config.17# - `var` determines the name of variables to set when the package is found.18# <var>_CFLAGS and <var>_LIBS are set with corresponding values.19# - `package_desc` package name and version requirement string, list of20# strings describing packages to locate, or depends function that will21# resolve to such a string or list of strings.22# - `when` a depends function that will determine whether to perform23# any checks (default is to always perform checks).24# - `allow_missing` If set, failure to fulfill the package description25# will not result in an error or logged message, and any error message26# will be returned to the caller.27# Returns `True` when the package description is fulfilled.28@template29def pkg_check_modules(var, package_desc, when=always,30 allow_missing=False):31 if isinstance(package_desc, (tuple, list)):32 package_desc = ' '.join(package_desc)33 package_desc = dependable(package_desc)34 @depends(when, '--enable-compile-environment')35 def when_and_compile_environment(when, compile_environment):36 return when and compile_environment37 @depends(pkg_config, pkg_config_version,38 when=when_and_compile_environment)39 def check_pkg_config(pkg_config, version):40 min_version = '0.9.0'41 if pkg_config is None:42 die("*** The pkg-config script could not be found. Make sure it is\n"43 "*** in your path, or set the PKG_CONFIG environment variable\n"44 "*** to the full path to pkg-config.")45 if version < min_version:46 die("*** Your version of pkg-config is too old. You need version %s or newer.",47 min_version)48 @depends(pkg_config, package_desc, when=when_and_compile_environment)49 @imports('subprocess')50 @imports('sys')51 @imports(_from='mozbuild.configure.util', _import='LineIO')52 def package(pkg_config, package_desc):53 # package_desc may start as a depends function, so we can't use...

Full Screen

Full Screen

pkgconfig.py

Source:pkgconfig.py Github

copy

Full Screen

1# -*- mode: python; encoding: utf-8 -*-2# Gustavo Carneiro (gjamc) 20083import Options4import Configure5import subprocess6import config_c7import sys8def configure(conf):9 pkg_config = conf.find_program('pkg-config', var='PKG_CONFIG')10 if not pkg_config: return11@Configure.conf12def pkg_check_modules(conf, uselib_name, expression, mandatory=True):13 pkg_config = conf.env['PKG_CONFIG']14 if not pkg_config:15 if mandatory:16 conf.fatal("pkg-config is not available")17 else:18 return False19 if Options.options.verbose:20 extra_msg = ' (%s)' % expression21 else:22 extra_msg = ''23 conf.start_msg('Checking for pkg-config flags for %s%s' % (uselib_name, extra_msg))24 argv = [pkg_config, '--cflags', '--libs', expression]25 cmd = subprocess.Popen(argv, stdout=subprocess.PIPE, stderr=subprocess.PIPE)26 out, err = cmd.communicate()27 retval = cmd.wait()28 conf.to_log('%r: %r (exit code %i)\n%s' % (argv, out, retval, err))29 if retval != 0:30 conf.end_msg(False)31 sys.stderr.write(err)32 else:33 if Options.options.verbose:34 conf.end_msg(out)35 else:36 conf.end_msg(True)37 if retval == 0:38 conf.parse_flags(out, uselib_name, conf.env)39 conf.env[uselib_name] = True40 return True41 else:42 conf.env[uselib_name] = False43 if mandatory:44 raise Configure.ConfigurationError('pkg-config check failed')45 else:46 return False47@Configure.conf48def pkg_check_module_variable(conf, module, variable):49 pkg_config = conf.env['PKG_CONFIG']50 if not pkg_config:51 conf.fatal("pkg-config is not available")52 argv = [pkg_config, '--variable', variable, module]53 cmd = subprocess.Popen(argv, stdout=subprocess.PIPE)54 out, dummy = cmd.communicate()55 retval = cmd.wait()56 out = out.rstrip() # strip the trailing newline57 msg_checking = ("Checking for pkg-config variable %r in %s" % (variable, module,))58 conf.check_message_custom(msg_checking, '', out)59 conf.log.write('%r: %r (exit code %i)\n' % (argv, out, retval))60 if retval == 0:61 return out62 else:...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run fMBT automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful