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

Python Logs.debug函数代码示例

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

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



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

示例1: start

	def start(self, node, env):
		debug('preproc: scanning %s (in %s)', node.name, node.parent.name)

		self.env = env
		bld = node.ctx
		try:
			self.parse_cache = bld.parse_cache
		except AttributeError:
			bld.parse_cache = {}
			self.parse_cache = bld.parse_cache

		self.addlines(node)

		# macros may be defined on the command-line, so they must be parsed as if they were part of the file
		if env['DEFINES']:
			lst = ['%s %s' % (x[0], Utils.trimquotes('='.join(x[1:]))) for x in [y.split('=') for y in env['DEFINES']]]
			self.lines = [('define', x) for x in lst] + self.lines

		while self.lines:
			(kind, line) = self.lines.pop(0)
			if kind == POPFILE:
				self.currentnode_stack.pop()
				continue
			try:
				self.process_line(kind, line)
			except Exception as e:
				if Logs.verbose:
					debug('preproc: line parsing failed (%s): %s %s', e, line, Utils.ex_stack())
开发者ID:zsx,项目名称:waf,代码行数:28,代码来源:c_preproc.py


示例2: exec_mf

def exec_mf(self):
	env = self.env
	outfile = self.inputs[0].bldpath()
	manifest = outfile + '.manifest'
	if os.path.exists(manifest):
		debug('msvc: manifesttool')
		mtool = env['MT']
		if not mtool:
			return 0

		mode = ''
		# embedding mode. Different for EXE's and DLL's.
		# see: http://msdn2.microsoft.com/en-us/library/ms235591(VS.80).aspx
		if 'cprogram' in self.generator.features:
			mode = '1'
		elif 'cshlib' in self.generator.features or 'cxxshlib' in self.generator.features:
			mode = '2'

		debug('msvc: embedding manifest')
		#flags = ' '.join(env['MTFLAGS'] or [])

		lst = []
		lst.extend(Utils.to_list(env['MT']))
		lst.extend(Utils.to_list(env['MTFLAGS']))
		lst.extend(Utils.to_list("-manifest"))
		lst.extend(Utils.to_list(manifest))
		lst.extend(Utils.to_list("-outputresource:%s;%s" % (outfile, mode)))

		#cmd='%s %s -manifest "%s" -outputresource:"%s";#%s' % (mtool, flags,
		#	manifest, outfile, mode)
		lst = [lst]
		ret = self.exec_command(*lst)

		return ret
开发者ID:zsx,项目名称:waf,代码行数:34,代码来源:msvc.py


示例3: configure

def configure(conf):
	"""
	for each compiler for the platform, try to configure the compiler
	in theory the tools should raise a configuration error if the compiler
	pretends to be something it is not (setting CC=icc and trying to configure gcc)
	"""
	try: test_for_compiler = Options.options.check_c_compiler
	except AttributeError: conf.fatal("Add options(opt): opt.tool_options('compiler_cc')")
	orig = conf.env
	for compiler in test_for_compiler.split():
		try:
			conf.start_msg('Checking for %r (c compiler)' % compiler)
			conf.env = orig.derive()
			conf.check_tool(compiler)
		except conf.errors.ConfigurationError as e:
			conf.end_msg(False)
			debug('compiler_cc: %r' % e)
		else:
			if conf.env['CC']:
				orig.table = conf.env.get_merged_dict()
				conf.env = orig
				conf.end_msg(True)
				conf.env['COMPILER_CC'] = compiler
				break
			conf.end_msg(False)
	else:
		conf.fatal('could not configure a c compiler!')
开发者ID:zsx,项目名称:waf,代码行数:27,代码来源:compiler_c.py


示例4: configure

