Python waflib.ConfigSet.ConfigSet() Examples
The following are 30
code examples of waflib.ConfigSet.ConfigSet().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
waflib.ConfigSet
, or try the search function
.
Example #1
Source File: Build.py From royal-chaos with MIT License | 6 votes |
def restore(self): try: env=ConfigSet.ConfigSet(os.path.join(self.cache_dir,'build.config.py')) except EnvironmentError: pass else: if env['version']<Context.HEXVERSION: raise Errors.WafError('Version mismatch! reconfigure the project') for t in env['tools']: self.setup(**t) dbfn=os.path.join(self.variant_dir,Context.DBFILE) try: data=Utils.readf(dbfn,'rb') except(IOError,EOFError): Logs.debug('build: Could not load the build cache %s (missing)'%dbfn) else: try: waflib.Node.pickle_lock.acquire() waflib.Node.Nod3=self.node_class try: data=cPickle.loads(data) except Exception ,e: Logs.debug('build: Could not pickle the build cache %s: %r'%(dbfn,e)) else:
Example #2
Source File: TaskGen.py From royal-chaos with MIT License | 6 votes |
def __init__(self,*k,**kw): self.source='' self.target='' self.meths=[] self.prec=Utils.defaultdict(list) self.mappings={} self.features=[] self.tasks=[] if not'bld'in kw: self.env=ConfigSet.ConfigSet() self.idx=0 self.path=None else: self.bld=kw['bld'] self.env=self.bld.env.derive() self.path=self.bld.path try: self.idx=self.bld.idx[id(self.path)]=self.bld.idx.get(id(self.path),0)+1 except AttributeError: self.bld.idx={} self.idx=self.bld.idx[id(self.path)]=1 for key,val in kw.items(): setattr(self,key,val)
Example #3
Source File: TaskGen.py From 802.11ah-ns3 with GNU General Public License v2.0 | 6 votes |
def __init__(self,*k,**kw): self.source='' self.target='' self.meths=[] self.prec=Utils.defaultdict(list) self.mappings={} self.features=[] self.tasks=[] if not'bld'in kw: self.env=ConfigSet.ConfigSet() self.idx=0 self.path=None else: self.bld=kw['bld'] self.env=self.bld.env.derive() self.path=self.bld.path try: self.idx=self.bld.idx[id(self.path)]=self.bld.idx.get(id(self.path),0)+1 except AttributeError: self.bld.idx={} self.idx=self.bld.idx[id(self.path)]=1 for key,val in kw.items(): setattr(self,key,val)
Example #4
Source File: Build.py From 802.11ah-ns3 with GNU General Public License v2.0 | 6 votes |
def restore(self): try: env=ConfigSet.ConfigSet(os.path.join(self.cache_dir,'build.config.py')) except EnvironmentError: pass else: if env['version']<Context.HEXVERSION: raise Errors.WafError('Version mismatch! reconfigure the project') for t in env['tools']: self.setup(**t) dbfn=os.path.join(self.variant_dir,Context.DBFILE) try: data=Utils.readf(dbfn,'rb') except(IOError,EOFError): Logs.debug('build: Could not load the build cache %s (missing)'%dbfn) else: try: waflib.Node.pickle_lock.acquire() waflib.Node.Nod3=self.node_class try: data=cPickle.loads(data) except Exception ,e: Logs.debug('build: Could not pickle the build cache %s: %r'%(dbfn,e)) else:
Example #5
Source File: relocation.py From ns-3-dev-git with GNU General Public License v2.0 | 5 votes |
def store(self): old1(self) db = os.path.join(self.variant_dir, EXTRA_LOCK) env = ConfigSet.ConfigSet() env.SRCDIR = self.srcnode.abspath() env.store(db)
Example #6
Source File: Scripting.py From royal-chaos with MIT License | 5 votes |
def distclean(ctx): '''removes the build directory''' lst=os.listdir('.') for f in lst: if f==Options.lockfile: try: proj=ConfigSet.ConfigSet(f) except IOError: Logs.warn('Could not read %r'%f) continue if proj['out_dir']!=proj['top_dir']: try: shutil.rmtree(proj['out_dir']) except IOError: pass except OSError ,e: if e.errno!=errno.ENOENT: Logs.warn('Could not remove %r'%proj['out_dir']) else: distclean_dir(proj['out_dir']) for k in(proj['out_dir'],proj['top_dir'],proj['run_dir']): p=os.path.join(k,Options.lockfile) try: os.remove(p) except OSError ,e: if e.errno!=errno.ENOENT: Logs.warn('Could not remove %r'%p)
Example #7
Source File: Scripting.py From royal-chaos with MIT License | 5 votes |
def autoconfigure(execute_method): def execute(self): if not Configure.autoconfig: return execute_method(self) env=ConfigSet.ConfigSet() do_config=False try: env.load(os.path.join(Context.top_dir,Options.lockfile)) except Exception: Logs.warn('Configuring the project') do_config=True else: if env.run_dir!=Context.run_dir: do_config=True else: h=0 for f in env['files']: h=Utils.h_list((h,Utils.readf(f,'rb'))) do_config=h!=env.hash if do_config: Options.commands.insert(0,self.cmd) Options.commands.insert(0,'configure') if Configure.autoconfig=='clobber': Options.options.__dict__=env.options return return execute_method(self) return execute
Example #8
Source File: compat15.py From royal-chaos with MIT License | 5 votes |
def retrieve(self,name,fromenv=None): try: env=self.all_envs[name] except KeyError: env=ConfigSet.ConfigSet() self.prepare_env(env) self.all_envs[name]=env else: if fromenv: Logs.warn("The environment %s may have been configured already"%name) return env
Example #9
Source File: relocation.py From royal-chaos with MIT License | 5 votes |
def store(self): old1(self) db = os.path.join(self.variant_dir, EXTRA_LOCK) env = ConfigSet.ConfigSet() env.SRCDIR = self.srcnode.abspath() env.store(db)
Example #10
Source File: relocation.py From royal-chaos with MIT License | 5 votes |
def init_dirs(self): if not (os.path.isabs(self.top_dir) and os.path.isabs(self.out_dir)): raise Errors.WafError('The project was not configured: run "waf configure" first!') srcdir = None db = os.path.join(self.variant_dir, EXTRA_LOCK) env = ConfigSet.ConfigSet() try: env.load(db) srcdir = env.SRCDIR except: pass if srcdir: d = self.root.find_node(srcdir) if d and srcdir != self.top_dir and getattr(d, 'children', ''): srcnode = self.root.make_node(self.top_dir) print(("relocating the source directory %r -> %r" % (srcdir, self.top_dir))) srcnode.children = {} for (k, v) in list(d.children.items()): srcnode.children[k] = v v.parent = srcnode d.children = {} old2(self)
Example #11
Source File: Configure.py From royal-chaos with MIT License | 5 votes |
def execute(self): self.init_dirs() self.cachedir=self.bldnode.make_node(Build.CACHE_DIR) self.cachedir.mkdir() path=os.path.join(self.bldnode.abspath(),WAF_CONFIG_LOG) self.logger=Logs.make_logger(path,'cfg') app=getattr(Context.g_module,'APPNAME','') if app: ver=getattr(Context.g_module,'VERSION','') if ver: app="%s (%s)"%(app,ver) params={'now':time.ctime(),'pyver':sys.hexversion,'systype':sys.platform,'args':" ".join(sys.argv),'wafver':Context.WAFVERSION,'abi':Context.ABI,'app':app} self.to_log(conf_template%params) self.msg('Setting top to',self.srcnode.abspath()) self.msg('Setting out to',self.bldnode.abspath()) if id(self.srcnode)==id(self.bldnode): Logs.warn('Setting top == out (remember to use "update_outputs")') elif id(self.path)!=id(self.srcnode): if self.srcnode.is_child_of(self.path): Logs.warn('Are you certain that you do not want to set top="." ?') super(ConfigurationContext,self).execute() self.store() Context.top_dir=self.srcnode.abspath() Context.out_dir=self.bldnode.abspath() env=ConfigSet.ConfigSet() env['argv']=sys.argv env['options']=Options.options.__dict__ env.run_dir=Context.run_dir env.top_dir=Context.top_dir env.out_dir=Context.out_dir env['hash']=self.hash env['files']=self.files env['environ']=dict(self.environ) if not self.env.NO_LOCK_IN_RUN and not getattr(Options.options,'no_lock_in_run'): env.store(os.path.join(Context.run_dir,Options.lockfile)) if not self.env.NO_LOCK_IN_TOP and not getattr(Options.options,'no_lock_in_top'): env.store(os.path.join(Context.top_dir,Options.lockfile)) if not self.env.NO_LOCK_IN_OUT and not getattr(Options.options,'no_lock_in_out'): env.store(os.path.join(Context.out_dir,Options.lockfile))
Example #12
Source File: relocation.py From ns-3-dev-git with GNU General Public License v2.0 | 5 votes |
def init_dirs(self): if not (os.path.isabs(self.top_dir) and os.path.isabs(self.out_dir)): raise Errors.WafError('The project was not configured: run "waf configure" first!') srcdir = None db = os.path.join(self.variant_dir, EXTRA_LOCK) env = ConfigSet.ConfigSet() try: env.load(db) srcdir = env.SRCDIR except: pass if srcdir: d = self.root.find_node(srcdir) if d and srcdir != self.top_dir and getattr(d, 'children', ''): srcnode = self.root.make_node(self.top_dir) print(("relocating the source directory %r -> %r" % (srcdir, self.top_dir))) srcnode.children = {} for (k, v) in list(d.children.items()): srcnode.children[k] = v v.parent = srcnode d.children = {} old2(self)
Example #13
Source File: relocation.py From CRE-NS3 with GNU General Public License v2.0 | 5 votes |
def store(self): old1(self) db = os.path.join(self.variant_dir, EXTRA_LOCK) env = ConfigSet.ConfigSet() env.SRCDIR = self.srcnode.abspath() env.store(db)
Example #14
Source File: relocation.py From CRE-NS3 with GNU General Public License v2.0 | 5 votes |
def init_dirs(self): if not (os.path.isabs(self.top_dir) and os.path.isabs(self.out_dir)): raise Errors.WafError('The project was not configured: run "waf configure" first!') srcdir = None db = os.path.join(self.variant_dir, EXTRA_LOCK) env = ConfigSet.ConfigSet() try: env.load(db) srcdir = env.SRCDIR except: pass if srcdir: d = self.root.find_node(srcdir) if d and srcdir != self.top_dir and getattr(d, 'children', ''): srcnode = self.root.make_node(self.top_dir) print("relocating the source directory %r -> %r" % (srcdir, self.top_dir)) srcnode.children = {} for (k, v) in d.children.items(): srcnode.children[k] = v v.parent = srcnode d.children = {} old2(self)
Example #15
Source File: relocation.py From ns3-ecn-sharp with GNU General Public License v2.0 | 5 votes |
def store(self): old1(self) db = os.path.join(self.variant_dir, EXTRA_LOCK) env = ConfigSet.ConfigSet() env.SRCDIR = self.srcnode.abspath() env.store(db)
Example #16
Source File: relocation.py From ns3-ecn-sharp with GNU General Public License v2.0 | 5 votes |
def init_dirs(self): if not (os.path.isabs(self.top_dir) and os.path.isabs(self.out_dir)): raise Errors.WafError('The project was not configured: run "waf configure" first!') srcdir = None db = os.path.join(self.variant_dir, EXTRA_LOCK) env = ConfigSet.ConfigSet() try: env.load(db) srcdir = env.SRCDIR except: pass if srcdir: d = self.root.find_node(srcdir) if d and srcdir != self.top_dir and getattr(d, 'children', ''): srcnode = self.root.make_node(self.top_dir) print(("relocating the source directory %r -> %r" % (srcdir, self.top_dir))) srcnode.children = {} for (k, v) in list(d.children.items()): srcnode.children[k] = v v.parent = srcnode d.children = {} old2(self)
Example #17
Source File: relocation.py From ns3-802.11ad with GNU General Public License v2.0 | 5 votes |
def store(self): old1(self) db = os.path.join(self.variant_dir, EXTRA_LOCK) env = ConfigSet.ConfigSet() env.SRCDIR = self.srcnode.abspath() env.store(db)
Example #18
Source File: relocation.py From ns3-802.11ad with GNU General Public License v2.0 | 5 votes |
def init_dirs(self): if not (os.path.isabs(self.top_dir) and os.path.isabs(self.out_dir)): raise Errors.WafError('The project was not configured: run "waf configure" first!') srcdir = None db = os.path.join(self.variant_dir, EXTRA_LOCK) env = ConfigSet.ConfigSet() try: env.load(db) srcdir = env.SRCDIR except: pass if srcdir: d = self.root.find_node(srcdir) if d and srcdir != self.top_dir and getattr(d, 'children', ''): srcnode = self.root.make_node(self.top_dir) print(("relocating the source directory %r -> %r" % (srcdir, self.top_dir))) srcnode.children = {} for (k, v) in list(d.children.items()): srcnode.children[k] = v v.parent = srcnode d.children = {} old2(self)
Example #19
Source File: relocation.py From Tocino with GNU General Public License v2.0 | 5 votes |
def store(self): old1(self) db = os.path.join(self.variant_dir, EXTRA_LOCK) env = ConfigSet.ConfigSet() env.SRCDIR = self.srcnode.abspath() env.store(db)
Example #20
Source File: relocation.py From Tocino with GNU General Public License v2.0 | 5 votes |
def init_dirs(self): if not (os.path.isabs(self.top_dir) and os.path.isabs(self.out_dir)): raise Errors.WafError('The project was not configured: run "waf configure" first!') srcdir = None db = os.path.join(self.variant_dir, EXTRA_LOCK) env = ConfigSet.ConfigSet() try: env.load(db) srcdir = env.SRCDIR except: pass if srcdir: d = self.root.find_node(srcdir) if d and srcdir != self.top_dir and getattr(d, 'children', ''): srcnode = self.root.make_node(self.top_dir) print("relocating the source directory %r -> %r" % (srcdir, self.top_dir)) srcnode.children = {} for (k, v) in d.children.items(): srcnode.children[k] = v v.parent = srcnode d.children = {} old2(self)
Example #21
Source File: Scripting.py From 802.11ah-ns3 with GNU General Public License v2.0 | 5 votes |
def distclean(ctx): '''removes the build directory''' lst=os.listdir('.') for f in lst: if f==Options.lockfile: try: proj=ConfigSet.ConfigSet(f) except IOError: Logs.warn('Could not read %r'%f) continue if proj['out_dir']!=proj['top_dir']: try: shutil.rmtree(proj['out_dir']) except IOError: pass except OSError ,e: if e.errno!=errno.ENOENT: Logs.warn('Could not remove %r'%proj['out_dir']) else: distclean_dir(proj['out_dir']) for k in(proj['out_dir'],proj['top_dir'],proj['run_dir']): p=os.path.join(k,Options.lockfile) try: os.remove(p) except OSError ,e: if e.errno!=errno.ENOENT: Logs.warn('Could not remove %r'%p)
Example #22
Source File: relocation.py From ntu-dsi-dcn with GNU General Public License v2.0 | 5 votes |
def init_dirs(self): if not (os.path.isabs(self.top_dir) and os.path.isabs(self.out_dir)): raise Errors.WafError('The project was not configured: run "waf configure" first!') srcdir = None db = os.path.join(self.variant_dir, EXTRA_LOCK) env = ConfigSet.ConfigSet() try: env.load(db) srcdir = env.SRCDIR except: pass if srcdir: d = self.root.find_node(srcdir) if d and srcdir != self.top_dir and getattr(d, 'children', ''): srcnode = self.root.make_node(self.top_dir) print("relocating the source directory %r -> %r" % (srcdir, self.top_dir)) srcnode.children = {} for (k, v) in d.children.items(): srcnode.children[k] = v v.parent = srcnode d.children = {} old2(self)
Example #23
Source File: relocation.py From IEEE-802.11ah-ns-3 with GNU General Public License v2.0 | 5 votes |
def store(self): old1(self) db = os.path.join(self.variant_dir, EXTRA_LOCK) env = ConfigSet.ConfigSet() env.SRCDIR = self.srcnode.abspath() env.store(db)
Example #24
Source File: relocation.py From IEEE-802.11ah-ns-3 with GNU General Public License v2.0 | 5 votes |
def init_dirs(self): if not (os.path.isabs(self.top_dir) and os.path.isabs(self.out_dir)): raise Errors.WafError('The project was not configured: run "waf configure" first!') srcdir = None db = os.path.join(self.variant_dir, EXTRA_LOCK) env = ConfigSet.ConfigSet() try: env.load(db) srcdir = env.SRCDIR except: pass if srcdir: d = self.root.find_node(srcdir) if d and srcdir != self.top_dir and getattr(d, 'children', ''): srcnode = self.root.make_node(self.top_dir) print(("relocating the source directory %r -> %r" % (srcdir, self.top_dir))) srcnode.children = {} for (k, v) in list(d.children.items()): srcnode.children[k] = v v.parent = srcnode d.children = {} old2(self)
Example #25
Source File: relocation.py From ns3-load-balance with GNU General Public License v2.0 | 5 votes |
def store(self): old1(self) db = os.path.join(self.variant_dir, EXTRA_LOCK) env = ConfigSet.ConfigSet() env.SRCDIR = self.srcnode.abspath() env.store(db)
Example #26
Source File: relocation.py From ns3-load-balance with GNU General Public License v2.0 | 5 votes |
def init_dirs(self): if not (os.path.isabs(self.top_dir) and os.path.isabs(self.out_dir)): raise Errors.WafError('The project was not configured: run "waf configure" first!') srcdir = None db = os.path.join(self.variant_dir, EXTRA_LOCK) env = ConfigSet.ConfigSet() try: env.load(db) srcdir = env.SRCDIR except: pass if srcdir: d = self.root.find_node(srcdir) if d and srcdir != self.top_dir and getattr(d, 'children', ''): srcnode = self.root.make_node(self.top_dir) print(("relocating the source directory %r -> %r" % (srcdir, self.top_dir))) srcnode.children = {} for (k, v) in list(d.children.items()): srcnode.children[k] = v v.parent = srcnode d.children = {} old2(self)
Example #27
Source File: Configure.py From 802.11ah-ns3 with GNU General Public License v2.0 | 5 votes |
def setenv(self,name,env=None): if name not in self.all_envs or env: if not env: env=ConfigSet.ConfigSet() self.prepare_env(env) else: env=env.derive() self.all_envs[name]=env self.variant=name
Example #28
Source File: Scripting.py From 802.11ah-ns3 with GNU General Public License v2.0 | 5 votes |
def autoconfigure(execute_method): def execute(self): if not Configure.autoconfig: return execute_method(self) env=ConfigSet.ConfigSet() do_config=False try: env.load(os.path.join(Context.top_dir,Options.lockfile)) except Exception: Logs.warn('Configuring the project') do_config=True else: if env.run_dir!=Context.run_dir: do_config=True else: h=0 for f in env['files']: h=Utils.h_list((h,Utils.readf(f,'rb'))) do_config=h!=env.hash if do_config: Options.commands.insert(0,self.cmd) Options.commands.insert(0,'configure') if Configure.autoconfig=='clobber': Options.options.__dict__=env.options return return execute_method(self) return execute
Example #29
Source File: compat15.py From 802.11ah-ns3 with GNU General Public License v2.0 | 5 votes |
def retrieve(self,name,fromenv=None): try: env=self.all_envs[name] except KeyError: env=ConfigSet.ConfigSet() self.prepare_env(env) self.all_envs[name]=env else: if fromenv: Logs.warn("The environment %s may have been configured already"%name) return env
Example #30
Source File: relocation.py From 802.11ah-ns3 with GNU General Public License v2.0 | 5 votes |
def store(self): old1(self) db = os.path.join(self.variant_dir, EXTRA_LOCK) env = ConfigSet.ConfigSet() env.SRCDIR = self.srcnode.abspath() env.store(db)