def process(fn, outfile, lazy=False): if lazy and os.stat(fn).st_mtime < os.stat(outfile).st_mtime: return print 'Processing %s into %s' % (fn, outfile) gen = Gen() directives.execute(directives.load(fn),gen) result = gen.generate() print >> open(outfile, 'w'), result
def get_aux(self, name): if self.auxiliary is None: aux_gen = Gen(priority_order=['require', 'define']) directives.execute( directives.load(os.path.join(scriptdir, 'gderived-defs')), aux_gen) self.auxiliary = aux_gen.global_bindings return self.auxiliary[name]
def process(fn, outfile, lazy=False): if lazy and os.stat(fn).st_mtime < os.stat(outfile).st_mtime: return print 'Processing %s into %s' % (fn, outfile) gen = Gen() directives.execute(directives.load(fn), gen) result = gen.generate() print >> open(outfile, 'w'), result
def process(fn, outfile, lazy=False): if lazy and os.stat(fn).st_mtime < os.stat(outfile).st_mtime: return print('Processing %s into %s' % (fn, outfile)) gen = Gen() directives.execute(directives.load(fn),gen) result = gen.generate() result = hack_derived_header(outfile, result) print(result, file=open(outfile, 'w'))
def process(fn, outfile, lazy=False): if (lazy and os.path.exists(outfile) and os.stat(fn).st_mtime < os.stat(outfile).st_mtime): return print 'Processing %s into %s' % (fn, outfile) gen = Gen() directives.execute(directives.load(fn), gen) result = gen.generate() result = hack_derived_header(outfile, result) print >> open(outfile, 'w'), result
def process(fn, outfile, lazy=False): if lazy and os.path.exists(outfile) and os.stat(fn).st_mtime < os.stat(outfile).st_mtime: return print "Processing %s into %s" % (fn, outfile) gen = Gen() directives.execute(directives.load(fn), gen) result = gen.generate() result = hack_derived_header(outfile, result) result = add_imports(gen, outfile, result) print >> open(outfile, "w"), result
def dire_incl(self, name, parm, body): if body is not None: self.invalid(name, 'non-empty body') def load(): for d in directives.load(parm.strip()+'.derived'): if d.name not in ('noinherit', 'import'): yield d included_directives = list(load()) directives.execute(included_directives, self)
def process(fn, mergefile=None, lazy=False): if lazy and mergefile and os.stat(fn).st_mtime < os.stat(mergefile).st_mtime: return gen = Gen() directives.execute(directives.load(fn),gen) result = gen.generate() if mergefile is None: print result else: print 'Merging %s into %s' % (fn, mergefile) result = merge(mergefile, result)
def dire_incl(self, name, parm, body): if body is not None: self.invalid(name, "non-empty body") def load(): for d in directives.load(parm.strip() + ".derived"): if d.name not in ("noinherit", "import"): yield d included_directives = list(load()) directives.execute(included_directives, self)
def process(fn, mergefile=None, lazy=False): if lazy and mergefile and os.stat(fn).st_mtime < os.stat( mergefile).st_mtime: return gen = Gen() directives.execute(directives.load(fn), gen) result = gen.generate() if mergefile is None: print result else: print 'Merging %s into %s' % (fn, mergefile) result = merge(mergefile, result)
def process(fn, outfile, lazy=False): if (lazy and os.path.exists(outfile) and os.stat(fn).st_mtime < os.stat(outfile).st_mtime): print(outfile) return print('Processing %s into %s' % (fn, outfile)) gen = Gen() directives.execute(directives.load(fn), gen) result = gen.generate() result = hack_derived_header(outfile, result) result = add_imports(gen, outfile, result) if not os.path.exists(outfile): pathlib.Path(os.path.dirname(outfile)).mkdir(parents=True, exist_ok=True) print(result, file=open(outfile, 'w'))
def dire_incl(self,name,parm,body): if body is not None: self.invalid(name,'non-empty body') directives.execute(directives.load(parm.strip()+'.derived'),self)
def dire_require(self, name, parm, body): if body is not None: self.invalid('require', 'non-empty body') sub_gen = Gen(bindings=self.global_bindings, priority__order=['require', 'define']) directives.execute(directives.load(parm.strip()), sub_gen)
def dire_incl(self, name, parm, body): if body is not None: self.invalid(name, 'non-empty body') directives.execute(directives.load(parm.strip() + '.derived'), self)
def get_aux(self, name): if self.auxiliary is None: aux_gen = Gen(priority_order=["require", "define"]) directives.execute(directives.load(os.path.join(scriptdir, "gexpose-defs")), aux_gen) self.auxiliary = aux_gen.global_bindings return self.auxiliary[name]
def get_aux(self,name): if self.auxiliary is None: aux_gen = Gen(priority_order=['require','define']) directives.execute(directives.load(os.path.join(scriptdir,'gderived-defs')),aux_gen) self.auxiliary = aux_gen.global_bindings return self.auxiliary[name]
def dire_require(self,name,parm,body): if body is not None: self.invalid('require','non-empty body') sub_gen = Gen(bindings=self.global_bindings, priority__order=['require','define']) directives.execute(directives.load(parm.strip()),sub_gen)
def dire_incl(self, name, parm, body): if body is not None: self.invalid(name, "non-empty body") directives.execute(directives.load(parm.strip() + ".expose"), self)