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


Python Context.create_context方法代码示例

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


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

示例1: parse_options

# 需要导入模块: from waflib import Context [as 别名]
# 或者: from waflib.Context import create_context [as 别名]
def parse_options():
	"""
	Parse the command-line options and initialize the logging system.
	Called by :py:func:`waflib.Scripting.waf_entry_point` during the initialization.
	"""
	Context.create_context('options').execute()

	for var in Options.envvars:
		(name, value) = var.split('=', 1)
		os.environ[name.strip()] = value

	if not Options.commands:
		Options.commands = [default_cmd]
	Options.commands = [x for x in Options.commands if x != 'options'] # issue 1076

	# process some internal Waf options
	Logs.verbose = Options.options.verbose
	#Logs.init_log()

	if Options.options.zones:
		Logs.zones = Options.options.zones.split(',')
		if not Logs.verbose:
			Logs.verbose = 1
	elif Logs.verbose > 0:
		Logs.zones = ['runner']

	if Logs.verbose > 2:
		Logs.zones = ['*']
开发者ID:XNerv,项目名称:waf,代码行数:30,代码来源:Scripting.py

示例2: start

# 需要导入模块: from waflib import Context [as 别名]
# 或者: from waflib.Context import create_context [as 别名]
def start(cwd, version, wafdir):
	# this is the entry point of our small build system

	Logs.init_log()
	Context.waf_dir = wafdir
	Context.out_dir = Context.top_dir = Context.run_dir = cwd
	Context.g_module = Context.load_module(cwd + os.sep + 'wscript')
	Context.g_module.configure = configure
	Context.g_module.root_path = cwd
	Context.Context.recurse = recurse_rep

	Context.g_module.top = Context.g_module.out = '.' # no build directory

	# just parse the options and execute a build
	Options.OptionsContext().execute()

	conf = Context.create_context('configure')
	conf.options = Options.options
	conf.execute()

	bld = Context.create_context('build')
	bld.env = conf.env
	bld.options = Options.options
	bld.environ = os.environ
	bld.execute()
开发者ID:afeldman,项目名称:waf,代码行数:27,代码来源:ebdlib.py

示例3: parse_options

# 需要导入模块: from waflib import Context [as 别名]
# 或者: from waflib.Context import create_context [as 别名]
def parse_options():
	"""
	Parse the command-line options and initialize the logging system.
	Called by :py:func:`waflib.Scripting.waf_entry_point` during the initialization.
	"""
	Context.create_context('options').execute()

	if not Options.commands:
		Options.commands = [default_cmd]
	Options.commands = [x for x in Options.commands if x != 'options'] # issue 1076

	# process some internal Waf options
	Logs.verbose = Options.options.verbose
	Logs.init_log()

	if Options.options.zones:
		Logs.zones = Options.options.zones.split(',')
		if not Logs.verbose:
			Logs.verbose = 1
	elif Logs.verbose > 0:
		Logs.zones = ['runner']

	if Logs.verbose > 2:
		Logs.zones = ['*']
		
	# Force console mode for SSH connections
	if getattr(Options.options, 'console_mode', None):
		if os.environ.get('SSH_CLIENT') != None or os.environ.get('SSH_TTY') != None:
			Logs.info("[INFO] - SSH Connection detected. Forcing 'console_mode'")
			Options.options.console_mode = str(True)
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:32,代码来源:Scripting.py

示例4: parse_options

# 需要导入模块: from waflib import Context [as 别名]
# 或者: from waflib.Context import create_context [as 别名]
def parse_options():
	Context.create_context('options').execute()
	if not Options.commands:
		Options.commands=[default_cmd]
	Logs.verbose=Options.options.verbose
	Logs.init_log()
	if Options.options.zones:
		Logs.zones=Options.options.zones.split(',')
		if not Logs.verbose:
			Logs.verbose=1
	elif Logs.verbose>0:
		Logs.zones=['runner']
	if Logs.verbose>2:
		Logs.zones=['*']
开发者ID:dproc,项目名称:trex_odp_porting_integration,代码行数:16,代码来源:Scripting.py

示例5: run_command

# 需要导入模块: from waflib import Context [as 别名]
# 或者: from waflib.Context import create_context [as 别名]
def run_command(cmd_name):
	ctx=Context.create_context(cmd_name)
	ctx.log_timer=Utils.Timer()
	ctx.options=Options.options
	ctx.cmd=cmd_name
	ctx.execute()
	return ctx
开发者ID:Cactuslegs,项目名称:audacity-of-nope,代码行数:9,代码来源:Scripting.py

示例6: build

# 需要导入模块: from waflib import Context [as 别名]
# 或者: from waflib.Context import create_context [as 别名]
def build(bld):
	subdirs = getattr(bld, 'subdirs', None)

	if subdirs:
		bld.recurse(subdirs)
		return

	maxdepth = getattr(Context.g_module, 'maxdepth', 1)
	subdirs = [ x.parent.nice_path() for x in bld.path.ant_glob('**/wscript_build', maxdepth=maxdepth ) ]
	what = Options.options.variant or ''
	variants = what.split(',')

	success = False
	for opt in variants:
		for variant in bld.env.variants:
			if opt not in variant:
				continue

			ctx = Context.create_context(bld.cmd)
			ctx.cmd = bld.cmd
			ctx.fun = 'build'
			ctx.subdirs = subdirs
			ctx.options = Options.options
			ctx.variant = variant
			ctx.execute()
			success = True

	if not success:
		raise Errors.WafError('"%s" is not a supported variant' % what)

	# Suppress missing target warnings
	bld.targets = '*'