def configure(conf):
	"""
	Detects a suitable C compiler

	:raises: :py:class:`waflib.Errors.ConfigurationError` when no suitable compiler is found
	"""
	try:
		test_for_compiler = conf.options.check_c_compiler or default_compilers()
	except AttributeError:
		conf.fatal("Add options(opt): opt.load('compiler_c')")

	for compiler in re.split('[ ,]+', test_for_compiler):
		conf.env.stash()
		conf.start_msg('Checking for %r (C compiler)' % compiler)
		try:
			conf.load(compiler)
		except conf.errors.ConfigurationError as e:
			conf.env.revert()
			conf.end_msg(False)
			debug('compiler_c: %r', e)
		else:
			if conf.env.CC:
				conf.end_msg(conf.env.get_flat('CC'))
				conf.env.COMPILER_CC = compiler
				conf.env.commit()
				break
			conf.env.revert()
			conf.end_msg(False)
	else:
		conf.fatal('could not configure a C compiler!')
开发者ID:ArduPilot,项目名称:waf,代码行数:30,代码来源:compiler_c.py


示例5: scan

def scan(task):
	"""
	Get the dependencies using a c/c++ preprocessor, this is required for finding dependencies of the kind::

		#include some_macro()

	This function is bound as a task method on :py:class:`waflib.Tools.c.c` and :py:class:`waflib.Tools.cxx.cxx` for example
	"""

	global go_absolute

	try:
		incn = task.generator.includes_nodes
	except AttributeError:
		raise Errors.WafError('%r is missing a feature such as "c", "cxx" or "includes": ' % task.generator)

	if go_absolute:
		nodepaths = incn + [task.generator.bld.root.find_dir(x) for x in standard_includes]
	else:
		nodepaths = [x for x in incn if x.is_child_of(x.ctx.srcnode) or x.is_child_of(x.ctx.bldnode)]

	tmp = c_parser(nodepaths)
	tmp.start(task.inputs[0], task.env)
	if Logs.verbose:
		debug('deps: deps for %r: %r; unresolved %r' % (task.inputs, tmp.nodes, tmp.names))
	return (tmp.nodes, tmp.names)
开发者ID:cournape,项目名称:waf,代码行数:26,代码来源:c_preproc.py


示例6: scan

	def scan(self):
		node=self.inputs[0]
		env=self.env
		nodes=[]
		names=[]
		seen=[]
		if not node:return(nodes,names)
		def parse_node(node):
			if node in seen:
				return
			seen.append(node)
			code=node.read()
			global re_tex
			for match in re_tex.finditer(code):
				for path in match.group('file').split(','):
					if path:
						add_name=True
						found=None
						for k in exts_deps_tex:
							debug('tex: trying %s%s'%(path,k))
							found=node.parent.find_resource(path+k)
							if found and not found in self.outputs:
								nodes.append(found)
								add_name=False
								if found.name.endswith('.tex')or found.name.endswith('.ltx'):
									parse_node(found)
						if add_name:
							names.append(path)
		parse_node(node)
		for x in nodes:
			x.parent.get_bld().mkdir()
		debug("tex: found the following : %s and names %s"%(nodes,names))
		return(nodes,names)
开发者ID:HariKishan8,项目名称:Networks,代码行数:33,代码来源:tex.py


示例7: configure

def configure(conf):
	"""
	for each compiler for the platform, try to configure the compiler
	in theory the tools should raise a configuration error if the compiler
	pretends to be something it is not (setting CC=icc and trying to configure gcc)
	"""
	try: test_for_compiler = conf.options.check_c_compiler
	except AttributeError: conf.fatal("Add options(opt): opt.load('compiler_c')")
	for compiler in test_for_compiler.split():
		conf.env.stash()
		conf.start_msg('Checking for %r (c compiler)' % compiler)
		try:
			conf.load(compiler)
		except conf.errors.ConfigurationError as e:
			conf.env.revert()
			conf.end_msg(False)
			debug('compiler_c: %r' % e)
		else:
			if conf.env['CC']:
				conf.end_msg(True)
				conf.env['COMPILER_CC'] = compiler
				break
			conf.end_msg(False)
	else:
		conf.fatal('could not configure a c compiler!')
开发者ID:RunarFreyr,项目名称:waz,代码行数:25,代码来源:compiler_c.py


