Esempio n. 1
0
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
Esempio n. 2
0
 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]
Esempio n. 3
0
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 >> open(outfile, 'w'), result
Esempio n. 4
0
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'))
Esempio n. 5
0
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
Esempio n. 6
0
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)
Esempio n. 7
0
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)
Esempio n. 8
0
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'))
Esempio n. 9
0
 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)
Esempio n. 10
0
 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)        
Esempio n. 11
0
 def load():
     for d in directives.load(parm.strip()+'.derived'):
         if d.name not in ('noinherit', 'import'):
             yield d
Esempio n. 12
0
 def load():
     for d in directives.load(
             os.path.join(scriptdir,
                          parm.strip() + '.derived')):
         if d.name not in ('noinherit', 'import'):
             yield d
Esempio n. 13
0
 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)
Esempio n. 14
0
 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]
Esempio n. 15
0
 def load():
     for d in directives.load(parm.strip() + ".derived"):
         if d.name not in ("noinherit", "import"):
             yield d
Esempio n. 16
0
 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]
Esempio n. 17
0
 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)        
Esempio n. 18
0
 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)