本文整理汇总了Python中mod.log.colored函数的典型用法代码示例。如果您正苦于以下问题:Python colored函数的具体用法?Python colored怎么用?Python colored使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了colored函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: check_imports
def check_imports(fips_dir, proj_dir) :
"""recursively check imports"""
log.colored(log.YELLOW, '=== imports:')
if util.is_valid_project_dir(proj_dir) :
dep.check_imports(fips_dir, proj_dir)
else :
log.warn('currently not in a project directory')
开发者ID:RobertoMalatesta,项目名称:fips,代码行数:7,代码来源:diag.py
示例2: configure
def configure(fips_dir, proj_dir, cfg_name) :
"""run ccmake or cmake-gui on the provided project and config
:param fips_dir: absolute fips path
:param proj_dir: absolute project dir
:cfg_name: build config name
"""
dep.fetch_imports(fips_dir, proj_dir)
proj_name = util.get_project_name_from_dir(proj_dir)
util.ensure_valid_project_dir(proj_dir)
dep.gather_and_write_imports(fips_dir, proj_dir)
# load configs, if more then one, only use first one
configs = config.load(fips_dir, proj_dir, cfg_name)
if configs :
cfg = configs[0]
log.colored(log.YELLOW, '=== configuring: {}'.format(cfg['name']))
# generate build files
if not gen_project(fips_dir, proj_dir, cfg, True) :
log.error("Failed to generate '{}' of project '{}'".format(cfg['name'], proj_name))
# run ccmake or cmake-gui
build_dir = util.get_build_dir(fips_dir, proj_name, cfg)
if ccmake.check_exists(fips_dir) :
ccmake.run(build_dir)
elif cmake_gui.check_exists(fips_dir) :
cmake_gui.run(build_dir)
else :
log.error("Neither 'ccmake' nor 'cmake-gui' found (run 'fips diag')")
else :
log.error("No configs found for '{}'".format(cfg_name))
开发者ID:RobertoMalatesta,项目名称:fips,代码行数:33,代码来源:project.py
示例3: check_fips
def check_fips(fips_dir) :
"""check whether fips is uptodate"""
log.colored(log.YELLOW, '=== fips:')
if git.check_branch_out_of_sync(fips_dir, 'master') :
log.warn("'fips' is not update, please run 'git pull' in fips directory!")
else :
log.colored(log.GREEN, ' uptodate')
开发者ID:RobertoMalatesta,项目名称:fips,代码行数:7,代码来源:diag.py
示例4: check_local_changes
def check_local_changes(fips_dir, proj_dir) :
"""this is a variation of check_imports which just checks for local
(uncommitted or unpushed) changes.
:param fips_dir: absolute fips directory
:param proj_dir: absolute project directory
:returns: True if checks were valid
"""
success, imported_projects = get_all_imports_exports(fips_dir, proj_dir)
num_imports = 0
for imp_proj_name in imported_projects :
imp_proj_dir = imported_projects[imp_proj_name]['proj_dir']
# don't git-check the top-level project directory
if imp_proj_dir != proj_dir :
num_imports += 1
log.info("checking '{}':".format(imp_proj_name))
if os.path.isdir(imp_proj_dir) :
if git.has_local_changes(imp_proj_dir) :
log.warn(" '{}' has local changes (uncommitted and/or unpushed)".format(imp_proj_dir))
else :
log.colored(log.GREEN, ' no local changes')
else :
log.warn(" '{}' does not exist, please run 'fips fetch'".format(imp_proj_dir))
if success and num_imports == 0 :
log.info(' none')
开发者ID:floooh,项目名称:fips,代码行数:26,代码来源:dep.py
示例5: build_deploy_webpage
def build_deploy_webpage(fips_dir, proj_dir) :
# if webpage dir exists, clear it first
ws_dir = util.get_workspace_dir(fips_dir)
webpage_dir = '{}/fips-deploy/oryol-webpage'.format(ws_dir)
if os.path.isdir(webpage_dir) :
shutil.rmtree(webpage_dir)
os.makedirs(webpage_dir)
# compile emscripten, pnacl and android samples
if BuildEmscripten and emscripten.check_exists(fips_dir) :
project.gen(fips_dir, proj_dir, 'emsc-ninja-release')
project.build(fips_dir, proj_dir, 'emsc-ninja-release')
if BuildWasm and emscripten.check_exists(fips_dir) :
project.gen(fips_dir, proj_dir, 'wasm-ninja-release')
project.build(fips_dir, proj_dir, 'wasm-ninja-release')
if BuildPNaCl and nacl.check_exists(fips_dir) :
project.gen(fips_dir, proj_dir, 'pnacl-ninja-release')
project.build(fips_dir, proj_dir, 'pnacl-ninja-release')
# export sample assets
export_assets(fips_dir, proj_dir, webpage_dir)
# deploy the webpage
deploy_webpage(fips_dir, proj_dir, webpage_dir)
log.colored(log.GREEN, 'Generated Samples web page under {}.'.format(webpage_dir))
开发者ID:UIKit0,项目名称:oryol,代码行数:26,代码来源:webpage.py
示例6: check_imports
def check_imports(fips_dir, proj_dir) :
"""do various checks on the imports of a project
:param fips_dir: absolute fips directory
:param proj_dir: absolute project directory
:returns: True if checks were valid
"""
# check whether any imported projects are in sync with the remote git repo
success, imported_projects = get_all_imports_exports(fips_dir, proj_dir)
num_imports = 0
for imp_proj_name in imported_projects :
imp_proj_dir = util.get_project_dir(fips_dir, imp_proj_name)
# don't git-check the top-level project directory
if imp_proj_dir != proj_dir :
num_imports += 1
log.info("git status of '{}':".format(imp_proj_name))
if os.path.isdir(imp_proj_dir) :
if git.check_out_of_sync(imp_proj_dir) :
log.warn(" '{}' is out of sync with remote git repo".format(imp_proj_dir))
else :
log.colored(log.GREEN, ' uptodate')
else :
log.warn(" '{}' does not exist, please run 'fips fetch'".format(imp_proj_dir))
if success and num_imports == 0 :
log.info(' none')
# gather imports, this will dump warnings
gather_imports(fips_dir, proj_dir)
开发者ID:RobertoMalatesta,项目名称:fips,代码行数:30,代码来源:dep.py
示例7: gdb
def gdb(fips_dir, proj_dir, cfg_name, target=None, target_args=None) :
"""debug a single target with gdb"""
# prepare
proj_name = util.get_project_name_from_dir(proj_dir)
util.ensure_valid_project_dir(proj_dir)
# load the config(s)
configs = config.load(fips_dir, proj_dir, cfg_name)
if configs :
for cfg in configs :
# check if config is valid
config_valid, _ = config.check_config_valid(fips_dir, proj_dir, cfg, print_errors = True)
if config_valid :
deploy_dir = util.get_deploy_dir(fips_dir, proj_name, cfg['name'])
log.colored(log.YELLOW, "=== gdb: {}".format(cfg['name']))
cmdLine = ['gdb', "-ex", "run", "--args", target]
if target_args :
cmdLine.extend(target_args)
try:
subprocess.call(args = cmdLine, cwd = deploy_dir)
except OSError :
log.error("Failed to execute gdb (not installed?)")
else :
log.error("Config '{}' not valid in this environment".format(cfg['name']))
else :
log.error("No valid configs found for '{}'".format(cfg_name))
return True
开发者ID:floooh,项目名称:fips,代码行数:29,代码来源:gdb.py
示例8: list_configs
def list_configs(fips_dir, proj_dir) :
"""list available configs"""
log.colored(log.YELLOW, '=== configs:')
configs = config.list(fips_dir, proj_dir, '*')
for folder in configs :
log.colored(log.BLUE, 'from {}:'.format(folder))
for cfg in configs[folder] :
log.info(' {}'.format(cfg))
开发者ID:RobertoMalatesta,项目名称:fips,代码行数:8,代码来源:list.py
示例9: build
def build(fips_dir, proj_dir, cfg_name, target=None) :
"""perform a build of config(s) in project
:param fips_dir: absolute path of fips
:param proj_dir: absolute path of project dir
:param cfg_name: config name or pattern
:param target: optional target name (build all if None)
:returns: True if build was successful
"""
# prepare
dep.fetch_imports(fips_dir, proj_dir)
proj_name = util.get_project_name_from_dir(proj_dir)
util.ensure_valid_project_dir(proj_dir)
dep.gather_and_write_imports(fips_dir, proj_dir)
# load the config(s)
configs = config.load(fips_dir, proj_dir, cfg_name)
num_valid_configs = 0
if configs :
for cfg in configs :
# check if config is valid
config_valid, _ = config.check_config_valid(fips_dir, cfg, print_errors=True)
if config_valid :
log.colored(log.YELLOW, "=== building: {}".format(cfg['name']))
if not gen_project(fips_dir, proj_dir, cfg, False) :
log.error("Failed to generate '{}' of project '{}'".format(cfg['name'], proj_name))
# select and run build tool
build_dir = util.get_build_dir(fips_dir, proj_name, cfg)
num_jobs = settings.get(proj_dir, 'jobs')
result = False
if cfg['build_tool'] == make.name :
result = make.run_build(fips_dir, target, build_dir, num_jobs)
elif cfg['build_tool'] == ninja.name :
result = ninja.run_build(fips_dir, target, build_dir, num_jobs)
elif cfg['build_tool'] == xcodebuild.name :
result = xcodebuild.run_build(fips_dir, target, cfg['build_type'], build_dir, num_jobs)
else :
result = cmake.run_build(fips_dir, target, cfg['build_type'], build_dir)
if result :
num_valid_configs += 1
else :
log.error("Failed to build config '{}' of project '{}'".format(cfg['name'], proj_name))
else :
log.error("Config '{}' not valid in this environment".format(cfg['name']))
else :
log.error("No valid configs found for '{}'".format(cfg_name))
if num_valid_configs != len(configs) :
log.error('{} out of {} configs failed!'.format(len(configs) - num_valid_configs, len(configs)))
return False
else :
log.colored(log.GREEN, '{} configs built'.format(num_valid_configs))
return True
开发者ID:RobertoMalatesta,项目名称:fips,代码行数:57,代码来源:project.py
示例10: list_settings
def list_settings(proj_dir) :
"""list settings file content"""
log.colored(log.YELLOW, '=== settings:')
if util.is_valid_project_dir(proj_dir) :
for key in ['config', 'target', 'jobs', 'ccache'] :
value = settings.get(proj_dir, key)
if type(value) is bool :
value = 'on' if value else 'off'
default = ' (default value)' if value == settings.get_default(key) else ''
log.info(' {}{}:{} {}{}'.format(log.BLUE, key, log.DEF, value, default))
else :
log.info(' currently not in a valid project directory')
开发者ID:RobertoMalatesta,项目名称:fips,代码行数:12,代码来源:list.py
示例11: check_tools
def check_tools(fips_dir) :
"""check whether required command line tools can be found"""
log.colored(log.YELLOW, '=== tools:')
tools = [ git, cmake, ccmake, cmake_gui, make, ninja, xcodebuild, java, ant, node, python2, ccache ]
platform = util.get_host_platform()
for tool in tools:
if platform in tool.platforms :
if tool.check_exists(fips_dir) :
log.ok(tool.name, 'found')
else :
if tool.optional :
log.optional(tool.name, 'OPTIONAL, NOT FOUND ({})'.format(tool.not_found))
else :
log.failed(tool.name, 'NOT FOUND ({})'.format(tool.not_found))
开发者ID:RobertoMalatesta,项目名称:fips,代码行数:14,代码来源:diag.py
示例12: build_deploy_webpage
def build_deploy_webpage(fips_dir, proj_dir) :
# if webpage dir exists, clear it first
ws_dir = util.get_workspace_dir(fips_dir)
webpage_dir = '{}/fips-deploy/oryol-wasm-buildsuite'.format(ws_dir)
if not os.path.exists(webpage_dir) :
os.makedirs(webpage_dir)
config = 'wasmasmjs-make-release'
project.clean(fips_dir, proj_dir, config)
project.gen(fips_dir, proj_dir, config)
for target in Samples :
project.build(fips_dir, proj_dir, config, target)
copy_build_files(fips_dir, proj_dir, webpage_dir)
if ExportAssets :
export_assets(fips_dir, proj_dir, webpage_dir)
log.colored(log.GREEN, 'Done. ({})'.format(webpage_dir))
开发者ID:floooh,项目名称:oryol-samples,代码行数:17,代码来源:wasmtest.py
示例13: make_clean
def make_clean(fips_dir, proj_dir, cfg_name) :
"""perform a 'make clean' on the project
:param fips_dir: absolute path of fips
:param proj_dir: absolute path of project dir
:param cfg_name: config name or pattern
"""
proj_name = util.get_project_name_from_dir(proj_dir)
configs = config.load(fips_dir, proj_dir, cfg_name)
num_valid_configs = 0
if configs :
for cfg in configs :
config_valid, _ = config.check_config_valid(fips_dir, cfg, print_errors=True)
if config_valid :
log.colored(log.YELLOW, "=== cleaning: {}".format(cfg['name']))
build_dir = util.get_build_dir(fips_dir, proj_name, cfg)
result = False
if cfg['build_tool'] == make.name :
result = make.run_clean(fips_dir, build_dir)
elif cfg['build_tool'] == ninja.name :
result = ninja.run_clean(fips_dir, build_dir)
elif cfg['build_tool'] == xcodebuild.name :
result = xcodebuild.run_clean(fips_dir, build_dir)
else :
result = cmake.run_clean(fips_dir, build_dir)
if result :
num_valid_configs += 1
else :
log.error("Failed to clean config '{}' of project '{}'".format(cfg['name'], proj_name))
else :
log.error("Config '{}' not valid in this environment".format(cfg['name']))
else :
log.error("No valid configs found for '{}'".format(cfg_name))
if num_valid_configs != len(configs) :
log.error('{} out of {} configs failed!'.format(len(configs) - num_valid_configs, len(configs)))
return False
else :
log.colored(log.GREEN, '{} configs cleaned'.format(num_valid_configs))
return True
开发者ID:RobertoMalatesta,项目名称:fips,代码行数:43,代码来源:project.py
示例14: build_deploy_webpage
def build_deploy_webpage(fips_dir, proj_dir) :
# if webpage dir exists, clear it first
ws_dir = util.get_workspace_dir(fips_dir)
webpage_dir = '{}/fips-deploy/oryol-samples-webpage'.format(ws_dir)
if os.path.isdir(webpage_dir) :
shutil.rmtree(webpage_dir)
os.makedirs(webpage_dir)
if emscripten.check_exists(fips_dir) :
project.gen(fips_dir, proj_dir, BuildConfig)
project.build(fips_dir, proj_dir, BuildConfig)
# export sample assets
if ExportAssets :
export_assets(fips_dir, proj_dir, webpage_dir)
# deploy the webpage
deploy_webpage(fips_dir, proj_dir, webpage_dir)
log.colored(log.GREEN, 'Generated Samples web page under {}.'.format(webpage_dir))
开发者ID:floooh,项目名称:oryol-samples,代码行数:20,代码来源:webpage.py
示例15: build_deploy_webpage
def build_deploy_webpage(fips_dir, proj_dir) :
# if webpage dir exists, clear it first
ws_dir = util.get_workspace_dir(fips_dir)
webpage_dir = '{}/fips-deploy/yakc-webpage/virtualkc'.format(ws_dir)
if os.path.isdir(webpage_dir) :
shutil.rmtree(webpage_dir)
os.makedirs(webpage_dir)
# compile emscripten, pnacl and android samples
if emscripten.check_exists(fips_dir) :
project.gen(fips_dir, proj_dir, 'yakc-emsc-make-release')
project.build(fips_dir, proj_dir, 'yakc-emsc-make-release')
# build the webpage via jekyll
subprocess.call('jekyll build', cwd=proj_dir+'/web', shell=True)
# deploy the webpage
deploy_webpage(fips_dir, proj_dir, webpage_dir)
log.colored(log.GREEN, 'Generated web page under {}.'.format(webpage_dir))
开发者ID:RobertoMalatesta,项目名称:yakc,代码行数:20,代码来源:web.py
示例16: show_help
def show_help(args) :
"""show help text"""
if len(args) > 0 :
# show help for one verb
verb_name = args[0]
if verb_name in verb.verbs :
verb.verbs[verb_name].help()
else :
log.error("unknown verb '{}'".format(verb))
else :
# show generic help
log.info("fips: the high-level, multi-platform build system wrapper\n"
"v{}\n"
"https://www.github.com/floooh/fips\n".format(VERSION))
for proj_name in verb.proj_verbs :
if proj_name != 'fips' :
log.colored(log.BLUE, "=== imported from '{}':".format(proj_name))
for verb_name in verb.proj_verbs[proj_name] :
verb.verbs[verb_name].help()
log.info(' ')
开发者ID:AdrienFromToulouse,项目名称:fips,代码行数:20,代码来源:fips.py
示例17: gen_project
def gen_project(fips_dir, proj_dir, cfg, force) :
"""private: generate build files for one config"""
proj_name = util.get_project_name_from_dir(proj_dir)
build_dir = util.get_build_dir(fips_dir, proj_name, cfg)
defines = {}
defines['FIPS_USE_CCACHE'] = 'ON' if settings.get(proj_dir, 'ccache') else 'OFF'
do_it = force
if not os.path.isdir(build_dir) :
os.makedirs(build_dir)
do_it = True
if do_it :
# if Ninja build tool and on Windows, need to copy
# the precompiled ninja.exe to the build dir
if cfg['build_tool'] == 'ninja' :
ninja.prepare_ninja_tool(fips_dir, build_dir)
log.colored(log.YELLOW, "=== generating: {}".format(cfg['name']))
toolchain_path = config.get_toolchain_for_platform(fips_dir, cfg['platform'])
return cmake.run_gen(cfg, proj_dir, build_dir, toolchain_path, defines)
else :
return True
开发者ID:RobertoMalatesta,项目名称:fips,代码行数:21,代码来源:project.py
示例18: list_imports
def list_imports(fips_dir, proj_dir) :
"""list project imports"""
log.colored(log.YELLOW, '=== imports:')
if util.is_valid_project_dir(proj_dir) :
success, result = dep.get_all_imports_exports(fips_dir, proj_dir)
if not success :
log.warn("missing import project directories, please run 'fips fetch'")
for dep_proj_name in result :
# top level project is in result, but has no URL set, filter
# this from the output
log.colored(log.BLUE, "project '{}' imports:".format(dep_proj_name))
cur_dep = result[dep_proj_name]
if cur_dep['imports'] :
for imp_proj in cur_dep['imports'] :
git_url = cur_dep['imports'][imp_proj]['git']
git_branch = cur_dep['imports'][imp_proj]['branch']
log.info(" '{}' from '{}' at branch '{}'".format(imp_proj, git_url, git_branch))
else :
log.info(" nothing")
else :
log.info(' currently not in a valid project directory')
开发者ID:RobertoMalatesta,项目名称:fips,代码行数:21,代码来源:list.py
示例19: _rec_update_imports
def _rec_update_imports(fips_dir, proj_dir, handled) :
"""same as _rec_fetch_imports() but for updating the imported projects
"""
ws_dir = util.get_workspace_dir(fips_dir)
proj_name = util.get_project_name_from_dir(proj_dir)
if proj_name not in handled :
handled.append(proj_name)
imports = get_imports(fips_dir, proj_dir)
for dep in imports:
dep_proj_name = dep
if dep not in handled:
dep_proj_dir = util.get_project_dir(fips_dir, dep_proj_name)
log.colored(log.YELLOW, "=== dependency: '{}':".format(dep_proj_name))
dep_ok = False
if os.path.isdir(dep_proj_dir) :
# directory did not exist, do a fresh git clone
dep = imports[dep_proj_name]
git_commit = None if 'rev' not in dep else dep['rev']
if git.has_local_changes(dep_proj_dir) :
log.warn(" '{}' has local changes, skipping...".format(dep_proj_dir))
else :
log.colored(log.BLUE, " updating '{}'...".format(dep_proj_dir))
git.update(dep_proj_dir)
if git_commit:
log.colored(log.YELLOW, "=== revision: '{}':".format(git_commit))
dep_ok = git.checkout(dep_proj_dir, git_commit)
else:
dep_ok = True
else :
log.warn(" '{}' does not exist, please run 'fips fetch'".format(dep_proj_dir))
# recuse
if dep_ok :
handled = _rec_update_imports(fips_dir, dep_proj_dir, handled)
# done, return the new handled array
return handled
开发者ID:floooh,项目名称:fips,代码行数:35,代码来源:dep.py
示例20: list_exports
def list_exports(fips_dir, proj_dir) :
"""list project exports"""
log.colored(log.YELLOW, '=== exports:')
if util.is_valid_project_dir(proj_dir) :
success, result = dep.get_all_imports_exports(fips_dir, proj_dir)
if not success :
log.warn("missing import project directories, please un 'fips fetch'")
for dep_proj_name in result :
cur_dep = result[dep_proj_name]
log.colored(log.BLUE, "project '{}' exports:".format(dep_proj_name))
cur_modules = cur_dep['exports']['modules']
cur_hdrs = cur_dep['exports']['header-dirs']
cur_libs = cur_dep['exports']['lib-dirs']
cur_defs = cur_dep['exports']['defines']
if not (cur_modules or cur_hdrs or cur_libs or cur_defs) :
log.info(" nothing")
if cur_modules :
log.info(" modules:")
for mod in cur_modules :
log.info(" {} => {}".format(mod, cur_modules[mod]))
if cur_hdrs :
log.info(" header search dirs:")
for hdr in cur_hdrs :
log.info(" {}".format(hdr))
if cur_libs :
log.info(" lib search dirs:")
for lib in cur_libs :
log.info(" {}".format(lib))
if cur_defs :
log.info(" defines:")
for define in cur_defs :
log.info(" {} => {}".format(define, cur_defs[define]))
else :
log.info(' currently not in a valid project directory')
开发者ID:RobertoMalatesta,项目名称:fips,代码行数:40,代码来源:list.py
注:本文中的mod.log.colored函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论