Пример #1
0
def processFile(attrs) :
    # dynamically load (and execute) the generator module
    absPyPath = attrs['generator']
    input = attrs['in']
    out_src = attrs['out_src']
    out_hdr = attrs['out_hdr']
    if 'args' in attrs :
        args = attrs['args']
    else :
        args = None
    if 'env' in attrs :
        env = attrs['env']
    else :
        env = None
    genutil.setEnv(env)
    path, script = os.path.split(absPyPath)
    sys.path.insert(0, path)
    moduleName, ext = os.path.splitext(script)
    if is_python3:
        module = importlib.import_module(moduleName)
    else:
        # FIXME PYTHON2
        fp, pathname, description = imp.find_module(moduleName)
        module = imp.load_module(moduleName, fp, pathname, description)
    if args :
        module.generate(input, out_src, out_hdr, args)
    else :
        module.generate(input, out_src, out_hdr)
Пример #2
0
def processFile(attrs) :
    # dynamically load (and execute) the generator module
    absPyPath = attrs['generator']
    input = attrs['in']
    out_src = attrs['out_src']
    out_hdr = attrs['out_hdr']
    if 'args' in attrs :
        args = attrs['args']
    else :
        args = None
    if 'env' in attrs :
        env = attrs['env']
    else :
        env = None
    genutil.setEnv(env)
    path, script = os.path.split(absPyPath)
    sys.path.insert(0, path)
    moduleName, ext = os.path.splitext(script)
    fp, pathname, description = imp.find_module(moduleName)
    module = imp.load_module(moduleName, fp, pathname, description)
    if args :
        module.generate(input, out_src, out_hdr, args)
    else :
        module.generate(input, out_src, out_hdr)