本文整理汇总了Python中mlog.red函数的典型用法代码示例。如果您正苦于以下问题:Python red函数的具体用法?Python red怎么用?Python red使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了red函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: detect
def detect(self):
confprog = "gnustep-config"
try:
gp = subprocess.Popen([confprog, "--help"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
gp.communicate()
except FileNotFoundError:
self.args = None
mlog.log("Dependency GnuStep found:", mlog.red("NO"), "(no gnustep-config)")
return
if gp.returncode != 0:
self.args = None
mlog.log("Dependency GnuStep found:", mlog.red("NO"))
return
if "gui" in self.modules:
arg = "--gui-libs"
else:
arg = "--base-libs"
fp = subprocess.Popen([confprog, "--objc-flags"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(flagtxt, flagerr) = fp.communicate()
flagtxt = flagtxt.decode()
flagerr = flagerr.decode()
if fp.returncode != 0:
raise DependencyException("Error getting objc-args: %s %s" % (flagtxt, flagerr))
args = flagtxt.split()
self.args = self.filter_arsg(args)
fp = subprocess.Popen([confprog, arg], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(libtxt, liberr) = fp.communicate()
libtxt = libtxt.decode()
liberr = liberr.decode()
if fp.returncode != 0:
raise DependencyException("Error getting objc-lib args: %s %s" % (libtxt, liberr))
self.libs = self.weird_filter(libtxt.split())
mlog.log("Dependency GnuStep found:", mlog.green("YES"))
开发者ID:eriknelson,项目名称:meson,代码行数:33,代码来源:dependencies.py
示例2: run
def run(args):
if sys.version_info < (3, 4):
print('Meson works correctly only with python 3.4+.')
print('You have python %s.' % sys.version)
print('Please update your environment')
return 1
if args[-1] == 'secret-handshake':
args = args[:-1]
handshake = True
else:
handshake = False
args = mesonlib.expand_arguments(args)
if not args:
return 1
options = parser.parse_args(args[1:])
if options.print_version:
print(coredata.version)
return 0
args = options.directories
if len(args) == 0 or len(args) > 2:
print('%s <source directory> <build directory>' % sys.argv[0])
print('If you omit either directory, the current directory is substituted.')
return 1
dir1 = args[0]
if len(args) > 1:
dir2 = args[1]
else:
dir2 = '.'
this_file = os.path.abspath(__file__)
while os.path.islink(this_file):
resolved = os.readlink(this_file)
if resolved[0] != '/':
this_file = os.path.join(os.path.dirname(this_file), resolved)
else:
this_file = resolved
try:
app = MesonApp(dir1, dir2, this_file, handshake, options)
except Exception as e:
# Log directory does not exist, so just print
# to stdout.
print('Error during basic setup:\n')
print(e)
return 1
try:
app.generate()
except Exception as e:
if isinstance(e, MesonException):
if hasattr(e, 'file') and hasattr(e, 'lineno') and hasattr(e, 'colno'):
mlog.log(mlog.red('\nMeson encountered an error in file %s, line %d, column %d:' % (e.file, e.lineno, e.colno)))
else:
mlog.log(mlog.red('\nMeson encountered an error:'))
mlog.log(e)
else:
traceback.print_exc()
return 1
return 0
开发者ID:yoava333,项目名称:meson,代码行数:57,代码来源:meson.py
示例3: __init__
def __init__(self, name, required):
Dependency.__init__(self)
self.name = name
if not PkgConfigDependency.pkgconfig_found:
self.check_pkgconfig()
self.is_found = False
p = subprocess.Popen(['pkg-config', '--modversion', name], stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out = p.communicate()[0]
if p.returncode != 0:
mlog.log('Dependency', name, 'found:', mlog.red('NO'))
if required:
raise DependencyException('Required dependency %s not found.' % name)
self.modversion = 'none'
self.cargs = []
self.libs = []
else:
mlog.log('Dependency', mlog.bold(name), 'found:', mlog.green('YES'))
self.is_found = True
self.modversion = out.decode().strip()
p = subprocess.Popen(['pkg-config', '--cflags', name], stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out = p.communicate()[0]
if p.returncode != 0:
raise RuntimeError('Could not generate cargs for %s.' % name)
self.cargs = out.decode().split()
p = subprocess.Popen(['pkg-config', '--libs', name], stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out = p.communicate()[0]
if p.returncode != 0:
raise RuntimeError('Could not generate libs for %s.' % name)
self.libs = out.decode().split()
开发者ID:garfunkel,项目名称:meson,代码行数:34,代码来源:dependencies.py
示例4: __init__
def __init__(self, environment, kwargs):
Dependency.__init__(self)
self.name = 'qt5'
self.root = '/usr'
mods = kwargs.get('modules', [])
self.cargs = []
self.largs = []
self.is_found = False
if isinstance(mods, str):
mods = [mods]
if len(mods) == 0:
raise DependencyException('No Qt5 modules specified.')
type_text = 'native'
if environment.is_cross_build() and kwargs.get('native', False):
type_text = 'cross'
self.pkgconfig_detect(mods, environment, kwargs)
elif not environment.is_cross_build() and shutil.which('pkg-config') is not None:
self.pkgconfig_detect(mods, environment, kwargs)
elif shutil.which('qmake') is not None:
self.qmake_detect(mods, kwargs)
else:
self.version = 'none'
if not self.is_found:
mlog.log('Qt5 %s dependency found: ' % type_text, mlog.red('NO'))
else:
mlog.log('Qt5 %s dependency found: ' % type_text, mlog.green('YES'))
开发者ID:kylemanna,项目名称:meson,代码行数:26,代码来源:dependencies.py
示例5: detect
def detect(self):
trial_dirs = mesonlib.get_library_dirs()
glib_found = False
gmain_found = False
for d in trial_dirs:
if os.path.isfile(os.path.join(d, self.libname)):
glib_found = True
if os.path.isfile(os.path.join(d, self.libmain_name)):
gmain_found = True
if glib_found and gmain_found:
self.is_found = True
self.compile_args = []
self.link_args = ['-lgtest']
if self.main:
self.link_args.append('-lgtest_main')
self.sources = []
mlog.log('Dependency GTest found:', mlog.green('YES'), '(prebuilt)')
elif os.path.exists(self.src_dir):
self.is_found = True
self.compile_args = ['-I' + self.src_include_dir]
self.link_args = []
if self.main:
self.sources = [self.all_src, self.main_src]
else:
self.sources = [self.all_src]
mlog.log('Dependency GTest found:', mlog.green('YES'), '(building self)')
else:
mlog.log('Dependency GTest found:', mlog.red('NO'))
self.is_found = False
return self.is_found
开发者ID:kylemanna,项目名称:meson,代码行数:30,代码来源:dependencies.py
示例6: __init__
def __init__(self, kwargs):
Dependency.__init__(self)
self.is_found = False
self.cargs = []
self.linkargs = []
sdlconf = shutil.which('sdl2-config')
if sdlconf:
pc = subprocess.Popen(['sdl2-config', '--cflags'], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
(stdo, _) = pc.communicate()
self.cargs = stdo.decode().strip().split()
pc = subprocess.Popen(['sdl2-config', '--libs'], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
(stdo, _) = pc.communicate()
self.linkargs = stdo.decode().strip().split()
self.is_found = True
mlog.log('Dependency', mlog.bold('sdl2'), 'found:', mlog.green('YES'), '(%s)' % sdlconf)
return
try:
pcdep = PkgConfigDependency('sdl2', kwargs)
if pcdep.found():
self.is_found = True
self.cargs = pcdep.get_compile_args()
self.linkargs = pcdep.get_link_args()
return
except Exception:
pass
if mesonlib.is_osx():
fwdep = ExtraFrameworkDependency('sdl2', kwargs.get('required', True))
if fwdep.found():
self.is_found = True
self.cargs = fwdep.get_compile_args()
self.linkargs = fwdep.get_link_args()
return
mlog.log('Dependency', mlog.bold('sdl2'), 'found:', mlog.red('NO'))
开发者ID:gitnicotobs,项目名称:meson,代码行数:33,代码来源:dependencies.py
示例7: __init__
def __init__(self, name, fullpath=None, silent=False, search_dir=None):
self.name = name
if fullpath is not None:
if not isinstance(fullpath, list):
self.fullpath = [fullpath]
else:
self.fullpath = fullpath
else:
self.fullpath = [shutil.which(name)]
if self.fullpath[0] is None and search_dir is not None:
trial = os.path.join(search_dir, name)
suffix = os.path.splitext(trial)[-1].lower()[1:]
if mesonlib.is_windows() and (suffix == 'exe' or suffix == 'com'\
or suffix == 'bat'):
self.fullpath = [trial]
elif not mesonlib.is_windows() and os.access(trial, os.X_OK):
self.fullpath = [trial]
else:
# Now getting desperate. Maybe it is a script file that is a) not chmodded
# executable or b) we are on windows so they can't be directly executed.
try:
first_line = open(trial).readline().strip()
if first_line.startswith('#!'):
commands = first_line[2:].split('#')[0].strip().split()
if mesonlib.is_windows():
commands[0] = commands[0].split('/')[-1] # Windows does not have /usr/bin.
self.fullpath = commands + [trial]
except Exception:
pass
if not silent:
if self.found():
mlog.log('Program', mlog.bold(name), 'found:', mlog.green('YES'), '(%s)' % ' '.join(self.fullpath))
else:
mlog.log('Program', mlog.bold(name), 'found:', mlog.red('NO'))
开发者ID:itech001,项目名称:meson,代码行数:34,代码来源:dependencies.py
示例8: detect
def detect(self):
confprog = 'gnustep-config'
gp = subprocess.Popen([confprog, '--help'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
gp.communicate()
if gp.returncode != 0:
self.args = None
mlog.log('Dependency GnuStep found:', mlog.red('NO'))
return
if 'gui' in self.modules:
arg = '--gui-libs'
else:
arg = '--base-libs'
fp = subprocess.Popen([confprog, '--objc-flags'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(flagtxt, flagerr) = fp.communicate()
flagtxt = flagtxt.decode()
flagerr = flagerr.decode()
if fp.returncode != 0:
raise DependencyException('Error getting objc-args: %s %s' % (flagtxt, flagerr))
args = flagtxt.split()
self.args = self.filter_arsg(args)
fp = subprocess.Popen([confprog, arg],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(libtxt, liberr) = fp.communicate()
libtxt = libtxt.decode()
liberr = liberr.decode()
if fp.returncode != 0:
raise DependencyException('Error getting objc-lib args: %s %s' % (libtxt, liberr))
self.libs = self.weird_filter(libtxt.split())
mlog.log('Dependency GnuStep found:', mlog.green('YES'))
开发者ID:garfunkel,项目名称:meson,代码行数:31,代码来源:dependencies.py
示例9: generate_coverage_rules
def generate_coverage_rules(self, outfile):
(gcovr_exe, lcov_exe, genhtml_exe) = environment.find_coverage_tools()
added_rule = False
if gcovr_exe:
added_rule = True
elem = NinjaBuildElement('coverage-xml', 'CUSTOM_COMMAND', '')
elem.add_item('COMMAND', [gcovr_exe, '-x', '-r', self.environment.get_build_dir(),\
'-o', os.path.join(self.environment.get_log_dir(), 'coverage.xml')])
elem.add_item('DESC', 'Generating XML coverage report.')
elem.write(outfile)
elem = NinjaBuildElement('coverage-text', 'CUSTOM_COMMAND', '')
elem.add_item('COMMAND', [gcovr_exe, '-r', self.environment.get_build_dir(),\
'-o', os.path.join(self.environment.get_log_dir(), 'coverage.txt')])
elem.add_item('DESC', 'Generating text coverage report.')
elem.write(outfile)
if lcov_exe and genhtml_exe:
added_rule = True
phony_elem = NinjaBuildElement('coverage-html', 'phony', 'coveragereport/index.html')
phony_elem.write(outfile)
elem = NinjaBuildElement('coveragereport/index.html', 'CUSTOM_COMMAND', '')
command = [lcov_exe, '--directory', self.environment.get_build_dir(),\
'--capture', '--output-file', 'coverage.info', '--no-checksum',\
'&&', genhtml_exe, '--prefix', self.environment.get_build_dir(),\
'--output-directory', self.environment.get_log_dir(), '--title', 'Code coverage',\
'--legend', '--show-details', 'coverage.info']
elem.add_item('COMMAND', command)
elem.add_item('DESC', 'Generating HTML coverage report.')
elem.write(outfile)
if not added_rule:
mlog.log(mlog.red('Warning:'), 'coverage requested but neither gcovr nor lcov/genhtml found.')
开发者ID:beebird,项目名称:meson,代码行数:31,代码来源:ninjabackend.py
示例10: find_external_dependency
def find_external_dependency(name, environment, kwargs):
required = kwargs.get("required", True)
if not isinstance(required, bool):
raise DependencyException('Keyword "required" must be a boolean.')
lname = name.lower()
if lname in packages:
dep = packages[lname](environment, kwargs)
if required and not dep.found():
raise DependencyException('Dependency "%s" not found' % name)
return dep
pkg_exc = None
pkgdep = None
try:
pkgdep = PkgConfigDependency(name, environment, kwargs)
if pkgdep.found():
return pkgdep
except Exception as e:
pkg_exc = e
if mesonlib.is_osx():
fwdep = ExtraFrameworkDependency(name, required)
if required and not fwdep.found():
raise DependencyException('Dependency "%s" not found' % name)
return fwdep
if pkg_exc is not None:
raise pkg_exc
mlog.log("Dependency", mlog.bold(name), "found:", mlog.red("NO"))
return pkgdep
开发者ID:eriknelson,项目名称:meson,代码行数:27,代码来源:dependencies.py
示例11: check_pkgconfig
def check_pkgconfig(self):
try:
p = subprocess.Popen(["pkg-config", "--version"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out = p.communicate()[0]
if p.returncode == 0:
mlog.log("Found pkg-config:", mlog.bold(shutil.which("pkg-config")), "(%s)" % out.decode().strip())
PkgConfigDependency.pkgconfig_found = True
return
except Exception:
pass
PkgConfigDependency.pkgconfig_found = False
mlog.log("Found Pkg-config:", mlog.red("NO"))
开发者ID:eriknelson,项目名称:meson,代码行数:12,代码来源:dependencies.py
示例12: check_pkgconfig
def check_pkgconfig(self):
try:
p = subprocess.Popen(['pkg-config', '--version'], stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out = p.communicate()[0]
if p.returncode == 0:
mlog.log('Found pkg-config:', mlog.bold(shutil.which('pkg-config')),
'(%s)' % out.decode().strip())
PkgConfigDependency.pkgconfig_found = True
return
except Exception:
pass
PkgConfigDependency.pkgconfig_found = False
mlog.log('Found Pkg-config:', mlog.red('NO'))
开发者ID:itech001,项目名称:meson,代码行数:14,代码来源:dependencies.py
示例13: check_wxconfig
def check_wxconfig(self):
for wxc in ["wx-config-3.0", "wx-config"]:
try:
p = subprocess.Popen([wxc, "--version"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out = p.communicate()[0]
if p.returncode == 0:
mlog.log("Found wx-config:", mlog.bold(shutil.which(wxc)), "(%s)" % out.decode().strip())
self.wxc = wxc
WxDependency.wx_found = True
return
except Exception:
pass
WxDependency.wxconfig_found = False
mlog.log("Found wx-config:", mlog.red("NO"))
开发者ID:eriknelson,项目名称:meson,代码行数:14,代码来源:dependencies.py
示例14: check_wxconfig
def check_wxconfig(self):
for wxc in ['wx-config-3.0', 'wx-config']:
try:
p = subprocess.Popen([wxc, '--version'], stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out = p.communicate()[0]
if p.returncode == 0:
mlog.log('Found wx-config:', mlog.bold(shutil.which(wxc)),
'(%s)' % out.decode().strip())
self.wxc = wxc
WxDependency.wx_found = True
return
except Exception:
pass
WxDependency.wxconfig_found = False
mlog.log('Found wx-config:', mlog.red('NO'))
开发者ID:kylemanna,项目名称:meson,代码行数:16,代码来源:dependencies.py
示例15: __init__
def __init__(self, name, kwargs):
required = kwargs.get('required', True)
Dependency.__init__(self)
self.name = name
if PkgConfigDependency.pkgconfig_found is None:
self.check_pkgconfig()
if not PkgConfigDependency.pkgconfig_found:
raise DependencyException('Pkg-config not found.')
self.is_found = False
p = subprocess.Popen(['pkg-config', '--modversion', name], stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out = p.communicate()[0]
if p.returncode != 0:
mlog.log('Dependency', name, 'found:', mlog.red('NO'))
if required:
raise DependencyException('Required dependency %s not found.' % name)
self.modversion = 'none'
self.cargs = []
self.libs = []
else:
self.modversion = out.decode().strip()
mlog.log('Dependency', mlog.bold(name), 'found:', mlog.green('YES'), self.modversion)
version_requirement = kwargs.get('version', None)
if version_requirement is None:
self.is_found = True
else:
if not isinstance(version_requirement, str):
raise DependencyException('Version argument must be string.')
self.is_found = mesonlib.version_compare(self.modversion, version_requirement)
if not self.is_found and required:
raise DependencyException('Invalid version of a dependency, needed %s %s found %s.' % (name, version_requirement, self.modversion))
if not self.is_found:
return
p = subprocess.Popen(['pkg-config', '--cflags', name], stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out = p.communicate()[0]
if p.returncode != 0:
raise RuntimeError('Could not generate cargs for %s.' % name)
self.cargs = out.decode().split()
p = subprocess.Popen(['pkg-config', '--libs', name], stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out = p.communicate()[0]
if p.returncode != 0:
raise RuntimeError('Could not generate libs for %s.' % name)
self.libs = out.decode().split()
开发者ID:objectx,项目名称:meson,代码行数:47,代码来源:dependencies.py
注:本文中的mlog.red函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论