source: waflib/extras/compat15.py @ 904702d

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 904702d was 904702d, checked in by Paul Brossier <piem@piem.org>, 9 years ago

waf, waflib: update to 1.8.7

  • Property mode set to 100644
File size: 8.7 KB
Line 
1#! /usr/bin/env python
2# encoding: utf-8
3# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
4
5import sys
6from waflib import ConfigSet,Logs,Options,Scripting,Task,Build,Configure,Node,Runner,TaskGen,Utils,Errors,Context
7sys.modules['Environment']=ConfigSet
8ConfigSet.Environment=ConfigSet.ConfigSet
9sys.modules['Logs']=Logs
10sys.modules['Options']=Options
11sys.modules['Scripting']=Scripting
12sys.modules['Task']=Task
13sys.modules['Build']=Build
14sys.modules['Configure']=Configure
15sys.modules['Node']=Node
16sys.modules['Runner']=Runner
17sys.modules['TaskGen']=TaskGen
18sys.modules['Utils']=Utils
19from waflib.Tools import c_preproc
20sys.modules['preproc']=c_preproc
21from waflib.Tools import c_config
22sys.modules['config_c']=c_config
23ConfigSet.ConfigSet.copy=ConfigSet.ConfigSet.derive
24ConfigSet.ConfigSet.set_variant=Utils.nada
25Build.BuildContext.add_subdirs=Build.BuildContext.recurse
26Build.BuildContext.new_task_gen=Build.BuildContext.__call__
27Build.BuildContext.is_install=0
28Node.Node.relpath_gen=Node.Node.path_from
29Utils.pproc=Utils.subprocess
30Utils.get_term_cols=Logs.get_term_cols
31def 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
55Utils.cmd_output=cmd_output
56def name_to_obj(self,s,env=None):
57        if Logs.verbose:
58                Logs.warn('compat: change "name_to_obj(name, env)" by "get_tgen_by_name(name)"')
59        return self.get_tgen_by_name(s)
60Build.BuildContext.name_to_obj=name_to_obj
61def env_of_name(self,name):
62        try:
63                return self.all_envs[name]
64        except KeyError:
65                Logs.error('no such environment: '+name)
66                return None
67Build.BuildContext.env_of_name=env_of_name
68def set_env_name(self,name,env):
69        self.all_envs[name]=env
70        return env
71Configure.ConfigurationContext.set_env_name=set_env_name
72def retrieve(self,name,fromenv=None):
73        try:
74                env=self.all_envs[name]
75        except KeyError:
76                env=ConfigSet.ConfigSet()
77                self.prepare_env(env)
78                self.all_envs[name]=env
79        else:
80                if fromenv:
81                        Logs.warn("The environment %s may have been configured already"%name)
82        return env
83Configure.ConfigurationContext.retrieve=retrieve
84Configure.ConfigurationContext.sub_config=Configure.ConfigurationContext.recurse
85Configure.ConfigurationContext.check_tool=Configure.ConfigurationContext.load
86Configure.conftest=Configure.conf
87Configure.ConfigurationError=Errors.ConfigurationError
88Utils.WafError=Errors.WafError
89Options.OptionsContext.sub_options=Options.OptionsContext.recurse
90Options.OptionsContext.tool_options=Context.Context.load
91Options.Handler=Options.OptionsContext
92Task.simple_task_type=Task.task_type_from_func=Task.task_factory
93Task.TaskBase.classes=Task.classes
94def setitem(self,key,value):
95        if key.startswith('CCFLAGS'):
96                key=key[1:]
97        self.table[key]=value
98ConfigSet.ConfigSet.__setitem__=setitem
99@TaskGen.feature('d')
100@TaskGen.before('apply_incpaths')
101def old_importpaths(self):
102        if getattr(self,'importpaths',[]):
103                self.includes=self.importpaths
104from waflib import Context
105eld=Context.load_tool
106def load_tool(*k,**kw):
107        ret=eld(*k,**kw)
108        if'set_options'in ret.__dict__:
109                if Logs.verbose:
110                        Logs.warn('compat: rename "set_options" to options')
111                ret.options=ret.set_options
112        if'detect'in ret.__dict__:
113                if Logs.verbose:
114                        Logs.warn('compat: rename "detect" to "configure"')
115                ret.configure=ret.detect
116        return ret
117Context.load_tool=load_tool
118def get_curdir(self):
119        return self.path.abspath()
120Context.Context.curdir=property(get_curdir,Utils.nada)
121rev=Context.load_module
122def load_module(path,encoding=None):
123        ret=rev(path,encoding)
124        if'set_options'in ret.__dict__:
125                if Logs.verbose:
126                        Logs.warn('compat: rename "set_options" to "options" (%r)'%path)
127                ret.options=ret.set_options
128        if'srcdir'in ret.__dict__:
129                if Logs.verbose:
130                        Logs.warn('compat: rename "srcdir" to "top" (%r)'%path)
131                ret.top=ret.srcdir
132        if'blddir'in ret.__dict__:
133                if Logs.verbose:
134                        Logs.warn('compat: rename "blddir" to "out" (%r)'%path)
135                ret.out=ret.blddir
136        return ret
137Context.load_module=load_module
138old_post=TaskGen.task_gen.post
139def post(self):
140        self.features=self.to_list(self.features)
141        if'cc'in self.features:
142                if Logs.verbose:
143                        Logs.warn('compat: the feature cc does not exist anymore (use "c")')
144                self.features.remove('cc')
145                self.features.append('c')
146        if'cstaticlib'in self.features:
147                if Logs.verbose:
148                        Logs.warn('compat: the feature cstaticlib does not exist anymore (use "cstlib" or "cxxstlib")')
149                self.features.remove('cstaticlib')
150                self.features.append(('cxx'in self.features)and'cxxstlib'or'cstlib')
151        if getattr(self,'ccflags',None):
152                if Logs.verbose:
153                        Logs.warn('compat: "ccflags" was renamed to "cflags"')
154                self.cflags=self.ccflags
155        return old_post(self)
156TaskGen.task_gen.post=post
157def waf_version(*k,**kw):
158        Logs.warn('wrong version (waf_version was removed in waf 1.6)')
159Utils.waf_version=waf_version
160import os
161@TaskGen.feature('c','cxx','d')
162@TaskGen.before('apply_incpaths','propagate_uselib_vars')
163@TaskGen.after('apply_link','process_source')
164def apply_uselib_local(self):
165        env=self.env
166        from waflib.Tools.ccroot import stlink_task
167        self.uselib=self.to_list(getattr(self,'uselib',[]))
168        self.includes=self.to_list(getattr(self,'includes',[]))
169        names=self.to_list(getattr(self,'uselib_local',[]))
170        get=self.bld.get_tgen_by_name
171        seen=set([])
172        seen_uselib=set([])
173        tmp=Utils.deque(names)
174        if tmp:
175                if Logs.verbose:
176                        Logs.warn('compat: "uselib_local" is deprecated, replace by "use"')
177        while tmp:
178                lib_name=tmp.popleft()
179                if lib_name in seen:
180                        continue
181                y=get(lib_name)
182                y.post()
183                seen.add(lib_name)
184                if getattr(y,'uselib_local',None):
185                        for x in self.to_list(getattr(y,'uselib_local',[])):
186                                obj=get(x)
187                                obj.post()
188                                if getattr(obj,'link_task',None):
189                                        if not isinstance(obj.link_task,stlink_task):
190                                                tmp.append(x)
191                if getattr(y,'link_task',None):
192                        link_name=y.target[y.target.rfind(os.sep)+1:]
193                        if isinstance(y.link_task,stlink_task):
194                                env.append_value('STLIB',[link_name])
195                        else:
196                                env.append_value('LIB',[link_name])
197                        self.link_task.set_run_after(y.link_task)
198                        self.link_task.dep_nodes+=y.link_task.outputs
199                        tmp_path=y.link_task.outputs[0].parent.bldpath()
200                        if not tmp_path in env['LIBPATH']:
201                                env.prepend_value('LIBPATH',[tmp_path])
202                for v in self.to_list(getattr(y,'uselib',[])):
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)
208                if getattr(y,'export_includes',None):
209                        self.includes.extend(y.to_incnodes(y.export_includes))
210@TaskGen.feature('cprogram','cxxprogram','cstlib','cxxstlib','cshlib','cxxshlib','dprogram','dstlib','dshlib')
211@TaskGen.after('apply_link')
212def apply_objdeps(self):
213        names=getattr(self,'add_objects',[])
214        if not names:
215                return
216        names=self.to_list(names)
217        get=self.bld.get_tgen_by_name
218        seen=[]
219        while names:
220                x=names[0]
221                if x in seen:
222                        names=names[1:]
223                        continue
224                y=get(x)
225                if getattr(y,'add_objects',None):
226                        added=0
227                        lst=y.to_list(y.add_objects)
228                        lst.reverse()
229                        for u in lst:
230                                if u in seen:continue
231                                added=1
232                                names=[u]+names
233                        if added:continue
234                y.post()
235                seen.append(x)
236                for t in getattr(y,'compiled_tasks',[]):
237                        self.link_task.inputs.extend(t.outputs)
238@TaskGen.after('apply_link')
239def process_obj_files(self):
240        if not hasattr(self,'obj_files'):
241                return
242        for x in self.obj_files:
243                node=self.path.find_resource(x)
244                self.link_task.inputs.append(node)
245@TaskGen.taskgen_method
246def add_obj_file(self,file):
247        if not hasattr(self,'obj_files'):self.obj_files=[]
248        if not'process_obj_files'in self.meths:self.meths.append('process_obj_files')
249        self.obj_files.append(file)
250old_define=Configure.ConfigurationContext.__dict__['define']
251@Configure.conf
252def define(self,key,val,quote=True):
253        old_define(self,key,val,quote)
254        if key.startswith('HAVE_'):
255                self.env[key]=1
256old_undefine=Configure.ConfigurationContext.__dict__['undefine']
257@Configure.conf
258def undefine(self,key):
259        old_undefine(self,key)
260        if key.startswith('HAVE_'):
261                self.env[key]=0
262def set_incdirs(self,val):
263        Logs.warn('compat: change "export_incdirs" by "export_includes"')
264        self.export_includes=val
265TaskGen.task_gen.export_incdirs=property(None,set_incdirs)
266def 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
279Build.BuildContext.install_dir=install_dir
Note: See TracBrowser for help on using the repository browser.