开发者ID:loverszhaokai,项目名称:peach-bupt-paper,代码行数:34,代码来源:wscript.py

示例7: run_command

# 需要导入模块: from waflib import Context [as 别名]
# 或者: from waflib.Context import create_context [as 别名]
def run_command(cmd_name):
	"""run a single command (usually given on the command line)"""
	ctx = Context.create_context(cmd_name)
	ctx.options = Options.options # provided for convenience
	ctx.cmd = cmd_name
	ctx.execute()
	return ctx
开发者ID:RunarFreyr,项目名称:waz,代码行数:9,代码来源:Scripting.py

示例8: parse_options

# 需要导入模块: from waflib import Context [as 别名]
# 或者: from waflib.Context import create_context [as 别名]
def parse_options():
	Context.create_context('options').execute()
	for var in Options.envvars:
		(name,value)=var.split('=',1)
		os.environ[name.strip()]=value
	if not Options.commands:
		Options.commands=[default_cmd]
	Options.commands=[x for x in Options.commands if x!='options']
	Logs.verbose=Options.options.verbose
	if Options.options.zones:
		Logs.zones=Options.options.zones.split(',')
		if not Logs.verbose:
			Logs.verbose=1
	elif Logs.verbose>0:
		Logs.zones=['runner']
	if Logs.verbose>2:
		Logs.zones=['*']
开发者ID:Gnurou,项目名称:glmark2,代码行数:19,代码来源:Scripting.py

示例9: run_command

# 需要导入模块: from waflib import Context [as 别名]
# 或者: from waflib.Context import create_context [as 别名]
def run_command(cmd_name):
	"""
	Execute a single command. Called by :py:func:`waflib.Scripting.run_commands`.

	:param cmd_name: command to execute, like ``build``
	:type cmd_name: string
	"""
	ctx = Context.create_context(cmd_name)
	ctx.options = Options.options # provided for convenience
	ctx.cmd = cmd_name
	ctx.execute()
	return ctx
开发者ID:CharString,项目名称:kupfer,代码行数:14,代码来源:Scripting.py

示例10: parse_options

# 需要导入模块: from waflib import Context [as 别名]
# 或者: from waflib.Context import create_context [as 别名]
def parse_options():
	"""
	Parses the command-line options and initialize the logging system.
	Called by :py:func:`waflib.Scripting.waf_entry_point` during the initialization.
	"""
	ctx = Context.create_context('options')
	ctx.execute()
	if not Options.commands:
		Options.commands.append(default_cmd)
	if Options.options.whelp:
		ctx.parser.print_help()
		sys.exit(0)
开发者ID:cawka,项目名称:waf,代码行数:14,代码来源:Scripting.py

示例11: run_build

# 需要导入模块: from waflib import Context [as 别名]
# 或者: from waflib.Context import create_context [as 别名]
def run_build(self,*k,**kw):
	lst=[str(v)for(p,v)in kw.items()if p!='env']
	h=Utils.h_list(lst)
	dir=self.bldnode.abspath()+os.sep+(not Utils.is_win32 and'.'or'')+'conf_check_'+Utils.to_hex(h)
	try:
		os.makedirs(dir)
	except OSError:
		pass
	try:
		os.stat(dir)
	except OSError:
		self.fatal('cannot use the configuration test folder %r'%dir)
	cachemode=getattr(Options.options,'confcache',None)
	if cachemode==1:
		try:
			proj=ConfigSet.ConfigSet(os.path.join(dir,'cache_run_build'))
		except EnvironmentError:
			pass
		else:
			ret=proj['cache_run_build']
			if isinstance(ret,str)and ret.startswith('Test does not build'):
				self.fatal(ret)
			return ret
	bdir=os.path.join(dir,'testbuild')
	if not os.path.exists(bdir):
		os.makedirs(bdir)
	self.test_bld=bld=Context.create_context('build',top_dir=dir,out_dir=bdir)
	bld.init_dirs()
	bld.progress_bar=0
	bld.targets='*'
	bld.logger=self.logger
	bld.all_envs.update(self.all_envs)
	bld.env=kw['env']
	bld.kw=kw
	bld.conf=self
	kw['build_fun'](bld)
	ret=-1
	try:
		try:
			bld.compile()
		except Errors.WafError:
			ret='Test does not build: %s'%Utils.ex_stack()
			self.fatal(ret)
		else:
			ret=getattr(bld,'retval',0)
	finally:
		if cachemode==1:
			proj=ConfigSet.ConfigSet()
			proj['cache_run_build']=ret
			proj.store(os.path.join(dir,'cache_run_build'))
		else:
			shutil.rmtree(dir)
	return ret
