本文整理汇总了Python中waflib.Node.Node方法的典型用法代码示例。如果您正苦于以下问题:Python Node.Node方法的具体用法?Python Node.Node怎么用?Python Node.Node使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类waflib.Node
的用法示例。
在下文中一共展示了Node.Node方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: to_incnodes
# 需要导入模块: from waflib import Node [as 别名]
# 或者: from waflib.Node import Node [as 别名]
def to_incnodes(self,inlst):
lst=[]
seen=set([])
for x in self.to_list(inlst):
if x in seen or not x:
continue
seen.add(x)
if isinstance(x,Node.Node):
lst.append(x)
else:
if os.path.isabs(x):
lst.append(self.bld.root.make_node(x)or x)
else:
if x[0]=='#':
p=self.bld.bldnode.make_node(x[1:])
v=self.bld.srcnode.make_node(x[1:])
else:
p=self.path.get_bld().make_node(x)
v=self.path.make_node(x)
if p.is_child_of(self.bld.bldnode):
p.mkdir()
lst.append(p)
lst.append(v)
return lst
示例2: process_lib
# 需要导入模块: from waflib import Node [as 别名]
# 或者: from waflib.Node import Node [as 别名]
def process_lib(self):
node=None
names=[x%self.name for x in lib_patterns[self.lib_type]]
for x in self.lib_paths+[self.path]+SYSTEM_LIB_PATHS:
if not isinstance(x,Node.Node):
x=self.bld.root.find_node(x)or self.path.find_node(x)
if not x:
continue
for y in names:
node=x.find_node(y)
if node:
node.sig=Utils.h_file(node.abspath())
break
else:
continue
break
else:
raise Errors.WafError('could not find library %r'%self.name)
self.link_task=self.create_task('fake_%s'%self.lib_type,[],[node])
self.target=self.name
示例3: find_node
# 需要导入模块: from waflib import Node [as 别名]
# 或者: from waflib.Node import Node [as 别名]
def find_node(self, base_path):
assert isinstance(base_path, Node.Node)
self.node = base_path.find_resource(self.name)
if self.node is None:
raise Errors.WafError("Input file %s not found in " % (self.name, base_path))
示例4: __init__
# 需要导入模块: from waflib import Node [as 别名]
# 或者: from waflib.Node import Node [as 别名]
def __init__(self, env, command, command_node, command_args, stdin, stdout, cwd, os_env, stderr):
Task.Task.__init__(self, env=env)
assert isinstance(command, (str, Node.Node))
self.command = command
self.command_args = command_args
self.stdin = stdin
self.stdout = stdout
self.cwd = cwd
self.os_env = os_env
self.stderr = stderr
if command_node is not None: self.dep_nodes = [command_node]
self.dep_vars = [] # additional environment variables to look
示例5: apply_java
# 需要导入模块: from waflib import Node [as 别名]
# 或者: from waflib.Node import Node [as 别名]
def apply_java(self):
Utils.def_attrs(self,jarname='',classpath='',sourcepath='.',srcdir='.',jar_mf_attributes={},jar_mf_classpath=[])
nodes_lst=[]
outdir=getattr(self,'outdir',None)
if outdir:
if not isinstance(outdir,Node.Node):
outdir=self.path.get_bld().make_node(self.outdir)
else:
outdir=self.path.get_bld()
outdir.mkdir()
self.outdir=outdir
self.env['OUTDIR']=outdir.abspath()
self.javac_task=tsk=self.create_task('javac')
tmp=[]
srcdir=getattr(self,'srcdir','')
if isinstance(srcdir,Node.Node):
srcdir=[srcdir]
for x in Utils.to_list(srcdir):
if isinstance(x,Node.Node):
y=x
else:
y=self.path.find_dir(x)
if not y:
self.bld.fatal('Could not find the folder %s from %s'%(x,self.path))
tmp.append(y)
tsk.srcdir=tmp
if getattr(self,'compat',None):
tsk.env.append_value('JAVACFLAGS',['-source',self.compat])
if hasattr(self,'sourcepath'):
fold=[isinstance(x,Node.Node)and x or self.path.find_dir(x)for x in self.to_list(self.sourcepath)]
names=os.pathsep.join([x.srcpath()for x in fold])
else:
names=[x.srcpath()for x in tsk.srcdir]
if names:
tsk.env.append_value('JAVACFLAGS',['-sourcepath',names])
示例6: jar_files
# 需要导入模块: from waflib import Node [as 别名]
# 或者: from waflib.Node import Node [as 别名]
def jar_files(self):
destfile=getattr(self,'destfile','test.jar')
jaropts=getattr(self,'jaropts',[])
manifest=getattr(self,'manifest',None)
basedir=getattr(self,'basedir',None)
if basedir:
if not isinstance(self.basedir,Node.Node):
basedir=self.path.get_bld().make_node(basedir)
else:
basedir=self.path.get_bld()
if not basedir:
self.bld.fatal('Could not find the basedir %r for %r'%(self.basedir,self))
self.jar_task=tsk=self.create_task('jar_create')
if manifest:
jarcreate=getattr(self,'jarcreate','cfm')
node=self.path.find_node(manifest)
tsk.dep_nodes.append(node)
jaropts.insert(0,node.abspath())
else:
jarcreate=getattr(self,'jarcreate','cf')
if not isinstance(destfile,Node.Node):
destfile=self.path.find_or_declare(destfile)
if not destfile:
self.bld.fatal('invalid destfile %r for %r'%(destfile,self))
tsk.set_outputs(destfile)
tsk.basedir=basedir
jaropts.append('-C')
jaropts.append(basedir.bldpath())
jaropts.append('.')
tsk.env['JAROPTS']=jaropts
tsk.env['JARCREATE']=jarcreate
if getattr(self,'javac_task',None):
tsk.set_run_after(self.javac_task)
示例7: create_javadoc
# 需要导入模块: from waflib import Node [as 别名]
# 或者: from waflib.Node import Node [as 别名]
def create_javadoc(self):
tsk=self.create_task('javadoc')
tsk.classpath=getattr(self,'classpath',[])
self.javadoc_package=Utils.to_list(self.javadoc_package)
if not isinstance(self.javadoc_output,Node.Node):
self.javadoc_output=self.bld.path.find_or_declare(self.javadoc_output)
示例8: feature_py
# 需要导入模块: from waflib import Node [as 别名]
# 或者: from waflib.Node import Node [as 别名]
def feature_py(self):
self.install_path=getattr(self,'install_path','${PYTHONDIR}')
install_from=getattr(self,'install_from',None)
if install_from and not isinstance(install_from,Node.Node):
install_from=self.path.find_dir(install_from)
self.install_from=install_from
ver=self.env.PYTHON_VERSION
if not ver:
self.bld.fatal('Installing python files requires PYTHON_VERSION, try conf.check_python_version')
if int(ver.replace('.',''))>31:
self.install_32=True
示例9: to_nodes
# 需要导入模块: from waflib import Node [as 别名]
# 或者: from waflib.Node import Node [as 别名]
def to_nodes(self,lst,path=None):
tmp=[]
path=path or self.path
find=path.find_resource
if isinstance(lst,Node.Node):
lst=[lst]
for x in Utils.to_list(lst):
if isinstance(x,str):
node=find(x)
else:
node=x
if not node:
raise Errors.WafError("source not found: %r in %r"%(x,self))
tmp.append(node)
return tmp
示例10: _subst_arg
# 需要导入模块: from waflib import Node [as 别名]
# 或者: from waflib.Node import Node [as 别名]
def _subst_arg(self, arg, direction, namespace):
"""
@param arg: the command argument (or stdin/stdout/stderr) to substitute
@param direction: direction of the argument: 'in', 'out', or None
"""
def repl(match):
if match.group('dollar'):
return "$"
elif match.group('subst'):
var = match.group('var')
code = match.group('code')
result = eval(var+code, namespace)
if isinstance(result, Node.Node):
if var == 'TGT':
return result.get_bld().abspath()
elif var == 'SRC':
return result.srcpath()
else:
raise ValueError("Bad subst variable %r" % var)
elif result is self.inputs:
if len(self.inputs) == 1:
return result[0].srcpath()
else:
raise ValueError("${SRC} requested but have multiple sources; which one?")
elif result is self.outputs:
if len(self.outputs) == 1:
return result[0].get_bld().abspath()
else:
raise ValueError("${TGT} requested but have multiple targets; which one?")
elif isinstance(result, list):
assert len(result) == 1
return result[0]
else:
return result
return None
return arg_rx.sub(repl, arg)
示例11: apply_java
# 需要导入模块: from waflib import Node [as 别名]
# 或者: from waflib.Node import Node [as 别名]
def apply_java(self):
Utils.def_attrs(self,jarname='',classpath='',sourcepath='.',srcdir='.',jar_mf_attributes={},jar_mf_classpath=[])
outdir=getattr(self,'outdir',None)
if outdir:
if not isinstance(outdir,Node.Node):
outdir=self.path.get_bld().make_node(self.outdir)
else:
outdir=self.path.get_bld()
outdir.mkdir()
self.outdir=outdir
self.env['OUTDIR']=outdir.abspath()
self.javac_task=tsk=self.create_task('javac')
tmp=[]
srcdir=getattr(self,'srcdir','')
if isinstance(srcdir,Node.Node):
srcdir=[srcdir]
for x in Utils.to_list(srcdir):
if isinstance(x,Node.Node):
y=x
else:
y=self.path.find_dir(x)
if not y:
self.bld.fatal('Could not find the folder %s from %s'%(x,self.path))
tmp.append(y)
tsk.srcdir=tmp
if getattr(self,'compat',None):
tsk.env.append_value('JAVACFLAGS',['-source',self.compat])
if hasattr(self,'sourcepath'):
fold=[isinstance(x,Node.Node)and x or self.path.find_dir(x)for x in self.to_list(self.sourcepath)]
names=os.pathsep.join([x.srcpath()for x in fold])
else:
names=[x.srcpath()for x in tsk.srcdir]
if names:
tsk.env.append_value('JAVACFLAGS',['-sourcepath',names])