示例8: run

	def run(task):
		command = 'SAS'
		env = task.env
		bld = task.generator.bld

		fun = sas_fun

		node = task.inputs[0]
		logfilenode = node.change_ext('.log')
		lstfilenode = node.change_ext('.lst')

		# set the cwd
		task.cwd = task.inputs[0].parent.get_src().abspath()
		debug('runner: %s on %s' % (command, node.abspath))

		SASINPUTS = node.parent.get_bld().abspath() + os.pathsep + node.parent.get_src().abspath() + os.pathsep
		task.env.env = {'SASINPUTS': SASINPUTS}

		task.env.SRCFILE = node.abspath()
		task.env.LOGFILE = logfilenode.abspath()
		task.env.LSTFILE = lstfilenode.abspath()
		ret = fun(task)
		if ret:
			error('Running %s on %r returned a non-zero exit' % (command, node))
			error('SRCFILE = %r' % node)
			error('LOGFILE = %r' % logfilenode)
			error('LSTFILE = %r' % lstfilenode)
		return ret
开发者ID:Dzshiftt,项目名称:Gnomescroll,代码行数:28,代码来源:sas.py


示例9: scan

def scan(task):
	"""
	Get the dependencies using a c/c++ preprocessor, this is required for finding dependencies of the kind
	#include some_macro()

	replacing this method may be a better choice than replacing "ccroot.scan" from all the tasks that use it
	"""

	global go_absolute

	try:
		incn = task.generator.includes_nodes
	except AttributeError:
		raise Errors.WafError('%r is missing a feature such as "c" or "cxx"' % task.generator)

	if go_absolute:
		nodepaths = incn
	else:
		nodepaths = [x for x in incn if x.is_child_of(x.ctx.srcnode) or x.is_child_of(x.ctx.bldnode)]

	tmp = c_parser(nodepaths)
	tmp.start(task.inputs[0], task.env)
	if Logs.verbose:
		debug('deps: deps for %r: %r; unresolved %r' % (task.inputs, tmp.nodes, tmp.names))
	return (tmp.nodes, tmp.names)
开发者ID:SjB,项目名称:waf,代码行数:25,代码来源:c_preproc.py


示例10: addlines

	def addlines(self,node):
		self.currentnode_stack.append(node.parent)
		filepath=node.abspath()
		self.count_files+=1
		if self.count_files>recursion_limit:
			raise PreprocError("recursion limit exceeded")
		pc=self.parse_cache
		debug('preproc: reading file %r',filepath)
		try:
			lns=pc[filepath]
		except KeyError:
			pass
		else:
			self.lines.extend(lns)
			return
		try:
			lines=filter_comments(filepath)
			lines.append((POPFILE,''))
			lines.reverse()
			pc[filepath]=lines
			self.lines.extend(lines)
		except IOError:
			raise PreprocError("could not read the file %s"%filepath)
		except Exception:
			if Logs.verbose>0:
				error("parsing %s failed"%filepath)
				traceback.print_exc()
开发者ID:AliZafar120,项目名称:ns3,代码行数:27,代码来源:c_preproc.py


示例11: libname_msvc

def libname_msvc(self,libname,is_static=False):
	lib=libname.lower()
	lib=re.sub('\.lib$','',lib)
	if lib in g_msvc_systemlibs:
		return lib
	lib=re.sub('^lib','',lib)
	if lib=='m':
		return None
	(lt_path,lt_libname,lt_static)=self.find_lt_names_msvc(lib,is_static)
	if lt_path!=None and lt_libname!=None:
		if lt_static==True:
			return os.path.join(lt_path,lt_libname)
	if lt_path!=None:
		_libpaths=[lt_path]+self.env['LIBPATH']
	else:
		_libpaths=self.env['LIBPATH']
	static_libs=['lib%ss.lib'%lib,'lib%s.lib'%lib,'%ss.lib'%lib,'%s.lib'%lib,]
	dynamic_libs=['lib%s.dll.lib'%lib,'lib%s.dll.a'%lib,'%s.dll.lib'%lib,'%s.dll.a'%lib,'lib%s_d.lib'%lib,'%s_d.lib'%lib,'%s.lib'%lib,]
	libnames=static_libs
	if not is_static:
		libnames=dynamic_libs+static_libs
	for path in _libpaths:
		for libn in libnames:
			if os.path.exists(os.path.join(path,libn)):
				debug('msvc: lib found: %s'%os.path.join(path,libn))
				return re.sub('\.lib$','',libn)
	self.fatal("The library %r could not be found"%libname)
	return re.sub('\.lib$','',libname)
