Changeset 904702d for waflib/Tools
- Timestamp:
- Mar 14, 2015, 6:06:10 PM (10 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 6d7acc8
- Parents:
- 5525507
- Location:
- waflib/Tools
- Files:
-
- 3 added
- 43 edited
Legend:
- Unmodified
- Added
- Removed
-
waflib/Tools/ar.py
r5525507 r904702d 9 9 def configure(conf): 10 10 conf.find_program('ar',var='AR') 11 conf.env.ARFLAGS='rcs' 11 conf.add_os_flags('ARFLAGS') 12 if not conf.env.ARFLAGS: 13 conf.env.ARFLAGS=['rcs'] -
waflib/Tools/asm.py
r5525507 r904702d 10 10 class asm(Task.Task): 11 11 color='BLUE' 12 run_str='${AS} ${ASFLAGS} ${ASMPATH_ST:INCPATHS} ${ AS_SRC_F}${SRC} ${AS_TGT_F}${TGT}'12 run_str='${AS} ${ASFLAGS} ${ASMPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${AS_SRC_F}${SRC} ${AS_TGT_F}${TGT}' 13 13 @extension('.s','.S','.asm','.ASM','.spp','.SPP') 14 14 def asm_hook(self,node): -
waflib/Tools/c.py
r5525507 r904702d 8 8 @TaskGen.extension('.c') 9 9 def c_hook(self,node): 10 if not self.env.CC and self.env.CXX: 11 return self.create_compiled_task('cxx',node) 10 12 return self.create_compiled_task('c',node) 11 13 class c(Task.Task): 12 run_str='${CC} ${ARCH_ST:ARCH} ${CFLAGS} ${CPPFLAGS} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${CC_SRC_F}${SRC} ${CC_TGT_F}${TGT }'14 run_str='${CC} ${ARCH_ST:ARCH} ${CFLAGS} ${CPPFLAGS} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${CC_SRC_F}${SRC} ${CC_TGT_F}${TGT[0].abspath()}' 13 15 vars=['CCDEPS'] 14 16 ext_in=['.h'] -
waflib/Tools/c_aliases.py
r5525507 r904702d 30 30 if'java'in exts: 31 31 return'java' 32 if type in ['program','shlib','stlib']:32 if type in('program','shlib','stlib'): 33 33 for x in feats: 34 if x in ['cxx','d','c']:34 if x in('cxx','d','c'): 35 35 feats.append(x+type) 36 36 return feats -
waflib/Tools/c_config.py
r5525507 r904702d 44 44 MACRO_TO_DEST_CPU={'__x86_64__':'x86_64','__amd64__':'x86_64','__i386__':'x86','__ia64__':'ia','__mips__':'mips','__sparc__':'sparc','__alpha__':'alpha','__aarch64__':'aarch64','__thumb__':'thumb','__arm__':'arm','__hppa__':'hppa','__powerpc__':'powerpc','__ppc__':'powerpc','__convex__':'convex','__m68k__':'m68k','__s390x__':'s390x','__s390__':'s390','__sh__':'sh',} 45 45 @conf 46 def parse_flags(self,line,uselib_store,env=None,force_static=False ):46 def parse_flags(self,line,uselib_store,env=None,force_static=False,posix=None): 47 47 assert(isinstance(line,str)) 48 48 env=env or self.env 49 app=env.append_value 50 appu=env.append_unique 51 lex=shlex.shlex(line,posix=False) 49 if posix is None: 50 posix=True 51 if'\\'in line: 52 posix=('\\ 'in line)or('\\\\'in line) 53 lex=shlex.shlex(line,posix=posix) 52 54 lex.whitespace_split=True 53 55 lex.commenters='' 54 56 lst=list(lex) 57 app=env.append_value 58 appu=env.append_unique 55 59 uselib=uselib_store 56 60 while lst: … … 61 65 if not ot:ot=lst.pop(0) 62 66 appu('INCLUDES_'+uselib,[ot]) 63 elif st=='-i nclude':67 elif st=='-i': 64 68 tmp=[x,lst.pop(0)] 65 69 app('CFLAGS',tmp) … … 85 89 elif x.startswith('-F'): 86 90 appu('FRAMEWORKPATH_'+uselib,[x[2:]]) 91 elif x=='-Wl,-rpath': 92 app('RPATH_'+uselib,lst.pop(0)) 93 elif x.startswith('-Wl,-R'): 94 app('RPATH_'+uselib,x[6:]) 95 elif x.startswith('-Wl,-rpath,'): 96 app('RPATH_'+uselib,x[11:]) 87 97 elif x.startswith('-Wl'): 88 98 app('LINKFLAGS_'+uselib,[x]) … … 92 102 elif x.startswith('-bundle'): 93 103 app('LINKFLAGS_'+uselib,[x]) 94 elif x.startswith('-undefined') :104 elif x.startswith('-undefined')or x.startswith('-Xlinker'): 95 105 arg=lst.pop(0) 96 106 app('LINKFLAGS_'+uselib,[x,arg]) … … 102 112 elif x.endswith('.a')or x.endswith('.so')or x.endswith('.dylib')or x.endswith('.lib'): 103 113 appu('LINKFLAGS_'+uselib,[x]) 104 @conf105 def ret_msg(self,f,kw):106 if isinstance(f,str):107 return f108 return f(kw)109 114 @conf 110 115 def validate_cfg(self,kw): … … 133 138 kw['msg']='Checking for %r %s %s'%(kw['package'],cfg_ver[x],kw[y]) 134 139 return 140 if not'define_name'in kw: 141 pkgname=kw.get('uselib_store',kw['package'].upper()) 142 kw['define_name']=self.have_define(pkgname) 143 if not'uselib_store'in kw: 144 self.undefine(kw['define_name']) 135 145 if not'msg'in kw: 136 146 kw['msg']='Checking for %r'%(kw['package']or kw['path']) 137 147 @conf 138 148 def exec_cfg(self,kw): 149 path=Utils.to_list(kw['path']) 139 150 def define_it(): 140 self.define(self.have_define(kw.get('uselib_store',kw['package'])),1,0) 151 pkgname=kw.get('uselib_store',kw['package'].upper()) 152 if kw.get('global_define'): 153 self.define(self.have_define(kw['package']),1,False) 154 else: 155 self.env.append_unique('DEFINES_%s'%pkgname,"%s=1"%self.have_define(pkgname)) 156 self.env[self.have_define(pkgname)]=1 141 157 if'atleast_pkgconfig_version'in kw: 142 cmd= [kw['path'],'--atleast-pkgconfig-version=%s'%kw['atleast_pkgconfig_version']]158 cmd=path+['--atleast-pkgconfig-version=%s'%kw['atleast_pkgconfig_version']] 143 159 self.cmd_and_log(cmd) 144 160 if not'okmsg'in kw: … … 148 164 y=x.replace('-','_') 149 165 if y in kw: 150 self.cmd_and_log( [kw['path'],'--%s=%s'%(x,kw[y]),kw['package']])166 self.cmd_and_log(path+['--%s=%s'%(x,kw[y]),kw['package']]) 151 167 if not'okmsg'in kw: 152 168 kw['okmsg']='yes' … … 154 170 break 155 171 if'modversion'in kw: 156 version=self.cmd_and_log( [kw['path'],'--modversion',kw['modversion']]).strip()172 version=self.cmd_and_log(path+['--modversion',kw['modversion']]).strip() 157 173 self.define('%s_VERSION'%Utils.quote_define_name(kw.get('uselib_store',kw['modversion'])),version) 158 174 return version 159 lst=[ kw['path']]175 lst=[]+path 160 176 defi=kw.get('define_variable',None) 161 177 if not defi: … … 163 179 for key,val in defi.items(): 164 180 lst.append('--define-variable=%s=%s'%(key,val)) 165 static= False181 static=kw.get('force_static',False) 166 182 if'args'in kw: 167 183 args=Utils.to_list(kw['args']) … … 185 201 kw['okmsg']='yes' 186 202 define_it() 187 self.parse_flags(ret,kw.get('uselib_store',kw['package'].upper()),kw.get('env',self.env),force_static=static )203 self.parse_flags(ret,kw.get('uselib_store',kw['package'].upper()),kw.get('env',self.env),force_static=static,posix=kw.get('posix',None)) 188 204 return ret 189 205 @conf … … 195 211 self.validate_cfg(kw) 196 212 if'msg'in kw: 197 self.start_msg(kw['msg'] )213 self.start_msg(kw['msg'],**kw) 198 214 ret=None 199 215 try: … … 201 217 except self.errors.WafError: 202 218 if'errmsg'in kw: 203 self.end_msg(kw['errmsg'],'YELLOW' )219 self.end_msg(kw['errmsg'],'YELLOW',**kw) 204 220 if Logs.verbose>1: 205 221 raise … … 207 223 self.fatal('The configuration failed') 208 224 else: 225 if not ret: 226 ret=True 209 227 kw['success']=ret 210 228 if'okmsg'in kw: 211 self.end_msg(self.ret_msg(kw['okmsg'],kw) )229 self.end_msg(self.ret_msg(kw['okmsg'],kw),**kw) 212 230 return ret 231 def build_fun(bld): 232 if bld.kw['compile_filename']: 233 node=bld.srcnode.make_node(bld.kw['compile_filename']) 234 node.write(bld.kw['code']) 235 o=bld(features=bld.kw['features'],source=bld.kw['compile_filename'],target='testprog') 236 for k,v in bld.kw.items(): 237 setattr(o,k,v) 238 if not bld.kw.get('quiet',None): 239 bld.conf.to_log("==>\n%s\n<=="%bld.kw['code']) 213 240 @conf 214 241 def validate_c(self,kw): 242 if not'build_fun'in kw: 243 kw['build_fun']=build_fun 215 244 if not'env'in kw: 216 245 kw['env']=self.env.derive() … … 307 336 if not'errmsg'in kw: 308 337 kw['errmsg']='no' 309 for(flagsname,flagstype)in [('cxxflags','compiler'),('cflags','compiler'),('linkflags','linker')]:338 for(flagsname,flagstype)in(('cxxflags','compiler'),('cflags','compiler'),('linkflags','linker')): 310 339 if flagsname in kw: 311 340 if not'msg'in kw: … … 369 398 def check(self,*k,**kw): 370 399 self.validate_c(kw) 371 self.start_msg(kw['msg'] )400 self.start_msg(kw['msg'],**kw) 372 401 ret=None 373 402 try: 374 ret=self.run_ c_code(*k,**kw)403 ret=self.run_build(*k,**kw) 375 404 except self.errors.ConfigurationError: 376 self.end_msg(kw['errmsg'],'YELLOW' )405 self.end_msg(kw['errmsg'],'YELLOW',**kw) 377 406 if Logs.verbose>1: 378 407 raise … … 383 412 ret=self.post_check(*k,**kw) 384 413 if not ret: 385 self.end_msg(kw['errmsg'],'YELLOW' )414 self.end_msg(kw['errmsg'],'YELLOW',**kw) 386 415 self.fatal('The configuration failed %r'%ret) 387 416 else: 388 self.end_msg(self.ret_msg(kw['okmsg'],kw) )417 self.end_msg(self.ret_msg(kw['okmsg'],kw),**kw) 389 418 return ret 390 419 class test_exec(Task.Task): … … 409 438 def test_exec_fun(self): 410 439 self.create_task('test_exec',self.link_task.outputs[0]) 411 CACHE_RESULTS=1412 COMPILE_ERRORS=2413 @conf414 def run_c_code(self,*k,**kw):415 lst=[str(v)for(p,v)in kw.items()if p!='env']416 h=Utils.h_list(lst)417 dir=self.bldnode.abspath()+os.sep+(not Utils.is_win32 and'.'or'')+'conf_check_'+Utils.to_hex(h)418 try:419 os.makedirs(dir)420 except OSError:421 pass422 try:423 os.stat(dir)424 except OSError:425 self.fatal('cannot use the configuration test folder %r'%dir)426 cachemode=getattr(Options.options,'confcache',None)427 if cachemode==CACHE_RESULTS:428 try:429 proj=ConfigSet.ConfigSet(os.path.join(dir,'cache_run_c_code'))430 except OSError:431 pass432 else:433 ret=proj['cache_run_c_code']434 if isinstance(ret,str)and ret.startswith('Test does not build'):435 self.fatal(ret)436 return ret437 bdir=os.path.join(dir,'testbuild')438 if not os.path.exists(bdir):439 os.makedirs(bdir)440 self.test_bld=bld=Build.BuildContext(top_dir=dir,out_dir=bdir)441 bld.init_dirs()442 bld.progress_bar=0443 bld.targets='*'444 if kw['compile_filename']:445 node=bld.srcnode.make_node(kw['compile_filename'])446 node.write(kw['code'])447 bld.logger=self.logger448 bld.all_envs.update(self.all_envs)449 bld.env=kw['env']450 o=bld(features=kw['features'],source=kw['compile_filename'],target='testprog')451 for k,v in kw.items():452 setattr(o,k,v)453 self.to_log("==>\n%s\n<=="%kw['code'])454 bld.targets='*'455 ret=-1456 try:457 try:458 bld.compile()459 except Errors.WafError:460 ret='Test does not build: %s'%Utils.ex_stack()461 self.fatal(ret)462 else:463 ret=getattr(bld,'retval',0)464 finally:465 proj=ConfigSet.ConfigSet()466 proj['cache_run_c_code']=ret467 proj.store(os.path.join(dir,'cache_run_c_code'))468 return ret469 440 @conf 470 441 def check_cxx(self,*k,**kw): … … 530 501 return(self.env.HAVE_PAT or'HAVE_%s')%Utils.quote_define_name(key) 531 502 @conf 532 def write_config_header(self,configfile='',guard='',top=False,env=None,defines=True,headers=False,remove=True,define_prefix=''): 533 if env: 534 Logs.warn('Cannot pass env to write_config_header') 503 def write_config_header(self,configfile='',guard='',top=False,defines=True,headers=False,remove=True,define_prefix=''): 535 504 if not configfile:configfile=WAF_CONFIG_H 536 505 waf_guard=guard or'W_%s_WAF'%Utils.quote_define_name(configfile) … … 555 524 lst.append('#include <%s>'%x) 556 525 if defines: 557 for x in self.env[DEFKEYS]: 558 if self.is_defined(x): 559 val=self.get_define(x) 560 lst.append('#define %s %s'%(define_prefix+x,val)) 561 else: 562 lst.append('/* #undef %s */'%(define_prefix+x)) 526 tbl={} 527 for k in self.env['DEFINES']: 528 a,_,b=k.partition('=') 529 tbl[a]=b 530 for k in self.env[DEFKEYS]: 531 try: 532 txt='#define %s%s %s'%(define_prefix,k,tbl[k]) 533 except KeyError: 534 txt='/* #undef %s%s */'%(define_prefix,k) 535 lst.append(txt) 563 536 return"\n".join(lst) 564 537 @conf … … 585 558 conf.load('cxx') 586 559 @conf 587 def get_cc_version(conf,cc,gcc=False,icc=False ):560 def get_cc_version(conf,cc,gcc=False,icc=False,clang=False): 588 561 cmd=cc+['-dM','-E','-'] 589 562 env=conf.env.env or None … … 603 576 if icc and out.find('__INTEL_COMPILER')<0: 604 577 conf.fatal('Not icc/icpc') 578 if clang and out.find('__clang__')<0: 579 conf.fatal('Not clang/clang++') 580 if not clang and out.find('__clang__')>=0: 581 conf.fatal('Could not find g++, if renamed try eg: CXX=g++48 waf configure') 605 582 k={} 606 if icc or gcc :583 if icc or gcc or clang: 607 584 out=out.splitlines() 608 585 for line in out: … … 646 623 else: 647 624 if isD('__clang__'): 648 conf.env['CC_VERSION']=(k['__clang_major__'],k['__clang_minor__'],k['__clang_patchlevel__']) 625 try: 626 conf.env['CC_VERSION']=(k['__clang_major__'],k['__clang_minor__'],k['__clang_patchlevel__']) 627 except KeyError: 628 conf.env['CC_VERSION']=(k['__GNUC__'],k['__GNUC_MINOR__'],k['__GNUC_PATCHLEVEL__']) 649 629 else: 650 conf.env['CC_VERSION']=(k['__GNUC__'],k['__GNUC_MINOR__'],k['__GNUC_PATCHLEVEL__']) 630 try: 631 conf.env['CC_VERSION']=(k['__GNUC__'],k['__GNUC_MINOR__'],k['__GNUC_PATCHLEVEL__']) 632 except KeyError: 633 conf.env['CC_VERSION']=(k['__GNUC__'],k['__GNUC_MINOR__'],0) 651 634 return k 652 635 @conf … … 688 671 def add_as_needed(self): 689 672 if self.env.DEST_BINFMT=='elf'and'gcc'in(self.env.CXX_NAME,self.env.CC_NAME): 690 self.env.append_unique('LINKFLAGS','- -as-needed')673 self.env.append_unique('LINKFLAGS','-Wl,--as-needed') 691 674 class cfgtask(Task.TaskBase): 692 675 def display(self): … … 709 692 @conf 710 693 def multicheck(self,*k,**kw): 711 self.start_msg(kw.get('msg','Executing %d configuration tests'%len(k)) )694 self.start_msg(kw.get('msg','Executing %d configuration tests'%len(k)),**kw) 712 695 class par(object): 713 696 def __init__(self): 714 697 self.keep=False 715 self.cache_global=Options.cache_global716 self.nocache=Options.options.nocache717 698 self.returned_tasks=[] 718 699 self.task_sigs={} … … 742 723 for x in tasks: 743 724 if x.hasrun!=Task.SUCCESS: 744 self.end_msg(kw.get('errmsg','no'),color='YELLOW' )725 self.end_msg(kw.get('errmsg','no'),color='YELLOW',**kw) 745 726 self.fatal(kw.get('fatalmsg',None)or'One of the tests has failed, see the config.log for more information') 746 self.end_msg('ok' )727 self.end_msg('ok',**kw) -
waflib/Tools/c_preproc.py
r5525507 r904702d 16 16 use_trigraphs=0 17 17 strict_quotes=0 18 g_optrans={'not':'!',' and':'&&','bitand':'&','and_eq':'&=','or':'||','bitor':'|','or_eq':'|=','xor':'^','xor_eq':'^=','compl':'~',}18 g_optrans={'not':'!','not_eq':'!','and':'&&','and_eq':'&=','or':'||','or_eq':'|=','xor':'^','xor_eq':'^=','bitand':'&','bitor':'|','compl':'~',} 19 19 re_lines=re.compile('^[ \t]*(#|%:)[ \t]*(ifdef|ifndef|if|else|elif|endif|include|import|define|undef|pragma)[ \t]*(.*)\r*$',re.IGNORECASE|re.MULTILINE) 20 20 re_mac=re.compile("^[a-zA-Z_]\w*") … … 72 72 elif d=='/':c=a/b 73 73 elif d=='^':c=a^b 74 elif d=='|':c=a|b75 elif d=='||':c=int(a or b)76 elif d=='&':c=a&b77 elif d=='&&':c=int(a and b)78 74 elif d=='==':c=int(a==b) 79 elif d=='!=':c=int(a!=b) 75 elif d=='|'or d=='bitor':c=a|b 76 elif d=='||'or d=='or':c=int(a or b) 77 elif d=='&'or d=='bitand':c=a&b 78 elif d=='&&'or d=='and':c=int(a and b) 79 elif d=='!='or d=='not_eq':c=int(a!=b) 80 elif d=='^'or d=='xor':c=int(a^b) 80 81 elif d=='<=':c=int(a<=b) 81 82 elif d=='<':c=int(a<b) 82 83 elif d=='>':c=int(a>b) 83 84 elif d=='>=':c=int(a>=b) 84 elif d=='^':c=int(a^b)85 85 elif d=='<<':c=a<<b 86 86 elif d=='>>':c=a>>b … … 382 382 else: 383 383 if toks[0][1]=='<'and toks[-1][1]=='>': 384 return stringize(toks).lstrip('<').rstrip('>') 384 ret='<',stringize(toks).lstrip('<').rstrip('>') 385 return ret 385 386 raise PreprocError("could not parse include %s."%txt) 386 387 def parse_char(txt): … … 411 412 if v: 412 413 if name==IDENT: 413 try:v=g_optrans[v];name=OP 414 try: 415 g_optrans[v]; 416 name=OP 414 417 except KeyError: 415 418 if v.lower()=="true": … … 473 476 return ret 474 477 def tryfind(self,filename): 478 if filename.endswith('.moc'): 479 self.names.append(filename) 480 return None 475 481 self.curfile=filename 476 482 found=self.cached_find_resource(self.currentnode_stack[-1],filename) … … 481 487 if found and not found in self.ban_includes: 482 488 self.nodes.append(found) 483 if filename[-4:]!='.moc': 484 self.addlines(found) 489 self.addlines(found) 485 490 else: 486 491 if not filename in self.names: … … 520 525 self.parse_cache=bld.parse_cache 521 526 except AttributeError: 522 bld.parse_cache={} 523 self.parse_cache=bld.parse_cache 527 self.parse_cache=bld.parse_cache={} 524 528 self.current_file=node 525 529 self.addlines(node) -
waflib/Tools/ccroot.py
r5525507 r904702d 76 76 name=name+'-'+nums[0] 77 77 elif self.env.DEST_OS=='openbsd': 78 pattern='%s.%s.%s'%(pattern,nums[0],nums[1]) 78 pattern='%s.%s'%(pattern,nums[0]) 79 if len(nums)>=2: 80 pattern+='.%s'%nums[1] 79 81 tmp=folder+os.sep+pattern%name 80 82 target=self.generator.path.find_or_declare(tmp) … … 82 84 class stlink_task(link_task): 83 85 run_str='${AR} ${ARFLAGS} ${AR_TGT_F}${TGT} ${AR_SRC_F}${SRC}' 86 chmod=Utils.O644 84 87 def rm_tgt(cls): 85 88 old=cls.run … … 112 115 inst_to=self.link_task.__class__.inst_to 113 116 if inst_to: 114 self.install_task=self.bld.install_files(inst_to,self.link_task.outputs[:],env=self.env,chmod=self.link_task.chmod )117 self.install_task=self.bld.install_files(inst_to,self.link_task.outputs[:],env=self.env,chmod=self.link_task.chmod,task=self.link_task) 115 118 @taskgen_method 116 119 def use_rec(self,name,**kw): … … 140 143 p=self.tmp_use_prec 141 144 for x in self.to_list(getattr(y,'use',[])): 145 if self.env["STLIB_"+x]: 146 continue 142 147 try: 143 148 p[x].append(name) … … 191 196 var=y.tmp_use_var 192 197 if var and link_task: 193 if var=='LIB'or y.tmp_use_stlib :198 if var=='LIB'or y.tmp_use_stlib or x in names: 194 199 self.env.append_value(var,[y.target[y.target.rfind(os.sep)+1:]]) 195 200 self.link_task.dep_nodes.extend(y.link_task.outputs) 196 201 tmp_path=y.link_task.outputs[0].parent.path_from(self.bld.bldnode) 197 self.env.append_ value(var+'PATH',[tmp_path])202 self.env.append_unique(var+'PATH',[tmp_path]) 198 203 else: 199 204 if y.tmp_use_objects: … … 206 211 try: 207 212 y=self.bld.get_tgen_by_name(x) 208 except E xception:213 except Errors.WafError: 209 214 if not self.env['STLIB_'+x]and not x in self.uselib: 210 215 self.uselib.append(x) 211 216 else: 212 for k in self.to_list(getattr(y,'use lib',[])):217 for k in self.to_list(getattr(y,'use',[])): 213 218 if not self.env['STLIB_'+k]and not k in self.uselib: 214 219 self.uselib.append(k) … … 239 244 _vars=self.get_uselib_vars() 240 245 env=self.env 241 for x in _vars: 242 y=x.lower() 243 env.append_unique(x,self.to_list(getattr(self,y,[]))) 244 for x in self.features: 245 for var in _vars: 246 compvar='%s_%s'%(var,x) 247 env.append_value(var,env[compvar]) 248 for x in self.to_list(getattr(self,'uselib',[])): 249 for v in _vars: 250 env.append_value(v,env[v+'_'+x]) 246 app=env.append_value 247 feature_uselib=self.features+self.to_list(getattr(self,'uselib',[])) 248 for var in _vars: 249 y=var.lower() 250 val=getattr(self,y,[]) 251 if val: 252 app(var,self.to_list(val)) 253 for x in feature_uselib: 254 val=env['%s_%s'%(var,x)] 255 if val: 256 app(var,val) 251 257 @feature('cshlib','cxxshlib','fcshlib') 252 258 @after_method('apply_link') … … 272 278 else: 273 279 self.link_task.inputs.append(node) 274 try: 275 inst_to=self.install_path 276 except AttributeError: 277 inst_to=self.link_task.__class__.inst_to 278 if not inst_to: 279 return 280 self.implib_install_task=self.bld.install_as('${LIBDIR}/%s'%implib.name,implib,self.env) 281 re_vnum=re.compile('^([1-9]\\d*|0)[.]([1-9]\\d*|0)[.]([1-9]\\d*|0)$') 280 if getattr(self,'install_task',None): 281 try: 282 inst_to=self.install_path_implib 283 except AttributeError: 284 try: 285 inst_to=self.install_path 286 except AttributeError: 287 inst_to='${IMPLIBDIR}' 288 self.install_task.dest='${BINDIR}' 289 if not self.env.IMPLIBDIR: 290 self.env.IMPLIBDIR=self.env.LIBDIR 291 self.implib_install_task=self.bld.install_files(inst_to,implib,env=self.env,chmod=self.link_task.chmod,task=self.link_task) 292 re_vnum=re.compile('^([1-9]\\d*|0)([.]([1-9]\\d*|0)[.]([1-9]\\d*|0))?$') 282 293 @feature('cshlib','cxxshlib','dshlib','fcshlib','vnum') 283 294 @after_method('apply_link','propagate_uselib_vars') … … 301 312 self.env.append_value('LINKFLAGS',v.split()) 302 313 if self.env.DEST_OS!='openbsd': 303 self.create_task('vnum',node,[node.parent.find_or_declare(name2),node.parent.find_or_declare(name3)]) 314 outs=[node.parent.find_or_declare(name3)] 315 if name2!=name3: 316 outs.append(node.parent.find_or_declare(name2)) 317 self.create_task('vnum',node,outs) 304 318 if getattr(self,'install_task',None): 305 319 self.install_task.hasrun=Task.SKIP_ME … … 312 326 else: 313 327 t1=bld.install_as(path+os.sep+name3,node,env=self.env,chmod=self.link_task.chmod) 314 t2=bld.symlink_as(path+os.sep+name2,name3)315 328 t3=bld.symlink_as(path+os.sep+libname,name3) 316 self.vnum_install_task=(t1,t2,t3) 329 if name2!=name3: 330 t2=bld.symlink_as(path+os.sep+name2,name3) 331 self.vnum_install_task=(t1,t2,t3) 332 else: 333 self.vnum_install_task=(t1,t3) 317 334 if'-dynamiclib'in self.env['LINKFLAGS']: 318 335 try: … … 328 345 quient=True 329 346 ext_in=['.bin'] 347 def keyword(self): 348 return'Symlinking' 330 349 def run(self): 331 350 for x in self.outputs: -
waflib/Tools/compiler_c.py
r5525507 r904702d 3 3 # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 4 5 import os,sys,imp,types 5 import os,sys,imp,types,re 6 6 from waflib.Tools import ccroot 7 7 from waflib import Utils,Configure 8 8 from waflib.Logs import debug 9 c_compiler={'win32':['msvc','gcc'],'cygwin':['gcc'],'darwin':['gcc'],'aix':['xlc','gcc'],'linux':['gcc','icc'],'sunos':['suncc','gcc'],'irix':['gcc','irixcc'],'hpux':['gcc'],'gnu':['gcc'],'java':['gcc','msvc','icc'],'default':['gcc'],} 9 c_compiler={'win32':['msvc','gcc','clang'],'cygwin':['gcc'],'darwin':['clang','gcc'],'aix':['xlc','gcc','clang'],'linux':['gcc','clang','icc'],'sunos':['suncc','gcc'],'irix':['gcc','irixcc'],'hpux':['gcc'],'gnu':['gcc','clang'],'java':['gcc','msvc','clang','icc'],'default':['gcc','clang'],} 10 def default_compilers(): 11 build_platform=Utils.unversioned_sys_platform() 12 possible_compiler_list=c_compiler.get(build_platform,c_compiler['default']) 13 return' '.join(possible_compiler_list) 10 14 def configure(conf): 11 try:test_for_compiler=conf.options.check_c_compiler 15 try:test_for_compiler=conf.options.check_c_compiler or default_compilers() 12 16 except AttributeError:conf.fatal("Add options(opt): opt.load('compiler_c')") 13 for compiler in test_for_compiler.split():17 for compiler in re.split('[ ,]+',test_for_compiler): 14 18 conf.env.stash() 15 conf.start_msg('Checking for %r ( ccompiler)'%compiler)19 conf.start_msg('Checking for %r (C compiler)'%compiler) 16 20 try: 17 21 conf.load(compiler) … … 27 31 conf.end_msg(False) 28 32 else: 29 conf.fatal('could not configure a ccompiler!')33 conf.fatal('could not configure a C compiler!') 30 34 def options(opt): 35 test_for_compiler=default_compilers() 31 36 opt.load_special_tools('c_*.py',ban=['c_dumbpreproc.py']) 32 global c_compiler 33 build_platform=Utils.unversioned_sys_platform() 34 possible_compiler_list=c_compiler[build_platform in c_compiler and build_platform or'default'] 35 test_for_compiler=' '.join(possible_compiler_list) 36 cc_compiler_opts=opt.add_option_group("C Compiler Options") 37 cc_compiler_opts.add_option('--check-c-compiler',default="%s"%test_for_compiler,help='On this platform (%s) the following C-Compiler will be checked by default: "%s"'%(build_platform,test_for_compiler),dest="check_c_compiler") 37 cc_compiler_opts=opt.add_option_group('Configuration options') 38 cc_compiler_opts.add_option('--check-c-compiler',default=None,help='list of C compilers to try [%s]'%test_for_compiler,dest="check_c_compiler") 38 39 for x in test_for_compiler.split(): 39 40 opt.load('%s'%x) -
waflib/Tools/compiler_cxx.py
r5525507 r904702d 3 3 # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 4 5 import os,sys,imp,types 5 import os,sys,imp,types,re 6 6 from waflib.Tools import ccroot 7 7 from waflib import Utils,Configure 8 8 from waflib.Logs import debug 9 cxx_compiler={'win32':['msvc','g++'],'cygwin':['g++'],'darwin':['g++'],'aix':['xlc++','g++'],'linux':['g++','icpc'],'sunos':['sunc++','g++'],'irix':['g++'],'hpux':['g++'],'gnu':['g++'],'java':['g++','msvc','icpc'],'default':['g++']} 9 cxx_compiler={'win32':['msvc','g++','clang++'],'cygwin':['g++'],'darwin':['clang++','g++'],'aix':['xlc++','g++','clang++'],'linux':['g++','clang++','icpc'],'sunos':['sunc++','g++'],'irix':['g++'],'hpux':['g++'],'gnu':['g++','clang++'],'java':['g++','msvc','clang++','icpc'],'default':['g++','clang++']} 10 def default_compilers(): 11 build_platform=Utils.unversioned_sys_platform() 12 possible_compiler_list=cxx_compiler.get(build_platform,cxx_compiler['default']) 13 return' '.join(possible_compiler_list) 10 14 def configure(conf): 11 try:test_for_compiler=conf.options.check_cxx_compiler 15 try:test_for_compiler=conf.options.check_cxx_compiler or default_compilers() 12 16 except AttributeError:conf.fatal("Add options(opt): opt.load('compiler_cxx')") 13 for compiler in test_for_compiler.split():17 for compiler in re.split('[ ,]+',test_for_compiler): 14 18 conf.env.stash() 15 conf.start_msg('Checking for %r ( c++ compiler)'%compiler)19 conf.start_msg('Checking for %r (C++ compiler)'%compiler) 16 20 try: 17 21 conf.load(compiler) … … 27 31 conf.end_msg(False) 28 32 else: 29 conf.fatal('could not configure a c++ compiler!')33 conf.fatal('could not configure a C++ compiler!') 30 34 def options(opt): 35 test_for_compiler=default_compilers() 31 36 opt.load_special_tools('cxx_*.py') 32 global cxx_compiler 33 build_platform=Utils.unversioned_sys_platform() 34 possible_compiler_list=cxx_compiler[build_platform in cxx_compiler and build_platform or'default'] 35 test_for_compiler=' '.join(possible_compiler_list) 36 cxx_compiler_opts=opt.add_option_group('C++ Compiler Options') 37 cxx_compiler_opts.add_option('--check-cxx-compiler',default="%s"%test_for_compiler,help='On this platform (%s) the following C++ Compiler will be checked by default: "%s"'%(build_platform,test_for_compiler),dest="check_cxx_compiler") 37 cxx_compiler_opts=opt.add_option_group('Configuration options') 38 cxx_compiler_opts.add_option('--check-cxx-compiler',default=None,help='list of C++ compilers to try [%s]'%test_for_compiler,dest="check_cxx_compiler") 38 39 for x in test_for_compiler.split(): 39 40 opt.load('%s'%x) -
waflib/Tools/compiler_d.py
r5525507 r904702d 3 3 # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 4 5 import os,sys,imp,types 5 import os,sys,imp,types,re 6 6 from waflib import Utils,Configure,Options,Logs 7 d_compiler={'default':['gdc','dmd','ldc2']} 8 def default_compilers(): 9 build_platform=Utils.unversioned_sys_platform() 10 possible_compiler_list=d_compiler.get(build_platform,d_compiler['default']) 11 return' '.join(possible_compiler_list) 7 12 def configure(conf): 8 for compiler in conf.options.dcheck.split(','): 13 try:test_for_compiler=conf.options.check_d_compiler or default_compilers() 14 except AttributeError:conf.fatal("Add options(opt): opt.load('compiler_d')") 15 for compiler in re.split('[ ,]+',test_for_compiler): 9 16 conf.env.stash() 10 conf.start_msg('Checking for %r ( dcompiler)'%compiler)17 conf.start_msg('Checking for %r (D compiler)'%compiler) 11 18 try: 12 19 conf.load(compiler) … … 22 29 conf.end_msg(False) 23 30 else: 24 conf.fatal(' no suitable d compiler was found')31 conf.fatal('could not configure a D compiler!') 25 32 def options(opt): 26 d_compiler_opts=opt.add_option_group('D Compiler Options') 27 d_compiler_opts.add_option('--check-d-compiler',default='gdc,dmd,ldc2',action='store',help='check for the compiler [Default:gdc,dmd,ldc2]',dest='dcheck') 28 for d_compiler in['gdc','dmd','ldc2']: 29 opt.load('%s'%d_compiler) 33 test_for_compiler=default_compilers() 34 d_compiler_opts=opt.add_option_group('Configuration options') 35 d_compiler_opts.add_option('--check-d-compiler',default=None,help='list of D compilers to try [%s]'%test_for_compiler,dest='check_d_compiler') 36 for x in test_for_compiler.split(): 37 opt.load('%s'%x) -
waflib/Tools/compiler_fc.py
r5525507 r904702d 3 3 # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 4 5 import os,sys,imp,types 5 import os,sys,imp,types,re 6 6 from waflib import Utils,Configure,Options,Logs,Errors 7 7 from waflib.Tools import fc 8 8 fc_compiler={'win32':['gfortran','ifort'],'darwin':['gfortran','g95','ifort'],'linux':['gfortran','g95','ifort'],'java':['gfortran','g95','ifort'],'default':['gfortran'],'aix':['gfortran']} 9 def __list_possible_compiler(platform): 10 try: 11 return fc_compiler[platform] 12 except KeyError: 13 return fc_compiler["default"] 9 def default_compilers(): 10 build_platform=Utils.unversioned_sys_platform() 11 possible_compiler_list=fc_compiler.get(build_platform,fc_compiler['default']) 12 return' '.join(possible_compiler_list) 14 13 def configure(conf): 15 try:test_for_compiler=conf.options.check_f c14 try:test_for_compiler=conf.options.check_fortran_compiler or default_compilers() 16 15 except AttributeError:conf.fatal("Add options(opt): opt.load('compiler_fc')") 17 for compiler in test_for_compiler.split():16 for compiler in re.split('[ ,]+',test_for_compiler): 18 17 conf.env.stash() 19 conf.start_msg('Checking for %r ( fortran compiler)'%compiler)18 conf.start_msg('Checking for %r (Fortran compiler)'%compiler) 20 19 try: 21 20 conf.load(compiler) … … 31 30 conf.end_msg(False) 32 31 else: 33 conf.fatal('could not configure a fortran compiler!')32 conf.fatal('could not configure a Fortran compiler!') 34 33 def options(opt): 34 test_for_compiler=default_compilers() 35 35 opt.load_special_tools('fc_*.py') 36 build_platform=Utils.unversioned_sys_platform() 37 detected_platform=Options.platform 38 possible_compiler_list=__list_possible_compiler(detected_platform) 39 test_for_compiler=' '.join(possible_compiler_list) 40 fortran_compiler_opts=opt.add_option_group("Fortran Compiler Options") 41 fortran_compiler_opts.add_option('--check-fortran-compiler',default="%s"%test_for_compiler,help='On this platform (%s) the following Fortran Compiler will be checked by default: "%s"'%(detected_platform,test_for_compiler),dest="check_fc") 42 for compiler in test_for_compiler.split(): 43 opt.load('%s'%compiler) 36 fortran_compiler_opts=opt.add_option_group('Configuration options') 37 fortran_compiler_opts.add_option('--check-fortran-compiler',default=None,help='list of Fortran compiler to try [%s]'%test_for_compiler,dest="check_fortran_compiler") 38 for x in test_for_compiler.split(): 39 opt.load('%s'%x) -
waflib/Tools/cxx.py
r5525507 r904702d 12 12 TaskGen.task_gen.mappings['.c']=TaskGen.task_gen.mappings['.cpp'] 13 13 class cxx(Task.Task): 14 run_str='${CXX} ${ARCH_ST:ARCH} ${CXXFLAGS} ${CPPFLAGS} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${CXX_SRC_F}${SRC} ${CXX_TGT_F}${TGT }'14 run_str='${CXX} ${ARCH_ST:ARCH} ${CXXFLAGS} ${CPPFLAGS} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${CXX_SRC_F}${SRC} ${CXX_TGT_F}${TGT[0].abspath()}' 15 15 vars=['CXXDEPS'] 16 16 ext_in=['.h'] -
waflib/Tools/dmd.py
r5525507 r904702d 9 9 def find_dmd(conf): 10 10 conf.find_program(['dmd','dmd2','ldc'],var='D') 11 out=conf.cmd_and_log( [conf.env.D,'--help'])11 out=conf.cmd_and_log(conf.env.D+['--help']) 12 12 if out.find("D Compiler v")==-1: 13 out=conf.cmd_and_log( [conf.env.D,'-version'])13 out=conf.cmd_and_log(conf.env.D+['-version']) 14 14 if out.find("based on DMD v1.")==-1: 15 15 conf.fatal("detected compiler is not dmd/ldc") … … 41 41 conf.find_dmd() 42 42 if sys.platform=='win32': 43 out=conf.cmd_and_log( [conf.env.D,'--help'])43 out=conf.cmd_and_log(conf.env.D+['--help']) 44 44 if out.find("D Compiler v2.")>-1: 45 45 conf.fatal('dmd2 on Windows is not supported, use gdc or ldc2 instead') -
waflib/Tools/fc.py
r5525507 r904702d 90 90 inst_to='${LIBDIR}' 91 91 class fcprogram_test(fcprogram): 92 def can_retrieve_cache(self):93 return False94 92 def runnable_status(self): 95 93 ret=super(fcprogram_test,self).runnable_status() -
waflib/Tools/fc_config.py
r5525507 r904702d 3 3 # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 4 5 import re, shutil,os,sys,string,shlex5 import re,os,sys,shlex 6 6 from waflib.Configure import conf 7 from waflib.TaskGen import feature, after_method,before_method8 from waflib import Build,Utils7 from waflib.TaskGen import feature,before_method 8 from waflib import Utils 9 9 FC_FRAGMENT=' program main\n end program main\n' 10 10 FC_FRAGMENT2=' PROGRAM MAIN\n END\n' … … 116 116 def check_fortran_verbose_flag(self,*k,**kw): 117 117 self.start_msg('fortran link verbose flag') 118 for x in ['-v','--verbose','-verbose','-V']:118 for x in('-v','--verbose','-verbose','-V'): 119 119 try: 120 120 self.check_cc(features='fc fcprogram_test',fragment=FC_FRAGMENT2,compile_filename='test.f',linkflags=[x],mandatory=True) … … 149 149 SPACE_OPTS=re.compile('^-[LRuYz]$') 150 150 NOSPACE_OPTS=re.compile('^-[RL]') 151 def _parse_flink_token(lexer,token,tmp_flags): 152 if _match_ignore(token): 153 pass 154 elif token.startswith('-lkernel32')and sys.platform=='cygwin': 155 tmp_flags.append(token) 156 elif SPACE_OPTS.match(token): 157 t=lexer.get_token() 158 if t.startswith('P,'): 159 t=t[2:] 160 for opt in t.split(os.pathsep): 161 tmp_flags.append('-L%s'%opt) 162 elif NOSPACE_OPTS.match(token): 163 tmp_flags.append(token) 164 elif POSIX_LIB_FLAGS.match(token): 165 tmp_flags.append(token) 166 else: 167 pass 168 t=lexer.get_token() 169 return t 151 170 def _parse_flink_line(line,final_flags): 152 171 lexer=shlex.shlex(line,posix=True) … … 155 174 tmp_flags=[] 156 175 while t: 157 def parse(token): 158 if _match_ignore(token): 159 pass 160 elif token.startswith('-lkernel32')and sys.platform=='cygwin': 161 tmp_flags.append(token) 162 elif SPACE_OPTS.match(token): 163 t=lexer.get_token() 164 if t.startswith('P,'): 165 t=t[2:] 166 for opt in t.split(os.pathsep): 167 tmp_flags.append('-L%s'%opt) 168 elif NOSPACE_OPTS.match(token): 169 tmp_flags.append(token) 170 elif POSIX_LIB_FLAGS.match(token): 171 tmp_flags.append(token) 172 else: 173 pass 174 t=lexer.get_token() 175 return t 176 t=parse(t) 176 t=_parse_flink_token(lexer,t,tmp_flags) 177 177 final_flags.extend(tmp_flags) 178 178 return final_flags … … 241 241 bld(features='c fcprogram',source='main.c',target='app',use='test') 242 242 def mangling_schemes(): 243 for u in ['_','']:244 for du in ['','_']:245 for c in ["lower","upper"]:243 for u in('_',''): 244 for du in('','_'): 245 for c in("lower","upper"): 246 246 yield(u,du,c) 247 247 def mangle_name(u,du,c,name): … … 275 275 @conf 276 276 def detect_openmp(self): 277 for x in ['-fopenmp','-openmp','-mp','-xopenmp','-omp','-qsmp=omp']:277 for x in('-fopenmp','-openmp','-mp','-xopenmp','-omp','-qsmp=omp'): 278 278 try: 279 279 self.check_fc(msg='Checking for OpenMP flag %s'%x,fragment='program main\n call omp_get_num_threads()\nend program main',fcflags=x,linkflags=x,uselib_store='OPENMP') -
waflib/Tools/flex.py
r5525507 r904702d 29 29 conf.find_program('flex',var='FLEX') 30 30 conf.env.FLEXFLAGS=['-t'] 31 if re.search(r"\\msys\\[0-9.]+\\bin\\flex.exe$",conf.env.FLEX ):31 if re.search(r"\\msys\\[0-9.]+\\bin\\flex.exe$",conf.env.FLEX[0]): 32 32 conf.env.FLEX_MSYS=True -
waflib/Tools/g95.py
r5525507 r904702d 10 10 def find_g95(conf): 11 11 fc=conf.find_program('g95',var='FC') 12 fc=conf.cmd_to_list(fc)13 12 conf.get_g95_version(fc) 14 13 conf.env.FC_NAME='G95' -
waflib/Tools/gcc.py
r5525507 r904702d 3 3 # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 4 5 import os,sys 6 from waflib import Configure,Options,Utils 5 7 from waflib.Tools import ccroot,ar 6 8 from waflib.Configure import conf … … 8 10 def find_gcc(conf): 9 11 cc=conf.find_program(['gcc','cc'],var='CC') 10 cc=conf.cmd_to_list(cc)11 12 conf.get_cc_version(cc,gcc=True) 12 13 conf.env.CC_NAME='gcc' 13 conf.env.CC=cc14 14 @conf 15 15 def gcc_common_flags(conf): -
waflib/Tools/gdc.py
r5525507 r904702d 9 9 def find_gdc(conf): 10 10 conf.find_program('gdc',var='D') 11 out=conf.cmd_and_log( [conf.env.D,'--version'])12 if out.find("gdc 11 out=conf.cmd_and_log(conf.env.D+['--version']) 12 if out.find("gdc")==-1: 13 13 conf.fatal("detected compiler is not gdc") 14 14 @conf -
waflib/Tools/gfortran.py
r5525507 r904702d 10 10 def find_gfortran(conf): 11 11 fc=conf.find_program(['gfortran','g77'],var='FC') 12 fc=conf.cmd_to_list(fc)13 12 conf.get_gfortran_version(fc) 14 13 conf.env.FC_NAME='GFORTRAN' -
waflib/Tools/glib2.py
r5525507 r904702d 4 4 5 5 import os 6 from waflib import Task,Utils,Options,Errors,Logs 7 from waflib.TaskGen import taskgen_method,before_method,after_method,feature 6 from waflib import Context,Task,Utils,Options,Errors,Logs 7 from waflib.TaskGen import taskgen_method,before_method,after_method,feature,extension 8 from waflib.Configure import conf 8 9 @taskgen_method 9 10 def add_marshal_file(self,filename,prefix): … … 99 100 filename_list=[filename_list] 100 101 self.settings_enum_files=filename_list 101 def r_change_ext(self,ext):102 name=self.name103 k=name.rfind('.')104 if k>=0:105 name=name[:k]+ext106 else:107 name=name+ext108 return self.parent.find_or_declare([name])109 102 @feature('glib2') 110 103 def process_settings(self): … … 137 130 schema_task.set_inputs(source_list) 138 131 schema_task.env['GLIB_COMPILE_SCHEMAS_OPTIONS']=[("--schema-file="+k.abspath())for k in source_list] 139 target_node= r_change_ext(schema_node,'.xml.valid')132 target_node=schema_node.change_ext('.xml.valid') 140 133 schema_task.set_outputs(target_node) 141 134 schema_task.env['GLIB_VALIDATE_SCHEMA_OUTPUT']=target_node.abspath() … … 156 149 run_str='rm -f ${GLIB_VALIDATE_SCHEMA_OUTPUT} && ${GLIB_COMPILE_SCHEMAS} --dry-run ${GLIB_COMPILE_SCHEMAS_OPTIONS} && touch ${GLIB_VALIDATE_SCHEMA_OUTPUT}' 157 150 color='PINK' 158 def configure(conf): 151 @extension('.gresource.xml') 152 def process_gresource_source(self,node): 153 if not self.env['GLIB_COMPILE_RESOURCES']: 154 raise Errors.WafError("Unable to process GResource file - glib-compile-resources was not found during configure") 155 if'gresource'in self.features: 156 return 157 h_node=node.change_ext('_xml.h') 158 c_node=node.change_ext('_xml.c') 159 self.create_task('glib_gresource_source',node,[h_node,c_node]) 160 self.source.append(c_node) 161 @feature('gresource') 162 def process_gresource_bundle(self): 163 for i in self.to_list(self.source): 164 node=self.path.find_resource(i) 165 task=self.create_task('glib_gresource_bundle',node,node.change_ext('')) 166 inst_to=getattr(self,'install_path',None) 167 if inst_to: 168 self.bld.install_files(inst_to,task.outputs) 169 class glib_gresource_base(Task.Task): 170 color='BLUE' 171 base_cmd='${GLIB_COMPILE_RESOURCES} --sourcedir=${SRC[0].parent.srcpath()} --sourcedir=${SRC[0].bld_dir()}' 172 def scan(self): 173 bld=self.generator.bld 174 kw={} 175 try: 176 if not kw.get('cwd',None): 177 kw['cwd']=bld.cwd 178 except AttributeError: 179 bld.cwd=kw['cwd']=bld.variant_dir 180 kw['quiet']=Context.BOTH 181 cmd=Utils.subst_vars('${GLIB_COMPILE_RESOURCES} --sourcedir=%s --sourcedir=%s --generate-dependencies %s'%(self.inputs[0].parent.srcpath(),self.inputs[0].bld_dir(),self.inputs[0].bldpath()),self.env) 182 output=bld.cmd_and_log(cmd,**kw) 183 nodes=[] 184 names=[] 185 for dep in output.splitlines(): 186 if dep: 187 node=bld.bldnode.find_node(dep) 188 if node: 189 nodes.append(node) 190 else: 191 names.append(dep) 192 return(nodes,names) 193 class glib_gresource_source(glib_gresource_base): 194 vars=['GLIB_COMPILE_RESOURCES'] 195 fun_h=Task.compile_fun_shell(glib_gresource_base.base_cmd+' --target=${TGT[0].abspath()} --generate-header ${SRC}') 196 fun_c=Task.compile_fun_shell(glib_gresource_base.base_cmd+' --target=${TGT[1].abspath()} --generate-source ${SRC}') 197 ext_out=['.h'] 198 def run(self): 199 return self.fun_h[0](self)or self.fun_c[0](self) 200 class glib_gresource_bundle(glib_gresource_base): 201 run_str=glib_gresource_base.base_cmd+' --target=${TGT} ${SRC}' 202 shell=True 203 @conf 204 def find_glib_genmarshal(conf): 159 205 conf.find_program('glib-genmarshal',var='GLIB_GENMARSHAL') 160 conf.find_perl_program('glib-mkenums',var='GLIB_MKENUMS') 161 conf.find_program('glib-compile-schemas',var='GLIB_COMPILE_SCHEMAS',mandatory=False) 206 @conf 207 def find_glib_mkenums(conf): 208 if not conf.env.PERL: 209 conf.find_program('perl',var='PERL') 210 conf.find_program('glib-mkenums',interpreter='PERL',var='GLIB_MKENUMS') 211 @conf 212 def find_glib_compile_schemas(conf): 213 conf.find_program('glib-compile-schemas',var='GLIB_COMPILE_SCHEMAS') 162 214 def getstr(varname): 163 215 return getattr(Options.options,varname,getattr(conf.env,varname,'')) … … 170 222 gsettingsschemadir=os.path.join(datadir,'glib-2.0','schemas') 171 223 conf.env['GSETTINGSSCHEMADIR']=gsettingsschemadir 224 @conf 225 def find_glib_compile_resources(conf): 226 conf.find_program('glib-compile-resources',var='GLIB_COMPILE_RESOURCES') 227 def configure(conf): 228 conf.find_glib_genmarshal() 229 conf.find_glib_mkenums() 230 conf.find_glib_compile_schemas(mandatory=False) 231 conf.find_glib_compile_resources(mandatory=False) 172 232 def options(opt): 173 opt.add_option('--gsettingsschemadir',help='GSettings schema location [Default: ${datadir}/glib-2.0/schemas]',default='',dest='GSETTINGSSCHEMADIR') 233 gr=opt.add_option_group('Installation directories') 234 gr.add_option('--gsettingsschemadir',help='GSettings schema location [DATADIR/glib-2.0/schemas]',default='',dest='GSETTINGSSCHEMADIR') -
waflib/Tools/gnu_dirs.py
r5525507 r904702d 3 3 # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 4 5 import os 5 import os,re 6 6 from waflib import Utils,Options,Context 7 _options=[x.split(', ')for x in'''8 bindir, user executables, ${EXEC_PREFIX}/bin9 sbindir, system admin executables, ${EXEC_PREFIX}/sbin10 libexecdir, program executables, ${EXEC_PREFIX}/libexec11 sysconfdir, read-only single-machine data, ${PREFIX}/etc12 sharedstatedir, modifiable architecture-independentdata, ${PREFIX}/com13 localstatedir, modifiable single-machine data, ${PREFIX}/var14 libdir, object code libraries, ${EXEC_PREFIX}/lib 15 includedir, Cheader files, ${PREFIX}/include16 oldincludedir, C header files for non-gcc, /usr/include17 datarootdir, read-only arch.-independent data root, ${PREFIX}/share18 datadir, read-onlyarchitecture-independent data, ${DATAROOTDIR}19 infodir, infodocumentation, ${DATAROOTDIR}/info7 gnuopts=''' 8 bindir, user commands, ${EXEC_PREFIX}/bin 9 sbindir, system binaries, ${EXEC_PREFIX}/sbin 10 libexecdir, program-specific binaries, ${EXEC_PREFIX}/libexec 11 sysconfdir, host-specific configuration, ${PREFIX}/etc 12 sharedstatedir, architecture-independent variable data, ${PREFIX}/com 13 localstatedir, variable data, ${PREFIX}/var 14 libdir, object code libraries, ${EXEC_PREFIX}/lib%s 15 includedir, header files, ${PREFIX}/include 16 oldincludedir, header files for non-GCC compilers, /usr/include 17 datarootdir, architecture-independent data root, ${PREFIX}/share 18 datadir, architecture-independent data, ${DATAROOTDIR} 19 infodir, GNU "info" documentation, ${DATAROOTDIR}/info 20 20 localedir, locale-dependent data, ${DATAROOTDIR}/locale 21 mandir, man documentation, ${DATAROOTDIR}/man21 mandir, manual pages, ${DATAROOTDIR}/man 22 22 docdir, documentation root, ${DATAROOTDIR}/doc/${PACKAGE} 23 htmldir, html documentation, ${DOCDIR} 24 dvidir, dvi documentation, ${DOCDIR} 25 pdfdir, pdf documentation, ${DOCDIR} 26 psdir, ps documentation, ${DOCDIR} 27 '''.split('\n')if x] 23 htmldir, HTML documentation, ${DOCDIR} 24 dvidir, DVI documentation, ${DOCDIR} 25 pdfdir, PDF documentation, ${DOCDIR} 26 psdir, PostScript documentation, ${DOCDIR} 27 '''%Utils.lib64() 28 _options=[x.split(', ')for x in gnuopts.splitlines()if x] 28 29 def configure(conf): 29 30 def get_param(varname,default): … … 46 47 complete=False 47 48 if not complete: 48 lst=[ name for name,_,_ in _options if not env[name.upper()]]49 lst=[x for x,_,_ in _options if not env[x.upper()]] 49 50 raise conf.errors.WafError('Variable substitution failure %r'%lst) 50 51 def options(opt): 51 inst_dir=opt.add_option_group('Installation directories','By default, "waf install" will put the files in\52 inst_dir=opt.add_option_group('Installation prefix','By default, "waf install" will put the files in\ 52 53 "/usr/local/bin", "/usr/local/lib" etc. An installation prefix other\ 53 54 than "/usr/local" can be given using "--prefix", for example "--prefix=$HOME"') … … 57 58 opt.parser.remove_option(k) 58 59 inst_dir.add_option(option) 59 inst_dir.add_option('--exec-prefix',help='installation prefix [Default: ${PREFIX}]',default='',dest='EXEC_PREFIX')60 dirs_options=opt.add_option_group(' Pre-defined installation directories','')60 inst_dir.add_option('--exec-prefix',help='installation prefix for binaries [PREFIX]',default='',dest='EXEC_PREFIX') 61 dirs_options=opt.add_option_group('Installation directories') 61 62 for name,help,default in _options: 62 63 option_name='--'+name 63 64 str_default=default 64 str_help='%s [ Default: %s]'%(help,str_default)65 str_help='%s [%s]'%(help,re.sub(r'\$\{([^}]+)\}',r'\1',str_default)) 65 66 dirs_options.add_option(option_name,help=str_help,default='',dest=name.upper()) -
waflib/Tools/gxx.py
r5525507 r904702d 3 3 # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 4 5 import os,sys 6 from waflib import Configure,Options,Utils 5 7 from waflib.Tools import ccroot,ar 6 8 from waflib.Configure import conf … … 8 10 def find_gxx(conf): 9 11 cxx=conf.find_program(['g++','c++'],var='CXX') 10 cxx=conf.cmd_to_list(cxx)11 12 conf.get_cc_version(cxx,gcc=True) 12 13 conf.env.CXX_NAME='gcc' 13 conf.env.CXX=cxx14 14 @conf 15 15 def gxx_common_flags(conf): -
waflib/Tools/icc.py
r5525507 r904702d 10 10 if sys.platform=='cygwin': 11 11 conf.fatal('The Intel compiler does not work on Cygwin') 12 v=conf.env 13 cc=None 14 if v['CC']:cc=v['CC'] 15 elif'CC'in conf.environ:cc=conf.environ['CC'] 16 if not cc:cc=conf.find_program('icc',var='CC') 17 if not cc:cc=conf.find_program('ICL',var='CC') 18 if not cc:conf.fatal('Intel C Compiler (icc) was not found') 19 cc=conf.cmd_to_list(cc) 12 cc=conf.find_program(['icc','ICL'],var='CC') 20 13 conf.get_cc_version(cc,icc=True) 21 v['CC']=cc 22 v['CC_NAME']='icc' 14 conf.env.CC_NAME='icc' 23 15 def configure(conf): 24 16 conf.find_icc() -
waflib/Tools/icpc.py
r5525507 r904702d 10 10 if sys.platform=='cygwin': 11 11 conf.fatal('The Intel compiler does not work on Cygwin') 12 v=conf.env 13 cxx=None 14 if v['CXX']:cxx=v['CXX'] 15 elif'CXX'in conf.environ:cxx=conf.environ['CXX'] 16 if not cxx:cxx=conf.find_program('icpc',var='CXX') 17 if not cxx:conf.fatal('Intel C++ Compiler (icpc) was not found') 18 cxx=conf.cmd_to_list(cxx) 12 cxx=conf.find_program('icpc',var='CXX') 19 13 conf.get_cc_version(cxx,icc=True) 20 v['CXX']=cxx 21 v['CXX_NAME']='icc' 14 conf.env.CXX_NAME='icc' 22 15 def configure(conf): 23 16 conf.find_icpc() -
waflib/Tools/ifort.py
r5525507 r904702d 10 10 def find_ifort(conf): 11 11 fc=conf.find_program('ifort',var='FC') 12 fc=conf.cmd_to_list(fc)13 12 conf.get_ifort_version(fc) 14 13 conf.env.FC_NAME='IFORT' … … 30 29 @conf 31 30 def get_ifort_version(conf,fc): 32 version_re=re.compile(r"ifort\s*\(IFORT\)\s*(?P<major>\d*)\.(?P<minor>\d*)",re.I).search 33 cmd=fc+['--version'] 31 version_re=re.compile(r"Intel[\sa-zA-Z()0-9,-]*Version\s*(?P<major>\d*)\.(?P<minor>\d*)",re.I).search 32 if Utils.is_win32: 33 cmd=fc 34 else: 35 cmd=fc+['-logo'] 34 36 out,err=fc_config.getoutput(conf,cmd,stdin=False) 35 37 if out: -
waflib/Tools/intltool.py
r5525507 r904702d 4 4 5 5 import os,re 6 from waflib import Configure, TaskGen,Task,Utils,Runner,Options,Build,Logs6 from waflib import Configure,Context,TaskGen,Task,Utils,Runner,Options,Build,Logs 7 7 import waflib.Tools.ccroot 8 from waflib.TaskGen import feature,before_method 8 from waflib.TaskGen import feature,before_method,taskgen_method 9 9 from waflib.Logs import error 10 from waflib.Configure import conf 11 _style_flags={'ba':'-b','desktop':'-d','keys':'-k','quoted':'--quoted-style','quotedxml':'--quotedxml-style','rfc822deb':'-r','schemas':'-s','xml':'-x',} 12 @taskgen_method 13 def ensure_localedir(self): 14 if not self.env.LOCALEDIR: 15 if self.env.DATAROOTDIR: 16 self.env.LOCALEDIR=os.path.join(self.env.DATAROOTDIR,'locale') 17 else: 18 self.env.LOCALEDIR=os.path.join(self.env.PREFIX,'share','locale') 10 19 @before_method('process_source') 11 20 @feature('intltool_in') … … 13 22 try:self.meths.remove('process_source') 14 23 except ValueError:pass 15 if not self.env.LOCALEDIR: 16 self.env.LOCALEDIR=self.env.PREFIX+'/share/locale' 24 self.ensure_localedir() 25 podir=getattr(self,'podir','.') 26 podirnode=self.path.find_dir(podir) 27 if not podirnode: 28 error("could not find the podir %r"%podir) 29 return 30 cache=getattr(self,'intlcache','.intlcache') 31 self.env.INTLCACHE=[os.path.join(str(self.path.get_bld()),podir,cache)] 32 self.env.INTLPODIR=podirnode.bldpath() 33 self.env.append_value('INTLFLAGS',getattr(self,'flags',self.env.INTLFLAGS_DEFAULT)) 34 if'-c'in self.env.INTLFLAGS: 35 self.bld.fatal('Redundant -c flag in intltool task %r'%self) 36 style=getattr(self,'style',None) 37 if style: 38 try: 39 style_flag=_style_flags[style] 40 except KeyError: 41 self.bld.fatal('intltool_in style "%s" is not valid'%style) 42 self.env.append_unique('INTLFLAGS',[style_flag]) 17 43 for i in self.to_list(self.source): 18 44 node=self.path.find_resource(i) 19 podir=getattr(self,'podir','po')20 podirnode=self.path.find_dir(podir)21 if not podirnode:22 error("could not find the podir %r"%podir)23 continue24 cache=getattr(self,'intlcache','.intlcache')25 self.env['INTLCACHE']=os.path.join(self.path.bldpath(),podir,cache)26 self.env['INTLPODIR']=podirnode.bldpath()27 self.env['INTLFLAGS']=getattr(self,'flags',['-q','-u','-c'])28 45 task=self.create_task('intltool',node,node.change_ext('')) 29 inst=getattr(self,'install_path', '${LOCALEDIR}')46 inst=getattr(self,'install_path',None) 30 47 if inst: 31 48 self.bld.install_files(inst,task.outputs) … … 34 51 try:self.meths.remove('process_source') 35 52 except ValueError:pass 36 if not self.env.LOCALEDIR: 37 self.env.LOCALEDIR=self.env.PREFIX+'/share/locale' 38 appname=getattr(self,'appname','set_your_app_name') 39 podir=getattr(self,'podir','') 53 self.ensure_localedir() 54 appname=getattr(self,'appname',getattr(Context.g_module,Context.APPNAME,'set_your_app_name')) 55 podir=getattr(self,'podir','.') 40 56 inst=getattr(self,'install_path','${LOCALEDIR}') 41 57 linguas=self.path.find_node(os.path.join(podir,'LINGUAS')) … … 63 79 color='BLUE' 64 80 class intltool(Task.Task): 65 run_str='${INTLTOOL} ${INTLFLAGS} ${INTLCACHE } ${INTLPODIR} ${SRC} ${TGT}'81 run_str='${INTLTOOL} ${INTLFLAGS} ${INTLCACHE_ST:INTLCACHE} ${INTLPODIR} ${SRC} ${TGT}' 66 82 color='BLUE' 83 @conf 84 def find_msgfmt(conf): 85 conf.find_program('msgfmt',var='MSGFMT') 86 @conf 87 def find_intltool_merge(conf): 88 if not conf.env.PERL: 89 conf.find_program('perl',var='PERL') 90 conf.env.INTLCACHE_ST='--cache=%s' 91 conf.env.INTLFLAGS_DEFAULT=['-q','-u'] 92 conf.find_program('intltool-merge',interpreter='PERL',var='INTLTOOL') 67 93 def configure(conf): 68 conf.find_program('msgfmt',var='MSGFMT') 69 conf.find_perl_program('intltool-merge',var='INTLTOOL') 70 prefix=conf.env.PREFIX 71 datadir=conf.env.DATADIR 72 if not datadir: 73 datadir=os.path.join(prefix,'share') 74 conf.define('LOCALEDIR',os.path.join(datadir,'locale').replace('\\','\\\\')) 75 conf.define('DATADIR',datadir.replace('\\','\\\\')) 94 conf.find_msgfmt() 95 conf.find_intltool_merge() 76 96 if conf.env.CC or conf.env.CXX: 77 97 conf.check(header_name='locale.h') -
waflib/Tools/irixcc.py
r5525507 r904702d 15 15 if not cc:cc=conf.find_program('cc',var='CC') 16 16 if not cc:conf.fatal('irixcc was not found') 17 cc=conf.cmd_to_list(cc)18 17 try: 19 18 conf.cmd_and_log(cc+['-version']) -
waflib/Tools/javaw.py
r5525507 r904702d 158 158 class javac(Task.Task): 159 159 color='BLUE' 160 nocache=True161 160 vars=['CLASSPATH','JAVACFLAGS','JAVAC','OUTDIR'] 162 161 def runnable_status(self): … … 254 253 for x in'javac java jar javadoc'.split(): 255 254 self.find_program(x,var=x.upper(),path_list=java_path) 256 self.env[x.upper()]=self.cmd_to_list(self.env[x.upper()])257 255 if'CLASSPATH'in self.environ: 258 256 v['CLASSPATH']=self.environ['CLASSPATH'] -
waflib/Tools/kde4.py
r5525507 r904702d 20 20 def configure(self): 21 21 kdeconfig=self.find_program('kde4-config') 22 prefix=self.cmd_and_log( '%s --prefix'%kdeconfig).strip()22 prefix=self.cmd_and_log(kdeconfig+['--prefix']).strip() 23 23 fname='%s/share/apps/cmake/modules/KDELibsDependencies.cmake'%prefix 24 24 try:os.stat(fname) … … 29 29 try: 30 30 txt=Utils.readf(fname) 31 except (OSError,IOError):31 except EnvironmentError: 32 32 self.fatal('could not read %s'%fname) 33 33 txt=txt.replace('\\\n','\n') -
waflib/Tools/ldc2.py
r5525507 r904702d 9 9 def find_ldc2(conf): 10 10 conf.find_program(['ldc2'],var='D') 11 out=conf.cmd_and_log( [conf.env.D,'-version'])11 out=conf.cmd_and_log(conf.env.D+['-version']) 12 12 if out.find("based on DMD v2.")==-1: 13 13 conf.fatal("detected compiler is not ldc2") -
waflib/Tools/msvc.py
r5525507 r904702d 60 60 def get_msvc_version(conf,compiler,version,target,vcvars): 61 61 debug('msvc: get_msvc_version: %r %r %r',compiler,version,target) 62 batfile=conf.bldnode.make_node('waf-print-msvc.bat') 62 try: 63 conf.msvc_cnt+=1 64 except AttributeError: 65 conf.msvc_cnt=1 66 batfile=conf.bldnode.make_node('waf-print-msvc-%d.bat'%conf.msvc_cnt) 63 67 batfile.write("""@echo off 64 68 set INCLUDE= … … 69 73 echo LIB=%%LIB%%;%%LIBPATH%% 70 74 """%(vcvars,target)) 71 sout=conf.cmd_and_log(['cmd ','/E:on','/V:on','/C',batfile.abspath()])75 sout=conf.cmd_and_log(['cmd.exe','/E:on','/V:on','/C',batfile.abspath()]) 72 76 lines=sout.splitlines() 73 77 if not lines[0]: … … 88 92 compiler_name,linker_name,lib_name=_get_prog_names(conf,compiler) 89 93 cxx=conf.find_program(compiler_name,path_list=MSVC_PATH) 90 cxx=conf.cmd_to_list(cxx)91 94 if'CL'in env: 92 95 del(env['CL']) … … 176 179 version_pattern=re.compile('^(\d\d?\.\d\d?)(Exp)?$') 177 180 detected_versions=[] 178 for vcver,vcvar in [('VCExpress','Exp'),('VisualStudio','')]:181 for vcver,vcvar in(('VCExpress','Exp'),('VisualStudio','')): 179 182 try: 180 183 prefix='SOFTWARE\\Wow6432node\\Microsoft\\'+vcver … … 373 376 patch_url='http://software.intel.com/en-us/forums/topic/328487' 374 377 compilervars_arch=os.path.join(path,'bin','compilervars_arch.bat') 375 for vscomntool in ['VS110COMNTOOLS','VS100COMNTOOLS']:378 for vscomntool in('VS110COMNTOOLS','VS100COMNTOOLS'): 376 379 if vscomntool in os.environ: 377 380 vs_express_path=os.environ[vscomntool]+r'..\IDE\VSWinExpress.exe' … … 529 532 elif'CXX'in conf.environ:cxx=conf.environ['CXX'] 530 533 cxx=conf.find_program(compiler_name,var='CXX',path_list=path) 531 cxx=conf.cmd_to_list(cxx)532 534 env=dict(conf.environ) 533 535 if path:env.update(PATH=';'.join(path)) … … 619 621 pdbnode=self.link_task.outputs[0].change_ext('.pdb') 620 622 self.link_task.outputs.append(pdbnode) 621 try: 622 self.install_task.source.append(pdbnode) 623 except AttributeError: 624 pass 623 if getattr(self,'install_task',None): 624 self.pdb_install_task=self.bld.install_files(self.install_task.dest,pdbnode,env=self.env) 625 625 break 626 626 @feature('cprogram','cshlib','cxxprogram','cxxshlib') … … 652 652 mode='2' 653 653 debug('msvc: embedding manifest in mode %r'%mode) 654 lst=[] 655 lst.append(env['MT']) 654 lst=[]+mtool 656 655 lst.extend(Utils.to_list(env['MTFLAGS'])) 657 656 lst.extend(['-manifest',manifest]) 658 657 lst.append('-outputresource:%s;%s'%(outfile,mode)) 659 lst=[lst] 660 return self.exec_command(*lst) 658 return self.exec_command(lst) 661 659 def quote_response_command(self,flag): 662 660 if flag.find(' ')>-1: … … 726 724 derived_class.exec_command_msvc=exec_command_msvc 727 725 derived_class.exec_mf=exec_mf 726 if hasattr(cls,'hcode'): 727 derived_class.hcode=cls.hcode 728 728 return derived_class 729 729 for k in'c cxx cprogram cxxprogram cshlib cxxshlib cstlib cxxstlib'.split(): -
waflib/Tools/perl.py
r5525507 r904702d 37 37 return False 38 38 self.env['PERL']=perl 39 version=self.cmd_and_log( [perl,"-e",'printf \"%vd\", $^V'])39 version=self.cmd_and_log(self.env.PERL+["-e",'printf \"%vd\", $^V']) 40 40 if not version: 41 41 res=False … … 49 49 @conf 50 50 def check_perl_module(self,module): 51 cmd= [self.env['PERL'],'-e','use %s'%module]51 cmd=self.env.PERL+['-e','use %s'%module] 52 52 self.start_msg('perl module %s'%module) 53 53 try: … … 64 64 if not perl: 65 65 self.fatal('find perl first') 66 def read_out(cmd): 67 return Utils.to_list(self.cmd_and_log(perl+cmd)) 68 env['LINKFLAGS_PERLEXT']=read_out(" -MConfig -e'print $Config{lddlflags}'") 69 env['INCLUDES_PERLEXT']=read_out(" -MConfig -e'print \"$Config{archlib}/CORE\"'") 70 env['CFLAGS_PERLEXT']=read_out(" -MConfig -e'print \"$Config{ccflags} $Config{cccdlflags}\"'") 71 env['XSUBPP']=read_out(" -MConfig -e'print \"$Config{privlib}/ExtUtils/xsubpp$Config{exe_ext}\"'") 72 env['EXTUTILS_TYPEMAP']=read_out(" -MConfig -e'print \"$Config{privlib}/ExtUtils/typemap\"'") 66 def cmd_perl_config(s): 67 return perl+['-MConfig','-e','print \"%s\"'%s] 68 def cfg_str(cfg): 69 return self.cmd_and_log(cmd_perl_config(cfg)) 70 def cfg_lst(cfg): 71 return Utils.to_list(cfg_str(cfg)) 72 env['LINKFLAGS_PERLEXT']=cfg_lst('$Config{lddlflags}') 73 env['INCLUDES_PERLEXT']=cfg_lst('$Config{archlib}/CORE') 74 env['CFLAGS_PERLEXT']=cfg_lst('$Config{ccflags} $Config{cccdlflags}') 75 env['XSUBPP']=cfg_lst('$Config{privlib}/ExtUtils/xsubpp$Config{exe_ext}') 76 env['EXTUTILS_TYPEMAP']=cfg_lst('$Config{privlib}/ExtUtils/typemap') 73 77 if not getattr(Options.options,'perlarchdir',None): 74 env['ARCHDIR_PERL']= self.cmd_and_log(perl+" -MConfig -e'print $Config{sitearch}'")78 env['ARCHDIR_PERL']=cfg_str('$Config{sitearch}') 75 79 else: 76 80 env['ARCHDIR_PERL']=getattr(Options.options,'perlarchdir') 77 env['perlext_PATTERN']='%s.'+ self.cmd_and_log(perl+" -MConfig -e'print $Config{dlext}'")81 env['perlext_PATTERN']='%s.'+cfg_str('$Config{dlext}') 78 82 def options(opt): 79 83 opt.add_option('--with-perl-binary',type='string',dest='perlbinary',help='Specify alternate perl binary',default=None) -
waflib/Tools/python.py
r5525507 r904702d 4 4 5 5 import os,sys 6 from waflib import Utils,Options,Errors,Logs 6 from waflib import Utils,Options,Errors,Logs,Task,Node 7 7 from waflib.TaskGen import extension,before_method,after_method,feature 8 8 from waflib.Configure import conf … … 27 27 INST=''' 28 28 import sys, py_compile 29 py_compile.compile(sys.argv[1], sys.argv[2], sys.argv[3] )29 py_compile.compile(sys.argv[1], sys.argv[2], sys.argv[3], True) 30 30 ''' 31 31 DISTUTILS_IMP=['from distutils.sysconfig import get_config_var, get_python_lib'] 32 @before_method('process_source') 33 @feature('py') 34 def feature_py(self): 35 self.install_path=getattr(self,'install_path','${PYTHONDIR}') 36 install_from=getattr(self,'install_from',None) 37 if install_from and not isinstance(install_from,Node.Node): 38 install_from=self.path.find_dir(install_from) 39 self.install_from=install_from 40 ver=self.env.PYTHON_VERSION 41 if not ver: 42 self.bld.fatal('Installing python files requires PYTHON_VERSION, try conf.check_python_version') 43 if int(ver.replace('.',''))>31: 44 self.install_32=True 32 45 @extension('.py') 33 46 def process_py(self,node): 34 try: 35 if not self.bld.is_install: 36 return 37 except AttributeError: 38 return 39 try: 40 if not self.install_path: 41 return 42 except AttributeError: 43 self.install_path='${PYTHONDIR}' 44 def inst_py(ctx): 45 install_from=getattr(self,'install_from',None) 46 if install_from: 47 install_from=self.path.find_dir(install_from) 48 install_pyfile(self,node,install_from) 49 self.bld.add_post_fun(inst_py) 50 def install_pyfile(self,node,install_from=None): 51 from_node=install_from or node.parent 52 tsk=self.bld.install_as(self.install_path+'/'+node.path_from(from_node),node,postpone=False) 53 path=tsk.get_install_path() 54 if self.bld.is_install<0: 55 Logs.info("+ removing byte compiled python files") 56 for x in'co': 57 try: 58 os.remove(path+x) 59 except OSError: 60 pass 61 if self.bld.is_install>0: 62 try: 63 st1=os.stat(path) 64 except OSError: 65 Logs.error('The python file is missing, this should not happen') 66 for x in['c','o']: 67 do_inst=self.env['PY'+x.upper()] 68 try: 69 st2=os.stat(path+x) 70 except OSError: 71 pass 72 else: 73 if st1.st_mtime<=st2.st_mtime: 74 do_inst=False 75 if do_inst: 76 lst=(x=='o')and[self.env['PYFLAGS_OPT']]or[] 77 (a,b,c)=(path,path+x,tsk.get_install_path(destdir=False)+x) 78 argv=self.env['PYTHON']+lst+['-c',INST,a,b,c] 79 Logs.info('+ byte compiling %r'%(path+x)) 80 env=self.env.env or None 81 ret=Utils.subprocess.Popen(argv,env=env).wait() 82 if ret: 83 raise Errors.WafError('py%s compilation failed %r'%(x,path)) 84 @feature('py') 85 def feature_py(self): 86 pass 47 assert(node.get_bld_sig()) 48 assert(getattr(self,'install_path')),'add features="py"' 49 if self.install_path: 50 if self.install_from: 51 self.bld.install_files(self.install_path,[node],cwd=self.install_from,relative_trick=True) 52 else: 53 self.bld.install_files(self.install_path,[node],relative_trick=True) 54 lst=[] 55 if self.env.PYC: 56 lst.append('pyc') 57 if self.env.PYO: 58 lst.append('pyo') 59 if self.install_path: 60 if self.install_from: 61 pyd=Utils.subst_vars("%s/%s"%(self.install_path,node.path_from(self.install_from)),self.env) 62 else: 63 pyd=Utils.subst_vars("%s/%s"%(self.install_path,node.path_from(self.path)),self.env) 64 else: 65 pyd=node.abspath() 66 for ext in lst: 67 if self.env.PYTAG: 68 name=node.name[:-3] 69 pyobj=node.parent.get_bld().make_node('__pycache__').make_node("%s.%s.%s"%(name,self.env.PYTAG,ext)) 70 pyobj.parent.mkdir() 71 else: 72 pyobj=node.change_ext(".%s"%ext) 73 tsk=self.create_task(ext,node,pyobj) 74 tsk.pyd=pyd 75 if self.install_path: 76 self.bld.install_files(os.path.dirname(pyd),pyobj,cwd=node.parent.get_bld(),relative_trick=True) 77 class pyc(Task.Task): 78 color='PINK' 79 def run(self): 80 cmd=[Utils.subst_vars('${PYTHON}',self.env),'-c',INST,self.inputs[0].abspath(),self.outputs[0].abspath(),self.pyd] 81 ret=self.generator.bld.exec_command(cmd) 82 return ret 83 class pyo(Task.Task): 84 color='PINK' 85 def run(self): 86 cmd=[Utils.subst_vars('${PYTHON}',self.env),Utils.subst_vars('${PYFLAGS_OPT}',self.env),'-c',INST,self.inputs[0].abspath(),self.outputs[0].abspath(),self.pyd] 87 ret=self.generator.bld.exec_command(cmd) 88 return ret 87 89 @feature('pyext') 88 90 @before_method('propagate_uselib_vars','apply_link') … … 132 134 self.to_log(out) 133 135 return_values=[] 134 for s in out.split ('\n'):136 for s in out.splitlines(): 135 137 s=s.strip() 136 138 if not s: … … 145 147 return return_values 146 148 @conf 147 def check_python_headers(conf): 149 def python_cross_compile(self,features='pyembed pyext'): 150 features=Utils.to_list(features) 151 if not('PYTHON_LDFLAGS'in self.environ or'PYTHON_PYEXT_LDFLAGS'in self.environ or'PYTHON_PYEMBED_LDFLAGS'in self.environ): 152 return False 153 for x in'PYTHON_VERSION PYTAG pyext_PATTERN'.split(): 154 if not x in self.environ: 155 self.fatal('Please set %s in the os environment'%x) 156 else: 157 self.env[x]=self.environ[x] 158 xx=self.env.CXX_NAME and'cxx'or'c' 159 if'pyext'in features: 160 flags=self.environ.get('PYTHON_PYEXT_LDFLAGS',self.environ.get('PYTHON_LDFLAGS',None)) 161 if flags is None: 162 self.fatal('No flags provided through PYTHON_PYEXT_LDFLAGS as required') 163 else: 164 self.parse_flags(flags,'PYEXT') 165 self.check(header_name='Python.h',define_name='HAVE_PYEXT',msg='Testing pyext configuration',features='%s %sshlib pyext'%(xx,xx),fragment=FRAG,errmsg='Could not build python extensions') 166 if'pyembed'in features: 167 flags=self.environ.get('PYTHON_PYEMBED_LDFLAGS',self.environ.get('PYTHON_LDFLAGS',None)) 168 if flags is None: 169 self.fatal('No flags provided through PYTHON_PYEMBED_LDFLAGS as required') 170 else: 171 self.parse_flags(flags,'PYEMBED') 172 self.check(header_name='Python.h',define_name='HAVE_PYEMBED',msg='Testing pyembed configuration',fragment=FRAG,errmsg='Could not build a python embedded interpreter',features='%s %sprogram pyembed'%(xx,xx)) 173 return True 174 @conf 175 def check_python_headers(conf,features='pyembed pyext'): 176 features=Utils.to_list(features) 177 assert('pyembed'in features)or('pyext'in features),"check_python_headers features must include 'pyembed' and/or 'pyext'" 148 178 env=conf.env 149 179 if not env['CC_NAME']and not env['CXX_NAME']: 150 180 conf.fatal('load a compiler first (gcc, g++, ..)') 181 if conf.python_cross_compile(features): 182 return 151 183 if not env['PYTHON_VERSION']: 152 184 conf.check_python_version() 153 pybin= conf.env.PYTHON185 pybin=env.PYTHON 154 186 if not pybin: 155 187 conf.fatal('Could not find the python executable') 156 v='prefix SO LDFLAGS LIBDIR LIBPL INCLUDEPY Py_ENABLE_SHARED MACOSX_DEPLOYMENT_TARGET LDSHARED CFLAGS '.split()188 v='prefix SO LDFLAGS LIBDIR LIBPL INCLUDEPY Py_ENABLE_SHARED MACOSX_DEPLOYMENT_TARGET LDSHARED CFLAGS LDVERSION'.split() 157 189 try: 158 190 lst=conf.get_python_variables(["get_config_var('%s') or ''"%x for x in v]) … … 160 192 conf.fatal("Python development headers not found (-v for details).") 161 193 vals=['%s = %r'%(x,y)for(x,y)in zip(v,lst)] 162 conf.to_log("Configuration returned from %r:\n% r\n"%(pybin,'\n'.join(vals)))194 conf.to_log("Configuration returned from %r:\n%s\n"%(pybin,'\n'.join(vals))) 163 195 dct=dict(zip(v,lst)) 164 196 x='MACOSX_DEPLOYMENT_TARGET' 165 197 if dct[x]: 166 conf.env[x]=conf.environ[x]=dct[x]198 env[x]=conf.environ[x]=dct[x] 167 199 env['pyext_PATTERN']='%s'+dct['SO'] 200 num='.'.join(env['PYTHON_VERSION'].split('.')[:2]) 201 conf.find_program([''.join(pybin)+'-config','python%s-config'%num,'python-config-%s'%num,'python%sm-config'%num],var='PYTHON_CONFIG',msg="python-config",mandatory=False) 202 if env.PYTHON_CONFIG: 203 all_flags=[['--cflags','--libs','--ldflags']] 204 if sys.hexversion<0x2070000: 205 all_flags=[[k]for k in all_flags[0]] 206 xx=env.CXX_NAME and'cxx'or'c' 207 if'pyembed'in features: 208 for flags in all_flags: 209 conf.check_cfg(msg='Asking python-config for pyembed %r flags'%' '.join(flags),path=env.PYTHON_CONFIG,package='',uselib_store='PYEMBED',args=flags) 210 conf.check(header_name='Python.h',define_name='HAVE_PYEMBED',msg='Getting pyembed flags from python-config',fragment=FRAG,errmsg='Could not build a python embedded interpreter',features='%s %sprogram pyembed'%(xx,xx)) 211 if'pyext'in features: 212 for flags in all_flags: 213 conf.check_cfg(msg='Asking python-config for pyext %r flags'%' '.join(flags),path=env.PYTHON_CONFIG,package='',uselib_store='PYEXT',args=flags) 214 conf.check(header_name='Python.h',define_name='HAVE_PYEXT',msg='Getting pyext flags from python-config',features='%s %sshlib pyext'%(xx,xx),fragment=FRAG,errmsg='Could not build python extensions') 215 conf.define('HAVE_PYTHON_H',1) 216 return 168 217 all_flags=dct['LDFLAGS']+' '+dct['CFLAGS'] 169 218 conf.parse_flags(all_flags,'PYEMBED') … … 171 220 conf.parse_flags(all_flags,'PYEXT') 172 221 result=None 173 for name in('python'+env['PYTHON_VERSION'],'python'+env['PYTHON_VERSION']+'m','python'+env['PYTHON_VERSION'].replace('.','')): 222 if not dct["LDVERSION"]: 223 dct["LDVERSION"]=env['PYTHON_VERSION'] 224 for name in('python'+dct['LDVERSION'],'python'+env['PYTHON_VERSION']+'m','python'+env['PYTHON_VERSION'].replace('.','')): 174 225 if not result and env['LIBPATH_PYEMBED']: 175 226 path=env['LIBPATH_PYEMBED'] … … 195 246 else: 196 247 conf.to_log("\n\n### LIB NOT FOUND\n") 197 if (Utils.is_win32 or sys.platform.startswith('os2')or dct['Py_ENABLE_SHARED']):248 if Utils.is_win32 or dct['Py_ENABLE_SHARED']: 198 249 env['LIBPATH_PYEXT']=env['LIBPATH_PYEMBED'] 199 250 env['LIB_PYEXT']=env['LIB_PYEMBED'] 200 num='.'.join(env['PYTHON_VERSION'].split('.')[:2]) 201 conf.find_program([''.join(pybin)+'-config','python%s-config'%num,'python-config-%s'%num,'python%sm-config'%num],var='PYTHON_CONFIG',mandatory=False) 202 includes=[] 203 if conf.env.PYTHON_CONFIG: 204 for incstr in conf.cmd_and_log([conf.env.PYTHON_CONFIG,'--includes']).strip().split(): 205 if(incstr.startswith('-I')or incstr.startswith('/I')): 206 incstr=incstr[2:] 207 if incstr not in includes: 208 includes.append(incstr) 209 conf.to_log("Include path for Python extensions (found via python-config --includes): %r\n"%(includes,)) 210 env['INCLUDES_PYEXT']=includes 211 env['INCLUDES_PYEMBED']=includes 212 else: 213 conf.to_log("Include path for Python extensions ""(found via distutils module): %r\n"%(dct['INCLUDEPY'],)) 214 env['INCLUDES_PYEXT']=[dct['INCLUDEPY']] 215 env['INCLUDES_PYEMBED']=[dct['INCLUDEPY']] 251 conf.to_log("Include path for Python extensions (found via distutils module): %r\n"%(dct['INCLUDEPY'],)) 252 env['INCLUDES_PYEXT']=[dct['INCLUDEPY']] 253 env['INCLUDES_PYEMBED']=[dct['INCLUDEPY']] 216 254 if env['CC_NAME']=='gcc': 217 255 env.append_value('CFLAGS_PYEMBED',['-fno-strict-aliasing']) … … 227 265 env.append_value('CXXFLAGS_PYEXT',dist_compiler.compile_options) 228 266 env.append_value('LINKFLAGS_PYEXT',dist_compiler.ldflags_shared) 229 try: 230 conf.check(header_name='Python.h',define_name='HAVE_PYTHON_H',uselib='PYEMBED',fragment=FRAG,errmsg=':-(') 231 except conf.errors.ConfigurationError: 232 xx=conf.env.CXX_NAME and'cxx'or'c' 233 flags=['--cflags','--libs','--ldflags'] 234 for f in flags: 235 conf.check_cfg(msg='Asking python-config for pyembed %s flags'%f,path=conf.env.PYTHON_CONFIG,package='',uselib_store='PYEMBED',args=[f]) 236 conf.check(header_name='Python.h',define_name='HAVE_PYTHON_H',msg='Getting pyembed flags from python-config',fragment=FRAG,errmsg='Could not build a python embedded interpreter',features='%s %sprogram pyembed'%(xx,xx)) 237 for f in flags: 238 conf.check_cfg(msg='Asking python-config for pyext %s flags'%f,path=conf.env.PYTHON_CONFIG,package='',uselib_store='PYEXT',args=[f]) 239 conf.check(header_name='Python.h',define_name='HAVE_PYTHON_H',msg='Getting pyext flags from python-config',features='%s %sshlib pyext'%(xx,xx),fragment=FRAG,errmsg='Could not build python extensions') 267 conf.check(header_name='Python.h',define_name='HAVE_PYTHON_H',uselib='PYEMBED',fragment=FRAG,errmsg='Distutils not installed? Broken python installation? Get python-config now!') 240 268 @conf 241 269 def check_python_version(conf,minver=None): … … 253 281 pyver='.'.join([str(x)for x in pyver_tuple[:2]]) 254 282 conf.env['PYTHON_VERSION']=pyver 255 if'PYTHONDIR'in conf.environ: 283 if'PYTHONDIR'in conf.env: 284 pydir=conf.env['PYTHONDIR'] 285 elif'PYTHONDIR'in conf.environ: 256 286 pydir=conf.environ['PYTHONDIR'] 257 287 else: 258 288 if Utils.is_win32: 259 (python_LIBDEST,pydir)=conf.get_python_variables(["get_config_var('LIBDEST') or ''","get_python_lib(standard_lib=0 , prefix=%r) or ''"%conf.env['PREFIX']])289 (python_LIBDEST,pydir)=conf.get_python_variables(["get_config_var('LIBDEST') or ''","get_python_lib(standard_lib=0) or ''"]) 260 290 else: 261 291 python_LIBDEST=None 262 (pydir,)=conf.get_python_variables(["get_python_lib(standard_lib=0 , prefix=%r) or ''"%conf.env['PREFIX']])292 (pydir,)=conf.get_python_variables(["get_python_lib(standard_lib=0) or ''"]) 263 293 if python_LIBDEST is None: 264 294 if conf.env['LIBDIR']: … … 266 296 else: 267 297 python_LIBDEST=os.path.join(conf.env['PREFIX'],"lib","python"+pyver) 268 if'PYTHONARCHDIR'in conf.environ: 298 if'PYTHONARCHDIR'in conf.env: 299 pyarchdir=conf.env['PYTHONARCHDIR'] 300 elif'PYTHONARCHDIR'in conf.environ: 269 301 pyarchdir=conf.environ['PYTHONARCHDIR'] 270 302 else: 271 (pyarchdir,)=conf.get_python_variables(["get_python_lib(plat_specific=1, standard_lib=0 , prefix=%r) or ''"%conf.env['PREFIX']])303 (pyarchdir,)=conf.get_python_variables(["get_python_lib(plat_specific=1, standard_lib=0) or ''"]) 272 304 if not pyarchdir: 273 305 pyarchdir=pydir … … 289 321 version = getattr(current_module, '__version__', None) 290 322 if version is not None: 291 323 print(str(version)) 292 324 else: 293 325 print('unknown version') 294 326 ''' 295 327 @conf 296 328 def check_python_module(conf,module_name,condition=''): 297 msg= 'Python module %s'%module_name329 msg="Checking for python module '%s'"%module_name 298 330 if condition: 299 331 msg='%s (%s)'%(msg,condition) … … 325 357 conf.end_msg(ret) 326 358 def configure(conf): 327 try:328 conf.find_program('python',var='PYTHON')329 except conf.errors.ConfigurationError:330 Logs.warn("could not find a python executable, setting to sys.executable '%s'"%sys.executable)331 conf.env.PYTHON=sys.executable332 if conf.env.PYTHON!=sys.executable:333 Logs.warn("python executable %r differs from system %r"%(conf.env.PYTHON,sys.executable))334 conf.env.PYTHON=conf.cmd_to_list(conf.env.PYTHON)335 359 v=conf.env 336 v['PYCMD']='"import sys, py_compile;py_compile.compile(sys.argv[1], sys.argv[2])"' 360 v['PYTHON']=Options.options.python or os.environ.get('PYTHON',sys.executable) 361 if Options.options.pythondir: 362 v['PYTHONDIR']=Options.options.pythondir 363 if Options.options.pythonarchdir: 364 v['PYTHONARCHDIR']=Options.options.pythonarchdir 365 conf.find_program('python',var='PYTHON') 337 366 v['PYFLAGS']='' 338 367 v['PYFLAGS_OPT']='-O' 339 368 v['PYC']=getattr(Options.options,'pyc',1) 340 369 v['PYO']=getattr(Options.options,'pyo',1) 370 try: 371 v.PYTAG=conf.cmd_and_log(conf.env.PYTHON+['-c',"import imp;print(imp.get_tag())"]).strip() 372 except Errors.WafError: 373 pass 341 374 def options(opt): 342 opt.add_option('--nopyc',action='store_false',default=1,help='Do not install bytecode compiled .pyc files (configuration) [Default:install]',dest='pyc') 343 opt.add_option('--nopyo',action='store_false',default=1,help='Do not install optimised compiled .pyo files (configuration) [Default:install]',dest='pyo') 375 pyopt=opt.add_option_group("Python Options") 376 pyopt.add_option('--nopyc',dest='pyc',action='store_false',default=1,help='Do not install bytecode compiled .pyc files (configuration) [Default:install]') 377 pyopt.add_option('--nopyo',dest='pyo',action='store_false',default=1,help='Do not install optimised compiled .pyo files (configuration) [Default:install]') 378 pyopt.add_option('--python',dest="python",help='python binary to be used [Default: %s]'%sys.executable) 379 pyopt.add_option('--pythondir',dest='pythondir',help='Installation path for python modules (py, platform-independent .py and .pyc files)') 380 pyopt.add_option('--pythonarchdir',dest='pythonarchdir',help='Installation path for python extension (pyext, platform-dependent .so or .dylib files)') -
waflib/Tools/qt4.py
r5525507 r904702d 12 12 has_xml=True 13 13 import os,sys 14 from waflib.Tools import c _preproc,cxx15 from waflib import Task,Utils,Options,Errors 14 from waflib.Tools import cxx 15 from waflib import Task,Utils,Options,Errors,Context 16 16 from waflib.TaskGen import feature,after_method,extension 17 17 from waflib.Configure import conf … … 26 26 Task.Task.__init__(self,*k,**kw) 27 27 self.moc_done=0 28 def scan(self):29 (nodes,names)=c_preproc.scan(self)30 lst=[]31 for x in nodes:32 if x.name.endswith('.moc'):33 s=x.path_from(self.inputs[0].parent.get_bld())34 if s not in names:35 names.append(s)36 else:37 lst.append(x)38 return(lst,names)39 28 def runnable_status(self): 40 29 if self.moc_done: … … 57 46 tsk.set_inputs(h_node) 58 47 tsk.set_outputs(m_node) 48 if self.generator: 49 self.generator.tasks.append(tsk) 59 50 gen=self.generator.bld.producer 60 51 gen.outstanding.insert(0,tsk) 61 52 gen.total+=1 62 53 return tsk 54 def moc_h_ext(self): 55 try: 56 ext=Options.options.qt_header_ext.split() 57 except AttributeError: 58 pass 59 if not ext: 60 ext=MOC_H 61 return ext 63 62 def add_moc_tasks(self): 64 63 node=self.inputs[0] … … 70 69 else: 71 70 delattr(self,'cache_sig') 71 include_nodes=[node.parent]+self.generator.includes_nodes 72 72 moctasks=[] 73 mocfiles=[] 74 try: 75 tmp_lst=bld.raw_deps[self.uid()] 76 bld.raw_deps[self.uid()]=[] 77 except KeyError: 78 tmp_lst=[] 79 for d in tmp_lst: 73 mocfiles=set([]) 74 for d in bld.raw_deps.get(self.uid(),[]): 80 75 if not d.endswith('.moc'): 81 76 continue 82 77 if d in mocfiles: 83 Logs.error("paranoia owns")84 78 continue 85 mocfiles.a ppend(d)79 mocfiles.add(d) 86 80 h_node=None 87 try:ext=Options.options.qt_header_ext.split()88 except AttributeError:pass89 if not ext:ext=MOC_H90 81 base2=d[:-4] 91 for x in [node.parent]+self.generator.includes_nodes:92 for e in ext:82 for x in include_nodes: 83 for e in self.moc_h_ext(): 93 84 h_node=x.find_node(base2+e) 94 85 if h_node: … … 100 91 for k in EXT_QT4: 101 92 if base2.endswith(k): 102 for x in [node.parent]+self.generator.includes_nodes:93 for x in include_nodes: 103 94 h_node=x.find_node(base2) 104 95 if h_node: 105 96 break 106 if h_node:107 m_node=h_node.change_ext(k+'.moc')108 break97 if h_node: 98 m_node=h_node.change_ext(k+'.moc') 99 break 109 100 if not h_node: 110 raise Errors.WafError('no header found for %r which is a moc file'%d) 111 bld.node_deps[(self.inputs[0].parent.abspath(),m_node.name)]=h_node 101 raise Errors.WafError('No source found for %r which is a moc file'%d) 112 102 task=self.create_moc_task(h_node,m_node) 113 103 moctasks.append(task) 114 tmp_lst=bld.raw_deps[self.uid()]=mocfiles115 lst=bld.node_deps.get(self.uid(),())116 for d in lst:117 name=d.name118 if name.endswith('.moc'):119 task=self.create_moc_task(bld.node_deps[(self.inputs[0].parent.abspath(),name)],d)120 moctasks.append(task)121 104 self.run_after.update(set(moctasks)) 122 105 self.moc_done=1 123 run=Task.classes['cxx'].__dict__['run']124 106 class trans_update(Task.Task): 125 107 run_str='${QT_LUPDATE} ${SRC} -ts ${TGT}' … … 141 123 def create_rcc_task(self,node): 142 124 rcnode=node.change_ext('_rc.cpp') 143 rcctask=self.create_task('rcc',node,rcnode)125 self.create_task('rcc',node,rcnode) 144 126 cpptask=self.create_task('cxx',rcnode,rcnode.change_ext('.o')) 145 127 try: … … 180 162 if len(flag)<2:continue 181 163 f=flag[0:2] 182 if f in ['-D','-I','/D','/I']:164 if f in('-D','-I','/D','/I'): 183 165 if(f[0]=='/'): 184 166 lst.append('-'+flag[1:]) … … 191 173 class rcc(Task.Task): 192 174 color='BLUE' 193 run_str='${QT_RCC} -name ${ SRC[0].name} ${SRC[0].abspath()} ${RCC_ST} -o ${TGT}'175 run_str='${QT_RCC} -name ${tsk.rcname()} ${SRC[0].abspath()} ${RCC_ST} -o ${TGT}' 194 176 ext_out=['.h'] 177 def rcname(self): 178 return os.path.splitext(self.inputs[0].name)[0] 195 179 def scan(self): 196 node=self.inputs[0]197 180 if not has_xml: 198 181 Logs.error('no xml support was found, the rcc dependencies will be incomplete!') … … 217 200 color='BLUE' 218 201 run_str='${QT_MOC} ${MOC_FLAGS} ${MOCCPPPATH_ST:INCPATHS} ${MOCDEFINES_ST:DEFINES} ${SRC} ${MOC_ST} ${TGT}' 202 def keyword(self): 203 return"Creating" 204 def __str__(self): 205 return self.outputs[0].path_from(self.generator.bld.launch_node()) 219 206 class ui4(Task.Task): 220 207 color='BLUE' … … 268 255 cand=None 269 256 prev_ver=['4','0','0'] 270 for qmk in ['qmake-qt4','qmake4','qmake']:257 for qmk in('qmake-qt4','qmake4','qmake'): 271 258 try: 272 259 qmake=self.find_program(qmk,path_list=paths) … … 275 262 else: 276 263 try: 277 version=self.cmd_and_log( [qmake,'-query','QT_VERSION']).strip()264 version=self.cmd_and_log(qmake+['-query','QT_VERSION']).strip() 278 265 except self.errors.WafError: 279 266 pass … … 288 275 else: 289 276 self.fatal('Could not find qmake for qt4') 290 qtbin=self.cmd_and_log( [self.env.QMAKE,'-query','QT_INSTALL_BINS']).strip()+os.sep277 qtbin=self.cmd_and_log(self.env.QMAKE+['-query','QT_INSTALL_BINS']).strip()+os.sep 291 278 def find_bin(lst,var): 292 279 if var in env: … … 302 289 find_bin(['uic-qt3','uic3'],'QT_UIC3') 303 290 find_bin(['uic-qt4','uic'],'QT_UIC') 304 if not env ['QT_UIC']:291 if not env.QT_UIC: 305 292 self.fatal('cannot find the uic compiler for qt4') 306 try: 307 uicver=self.cmd_and_log(env['QT_UIC']+" -version 2>&1").strip() 308 except self.errors.ConfigurationError: 309 self.fatal('this uic compiler is for qt3, add uic for qt4 to your path') 293 self.start_msg('Checking for uic version') 294 uicver=self.cmd_and_log(env.QT_UIC+["-version"],output=Context.BOTH) 295 uicver=''.join(uicver).strip() 310 296 uicver=uicver.replace('Qt User Interface Compiler ','').replace('User Interface Compiler for Qt','') 311 self. msg('Checking for uic version','%s'%uicver)297 self.end_msg(uicver) 312 298 if uicver.find(' 3.')!=-1: 313 299 self.fatal('this uic compiler is for qt3, add uic for qt4 to your path') 314 300 find_bin(['moc-qt4','moc'],'QT_MOC') 315 find_bin(['rcc '],'QT_RCC')301 find_bin(['rcc-qt4','rcc'],'QT_RCC') 316 302 find_bin(['lrelease-qt4','lrelease'],'QT_LRELEASE') 317 303 find_bin(['lupdate-qt4','lupdate'],'QT_LUPDATE') … … 328 314 if not qtlibs: 329 315 try: 330 qtlibs=self.cmd_and_log( [self.env.QMAKE,'-query','QT_INSTALL_LIBS']).strip()316 qtlibs=self.cmd_and_log(self.env.QMAKE+['-query','QT_INSTALL_LIBS']).strip() 331 317 except Errors.WafError: 332 qtdir=self.cmd_and_log( [self.env.QMAKE,'-query','QT_INSTALL_PREFIX']).strip()+os.sep318 qtdir=self.cmd_and_log(self.env.QMAKE+['-query','QT_INSTALL_PREFIX']).strip()+os.sep 333 319 qtlibs=os.path.join(qtdir,'lib') 334 320 self.msg('Found the Qt4 libraries in',qtlibs) 335 qtincludes=os.environ.get("QT4_INCLUDES",None)or self.cmd_and_log( [self.env.QMAKE,'-query','QT_INSTALL_HEADERS']).strip()321 qtincludes=os.environ.get("QT4_INCLUDES",None)or self.cmd_and_log(self.env.QMAKE+['-query','QT_INSTALL_HEADERS']).strip() 336 322 env=self.env 337 323 if not'PKG_CONFIG_PATH'in os.environ: -
waflib/Tools/ruby.py
r5525507 r904702d 28 28 ruby=self.env.RUBY 29 29 try: 30 version=self.cmd_and_log( [ruby,'-e','puts defined?(VERSION) ? VERSION : RUBY_VERSION']).strip()30 version=self.cmd_and_log(ruby+['-e','puts defined?(VERSION) ? VERSION : RUBY_VERSION']).strip() 31 31 except Exception: 32 32 self.fatal('could not determine ruby version') … … 52 52 version=tuple(map(int,self.env.RUBY_VERSION.split("."))) 53 53 def read_out(cmd): 54 return Utils.to_list(self.cmd_and_log( [self.env.RUBY,'-rrbconfig','-e',cmd]))54 return Utils.to_list(self.cmd_and_log(self.env.RUBY+['-rrbconfig','-e',cmd])) 55 55 def read_config(key): 56 return read_out('puts Config::CONFIG[%r]'%key)56 return read_out('puts RbConfig::CONFIG[%r]'%key) 57 57 ruby=self.env['RUBY'] 58 58 archdir=read_config('archdir') … … 88 88 self.start_msg('Ruby module %s'%module_name) 89 89 try: 90 self.cmd_and_log( [self.env['RUBY'],'-e','require \'%s\';puts 1'%module_name])90 self.cmd_and_log(self.env.RUBY+['-e','require \'%s\';puts 1'%module_name]) 91 91 except Exception: 92 92 self.end_msg(False) -
waflib/Tools/suncc.py
r5525507 r904702d 3 3 # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 4 5 import os6 5 from waflib import Utils 7 6 from waflib.Tools import ccroot,ar … … 10 9 def find_scc(conf): 11 10 v=conf.env 12 cc=None 13 if v['CC']:cc=v['CC'] 14 elif'CC'in conf.environ:cc=conf.environ['CC'] 15 if not cc:cc=conf.find_program('cc',var='CC') 16 if not cc:conf.fatal('Could not find a Sun C compiler') 17 cc=conf.cmd_to_list(cc) 11 cc=conf.find_program('cc',var='CC') 18 12 try: 19 13 conf.cmd_and_log(cc+['-flags']) 20 14 except Exception: 21 15 conf.fatal('%r is not a Sun compiler'%cc) 22 v['CC']=cc 23 v['CC_NAME']='sun' 16 v.CC_NAME='sun' 24 17 conf.get_suncc_version(cc) 25 18 @conf -
waflib/Tools/suncxx.py
r5525507 r904702d 3 3 # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 4 5 import os6 5 from waflib import Utils 7 6 from waflib.Tools import ccroot,ar … … 10 9 def find_sxx(conf): 11 10 v=conf.env 12 cc=None 13 if v['CXX']:cc=v['CXX'] 14 elif'CXX'in conf.environ:cc=conf.environ['CXX'] 15 if not cc:cc=conf.find_program('CC',var='CXX') 16 if not cc:cc=conf.find_program('c++',var='CXX') 17 if not cc:conf.fatal('Could not find a Sun C++ compiler') 18 cc=conf.cmd_to_list(cc) 11 cc=conf.find_program(['CC','c++'],var='CXX') 19 12 try: 20 13 conf.cmd_and_log(cc+['-flags']) 21 14 except Exception: 22 15 conf.fatal('%r is not a Sun compiler'%cc) 23 v['CXX']=cc 24 v['CXX_NAME']='sun' 16 v.CXX_NAME='sun' 25 17 conf.get_suncc_version(cc) 26 18 @conf -
waflib/Tools/tex.py
r5525507 r904702d 4 4 5 5 import os,re 6 from waflib import Utils,Task,Errors,Logs 6 from waflib import Utils,Task,Errors,Logs,Node 7 7 from waflib.TaskGen import feature,before_method 8 8 re_bibunit=re.compile(r'\\(?P<type>putbib)\[(?P<file>[^\[\]]*)\]',re.M) … … 15 15 path=match.group('file') 16 16 if path: 17 for k in ['','.bib']:17 for k in('','.bib'): 18 18 Logs.debug('tex: trying %s%s'%(path,k)) 19 19 fi=node.parent.find_resource(path+k) … … 24 24 Logs.debug("tex: found the following bibunit files: %s"%nodes) 25 25 return nodes 26 exts_deps_tex=['','.ltx','.tex','.bib','.pdf','.png','.eps','.ps' ]26 exts_deps_tex=['','.ltx','.tex','.bib','.pdf','.png','.eps','.ps','.sty'] 27 27 exts_tex=['.ltx','.tex'] 28 re_tex=re.compile(r'\\(?P<type> include|bibliography|putbib|includegraphics|input|import|bringin|lstinputlisting)(\[[^\[\]]*\])?{(?P<file>[^{}]*)}',re.M)28 re_tex=re.compile(r'\\(?P<type>usepackage|RequirePackage|include|bibliography([^\[\]{}]*)|putbib|includegraphics|input|import|bringin|lstinputlisting)(\[[^\[\]]*\])?{(?P<file>[^{}]*)}',re.M) 29 29 g_bibtex_re=re.compile('bibdata',re.M) 30 g_glossaries_re=re.compile('\\@newglossary',re.M) 30 31 class tex(Task.Task): 31 32 bibtex_fun,_=Task.compile_fun('${BIBTEX} ${BIBTEXFLAGS} ${SRCFILE}',shell=False) … … 37 38 Execute the program **makeindex** 38 39 """ 40 makeglossaries_fun,_=Task.compile_fun('${MAKEGLOSSARIES} ${SRCFILE}',shell=False) 41 makeglossaries_fun.__doc__=""" 42 Execute the program **makeglossaries** 43 """ 39 44 def exec_command(self,cmd,**kw): 40 45 bld=self.generator.bld 46 Logs.info('runner: %r'%cmd) 41 47 try: 42 48 if not kw.get('cwd',None): … … 72 78 global re_tex 73 79 for match in re_tex.finditer(code): 80 multibib=match.group('type') 81 if multibib and multibib.startswith('bibliography'): 82 multibib=multibib[len('bibliography'):] 83 if multibib.startswith('style'): 84 continue 85 else: 86 multibib=None 74 87 for path in match.group('file').split(','): 75 88 if path: … … 77 90 found=None 78 91 for k in exts_deps_tex: 79 Logs.debug('tex: trying %s%s'%(path,k)) 80 found=node.parent.find_resource(path+k) 92 for up in self.texinputs_nodes: 93 Logs.debug('tex: trying %s%s'%(path,k)) 94 found=up.find_resource(path+k) 95 if found: 96 break 81 97 for tsk in self.generator.tasks: 82 98 if not found or found in tsk.outputs: … … 89 105 parse_node(found) 90 106 break 107 if found and multibib and found.name.endswith('.bib'): 108 try: 109 self.multibibs.append(found) 110 except AttributeError: 111 self.multibibs=[found] 91 112 if add_name: 92 113 names.append(path) … … 103 124 try: 104 125 ct=aux_node.read() 105 except (OSError,IOError):126 except EnvironmentError: 106 127 Logs.error('Error reading %s: %r'%aux_node.abspath()) 107 128 continue 108 129 if g_bibtex_re.findall(ct): 109 Logs. warn('calling bibtex')130 Logs.info('calling bibtex') 110 131 self.env.env={} 111 132 self.env.env.update(os.environ) 112 self.env.env.update({'BIBINPUTS':self. TEXINPUTS,'BSTINPUTS':self.TEXINPUTS})133 self.env.env.update({'BIBINPUTS':self.texinputs(),'BSTINPUTS':self.texinputs()}) 113 134 self.env.SRCFILE=aux_node.name[:-4] 114 135 self.check_status('error when calling bibtex',self.bibtex_fun()) 136 for node in getattr(self,'multibibs',[]): 137 self.env.env={} 138 self.env.env.update(os.environ) 139 self.env.env.update({'BIBINPUTS':self.texinputs(),'BSTINPUTS':self.texinputs()}) 140 self.env.SRCFILE=node.name[:-4] 141 self.check_status('error when calling bibtex',self.bibtex_fun()) 115 142 def bibunits(self): 116 143 try: … … 120 147 else: 121 148 if bibunits: 122 fn=['bu'+str(i)for i in xrange(1,len(bibunits)+1)]149 fn=['bu'+str(i)for i in range(1,len(bibunits)+1)] 123 150 if fn: 124 Logs. warn('calling bibtex on bibunits')151 Logs.info('calling bibtex on bibunits') 125 152 for f in fn: 126 self.env.env={'BIBINPUTS':self. TEXINPUTS,'BSTINPUTS':self.TEXINPUTS}153 self.env.env={'BIBINPUTS':self.texinputs(),'BSTINPUTS':self.texinputs()} 127 154 self.env.SRCFILE=f 128 155 self.check_status('error when calling bibtex',self.bibtex_fun()) 129 156 def makeindex(self): 157 self.idx_node=self.inputs[0].change_ext('.idx') 130 158 try: 131 159 idx_path=self.idx_node.abspath() 132 160 os.stat(idx_path) 133 161 except OSError: 134 Logs. warn('index file %s absent, not calling makeindex'%idx_path)162 Logs.info('index file %s absent, not calling makeindex'%idx_path) 135 163 else: 136 Logs. warn('calling makeindex')164 Logs.info('calling makeindex') 137 165 self.env.SRCFILE=self.idx_node.name 138 166 self.env.env={} … … 142 170 if os.path.exists(os.path.join(p.abspath(),'btaux.aux')): 143 171 self.aux_nodes+=p.ant_glob('*[0-9].aux') 172 def makeglossaries(self): 173 src_file=self.inputs[0].abspath() 174 base_file=os.path.basename(src_file) 175 base,_=os.path.splitext(base_file) 176 for aux_node in self.aux_nodes: 177 try: 178 ct=aux_node.read() 179 except EnvironmentError: 180 Logs.error('Error reading %s: %r'%aux_node.abspath()) 181 continue 182 if g_glossaries_re.findall(ct): 183 if not self.env.MAKEGLOSSARIES: 184 raise Errors.WafError("The program 'makeglossaries' is missing!") 185 Logs.warn('calling makeglossaries') 186 self.env.SRCFILE=base 187 self.check_status('error when calling makeglossaries %s'%base,self.makeglossaries_fun()) 188 return 189 def texinputs(self): 190 return os.pathsep.join([k.abspath()for k in self.texinputs_nodes])+os.pathsep 144 191 def run(self): 145 192 env=self.env … … 148 195 env.append_value('PDFLATEXFLAGS','-interaction=batchmode') 149 196 env.append_value('XELATEXFLAGS','-interaction=batchmode') 150 fun=self.texfun151 node=self.inputs[0]152 srcfile=node.abspath()153 texinputs=self.env.TEXINPUTS or''154 self.TEXINPUTS=node.parent.get_bld().abspath()+os.pathsep+node.parent.get_src().abspath()+os.pathsep+texinputs+os.pathsep155 197 self.cwd=self.inputs[0].parent.get_bld().abspath() 156 Logs.warn('first pass on %s'%self.__class__.__name__) 157 self.env.env={} 158 self.env.env.update(os.environ) 159 self.env.env.update({'TEXINPUTS':self.TEXINPUTS}) 160 self.env.SRCFILE=srcfile 161 self.check_status('error when calling latex',fun()) 162 self.aux_nodes=self.scan_aux(node.change_ext('.aux')) 163 self.idx_node=node.change_ext('.idx') 198 Logs.info('first pass on %s'%self.__class__.__name__) 199 cur_hash=self.hash_aux_nodes() 200 self.call_latex() 201 self.hash_aux_nodes() 164 202 self.bibtopic() 165 203 self.bibfile() 166 204 self.bibunits() 167 205 self.makeindex() 168 hash=''206 self.makeglossaries() 169 207 for i in range(10): 170 prev_hash=hash 208 prev_hash=cur_hash 209 cur_hash=self.hash_aux_nodes() 210 if not cur_hash: 211 Logs.error('No aux.h to process') 212 if cur_hash and cur_hash==prev_hash: 213 break 214 Logs.info('calling %s'%self.__class__.__name__) 215 self.call_latex() 216 def hash_aux_nodes(self): 217 try: 218 nodes=self.aux_nodes 219 except AttributeError: 171 220 try: 172 hashes=[Utils.h_file(x.abspath())for x in self.aux_nodes] 173 hash=Utils.h_list(hashes) 174 except(OSError,IOError): 175 Logs.error('could not read aux.h') 176 pass 177 if hash and hash==prev_hash: 178 break 179 Logs.warn('calling %s'%self.__class__.__name__) 180 self.env.env={} 181 self.env.env.update(os.environ) 182 self.env.env.update({'TEXINPUTS':self.TEXINPUTS}) 183 self.env.SRCFILE=srcfile 184 self.check_status('error when calling %s'%self.__class__.__name__,fun()) 221 self.aux_nodes=self.scan_aux(self.inputs[0].change_ext('.aux')) 222 except IOError: 223 return None 224 return Utils.h_list([Utils.h_file(x.abspath())for x in self.aux_nodes]) 225 def call_latex(self): 226 self.env.env={} 227 self.env.env.update(os.environ) 228 self.env.env.update({'TEXINPUTS':self.texinputs()}) 229 self.env.SRCFILE=self.inputs[0].abspath() 230 self.check_status('error when calling latex',self.texfun()) 185 231 class latex(tex): 186 232 texfun,vars=Task.compile_fun('${LATEX} ${LATEXFLAGS} ${SRCFILE}',shell=False) … … 204 250 @before_method('process_source') 205 251 def apply_tex(self): 206 if not getattr(self,'type',None)in ['latex','pdflatex','xelatex']:252 if not getattr(self,'type',None)in('latex','pdflatex','xelatex'): 207 253 self.type='pdflatex' 208 254 tree=self.bld … … 212 258 if getattr(self,'deps',None): 213 259 deps=self.to_list(self.deps) 214 for filename in deps: 215 n=self.path.find_resource(filename) 216 if not n: 217 self.bld.fatal('Could not find %r for %r'%(filename,self)) 218 if not n in deps_lst: 219 deps_lst.append(n) 260 for dep in deps: 261 if isinstance(dep,str): 262 n=self.path.find_resource(dep) 263 if not n: 264 self.bld.fatal('Could not find %r for %r'%(dep,self)) 265 if not n in deps_lst: 266 deps_lst.append(n) 267 elif isinstance(dep,Node.Node): 268 deps_lst.append(dep) 220 269 for node in self.to_nodes(self.source): 221 270 if self.type=='latex': … … 227 276 task.env=self.env 228 277 if deps_lst: 229 try: 230 lst=tree.node_deps[task.uid()] 231 for n in deps_lst: 232 if not n in lst: 233 lst.append(n) 234 except KeyError: 235 tree.node_deps[task.uid()]=deps_lst 236 v=dict(os.environ) 237 p=node.parent.abspath()+os.pathsep+self.path.abspath()+os.pathsep+self.path.get_bld().abspath()+os.pathsep+v.get('TEXINPUTS','')+os.pathsep 238 v['TEXINPUTS']=p 278 for n in deps_lst: 279 if not n in task.dep_nodes: 280 task.dep_nodes.append(n) 281 if hasattr(self,'texinputs_nodes'): 282 task.texinputs_nodes=self.texinputs_nodes 283 else: 284 task.texinputs_nodes=[node.parent,node.parent.get_bld(),self.path,self.path.get_bld()] 285 lst=os.environ.get('TEXINPUTS','') 286 if self.env.TEXINPUTS: 287 lst+=os.pathsep+self.env.TEXINPUTS 288 if lst: 289 lst=lst.split(os.pathsep) 290 for x in lst: 291 if x: 292 if os.path.isabs(x): 293 p=self.bld.root.find_node(x) 294 if p: 295 task.texinputs_nodes.append(p) 296 else: 297 Logs.error('Invalid TEXINPUTS folder %s'%x) 298 else: 299 Logs.error('Cannot resolve relative paths in TEXINPUTS %s'%x) 239 300 if self.type=='latex': 240 301 if'ps'in outs: 241 302 tsk=self.create_task('dvips',task.outputs,node.change_ext('.ps')) 242 tsk.env.env=dict( v)303 tsk.env.env=dict(os.environ) 243 304 if'pdf'in outs: 244 305 tsk=self.create_task('dvipdf',task.outputs,node.change_ext('.pdf')) 245 tsk.env.env=dict( v)306 tsk.env.env=dict(os.environ) 246 307 elif self.type=='pdflatex': 247 308 if'ps'in outs: … … 250 311 def configure(self): 251 312 v=self.env 252 for p in'tex latex pdflatex xelatex bibtex dvips dvipdf ps2pdf makeindex pdf2ps '.split():313 for p in'tex latex pdflatex xelatex bibtex dvips dvipdf ps2pdf makeindex pdf2ps makeglossaries'.split(): 253 314 try: 254 315 self.find_program(p,var=p.upper()) -
waflib/Tools/vala.py
r5525507 r904702d 11 11 ext_out=['.h'] 12 12 def run(self): 13 cmd= [self.env['VALAC']]+self.env['VALAFLAGS']13 cmd=self.env.VALAC+self.env.VALAFLAGS 14 14 cmd.extend([a.abspath()for a in self.inputs]) 15 15 ret=self.exec_command(cmd,cwd=self.outputs[0].parent.abspath()) … … 160 160 valac=self.find_program(valac_name,var='VALAC') 161 161 try: 162 output=self.cmd_and_log(valac+ ' --version')162 output=self.cmd_and_log(valac+['--version']) 163 163 except Exception: 164 164 valac_version=None -
waflib/Tools/waf_unit_test.py
r5525507 r904702d 3 3 # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file 4 4 5 import os ,sys6 from waflib.TaskGen import feature,after_method 5 import os 6 from waflib.TaskGen import feature,after_method,taskgen_method 7 7 from waflib import Utils,Task,Logs,Options 8 8 testlock=Utils.threading.Lock() … … 12 12 if getattr(self,'link_task',None): 13 13 self.create_task('utest',self.link_task.outputs) 14 @taskgen_method 15 def add_test_results(self,tup): 16 Logs.debug("ut: %r",tup) 17 self.utest_result=tup 18 try: 19 self.bld.utest_results.append(tup) 20 except AttributeError: 21 self.bld.utest_results=[tup] 14 22 class utest(Task.Task): 15 23 color='PINK' … … 24 32 return Task.RUN_ME 25 33 return ret 26 def run(self): 27 filename=self.inputs[0].abspath() 28 self.ut_exec=getattr(self.generator,'ut_exec',[filename]) 29 if getattr(self.generator,'ut_fun',None): 30 self.generator.ut_fun(self) 34 def add_path(self,dct,path,var): 35 dct[var]=os.pathsep.join(Utils.to_list(path)+[os.environ.get(var,'')]) 36 def get_test_env(self): 31 37 try: 32 38 fu=getattr(self.generator.bld,'all_test_paths') … … 40 46 if s not in lst: 41 47 lst.append(s) 42 def add_path(dct,path,var):43 dct[var]=os.pathsep.join(Utils.to_list(path)+[os.environ.get(var,'')])44 48 if Utils.is_win32: 45 add_path(fu,lst,'PATH')49 self.add_path(fu,lst,'PATH') 46 50 elif Utils.unversioned_sys_platform()=='darwin': 47 add_path(fu,lst,'DYLD_LIBRARY_PATH')48 add_path(fu,lst,'LD_LIBRARY_PATH')51 self.add_path(fu,lst,'DYLD_LIBRARY_PATH') 52 self.add_path(fu,lst,'LD_LIBRARY_PATH') 49 53 else: 50 add_path(fu,lst,'LD_LIBRARY_PATH')54 self.add_path(fu,lst,'LD_LIBRARY_PATH') 51 55 self.generator.bld.all_test_paths=fu 56 return fu 57 def run(self): 58 filename=self.inputs[0].abspath() 59 self.ut_exec=getattr(self.generator,'ut_exec',[filename]) 60 if getattr(self.generator,'ut_fun',None): 61 self.generator.ut_fun(self) 52 62 cwd=getattr(self.generator,'ut_cwd','')or self.inputs[0].parent.abspath() 53 testcmd=getattr( Options.options,'testcmd',False)63 testcmd=getattr(self.generator,'ut_cmd',False)or getattr(Options.options,'testcmd',False) 54 64 if testcmd: 55 65 self.ut_exec=(testcmd%self.ut_exec[0]).split(' ') 56 proc=Utils.subprocess.Popen(self.ut_exec,cwd=cwd,env= fu,stderr=Utils.subprocess.PIPE,stdout=Utils.subprocess.PIPE)66 proc=Utils.subprocess.Popen(self.ut_exec,cwd=cwd,env=self.get_test_env(),stderr=Utils.subprocess.PIPE,stdout=Utils.subprocess.PIPE) 57 67 (stdout,stderr)=proc.communicate() 58 68 tup=(filename,proc.returncode,stdout,stderr) 59 self.generator.utest_result=tup60 69 testlock.acquire() 61 70 try: 62 bld=self.generator.bld 63 Logs.debug("ut: %r",tup) 64 try: 65 bld.utest_results.append(tup) 66 except AttributeError: 67 bld.utest_results=[tup] 71 return self.generator.add_test_results(tup) 68 72 finally: 69 73 testlock.release() -
waflib/Tools/xlc.py
r5525507 r904702d 8 8 def find_xlc(conf): 9 9 cc=conf.find_program(['xlc_r','xlc'],var='CC') 10 cc=conf.cmd_to_list(cc)11 10 conf.get_xlc_version(cc) 12 11 conf.env.CC_NAME='xlc' 13 conf.env.CC=cc14 12 @conf 15 13 def xlc_common_flags(conf): -
waflib/Tools/xlcxx.py
r5525507 r904702d 8 8 def find_xlcxx(conf): 9 9 cxx=conf.find_program(['xlc++_r','xlc++'],var='CXX') 10 cxx=conf.cmd_to_list(cxx)11 10 conf.get_xlc_version(cxx) 12 11 conf.env.CXX_NAME='xlc++' 13 conf.env.CXX=cxx14 12 @conf 15 13 def xlcxx_common_flags(conf):
Note: See TracChangeset
for help on using the changeset viewer.