• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python log.error函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mod.log.error函数的典型用法代码示例。如果您正苦于以下问题:Python error函数的具体用法?Python error怎么用?Python error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了error函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: get_include_path

def get_include_path() :
    """return the global shader header search path"""
    include_path = '{}/bgfx/src'.format(proj_path)
    include_path = os.path.normpath(include_path)
    if not os.path.isdir(include_path) :
        log.error("could not find bgfx shader include search path at '{}'".format(include_path))
    return include_path
开发者ID:jaynus,项目名称:fips-bgfx,代码行数:7,代码来源:BgfxShaderEmbedded.py


示例2: ensure_valid_project_dir

def ensure_valid_project_dir(proj_dir):
    """test if project dir is valid, if not, dump error and abort

    :param proj_dir:    absolute project directory to check
    """
    if not is_valid_project_dir(proj_dir):
        log.error("'{}' is not a valid project directory".format(proj_dir))
开发者ID:TheGoozah,项目名称:fips,代码行数:7,代码来源:util.py


示例3: gather_and_write_imports

def gather_and_write_imports(fips_dir, proj_dir) :
    """first does and gather_imports, then a write_imports with the result"""
    imports = gather_imports(fips_dir, proj_dir)
    if imports is not None :
        write_imports(fips_dir, proj_dir, imports)
    else :
        log.error("project imports are incomplete, please run 'fips fetch'")
开发者ID:RobertoMalatesta,项目名称:fips,代码行数:7,代码来源:dep.py


示例4: copy_template_file

def copy_template_file(fips_dir, proj_dir, filename, values, silent=False) :
    """copy a template file from fips/templates to the project 
    directory and replace template values (e.g. the project name),
    ask for user permission if files exist

    :param fips_dir:    absolute fips directory
    :param proj_dir:    absolute project directory
    :param filename:    filename to copy from fips/templates
    :param values:      template key/value dictionary
    :param silent:      if True, overwrite existing file and don't print status
    :returns:           True file overwritten, False on not overwritten
    """
    
    src_path = fips_dir + '/templates/' + filename
    dst_path = proj_dir + '/' + filename

    if not os.path.isfile(src_path) :
        log.error("template src file '{}' doesn't exist".format(src_path))
    
    if not silent :
        if os.path.isfile(dst_path) :
            if not util.confirm("overwrite '{}'?".format(dst_path)) :
                log.info("skipping '{}'".format(dst_path))
                return False

    content = None
    with open(src_path, 'r') as f :
        content = f.read()
    content = Template(content).substitute(values)
    with open(dst_path, 'w') as f :
        f.write(content)

    if not silent :
        log.info("wrote '{}'".format(dst_path))
    return True
开发者ID:XoDeR,项目名称:Amstel,代码行数:35,代码来源:template.py


示例5: run

def run(fips_dir, proj_dir, args) :
    """run the init verb"""
    if len(args) > 0 :
        proj_name = args[0]
        project.init(fips_dir, proj_name)
    else :
        log.error("expected one arg [project]")
开发者ID:AdrienFromToulouse,项目名称:fips,代码行数:7,代码来源:init.py


示例6: load

def load(fips_dir, proj_dir, pattern) :
    """load one or more matching configs from fips and current project dir

    :param fips_dir:    absolute fips directory
    :param proj_dir:    absolute project directory
    :param pattern:     config name pattern (e.g. 'linux-make-*')
    :returns:   an array of loaded config objects
    """
    dirs = get_config_dirs(fips_dir, proj_dir)
    configs = []
    for curDir in dirs :
        paths = glob.glob('{}/{}.yml'.format(curDir, pattern))
        for path in paths :
            try :
                with open(path, 'r') as f :
                    cfg = yaml.load(f)
                folder, fname = os.path.split(path)

                # patch path, folder, and name
                cfg['path'] = path
                cfg['folder'] = folder
                cfg['name'] = os.path.splitext(fname)[0]
                if 'generator' not in cfg :
                    cfg['generator'] = 'Default'
                if 'generator-platform' not in cfg :
                    cfg['generator-platform'] = None
                if 'generator-toolset' not in cfg :
                    cfg['generator-toolset'] = None
                if 'defines' not in cfg :
                    cfg['defines'] = None
                configs.append(cfg)
            except yaml.error.YAMLError, e:
                log.error('YML parse error: {}', e.message)