开发者ID:RONNCC,项目名称:pysoy,代码行数:28,代码来源:msvc.py


示例12: exec_mf

def exec_mf(self):
	env=self.env
	mtool=env['MT']
	if not mtool:
		return 0
	self.do_manifest=False
	outfile=self.outputs[0].abspath()
	manifest=None
	for out_node in self.outputs:
		if out_node.name.endswith('.manifest'):
			manifest=out_node.abspath()
			break
	if manifest is None:
		return 0
	mode=''
	if'cprogram'in self.generator.features or'cxxprogram'in self.generator.features:
		mode='1'
	elif'cshlib'in self.generator.features or'cxxshlib'in self.generator.features:
		mode='2'
	debug('msvc: embedding manifest in mode %r'%mode)
	lst=[]
	lst.append(env['MT'])
	lst.extend(Utils.to_list(env['MTFLAGS']))
	lst.extend(['-manifest',manifest])
	lst.append('-outputresource:%s;%s'%(outfile,mode))
	lst=[lst]
	return self.exec_command(*lst)
开发者ID:RONNCC,项目名称:pysoy,代码行数:27,代码来源:msvc.py


示例13: run

	def run(self):
		env = self.env
		gen = self.generator
		path = gen.path
		bld = gen.bld
		bjam = gen.bld.root.find_dir(env.BJAM_SRC)
		if not bjam:
			error('Can not find bjam source')
			return -1
		bjam_exe_relpath = 'bin.' + env.BJAM_UNAME + '/bjam'
		bjam_exe = bjam.find_resource(bjam_exe_relpath)
		if bjam_exe:
			env.BJAM = bjam_exe.srcpath()
			return 0
		bjam_cmd = ['./build.sh']
		debug('runner: ' + bjam.srcpath() + '> ' + str(bjam_cmd))
		result = self.exec_command(bjam_cmd, cwd=bjam.srcpath())
		if not result == 0:
			error('bjam failed')
			return -1
		bjam_exe = bjam.find_resource(bjam_exe_relpath)
		if bjam_exe:
			env.BJAM = bjam_exe.srcpath()
			return 0
		error('bjam failed')
		return -1
开发者ID:Dzshiftt,项目名称:Gnomescroll,代码行数:26,代码来源:bjam.py


示例14: scan

	def scan(self):
		"""
		A simple regex-based scanner for latex dependencies, uses re_tex from above

		Depending on your needs you might want:

		* to change re_tex

		::

			from waflib.Tools import tex
			tex.re_tex = myregex

		* or to change the method scan from the latex tasks

		::

			from waflib.Task import classes
			classes['latex'].scan = myscanfunction

		"""
		node = self.inputs[0]
		env = self.env

		nodes = []
		names = []
		seen = []
		if not node: return (nodes, names)

		def parse_node(node):
			if node in seen:
				return
			seen.append(node
)
			code = node.read()
			global re_tex
			for match in re_tex.finditer(code):
				path = match.group('file')
				if path:
					add_name = True
					found = None
					for k in exts_deps_tex:
						debug('tex: trying %s%s' % (path, k))
						found = node.parent.find_resource(path + k)
						if found:
							nodes.append(found)
							add_name = False
							if found.name.endswith('.tex') or found.name.endswith('.ltx'):
								parse_node(found)
						# no break, people are crazy
					if add_name:
						names.append(path)
		parse_node(node)

		for x in nodes:
			x.parent.get_bld().mkdir()

		debug("tex: found the following : %s and names %s" % (nodes, names))
		return (nodes, names)
开发者ID:SjB,项目名称:waf,代码行数:59,代码来源:tex.py


示例15: check_python_version