开发者ID:allencubie,项目名称:lib,代码行数:55,代码来源:Configure.py

示例12: start

# 需要导入模块: from waflib import Context [as 别名]
# 或者: from waflib.Context import create_context [as 别名]
def start(cwd, version, wafdir):
	# simple example, the file main.c is hard-coded
	try:
		os.stat(cwd + os.sep + 'cbit')
	except:
		print('call from a folder containing a file named "cbit"')
		sys.exit(1)

	Logs.init_log()
	Context.waf_dir = wafdir
	Context.top_dir = Context.run_dir = cwd
	Context.out_dir = os.path.join(cwd, 'build')
	Context.g_module = imp.new_module('wscript')
	Context.g_module.root_path = os.path.join(cwd, 'cbit')
	Context.Context.recurse = recurse_rep

	# this is a fake module, which looks like a standard wscript file
	Context.g_module.options = options
	Context.g_module.configure = configure
	Context.g_module.build = build

	Options.OptionsContext().execute()

	do_config = 'configure' in sys.argv
	try:
		os.stat(cwd + os.sep + 'build')
	except:
		do_config = True
	if do_config:
		Context.create_context('configure').execute()

	if 'clean' in sys.argv:
		Context.create_context('clean').execute()
	if 'build' in sys.argv:
		Context.create_context('build').execute()
开发者ID:ArduPilot,项目名称:waf,代码行数:37,代码来源:cbdlib.py

示例13: start

# 需要导入模块: from waflib import Context [as 别名]
# 或者: from waflib.Context import create_context [as 别名]
def start(cwd, version, wafdir):
	# this is the entry point of our small build system
	# no script file here
	Logs.init_log()
	Context.waf_dir = wafdir
	Context.out_dir = Context.top_dir = Context.run_dir = cwd
	Context.g_module = imp.new_module('wscript')
	Context.g_module.root_path = cwd
	Context.Context.recurse = recurse_rep

	Context.g_module.configure = configure
	Context.g_module.build = build
	Context.g_module.options = options
	Context.g_module.top = Context.g_module.out = '.'

	Options.OptionsContext().execute()

	do_config = 'configure' in sys.argv
	try:
		os.stat(cwd + os.sep + 'c4che')
	except:
		do_config = True
	if do_config:
		Context.create_context('configure').execute()

	if 'clean' in sys.argv:
		Context.create_context('clean').execute()

	if 'build' in sys.argv:
		Context.create_context('build').execute()
开发者ID:AleemDev,项目名称:waf,代码行数:32,代码来源:dbdlib.py

示例14: start

# 需要导入模块: from waflib import Context [as 别名]
# 或者: from waflib.Context import create_context [as 别名]
def start(cwd, version, wafdir):
	# simple example, the file main.c is hard-coded
	try:
		os.stat(cwd + os.sep + 'bbit')
	except:
		print('call from a folder containing a file named "bbit"')
		sys.exit(1)

	Logs.init_log()
	Context.waf_dir = wafdir
	Context.top_dir = Context.run_dir = cwd
	Context.out_dir = os.path.join(cwd, 'build')
	Context.g_module = imp.new_module('wscript')
	Context.g_module.root_path = os.path.join(cwd, 'bbit')
	Context.Context.recurse = \
		lambda x, y: getattr(Context.g_module, x.cmd or x.fun, Utils.nada)(x)

	Context.g_module.configure = lambda ctx: ctx.load('g++')
	Context.g_module.build = lambda bld: bld.objects(source='main.c')

	Options.OptionsContext().execute()

	do_config = 'configure' in sys.argv
	try:
		os.stat(cwd + os.sep + 'build')
	except:
		do_config = True
	if do_config:
		Context.create_context('configure').execute()

	if 'clean' in sys.argv:
		Context.create_context('clean').execute()
	if 'build' in sys.argv:
		Context.create_context('build').execute()
开发者ID:afeldman,项目名称:waf,代码行数:36,代码来源:bbdlib.py

示例15: start

# 需要导入模块: from waflib import Context [as 别名]
# 或者: from waflib.Context import create_context [as 别名]
def start(cwd, version, wafdir):
    # this is the entry point of our small build system
    # no script file here
    Logs.init_log()
    Context.waf_dir = wafdir
    Context.out_dir = Context.top_dir = Context.run_dir = cwd
    Context.g_module = imp.new_module("wscript")
    Context.g_module.root_path = cwd
    Context.Context.recurse = recurse_rep

    Context.g_module.configure = configure
    Context.g_module.build = build
    Context.g_module.options = options
    Context.g_module.top = Context.g_module.out = "."

    Options.OptionsContext().execute()

    do_config = "configure" in sys.argv
    try:
        os.stat(cwd + os.sep + "c4che")
    except:
        do_config = True
    if do_config:
        Context.create_context("configure").execute()

    if "clean" in sys.argv:
        Context.create_context("clean").execute()

    if "build" in sys.argv:
        Context.create_context("build").execute()
开发者ID:ArduPilot,项目名称:waf,代码行数:32,代码来源:dbdlib.py


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