本文整理汇总了Python中mlog.log函数的典型用法代码示例。如果您正苦于以下问题:Python log函数的具体用法?Python log怎么用?Python log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了log函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __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
示例2: 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
示例3: __init__
def __init__(self, environment, kwargs):
Dependency.__init__(self)
self.name = "boost"
try:
self.boost_root = os.environ["BOOST_ROOT"]
if not os.path.isabs(self.boost_root):
raise DependencyException("BOOST_ROOT must be an absolute path.")
except KeyError:
self.boost_root = None
if self.boost_root is None:
self.incdir = "/usr/include/boost"
else:
self.incdir = os.path.join(self.boost_root, "include/boost")
self.src_modules = {}
self.lib_modules = {}
self.lib_modules_mt = {}
self.detect_version()
self.requested_modules = self.get_requested(kwargs)
module_str = ", ".join(self.requested_modules)
if self.version is not None:
self.detect_src_modules()
self.detect_lib_modules()
self.validate_requested()
if self.boost_root is not None:
info = self.version + ", " + self.boost_root
else:
info = self.version
mlog.log("Dependency Boost (%s) found:" % module_str, mlog.green("YES"), "(" + info + ")")
else:
mlog.log("Dependency Boost (%s) found:" % module_str, mlog.red("NO"))
开发者ID:eriknelson,项目名称:meson,代码行数:30,代码来源:dependencies.py
示例4: 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
示例5: __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
示例6: __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
示例7: qmake_detect
def qmake_detect(self, mods, kwargs):
pc = subprocess.Popen(['qmake', '-v'], stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
(stdo, _) = pc.communicate()
if pc.returncode != 0:
return
stdo = stdo.decode()
if not 'version 5' in stdo:
mlog.log('QMake is not for Qt5.')
return
self.version = re.search('5(\.\d+)+', stdo).group(0)
(stdo, _) = subprocess.Popen(['qmake', '-query'], stdout=subprocess.PIPE).communicate()
qvars = {}
for line in stdo.decode().split('\n'):
line = line.strip()
if line == '':
continue
(k, v) = tuple(line.split(':', 1))
qvars[k] = v
if mesonlib.is_osx():
return self.framework_detect(qvars, mods, kwargs)
incdir = qvars['QT_INSTALL_HEADERS']
self.cargs.append('-I' + incdir)
libdir = qvars['QT_INSTALL_LIBS']
bindir = qvars['QT_INSTALL_BINS']
#self.largs.append('-L' + libdir)
for module in mods:
mincdir = os.path.join(incdir, 'Qt' + module)
self.cargs.append('-I' + mincdir)
libfile = os.path.join(libdir, 'Qt5' + module + '.lib')
if not os.path.isfile(libfile):
# MinGW links directly to .dll, not to .lib.
libfile = os.path.join(bindir, 'Qt5' + module + '.dll')
self.largs.append(libfile)
self.is_found = True
开发者ID:kylemanna,项目名称:meson,代码行数:35,代码来源:dependencies.py
示例8: qmake_detect
def qmake_detect(self, mods, kwargs):
pc = subprocess.Popen(["qmake", "-v"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdo, _) = pc.communicate()
if pc.returncode != 0:
return
stdo = stdo.decode()
if not "version 5" in stdo:
mlog.log("QMake is not for Qt5.")
return
self.version = re.search("5(\.\d+)+", stdo).match(0)
(stdo, _) = subprocess.Popen(["qmake", "-query"], stdout=subprocess.PIPE).communicate()
qvars = {}
for line in stdo.decode().split("\n"):
line = line.strip()
if line == "":
continue
(k, v) = tuple(line.split(":", 1))
qvars[k] = v
if mesonlib.is_osx():
return self.framework_detect(qvars, mods, kwargs)
incdir = qvars["QT_INSTALL_HEADERS"]
self.cargs.append("-I" + incdir)
libdir = qvars["QT_INSTALL_LIBS"]
bindir = qvars["QT_INSTALL_BINS"]
# self.largs.append('-L' + libdir)
for module in mods:
mincdir = os.path.join(incdir, "Qt" + module)
self.cargs.append("-I" + mincdir)
libfile = os.path.join(libdir, "Qt5" + module + ".lib")
if not os.path.isfile(libfile):
# MinGW links directly to .dll, not to .lib.
libfile = os.path.join(bindir, "Qt5" + module + ".dll")
self.largs.append(libfile)
self.is_found = True
开发者ID:eriknelson,项目名称:meson,代码行数:34,代码来源:dependencies.py
示例9: parse_gresource_xml
def parse_gresource_xml(self, state, fobj, resource_loc):
if isinstance(fobj, File):
fname = fobj.fname
subdir = fobj.subdir
else:
fname = fobj
subdir = state.subdir
abspath = os.path.join(state.environment.source_dir, state.subdir, fname)
relative_part = os.path.split(fname)[0]
try:
tree = ET.parse(abspath)
root = tree.getroot()
result = []
for child in root[0]:
if child.tag != 'file':
mlog.log("Warning, malformed rcc file: ", os.path.join(state.subdir, fname))
break
else:
relfname = os.path.join(resource_loc, child.text)
absfname = os.path.join(state.environment.source_dir, relfname)
if os.path.isfile(absfname):
result.append(relfname)
else:
mlog.log('Warning, resource file points to nonexisting file %s.' % relfname)
return result
except Exception:
return []
开发者ID:vijaysm,项目名称:meson,代码行数:27,代码来源:gnome.py
示例10: __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
示例11: 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
示例12: check_unknown_kwargs_int
def check_unknown_kwargs_int(self, kwargs, known_kwargs):
unknowns = []
for k in kwargs:
if not k in known_kwargs:
unknowns.append(k)
if len(unknowns) > 0:
mlog.log(mlog.bold('Warning:'), 'Unknown keyword argument(s) in target %s: %s.' %
(self.name, ', '.join(unknowns)))
开发者ID:DragoonX6,项目名称:meson,代码行数:8,代码来源:build.py
示例13: check_pkgconfig
def check_pkgconfig(self):
p = subprocess.Popen(['pkg-config', '--version'], stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out = p.communicate()[0]
if p.returncode != 0:
raise RuntimeError('Pkg-config executable not found.')
mlog.log('Found pkg-config version:', mlog.bold(out.decode().strip()),
'(%s)' % shutil.which('pkg-config'))
PkgConfigDependency.pkgconfig_found = True
开发者ID:garfunkel,项目名称:meson,代码行数:9,代码来源:dependencies.py
示例14: check_unknown_kwargs_int
def check_unknown_kwargs_int(self, kwargs, known_kwargs):
unknowns = []
for k in kwargs:
if not k in known_kwargs:
unknowns.append(k)
if len(unknowns) > 0:
mlog.log(
mlog.bold("Warning:"),
"Unknown keyword argument(s) in target %s: %s." % (self.name, ", ".join(unknowns)),
)
开发者ID:eriknelson,项目名称:meson,代码行数:10,代码来源:build.py
示例15: 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
示例16: generate_shlib_aliases
def generate_shlib_aliases(self, target, outdir, outfile, elem):
basename = target.get_filename()
aliases = target.get_aliaslist()
aliascmd = []
if shutil.which('ln'):
for alias in aliases:
aliasfile = os.path.join(outdir, alias)
cmd = ["&&", 'ln', '-s', '-f', basename, aliasfile]
aliascmd += cmd
else:
mlog.log("Library versioning disabled because host does not support symlinks.")
elem.add_item('aliasing', aliascmd)
elem.write(outfile)
开发者ID:beebird,项目名称:meson,代码行数:13,代码来源:ninjabackend.py
示例17: __init__
def __init__(self, name, subdir, kwargs):
self.name = name
self.subdir = subdir
self.dependencies = []
self.process_kwargs(kwargs)
self.extra_files = []
self.install_rpath = ''
unknowns = []
for k in kwargs:
if k not in CustomTarget.known_kwargs:
unknowns.append(k)
if len(unknowns) > 0:
mlog.log(mlog.bold('Warning:'), 'Unknown keyword arguments in target %s: %s' %
(self.name, ', '.join(unknowns)))
开发者ID:objectx,项目名称:meson,代码行数:14,代码来源:build.py
示例18: 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
示例19: 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
示例20: parse_qrc
def parse_qrc(self, state, fname):
abspath = os.path.join(state.environment.source_dir, state.subdir, fname)
relative_part = os.path.split(fname)[0]
try:
tree = ET.parse(abspath)
root = tree.getroot()
result = []
for child in root[0]:
if child.tag != 'file':
mlog.log("Warning, malformed rcc file: ", os.path.join(state.subdir, fname))
break
else:
result.append(os.path.join(state.subdir, relative_part, child.text))
return result
except Exception:
return []
开发者ID:gitnicotobs,项目名称:meson,代码行数:16,代码来源:qt4.py
注:本文中的mlog.log函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论