开发者ID:AdrienFromToulouse,项目名称:fips,代码行数:33,代码来源:config.py


示例7: run

def run(fips_dir, proj_dir, args) :
    """run diagnostics

    :param fips_dir:    absolute path to fips directory
    :param proj_dir:    absolute path to current project
    :args:              command line args
    """
    noun = 'all'
    ok = False
    if len(args) > 0 :
        noun = args[0]
    if noun in ['all', 'configs'] :
        check_configs(fips_dir, proj_dir)
        ok = True
    if noun in ['all', 'imports'] :
        check_imports(fips_dir, proj_dir)
        ok = True
    if noun in ['all', 'tools'] :
        check_tools(fips_dir)
        ok = True
    if noun in ['all', 'fips'] :
        check_fips(fips_dir)
        ok = True
    if not ok :
        log.error("invalid noun '{}'".format(noun))
开发者ID:RobertoMalatesta,项目名称:fips,代码行数:25,代码来源:diag.py


示例8: run

def run(fips_dir, proj_dir, args) :
    if not util.is_valid_project_dir(proj_dir) :
        log.error('must be run in a project directory')
    if len(args) > 0:
        if args[0] == 'clean':
            vscode.cleanup(fips_dir, proj_dir)
        else:
            log.error("invalid noun '{}' (expected: clean)".format(noun))
开发者ID:floooh,项目名称:fips,代码行数:8,代码来源:vscode.py


示例9: check_config_valid

def check_config_valid(fips_dir, cfg, print_errors=False) :
    """check if provided config is valid, and print errors if not

    :param cfg:     a loaded config object
    :returns:       (True, [ errors ]) tuple with result and error messages
    """
    errors = []
    valid = True

    # check whether all required fields are present
    # (NOTE: name and folder should always be present since they are appended
    # during loading)
    required_fields = ['name', 'folder', 'platform', 'generator', 'build_tool', 'build_type']
    for field in required_fields :
        if field not in cfg :
            errors.append("missing field '{}' in '{}'".format(field, cfg['path']))
            valid = False
    
    # check if the platform string is valid
    if not valid_platform(cfg['platform']) :
        errors.append("invalid platform name '{}' in '{}'".format(cfg['platform'], cfg['path']))
        valid = False

    # check if the platform can be built on current host platform
    if cfg['platform'] not in target_platforms[util.get_host_platform()] :
        errors.append("'{}' is not a valid target platform for host '{}'".format(cfg['platform'], util.get_host_platform()))
        valid = False

    # check if the target platform SDK is installed
    if not check_sdk(fips_dir, cfg['platform']) :
        errors.append("platform sdk for '{}' not installed (see './fips help setup')".format(cfg['platform']))
        valid = False

    # check if the generator name is valid
    if not valid_generator(cfg['generator']) :
        errors.append("invalid generator name '{}' in '{}'".format(cfg['generator'], cfg['path']))
        valid = False

    # check if build tool is valid
    if not valid_build_tool(cfg['build_tool']) :
        errors.append("invalid build_tool name '{}' in '{}'".format(cfg['build_tool'], cfg['path']))
        valid = False

    # check if the build tool can be found
    if not check_build_tool(fips_dir, cfg['build_tool']) :
        errors.append("build tool '{}' not found".format(cfg['build_tool']))
        valid = False

    # check if build type is valid (Debug, Release, Profiling)
    if not valid_build_type(cfg['build_type']) :
        errors.append("invalid build_type '{}' in '{}'".format(cfg['build_type'], cfg['path']))
        valid = False

    if print_errors :
        for error in errors :
            log.error(error, False)

    return (valid, errors)
开发者ID:RobertoMalatesta,项目名称:fips,代码行数:58,代码来源:config.py


示例10: 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


示例11: push

def push(proj_dir):
    """runs a 'git push' in the provided git repo
    
    :param proj_dir:    path to git repo
    """
    check_exists_with_error()
    try:
        res = subprocess.check_call('git push', cwd=proj_dir, shell=True)
    except subprocess.CalledProcessError as e:
        log.error("'git push' failed with '{}'".format(e.returncode))
开发者ID:floooh,项目名称:fips,代码行数:10,代码来源:git.py


示例12: commit

