本文整理汇总了Python中waflib.Utils.O644属性的典型用法代码示例。如果您正苦于以下问题:Python Utils.O644属性的具体用法?Python Utils.O644怎么用?Python Utils.O644使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类waflib.Utils
的用法示例。
在下文中一共展示了Utils.O644属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: apply_copy
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import O644 [as 别名]
def apply_copy(self):
Utils.def_attrs(self, fun=copy_func)
self.default_install_path = 0
lst = self.to_list(self.source)
self.meths.remove('process_source')
for filename in lst:
node = self.path.find_resource(filename)
if not node: raise Errors.WafError('cannot find input file %s for processing' % filename)
target = self.target
if not target or len(lst)>1: target = node.name
# TODO the file path may be incorrect
newnode = self.path.find_or_declare(target)
tsk = self.create_task('copy', node, newnode)
tsk.fun = self.fun
tsk.chmod = getattr(self, 'chmod', Utils.O644)
if not tsk.env:
tsk.debug()
raise Errors.WafError('task without an environment')
示例2: apply_cs
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import O644 [as 别名]
def apply_cs(self):
cs_nodes=[]
no_nodes=[]
for x in self.to_nodes(self.source):
if x.name.endswith('.cs'):
cs_nodes.append(x)
else:
no_nodes.append(x)
self.source=no_nodes
bintype=getattr(self,'bintype',self.gen.endswith('.dll')and'library'or'exe')
self.cs_task=tsk=self.create_task('mcs',cs_nodes,self.path.find_or_declare(self.gen))
tsk.env.CSTYPE='/target:%s'%bintype
tsk.env.OUT='/out:%s'%tsk.outputs[0].abspath()
self.env.append_value('CSFLAGS','/platform:%s'%getattr(self,'platform','anycpu'))
inst_to=getattr(self,'install_path',bintype=='exe'and'${BINDIR}'or'${LIBDIR}')
if inst_to:
mod=getattr(self,'chmod',bintype=='exe'and Utils.O755 or Utils.O644)
self.install_task=self.bld.install_files(inst_to,self.cs_task.outputs[:],env=self.env,chmod=mod)
示例3: apply_subst
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import O644 [as 别名]
def apply_subst(self):
Utils.def_attrs(self, fun=subst_func)
lst = self.to_list(self.source)
self.meths.remove('process_source')
self.dict = getattr(self, 'dict', {})
for filename in lst:
node = self.path.find_resource(filename)
if not node: raise Errors.WafError('cannot find input file %s for processing' % filename)
if self.target:
newnode = self.path.find_or_declare(self.target)
else:
newnode = node.change_ext('')
try:
self.dict = self.dict.get_merged_dict()
except AttributeError:
pass
if self.dict and not self.env['DICT_HASH']:
self.env = self.env.derive()
keys = list(self.dict.keys())
keys.sort()
lst = [self.dict[x] for x in keys]
self.env['DICT_HASH'] = str(Utils.h_list(lst))
tsk = self.create_task('copy', node, newnode)
tsk.fun = self.fun
tsk.dict = self.dict
tsk.dep_vars = ['DICT_HASH']
tsk.chmod = getattr(self, 'chmod', Utils.O644)
if not tsk.env:
tsk.debug()
raise Errors.WafError('task without an environment')
####################
## command-output ####
####################
示例4: apply_intltool_po
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import O644 [as 别名]
def apply_intltool_po(self):
try:self.meths.remove('process_source')
except ValueError:pass
self.ensure_localedir()
appname=getattr(self,'appname',getattr(Context.g_module,Context.APPNAME,'set_your_app_name'))
podir=getattr(self,'podir','.')
inst=getattr(self,'install_path','${LOCALEDIR}')
linguas=self.path.find_node(os.path.join(podir,'LINGUAS'))
if linguas:
file=open(linguas.abspath())
langs=[]
for line in file.readlines():
if not line.startswith('#'):
langs+=line.split()
file.close()
re_linguas=re.compile('[-a-zA-Z_@.]+')
for lang in langs:
if re_linguas.match(lang):
node=self.path.find_resource(os.path.join(podir,re_linguas.match(lang).group()+'.po'))
task=self.create_task('po',node,node.change_ext('.mo'))
if inst:
filename=task.outputs[0].name
(langname,ext)=os.path.splitext(filename)
inst_file=inst+os.sep+langname+os.sep+'LC_MESSAGES'+os.sep+appname+'.mo'
self.bld.install_as(inst_file,task.outputs[0],chmod=getattr(self,'chmod',Utils.O644),env=task.env)
else:
Logs.pprint('RED',"Error no LINGUAS file found in po directory")
示例5: apply_msgfmt
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import O644 [as 别名]
def apply_msgfmt(self):
for lang in self.to_list(self.langs):
node=self.path.find_resource(lang+'.po')
task=self.create_task('msgfmt',node,node.change_ext('.mo'))
langname=lang.split('/')
langname=langname[-1]
inst=getattr(self,'install_path','${KDE4_LOCALE_INSTALL_DIR}')
self.bld.install_as(inst+os.sep+langname+os.sep+'LC_MESSAGES'+os.sep+getattr(self,'appname','set_your_appname')+'.mo',task.outputs[0],chmod=getattr(self,'chmod',Utils.O644))
示例6: copy_fun
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import O644 [as 别名]
def copy_fun(self,src,tgt,**kw):
if Utils.is_win32 and len(tgt)>259 and not tgt.startswith('\\\\?\\'):
tgt='\\\\?\\'+tgt
shutil.copy2(src,tgt)
os.chmod(tgt,kw.get('chmod',Utils.O644))
示例7: do_install
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import O644 [as 别名]
def do_install(self,src,tgt,**kw):
d,_=os.path.split(tgt)
if not d:
raise Errors.WafError('Invalid installation given %r->%r'%(src,tgt))
Utils.check_dir(d)
srclbl=src.replace(self.srcnode.abspath()+os.sep,'')
if not Options.options.force:
try:
st1=os.stat(tgt)
st2=os.stat(src)
except OSError:
pass
else:
if st1.st_mtime+2>=st2.st_mtime and st1.st_size==st2.st_size:
if not self.progress_bar:
Logs.info('- install %s (from %s)'%(tgt,srclbl))
return False
if not self.progress_bar:
Logs.info('+ install %s (from %s)'%(tgt,srclbl))
try:
os.chmod(tgt,Utils.O644|stat.S_IMODE(os.stat(tgt).st_mode))
except EnvironmentError:
pass
try:
os.remove(tgt)
except OSError:
pass
try:
self.copy_fun(src,tgt,**kw)
except IOError:
try:
os.stat(src)
except EnvironmentError:
Logs.error('File %r does not exist'%src)
raise Errors.WafError('Could not install the file %r'%tgt)
示例8: install_as
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import O644 [as 别名]
def install_as(self,dest,srcfile,env=None,chmod=Utils.O644,cwd=None,add=True,postpone=True,task=None):
tsk=inst(env=env or self.env)
tsk.bld=self
tsk.path=cwd or self.path
tsk.chmod=chmod
tsk.source=[srcfile]
tsk.task=task
tsk.dest=dest
tsk.exec_task=tsk.exec_install_as
if add:self.add_to_group(tsk)
self.run_task_now(tsk,postpone)
return tsk
示例9: install_as
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import O644 [as 别名]
def install_as(self,dest,srcfile,env=None,chmod=Utils.O644,cwd=None,add=True,postpone=True,task=None):
assert(dest)
tsk=inst(env=env or self.env)
tsk.bld=self
tsk.path=cwd or self.path
tsk.chmod=chmod
tsk.source=[srcfile]
tsk.task=task
tsk.dest=dest
tsk.exec_task=tsk.exec_install_as
if add:self.add_to_group(tsk)
self.run_task_now(tsk,postpone)
return tsk