Changeset 904702d for waflib/extras/compat15.py
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waflib/extras/compat15.py
r5525507 r904702d 27 27 Build.BuildContext.is_install=0 28 28 Node.Node.relpath_gen=Node.Node.path_from 29 Utils.pproc=Utils.subprocess 30 Utils.get_term_cols=Logs.get_term_cols 31 def cmd_output(cmd,**kw): 32 silent=False 33 if'silent'in kw: 34 silent=kw['silent'] 35 del(kw['silent']) 36 if'e'in kw: 37 tmp=kw['e'] 38 del(kw['e']) 39 kw['env']=tmp 40 kw['shell']=isinstance(cmd,str) 41 kw['stdout']=Utils.subprocess.PIPE 42 if silent: 43 kw['stderr']=Utils.subprocess.PIPE 44 try: 45 p=Utils.subprocess.Popen(cmd,**kw) 46 output=p.communicate()[0] 47 except OSError ,e: 48 raise ValueError(str(e)) 49 if p.returncode: 50 if not silent: 51 msg="command execution failed: %s -> %r"%(cmd,str(output)) 52 raise ValueError(msg) 53 output='' 54 return output 55 Utils.cmd_output=cmd_output 29 56 def name_to_obj(self,s,env=None): 30 Logs.warn('compat: change "name_to_obj(name, env)" by "get_tgen_by_name(name)"') 57 if Logs.verbose: 58 Logs.warn('compat: change "name_to_obj(name, env)" by "get_tgen_by_name(name)"') 31 59 return self.get_tgen_by_name(s) 32 60 Build.BuildContext.name_to_obj=name_to_obj … … 50 78 self.all_envs[name]=env 51 79 else: 52 if fromenv:Logs.warn("The environment %s may have been configured already"%name) 80 if fromenv: 81 Logs.warn("The environment %s may have been configured already"%name) 53 82 return env 54 83 Configure.ConfigurationContext.retrieve=retrieve … … 57 86 Configure.conftest=Configure.conf 58 87 Configure.ConfigurationError=Errors.ConfigurationError 88 Utils.WafError=Errors.WafError 59 89 Options.OptionsContext.sub_options=Options.OptionsContext.recurse 60 90 Options.OptionsContext.tool_options=Context.Context.load … … 77 107 ret=eld(*k,**kw) 78 108 if'set_options'in ret.__dict__: 79 Logs.warn('compat: rename "set_options" to options') 109 if Logs.verbose: 110 Logs.warn('compat: rename "set_options" to options') 80 111 ret.options=ret.set_options 81 112 if'detect'in ret.__dict__: 82 Logs.warn('compat: rename "detect" to "configure"') 113 if Logs.verbose: 114 Logs.warn('compat: rename "detect" to "configure"') 83 115 ret.configure=ret.detect 84 116 return ret 85 117 Context.load_tool=load_tool 118 def get_curdir(self): 119 return self.path.abspath() 120 Context.Context.curdir=property(get_curdir,Utils.nada) 86 121 rev=Context.load_module 87 def load_module(path ):88 ret=rev(path )122 def load_module(path,encoding=None): 123 ret=rev(path,encoding) 89 124 if'set_options'in ret.__dict__: 90 Logs.warn('compat: rename "set_options" to "options" (%r)'%path) 125 if Logs.verbose: 126 Logs.warn('compat: rename "set_options" to "options" (%r)'%path) 91 127 ret.options=ret.set_options 92 128 if'srcdir'in ret.__dict__: 93 Logs.warn('compat: rename "srcdir" to "top" (%r)'%path) 129 if Logs.verbose: 130 Logs.warn('compat: rename "srcdir" to "top" (%r)'%path) 94 131 ret.top=ret.srcdir 95 132 if'blddir'in ret.__dict__: 96 Logs.warn('compat: rename "blddir" to "out" (%r)'%path) 133 if Logs.verbose: 134 Logs.warn('compat: rename "blddir" to "out" (%r)'%path) 97 135 ret.out=ret.blddir 98 136 return ret … … 102 140 self.features=self.to_list(self.features) 103 141 if'cc'in self.features: 104 Logs.warn('compat: the feature cc does not exist anymore (use "c")') 142 if Logs.verbose: 143 Logs.warn('compat: the feature cc does not exist anymore (use "c")') 105 144 self.features.remove('cc') 106 145 self.features.append('c') 107 146 if'cstaticlib'in self.features: 108 Logs.warn('compat: the feature cstaticlib does not exist anymore (use "cstlib" or "cxxstlib")') 147 if Logs.verbose: 148 Logs.warn('compat: the feature cstaticlib does not exist anymore (use "cstlib" or "cxxstlib")') 109 149 self.features.remove('cstaticlib') 110 150 self.features.append(('cxx'in self.features)and'cxxstlib'or'cstlib') 111 151 if getattr(self,'ccflags',None): 112 Logs.warn('compat: "ccflags" was renamed to "cflags"') 152 if Logs.verbose: 153 Logs.warn('compat: "ccflags" was renamed to "cflags"') 113 154 self.cflags=self.ccflags 114 155 return old_post(self) … … 129 170 get=self.bld.get_tgen_by_name 130 171 seen=set([]) 172 seen_uselib=set([]) 131 173 tmp=Utils.deque(names) 132 174 if tmp: 133 Logs.warn('compat: "uselib_local" is deprecated, replace by "use"') 175 if Logs.verbose: 176 Logs.warn('compat: "uselib_local" is deprecated, replace by "use"') 134 177 while tmp: 135 178 lib_name=tmp.popleft() … … 158 201 env.prepend_value('LIBPATH',[tmp_path]) 159 202 for v in self.to_list(getattr(y,'uselib',[])): 160 if not env['STLIB_'+v]: 161 if not v in self.uselib: 162 self.uselib.insert(0,v) 203 if v not in seen_uselib: 204 seen_uselib.add(v) 205 if not env['STLIB_'+v]: 206 if not v in self.uselib: 207 self.uselib.insert(0,v) 163 208 if getattr(y,'export_includes',None): 164 209 self.includes.extend(y.to_incnodes(y.export_includes)) … … 219 264 self.export_includes=val 220 265 TaskGen.task_gen.export_incdirs=property(None,set_incdirs) 266 def install_dir(self,path): 267 if not path: 268 return[] 269 destpath=Utils.subst_vars(path,self.env) 270 if self.is_install>0: 271 Logs.info('* creating %s'%destpath) 272 Utils.check_dir(destpath) 273 elif self.is_install<0: 274 Logs.info('* removing %s'%destpath) 275 try: 276 os.remove(destpath) 277 except OSError: 278 pass 279 Build.BuildContext.install_dir=install_dir
Note: See TracChangeset
for help on using the changeset viewer.