def commit(proj_dir, msg):
    """runs a 'git commit -m msg' in the provided git repo

    :param proj_dir:    path to a git repo
    """
    check_exists_with_error()
    try:
        subprocess.check_call('git commit -m "{}"'.format(msg), cwd=proj_dir, shell=True)
    except subprocess.CalledProcessError as e:
        log.error("'git commit' failed with '{}'".format(e.returncode))
开发者ID:floooh,项目名称:fips,代码行数:10,代码来源:git.py


示例13: run

def run(fips_dir, proj_dir, args) :
    if len(args) > 0 :
        if args[0] == 'build' :
            build_deploy_webpage(fips_dir, proj_dir)
        elif args[0] == 'serve' :
            serve_webpage(fips_dir, proj_dir)
        else :
            log.error("Invalid param '{}', expected 'build' or 'serve'".format(args[0]))
    else :
        log.error("Param 'build' or 'serve' expected")
开发者ID:UIKit0,项目名称:oryol,代码行数:10,代码来源:webpage.py


示例14: run

def run(fips_dir, proj_dir, args) :
    """build fips project"""
    if not util.is_valid_project_dir(proj_dir) :
        log.error('must be run in a project directory')
    cfg_name = None
    if len(args) > 0 :
        cfg_name = args[0]
    if not cfg_name :
        cfg_name = settings.get(proj_dir, 'config')
    project.build(fips_dir, proj_dir, cfg_name)
开发者ID:AdrienFromToulouse,项目名称:fips,代码行数:10,代码来源:build.py


示例15: check_config_valid

def check_config_valid(fips_dir, proj_dir, cfg, print_errors=False) :
    """check if provided config is valid, and print errors if not

    :param cfg:     a loaded config object
    :returns:       (True, [ messages ]) tuple with result and error messages
    """
    messages = []
    valid = True

    # check whether all required fields are present
    # (NOTE: name and folder should always be present since they are appended
    # during loading)
    required_fields = ['name', 'folder', 'platform', 'generator', 'build_tool', 'build_type']
    for field in required_fields :
        if field not in cfg :
            messages.append("missing field '{}' in '{}'".format(field, cfg['path']))
            valid = False
    
    # check if the target platform SDK is installed
    if not check_sdk(fips_dir, cfg['platform']) :
        messages.append("platform sdk for '{}' not installed (see './fips help setup')".format(cfg['platform']))
        valid = False

    # check if the generator name is valid
    if not valid_generator(cfg['generator']) :
        messages.append("invalid generator name '{}' in '{}'".format(cfg['generator'], cfg['path']))
        valid = False

    # check if build tool is valid
    if not valid_build_tool(cfg['build_tool']) :
        messages.append("invalid build_tool name '{}' in '{}'".format(cfg['build_tool'], cfg['path']))
        valid = False

    # check if the build tool can be found
    if not check_build_tool(fips_dir, cfg['build_tool']) :
        messages.append("build tool '{}' not found".format(cfg['build_tool']))
        valid = False

    # check if build type is valid (Debug, Release, Profiling)
    if not valid_build_type(cfg['build_type']) :
        messages.append("invalid build_type '{}' in '{}'".format(cfg['build_type'], cfg['path']))
        valid = False

    # check if the toolchain file can be found (if this is a crosscompiling toolchain)
    if cfg['platform'] not in native_platforms :
        toolchain_path = get_toolchain(fips_dir, proj_dir, cfg)
        if not toolchain_path :
            messages.append("toolchain file not found for config '{}'!".format(cfg['name']))
            valid = False

    if print_errors :
        for msg in messages :
            log.error(msg, False)

    return (valid, messages)
开发者ID:AdrienFromToulouse,项目名称:fips,代码行数:55,代码来源:config.py


示例16: get_toolchain

