本文整理汇总了Python中waflib.Context.load_branch_spec方法的典型用法代码示例。如果您正苦于以下问题:Python Context.load_branch_spec方法的具体用法?Python Context.load_branch_spec怎么用?Python Context.load_branch_spec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类waflib.Context
的用法示例。
在下文中一共展示了Context.load_branch_spec方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: waf_entry_point
# 需要导入模块: from waflib import Context [as 别名]
# 或者: from waflib.Context import load_branch_spec [as 别名]
def waf_entry_point(current_directory, version, wafdir):
"""
This is the main entry point, all Waf execution starts here.
:param current_directory: absolute path representing the current directory
:type current_directory: string
:param version: version number
:type version: string
:param wafdir: absolute path representing the directory of the waf library
:type wafdir: string
"""
def _wait_for_user_input():
""" Helper function to wait for a key press when needed (like on windows to prevent closing the windows """
try:
if not Utils.unversioned_sys_platform() == 'win32':
return # No need on non windows platforms
if not _is_option_true(Options.options, 'ask_for_user_input'):
return # Obey what the user wants
if Options.options.execsolution:
return # Dont ask for input in visual studio
if _is_option_true(Options.options, 'internal_dont_check_recursive_execution'):
return # Dont ask from within Incredibuild
import msvcrt
Logs.error('Please Press Any Key to Continue')
msvcrt.getch()
except:
pass # Crashed to early to do something meaningful
def _dump_call_stack():
""" Util function to dump a callstack, and if running from Visual Studio, to format the error to be clickable """
if getattr(Options.options, 'execsolution', None):
exc_type, exc_value, exc_traceback = sys.exc_info()
stackstace = traceback.format_tb(exc_traceback)
sys.stdout.write('Traceback (most recent call last):\n')
python_to_vs = re.compile(r'(.*?)"(.+?)", line ([0-9]+?),(.*)', re.M)
# Align output vertically
nAlignedPos = 0
for line in stackstace[:-1]:
m = re.match(python_to_vs, line)
if m:
nNeededLenght = len('%s(%s):' % (m.group(2), m.group(3)))
if nNeededLenght > nAlignedPos:
nAlignedPos = nNeededLenght
# output
for line in stackstace[:-1]:
m = re.match(python_to_vs, line)
if m:
nNeededSpaces = 1 + (nAlignedPos - len('%s(%s):' % (m.group(2), m.group(3))))
sys.stdout.write('%s(%s):%s%s\n' % (m.group(2), m.group(3), ' ' * nNeededSpaces, m.group(4)))
else:
sys.stdout.write(line)
m = re.match(python_to_vs, stackstace[-1])
if m:
sys.stdout.write('%s(%s): error : %s %s\n' % (m.group(2), m.group(3), m.group(4), str(exc_value)))
else:
sys.stdout.write(line)
else:
traceback.print_exc(file=sys.stdout)
Logs.init_log()
if Context.WAFVERSION != version:
Logs.error('Waf script %r and library %r do not match (directory %r)' % (version, Context.WAFVERSION, wafdir))
_wait_for_user_input()
sys.exit(1)
# import waf branch spec
branch_spec_globals = Context.load_branch_spec(current_directory)
if Utils.is_win32: # Make sure we always have the same path, regardless of used shell
current_directory = current_directory[0].lower() + current_directory[1:]
if '--version' in sys.argv:
Context.run_dir = current_directory
ctx = Context.create_context('options')
ctx.curdir = current_directory
ctx.parse_args()
sys.exit(0)
Context.waf_dir = wafdir
Context.launch_dir = current_directory
# if 'configure' is in the commands, do not search any further
no_climb = os.environ.get('NOCLIMB', None)
if not no_climb:
for k in no_climb_commands:
if k in sys.argv:
no_climb = True
break
# try to find a lock file (if the project was configured)
cur_lockfile = current_directory + os.sep + branch_spec_globals['BINTEMP_FOLDER']
#.........这里部分代码省略.........
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:103,代码来源:Scripting.py
示例2: execute
# 需要导入模块: from waflib import Context [as 别名]
# 或者: from waflib.Context import load_branch_spec [as 别名]
def execute(self):
"""
See :py:func:`waflib.Context.Context.execute`
"""
self.init_dirs()
Logs.info("[WAF] Executing 'configure'")
self.cachedir = self.bldnode.make_node(Build.CACHE_DIR)
self.cachedir.mkdir()
path = os.path.join(self.bldnode.abspath(), WAF_CONFIG_LOG)
self.logger = Logs.make_logger(path, "cfg")
app = getattr(Context.g_module, "APPNAME", "")
if app:
ver = getattr(Context.g_module, "VERSION", "")
if ver:
app = "%s (%s)" % (app, ver)
now = time.ctime()
pyver = sys.hexversion
systype = sys.platform
args = " ".join(sys.argv)
wafver = Context.WAFVERSION
abi = Context.ABI
self.to_log(conf_template % vars())
if id(self.srcnode) == id(self.bldnode):
Logs.warn('Setting top == out (remember to use "update_outputs")')
elif id(self.path) != id(self.srcnode):
if self.srcnode.is_child_of(self.path):
Logs.warn('Are you certain that you do not want to set top="." ?')
super(ConfigurationContext, self).execute()
self.store()
Context.top_dir = self.srcnode.abspath()
Context.out_dir = self.bldnode.abspath()
# import waf branch spec
branch_spec_globals = Context.load_branch_spec(Context.top_dir)
Context.lock_dir = Context.run_dir + os.sep + branch_spec_globals["BINTEMP_FOLDER"]
# this will write a configure lock so that subsequent builds will
# consider the current path as the root directory (see prepare_impl).
# to remove: use 'waf distclean'
env = ConfigSet.ConfigSet()
env["argv"] = sys.argv
env["options"] = Options.options.__dict__
env.run_dir = Context.run_dir
env.top_dir = Context.top_dir
env.out_dir = Context.out_dir
env.lock_dir = Context.lock_dir
# Add cry_waf.exe for dependency tracking
cry_waf_exe_node = self.path.make_node("cry_waf.exe")
self.hash = hash((self.hash, cry_waf_exe_node.read("rb")))
self.files.append(os.path.normpath(cry_waf_exe_node.abspath()))
# conf.hash & conf.files hold wscript files paths and hash
# (used only by Configure.autoconfig)
env["hash"] = self.hash
env["files"] = self.files
env["environ"] = dict(self.environ)
env.store(Context.lock_dir + os.sep + Options.lockfile)
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:70,代码来源:Configure.py