def check_python_version(conf, minver=None):
    assert minver is None or isinstance(minver, tuple)
    pybin = conf.env["PYTHON"]
    if not pybin:
        conf.fatal("could not find the python executable")
    cmd = pybin + ["-c", "import sys\nfor x in sys.version_info: print(str(x))"]
    debug("python: Running python command %r" % cmd)
    lines = conf.cmd_and_log(cmd).split()
    assert len(lines) == 5, "found %i lines, expected 5: %r" % (len(lines), lines)
    pyver_tuple = (int(lines[0]), int(lines[1]), int(lines[2]), lines[3], int(lines[4]))
    result = (minver is None) or (pyver_tuple >= minver)
    if result:
        pyver = ".".join([str(x) for x in pyver_tuple[:2]])
        conf.env["PYTHON_VERSION"] = pyver
        if "PYTHONDIR" in conf.environ:
            pydir = conf.environ["PYTHONDIR"]
        else:
            if Utils.is_win32:
                (python_LIBDEST, pydir) = conf.get_python_variables(
                    [
                        "get_config_var('LIBDEST') or ''",
                        "get_python_lib(standard_lib=0, prefix=%r) or ''" % conf.env["PREFIX"],
                    ],
                    ["from distutils.sysconfig import get_config_var, get_python_lib"],
                )
            else:
                python_LIBDEST = None
                (pydir,) = conf.get_python_variables(
                    ["get_python_lib(standard_lib=0, prefix=%r) or ''" % conf.env["PREFIX"]],
                    ["from distutils.sysconfig import get_python_lib"],
                )
            if python_LIBDEST is None:
                if conf.env["LIBDIR"]:
                    python_LIBDEST = os.path.join(conf.env["LIBDIR"], "python" + pyver)
                else:
                    python_LIBDEST = os.path.join(conf.env["PREFIX"], "lib", "python" + pyver)
        if "PYTHONARCHDIR" in conf.environ:
            pyarchdir = conf.environ["PYTHONARCHDIR"]
        else:
            (pyarchdir,) = conf.get_python_variables(
                ["get_python_lib(plat_specific=1, standard_lib=0, prefix=%r) or ''" % conf.env["PREFIX"]],
                ["from distutils.sysconfig import get_python_lib"],
            )
            if not pyarchdir:
                pyarchdir = pydir
        if hasattr(conf, "define"):
            conf.define("PYTHONDIR", pydir)
            conf.define("PYTHONARCHDIR", pyarchdir)
        conf.env["PYTHONDIR"] = pydir
        conf.env["PYTHONARCHDIR"] = pyarchdir
    pyver_full = ".".join(map(str, pyver_tuple[:3]))
    if minver is None:
        conf.msg("Checking for python version", pyver_full)
    else:
        minver_str = ".".join(map(str, minver))
        conf.msg("Checking for python version", pyver_tuple, ">= %s" % (minver_str,) and "GREEN" or "YELLOW")
    if not result:
        conf.fatal("The python version is too old, expecting %r" % (minver,))
开发者ID:janbre,项目名称:NUTS,代码行数:58,代码来源:python.py


示例16: parse_node

		def parse_node(node):
			code = node.read()
			for match in re_aux.finditer(code):
				path = match.group('file')
				found = node.parent.find_or_declare(path)
				if found and found not in nodes:
					debug('tex: found aux node ' + found.abspath())
					nodes.append(found)
					parse_node(found)
开发者ID:GrahamDennis,项目名称:xpdeint,代码行数:9,代码来源:tex.py


示例17: get_msvc_version

def get_msvc_version(conf, compiler, version, target, vcvars):
	debug('msvc: get_msvc_version: %r %r %r', compiler, version, target)
	batfile = conf.bldnode.make_node('waf-print-msvc.bat')
	batfile.write("""@echo off
set INCLUDE=
set LIB=
call "%s" %s
echo PATH=%%PATH%%
echo INCLUDE=%%INCLUDE%%
echo LIB=%%LIB%%
""" % (vcvars,target))
	sout = conf.cmd_and_log(['cmd', '/E:on', '/V:on', '/C', batfile.abspath()])
	lines = sout.splitlines()

	for x in ('Setting environment', 'Setting SDK environment', 'Intel(R) C++ Compiler'):
		if lines[0].find(x) != -1:
			break
	else:
		debug('msvc: get_msvc_version: %r %r %r -> not found', compiler, version, target)
		conf.fatal('msvc: Impossible to find a valid architecture for building (in get_msvc_version)')

	for line in lines[1:]:
		if line.startswith('PATH='):
			path = line[5:]
			MSVC_PATH = path.split(';')
		elif line.startswith('INCLUDE='):
			MSVC_INCDIR = [i for i in line[8:].split(';') if i]
		elif line.startswith('LIB='):
			MSVC_LIBDIR = [i for i in line[4:].split(';') if i]

	# Check if the compiler is usable at all.
	# The detection may return 64-bit versions even on 32-bit systems, and these would fail to run.
	env = {}
	env.update(os.environ)
	env.update(PATH = path)
	compiler_name, linker_name, lib_name = _get_prog_names(conf, compiler)
	cxx = conf.find_program(compiler_name, path_list=MSVC_PATH)
	cxx = conf.cmd_to_list(cxx)

	# delete CL if exists. because it could contain parameters wich can change cl's behaviour rather catastrophically.
	if 'CL' in env:
		del(env['CL'])

	try:
		try:
			conf.cmd_and_log(cxx + ['/help'], env=env)
		except Exception as e:
			debug('msvc: get_msvc_version: %r %r %r -> failure' % (compiler, version, target))
			debug(str(e))
			conf.fatal('msvc: cannot run the compiler (in get_msvc_version)')
		else:
			debug('msvc: get_msvc_version: %r %r %r -> OK', compiler, version, target)
	finally:
		conf.env[compiler_name] = ''

	return (MSVC_PATH, MSVC_INCDIR, MSVC_LIBDIR)
开发者ID:SjB,项目名称:waf,代码行数:56,代码来源:msvc.py


示例18: get_msvc_version

def get_msvc_version(conf,compiler,version,target,vcvars):
	debug('msvc: get_msvc_version: %r %r %r',compiler,version,target)
	batfile=conf.bldnode.make_node('waf-print-msvc.bat')
	batfile.write("""@echo off
set INCLUDE=
set LIB=
call "%s" %s
echo PATH=%%PATH%%
echo INCLUDE=%%INCLUDE%%
echo LIB=%%LIB%%
"""%(vcvars,target))
	sout=conf.cmd_and_log(['cmd','/E:on','/V:on','/C',batfile.abspath()])
	lines=sout.splitlines()
	if not lines[0]:
		lines.pop(0)
	if version=='11.0':
		if lines[0].startswith('Error'):
			conf.fatal('msvc: Could not find a valid architecture for building (get_msvc_version_1)')
	else:
		for x in('Setting environment','Setting SDK environment','Intel(R) C++ Compiler','Intel Parallel Studio'):
			if lines[0].find(x)>-1:
				lines.pop(0)
				break
		else:
			debug('msvc: get_msvc_version: %r %r %r -> not found',compiler,version,target)
			conf.fatal('msvc: Could not find a valid architecture for building (get_msvc_version_2)')
	MSVC_PATH=MSVC_INCDIR=MSVC_LIBDIR=None
	for line in lines:
		if line.startswith('PATH='):
			path=line[5:]
			MSVC_PATH=path.split(';')
		elif line.startswith('INCLUDE='):
			MSVC_INCDIR=[i for i in line[8:].split(';')if i]
		elif line.startswith('LIB='):
			MSVC_LIBDIR=[i for i in line[4:].split(';')if i]
	if None in(MSVC_PATH,MSVC_INCDIR,MSVC_LIBDIR):
		conf.fatal('msvc: Could not find a valid architecture for building (get_msvc_version_3)')
	env=dict(os.environ)
	env.update(PATH=path)
	compiler_name,linker_name,lib_name=_get_prog_names(conf,compiler)
	cxx=conf.find_program(compiler_name,path_list=MSVC_PATH)
	cxx=conf.cmd_to_list(cxx)
	if'CL'in env:
		del(env['CL'])
	try:
		try:
			conf.cmd_and_log(cxx+['/help'],env=env)
		except Exception as e:
			debug('msvc: get_msvc_version: %r %r %r -> failure'%(compiler,version,target))
			debug(str(e))
			conf.fatal('msvc: cannot run the compiler (in get_msvc_version)')
		else:
			debug('msvc: get_msvc_version: %r %r %r -> OK',compiler,version,target)
	finally:
		conf.env[compiler_name]=''
	return(MSVC_PATH,MSVC_INCDIR,MSVC_LIBDIR)