def get_toolchain(fips_dir, proj_dir, cfg) :
    """get the toolchain path location for a config, this first checks
    for a 'cmake-toolchain' attribute, and if this does not exist, builds
    a xxx.toolchain.cmake file from the platform name (only for cross-
    compiling platforms). Toolchain files are searched in the
    following locations:
    - a fips-files/toolchains subdirectory in the project directory
    - a fips-files/toolchains subdirectory in all imported projects
    - finally in the cmake-toolchains subdirectory of the fips directory

    :param fips_dir:    absolute path to fips
    :param plat:        the target platform name
    :returns:           path to toolchain file or None for non-cross-compiling
    """

    # ignore native target platforms
    if 'platform' in cfg :
        if cfg['platform'] in native_platforms :
            return None
    else :
        log.error("config has no 'platform' attribute!'")

    # build toolchain file name
    toolchain = None
    if 'cmake-toolchain' in cfg :
        toolchain = cfg['cmake-toolchain']
    else :
        toolchain = '{}.toolchain.cmake'.format(cfg['platform'])
    
    # look for toolchain file in current project directory
    toolchain_dir = util.get_toolchains_dir(proj_dir)
    toolchain_path = None
    if toolchain_dir:
        toolchain_path = toolchain_dir + '/' + toolchain
    if toolchain_path and os.path.isfile(toolchain_path) :
        return toolchain_path
    else :
        # look for toolchain in all imported directories
        _, imported_projs = dep.get_all_imports_exports(fips_dir, proj_dir)
        for imported_proj_name in imported_projs :
            imported_proj_dir = imported_projs[imported_proj_name]['proj_dir']
            toolchain_dir = util.get_toolchains_dir(imported_proj_dir)
            toolchain_path = None
            if toolchain_dir:
                toolchain_path = toolchain_dir + '/' + toolchain
            if toolchain_path and os.path.isfile(toolchain_path):
                return toolchain_path
        else :
            # toolchain is not in current project or imported projects, 
            # try the fips directory
            toolchain_path = '{}/cmake-toolchains/{}'.format(fips_dir, toolchain)
            if os.path.isfile(toolchain_path) :
                return toolchain_path
    # fallthrough: no toolchain file found
    return None
开发者ID:floooh,项目名称:fips,代码行数:55,代码来源:config.py


示例17: run

def run(fips_dir, proj_dir, args) :
    """run the 'unset' verb"""
    if len(args) > 0 :
        noun = args[0]
        if noun in valid_nouns :
            settings.unset(proj_dir, noun)
        else :
            log.error("invalid noun '{}', must be: {}".format(
                noun, ', '.join(valid_nouns)))
    else :
        log.error("expected noun: {}".format(', '.join(valid_nouns)))
开发者ID:AdrienFromToulouse,项目名称:fips,代码行数:11,代码来源:unset.py


示例18: get_shaderc_path

def get_shaderc_path() :
    """find shaderc compiler, fail if not exists"""
    shaderc_path = os.path.abspath('{}/shaderc'.format(deploy_path))
    if not os.path.isfile(shaderc_path) :
        os_name = platform.system().lower()
        shaderc_path = '{}/bgfx/tools/bin/{}/shaderc'.format(proj_path, os_name)
        shaderc_path = os.path.normpath(shaderc_path)
        if not os.path.isfile(shaderc_path) :
            log.error("bgfx shaderc executable not found, please run 'make tools' in bgfx directory")

    return shaderc_path
开发者ID:newobj,项目名称:fips-bgfx,代码行数:11,代码来源:BgfxShaderEmbedded.py


示例19: commit_allow_empty

def commit_allow_empty(proj_dir, msg):
    """same as commit(), but uses the --allow-empty arg so that the
    commit doesn't fail if there's nothing to commit.

    :param proj_dir:    path to a git repo
    """
    check_exists_with_error()
    try:
        subprocess.check_call('git commit --allow-empty -m "{}"'.format(msg), cwd=proj_dir, shell=True)
    except subprocess.CalledProcessError as e:
        log.error("'git commit' failed with '{}'".format(e.returncode))
开发者ID:floooh,项目名称:fips,代码行数:11,代码来源:git.py


示例20: run

def run(fips_dir, proj_dir, args) :
    """run the 'setup' verb"""
    sdk_name = None
    if len(args) > 0 :
        sdk_name = args[0]
    if sdk_name == 'emscripten' :
        emscripten.setup(fips_dir, proj_dir)
    elif sdk_name == 'android' :
        android.setup(fips_dir, proj_dir)
    else :
        log.error("invalid SDK name (must be 'emscripten' or 'android')")
开发者ID:floooh,项目名称:fips,代码行数:11,代码来源:setup.py



注:本文中的mod.log.error函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python log.info函数代码示例发布时间:2022-05-27
下一篇:
Python log.colored函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap