本文整理汇总了Python中pex.tracer.TRACER.should_log方法的典型用法代码示例。如果您正苦于以下问题:Python TRACER.should_log方法的具体用法?Python TRACER.should_log怎么用?Python TRACER.should_log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pex.tracer.TRACER
的用法示例。
在下文中一共展示了TRACER.should_log方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: demote_bootstrap
# 需要导入模块: from pex.tracer import TRACER [as 别名]
# 或者: from pex.tracer.TRACER import should_log [as 别名]
def demote_bootstrap(cls):
TRACER.log('Bootstrap complete, performing final sys.path modifications...')
should_log = {level: TRACER.should_log(V=level) for level in range(1, 10)}
def log(msg, V=1):
if should_log.get(V, False):
print('pex: {}'.format(msg), file=sys.stderr)
# Remove the third party resources pex uses and demote pex bootstrap code to the end of
# sys.path for the duration of the run to allow conflicting versions supplied by user
# dependencies to win during the course of the execution of user code.
unregister_finders()
third_party.uninstall()
bootstrap = Bootstrap.locate()
log('Demoting code from %s' % bootstrap, V=2)
for module in bootstrap.demote():
log('un-imported {}'.format(module), V=9)
import pex
log('Re-imported pex from {}'.format(pex.__path__), V=3)
log('PYTHONPATH contains:')
for element in sys.path:
log(' %c %s' % (' ' if os.path.exists(element) else '*', element))
log(' * - paths that do not exist or will be imported via zipimport')