本文整理汇总了Python中mlog.green函数的典型用法代码示例。如果您正苦于以下问题:Python green函数的具体用法?Python green怎么用?Python green使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了green函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: 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
示例2: detect
def detect(self):
libname = os.path.join(self.libdir, self.libname)
mainname = os.path.join(self.libdir, self.libmain_name)
if os.path.exists(libname) and os.path.exists(mainname):
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
if self.is_found:
self.link_args.append('-lpthread')
return self.is_found
示例3: __init__
def __init__(self, kwargs):
Dependency.__init__(self)
# GMock may be a library or just source.
# Work with both.
self.name = 'gmock'
self.libdir = '/usr/lib'
self.libname = 'libgmock.so'
self.src_include_dir = '/usr/src/gmock'
self.src_dir = '/usr/src/gmock/src'
self.all_src = os.path.join(self.src_dir, 'gmock-all.cc')
self.main_src = os.path.join(self.src_dir, 'gmock_main.cc')
fname = os.path.join(self.libdir, self.libname)
if os.path.exists(fname):
self.is_found = True
self.compile_args = []
self.link_args = ['-lgmock']
self.sources = []
mlog.log('Dependency GMock 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 kwargs.get('main', False):
self.sources = [self.all_src, self.main_src]
else:
self.sources = [self.all_src]
mlog.log('Dependency GMock found:', mlog.green('YES'), '(building self)')
else:
mlog.log('Dependency GMock found:', mlog.red('NO'))
self.is_found = False
示例4: __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"))
示例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'))
示例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'))
示例7: __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'))
示例8: __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()
示例9: __init__
def __init__(self):
mlog.log('Detecting Qt tools.')
# The binaries have different names on different
# distros. Joy.
self.moc = dependencies.ExternalProgram('moc-qt4', silent=True)
if not self.moc.found():
self.moc = dependencies.ExternalProgram('moc', silent=True)
self.uic = dependencies.ExternalProgram('uic-qt4', silent=True)
if not self.uic.found():
self.uic = dependencies.ExternalProgram('uic', silent=True)
self.rcc = dependencies.ExternalProgram('rcc-qt4', silent=True)
if not self.rcc.found():
self.rcc = dependencies.ExternalProgram('rcc', silent=True)
# Moc, uic and rcc write their version strings to stderr.
# Moc and rcc return a non-zero result when doing so.
# What kind of an idiot thought that was a good idea?
if self.moc.found():
mp = subprocess.Popen(self.moc.get_command() + ['-v'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdout, stderr) = mp.communicate()
stdout = stdout.decode().strip()
stderr = stderr.decode().strip()
if 'Qt Meta' in stderr:
moc_ver = stderr
else:
raise MesonException('Moc preprocessor is not for Qt 4. Output:\n%s\n%s' %
(stdout, stderr))
mlog.log(' moc:', mlog.green('YES'), '(%s, %s)' % \
(' '.join(self.moc.fullpath), moc_ver.split()[-1]))
else:
mlog.log(' moc:', mlog.red('NO'))
if self.uic.found():
up = subprocess.Popen(self.uic.get_command() + ['-v'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdout, stderr) = up.communicate()
stdout = stdout.decode().strip()
stderr = stderr.decode().strip()
if 'version 4.' in stderr:
uic_ver = stderr
else:
raise MesonException('Uic compiler is not for Qt4. Output:\n%s\n%s' %
(stdout, stderr))
mlog.log(' uic:', mlog.green('YES'), '(%s, %s)' % \
(' '.join(self.uic.fullpath), uic_ver.split()[-1]))
else:
mlog.log(' uic:', mlog.red('NO'))
if self.rcc.found():
rp = subprocess.Popen(self.rcc.get_command() + ['-v'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdout, stderr) = rp.communicate()
stdout = stdout.decode().strip()
stderr = stderr.decode().strip()
if 'version 4.' in stderr:
rcc_ver = stderr
else:
raise MesonException('Rcc compiler is not for Qt 4. Output:\n%s\n%s' %
(stdout, stderr))
mlog.log(' rcc:', mlog.green('YES'), '(%s, %s)'\
% (' '.join(self.rcc.fullpath), rcc_ver.split()[-1]))
else:
mlog.log(' rcc:', mlog.red('NO'))
示例10: __init__
def __init__(self, environment, kwargs):
super().__init__()
self.name = 'threads'
self.is_found = True
mlog.log('Dependency', mlog.bold(self.name), 'found:', mlog.green('YES'))
示例11: find_exes
def find_exes(self):
# The binaries have different names on different
# distros. Joy.
global qt5toolinfo_printed
self.moc = ExternalProgram('moc', silent=True)
if not self.moc.found():
self.moc = ExternalProgram('moc-qt5', silent=True)
self.uic = ExternalProgram('uic', silent=True)
if not self.uic.found():
self.uic = ExternalProgram('uic-qt5', silent=True)
self.rcc = ExternalProgram('rcc', silent=True)
if not self.rcc.found():
self.rcc = ExternalProgram('rcc-qt5', silent=True)
# Moc, uic and rcc write their version strings to stderr.
# Moc and rcc return a non-zero result when doing so.
# What kind of an idiot thought that was a good idea?
if self.moc.found():
mp = subprocess.Popen([self.moc.get_command(), '-v'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdout, stderr) = mp.communicate()
stdout = stdout.decode().strip()
stderr = stderr.decode().strip()
if 'Qt 5' in stderr:
moc_ver = stderr
elif '5.' in stdout:
moc_ver = stdout
else:
raise DependencyException('Moc preprocessor is not for Qt 5. Output:\n%s\n%s' %
(stdout, stderr))
if not qt5toolinfo_printed:
mlog.log(' moc:', mlog.green('YES'), '(%s %s)' % \
(self.moc.fullpath, moc_ver.split()[-1]))
else:
if not qt5toolinfo_printed:
mlog.log(' moc:', mlog.red('NO'))
if self.uic.found():
up = subprocess.Popen([self.uic.get_command(), '-v'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdout, stderr) = up.communicate()
stdout = stdout.decode().strip()
stderr = stderr.decode().strip()
if 'version 5.' in stderr:
uic_ver = stderr
elif '5.' in stdout:
uic_ver = stdout
else:
raise DependencyException('Uic compiler is not for Qt 5. Output:\n%s\n%s' %
(stdout, stderr))
if not qt5toolinfo_printed:
mlog.log(' uic:', mlog.green('YES'), '(%s %s)' % \
(self.uic.fullpath, uic_ver.split()[-1]))
else:
if not qt5toolinfo_printed:
mlog.log(' uic:', mlog.red('NO'))
if self.rcc.found():
rp = subprocess.Popen([self.rcc.get_command(), '-v'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdout, stderr) = rp.communicate()
stdout = stdout.decode().strip()
stderr = stderr.decode().strip()
if 'version 5.' in stderr:
rcc_ver = stderr
elif '5.' in stdout:
rcc_ver = stdout
else:
raise DependencyException('Rcc compiler is not for Qt 5. Output:\n%s\n%s' %
(stdout, stderr))
if not qt5toolinfo_printed:
mlog.log(' rcc:', mlog.green('YES'), '(%s %s)'\
% (self.rcc.fullpath, rcc_ver.split()[-1]))
else:
if not qt5toolinfo_printed:
mlog.log(' rcc:', mlog.red('NO'))
qt5toolinfo_printed = True