开发者ID:RONNCC,项目名称:pysoy,代码行数:56,代码来源:msvc.py


示例19: run

    def run(self):
        task = self
        # assert len(task.inputs) > 0

        def input_path(node, template):
            if task.cwd is None:
                return template % node.bldpath()
            else:
                return template % node.abspath()

        def output_path(node, template):
            fun = node.abspath
            if task.cwd is None:
                fun = node.bldpath
            return template % fun()

        if isinstance(task.command, Node.Node):
            argv = [input_path(task.command, "%s")]
        else:
            argv = [task.command]

        for arg in task.command_args:
            if isinstance(arg, str):
                argv.append(arg)
            else:
                assert isinstance(arg, cmd_arg)
                argv.append(arg.get_path(task.env, (task.cwd is not None)))

        if task.stdin:
            stdin = open(input_path(task.stdin, "%s"))
        else:
            stdin = None

        if task.stdout:
            stdout = open(output_path(task.stdout, "%s"), "w")
        else:
            stdout = None

        if task.stderr:
            stderr = open(output_path(task.stderr, "%s"), "w")
        else:
            stderr = None

        if task.cwd is None:
            cwd = "None (actually %r)" % os.getcwd()
        else:
            cwd = repr(task.cwd)
        debug("command-output: cwd=%s, stdin=%r, stdout=%r, argv=%r" % (cwd, stdin, stdout, argv))

        if task.os_env is None:
            os_env = os.environ
        else:
            os_env = task.os_env
        command = subprocess.Popen(argv, stdin=stdin, stdout=stdout, stderr=stderr, cwd=task.cwd, env=os_env)
        return command.wait()
开发者ID:RunarFreyr,项目名称:waz,代码行数:55,代码来源:misc.py


示例20: find_boost_includes

def find_boost_includes(self, kw):
	"""
	check every path in kw['includes'] for subdir
	that either starts with boost- or is named boost.

	Then the version is checked and selected accordingly to
	min_version/max_version. The highest possible version number is
	selected!

	If no versiontag is set the versiontag is set accordingly to the
	selected library and INCLUDES_BOOST is set.
	"""
	boostPath = getattr(Options.options, 'boostincludes', '')
	if boostPath:
		boostPath = [os.path.normpath(os.path.expandvars(os.path.expanduser(boostPath)))]
	else:
		boostPath = Utils.to_list(kw['includes'])

	min_version = string_to_version(kw.get('min_version', ''))
	max_version = string_to_version(kw.get('max_version', '')) or (sys.maxint - 1)

	version = 0
	for include_path in boostPath:
		boost_paths = [p for p in glob.glob(os.path.join(include_path, 'boost*')) if os.path.isdir(p)]
		debug('BOOST Paths: %r' % boost_paths)
		for path in boost_paths:
			pathname = os.path.split(path)[-1]
			ret = -1
			if pathname == 'boost':
				path = include_path
				ret = self.get_boost_version_number(path)
			elif pathname.startswith('boost-'):
				ret = self.get_boost_version_number(path)
			ret = int(ret)

			if ret != -1 and ret >= min_version and ret <= max_version and ret > version:
				boost_path = path
				version = ret
	if not version:
		self.fatal('boost headers not found! (required version min: %s max: %s)'
			  % (kw['min_version'], kw['max_version']))
		return False

	found_version = version_string(version)
	versiontag = '^' + found_version + '$'
	if kw['tag_version'] is None:
		kw['tag_version'] = versiontag
	elif kw['tag_version'] != versiontag:
		warn('boost header version %r and tag_version %r do not match!' % (versiontag, kw['tag_version']))
	env = self.env
	env['INCLUDES_BOOST'] = boost_path
	env['BOOST_VERSION'] = found_version
	self.found_includes = 1
	ret = '%s (ver %s)' % (boost_path, found_version)
	return ret
开发者ID:SjB,项目名称:waf,代码行数:55,代码来源:boost.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python Logs.error函数代码示例发布时间:2022-05-26
下一篇:
Python conf.to_log函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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