当前位置: 首页>>代码示例>>Python>>正文


Python Logs.verbose方法代码示例

本文整理汇总了Python中waflib.Logs.verbose方法的典型用法代码示例。如果您正苦于以下问题:Python Logs.verbose方法的具体用法?Python Logs.verbose怎么用?Python Logs.verbose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在waflib.Logs的用法示例。


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

示例1: hwaf_ishell

# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import verbose [as 别名]

#.........这里部分代码省略.........
            ]
        # FIXME: when c-shells are supported...
        # c-shells use a space as an alias separation token
        # in c-shell:
        #   alias ll 'ls -l'
        # in s-shell:
        #   alias ll='ls -l'
        #shell_alias = ' ' 
    else:
        # default to dash...
        dotrc_fname = os.path.join(tmpdir, '.bashrc')
        shell_cmd += [
            #'--init-file',
            #dotrc_fname,
            '-i',
            ]
        env['ENV'] = dotrc_fname
        pass

    ###

    hwaf_runtime_aliases = ";\n".join([
        "alias %s%s'%s'" % (alias[0], shell_alias, alias[1])
        for alias in ctx.env.HWAF_RUNTIME_ALIASES
        ])
    
    dotrc = open(dotrc_fname, 'w')
    dotrc.write(textwrap.dedent(
        '''
        ## automatically generated by hwaf-shell
        echo ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
        echo ":: launching a sub-shell with the correct environment..."
        echo ":: sourcing ${HOME}/%(dotrc_fname)s..."
        source ${HOME}/%(dotrc_fname)s
        echo ":: sourcing ${HOME}/%(dotrc_fname)s... [done]"

        # adjust env. variables
        export PATH=%(hwaf_path)s
        export LD_LIBRARY_PATH=%(hwaf_ld_library_path)s
        export DYLD_LIBRARY_PATH=%(hwaf_dyld_library_path)s
        export PYTHONPATH=%(hwaf_pythonpath)s

        # customize PS1 so we know we are in a hwaf subshell
        export PS1="[hwaf] ${PS1}"

        # setup aliases
        %(hwaf_runtime_aliases)s
        
        echo ":: hwaf environment... [setup]"
        echo ":: hit ^D or exit to go back to the parent shell"
        echo ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
        ''' % {
            'dotrc_fname' : os.path.basename(dotrc_fname),
            'hwaf_path': env['PATH'],
            'hwaf_ld_library_path': env['LD_LIBRARY_PATH'],
            'hwaf_dyld_library_path': env['DYLD_LIBRARY_PATH'],
            'hwaf_pythonpath': env['PYTHONPATH'],
            'hwaf_runtime_aliases': hwaf_runtime_aliases,
            }
        ))
    dotrc.flush()
    dotrc.close()

    for k in env:
        v = env[k]
        if not isinstance(v, str):
            ctx.fatal('env[%s]=%r (%s)' % (k,v,type(v)))
            pass
        pass
    
    retval = subprocess.Popen(
        shell_cmd,
        env=env,
        cwd=ishell_cwd,
        shell=True,
        ).wait()

    try:
        import shutil
        shutil.rmtree(tmpdir)
    except Exception:
        msg.verbose('could not remove directory [%s]' % tmpdir)
        pass

    if retval:
        signame = None
        if retval < 0: # signal?
            import signal
            for name, val in vars(signal).items():
                if len(name) > 3 and name[:3] == 'SIG' and name[3] != '_':
                    if val == -retval:
                        signame = name
                        break
        if signame:
            raise waflib.Errors.WafError(
                "Command %s terminated with signal %s." % (shell_cmd, signame))
        else:
            raise waflib.Errors.WafError(
                "Command %s exited with code %i" % (shell_cmd, retval))
    return retval
开发者ID:hwaf,项目名称:hep-waftools,代码行数:104,代码来源:hwaf-runtime.py


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