Exemplo 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
Exemplo 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]
Exemplo 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()
    print >> open(outfile, 'w'), result
Exemplo 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'))
Exemplo 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)
    print >> open(outfile, 'w'), result
Exemplo n.º 6
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
Exemplo n.º 7
0
    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)
Exemplo n.º 8
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)
Exemplo n.º 9
0
    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)
Exemplo n.º 10
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)
Exemplo n.º 11
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'))
Exemplo n.º 12
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)
Exemplo n.º 13
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)        
Exemplo n.º 14
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)
Exemplo n.º 15
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]
Exemplo 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]
Exemplo 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)        
Exemplo 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)