Commit fc696a9f authored by Hilton Bristow's avatar Hilton Bristow

Improved standalone importing behaviour and creation of nested directories

parent 6f190bb9
#!/usr/bin/env python
import sys, re, os, time
from string import Template
from parse_tree import ParseTree, todict, constants
from filters import *
class MatlabWrapperGenerator(object):
"""
......@@ -22,9 +26,14 @@ class MatlabWrapperGenerator(object):
The output_dir specifies the directory to write the generated sources
to.
"""
# dynamically import the parsers
from jinja2 import Environment, FileSystemLoader
import hdr_parser
import rst_parser
# parse each of the files and store in a dictionary
# as a separate "namespace"
parser = CppHeaderParser()
parser = hdr_parser.CppHeaderParser()
rst = rst_parser.RstParser(parser)
rst_parser.verbose = False
rst_parser.show_warnings = False
......@@ -91,13 +100,13 @@ class MatlabWrapperGenerator(object):
output_class_dir = output_dir+'/+cv'
output_map_dir = output_dir+'/map'
if not os.path.isdir(output_source_dir):
os.mkdir(output_source_dir)
os.makedirs(output_source_dir)
if not os.path.isdir(output_private_dir):
os.mkdir(output_private_dir)
os.makedirs(output_private_dir)
if not os.path.isdir(output_class_dir):
os.mkdir(output_class_dir)
os.makedirs(output_class_dir)
if not os.path.isdir(output_map_dir):
os.mkdir(output_map_dir)
os.makedirs(output_map_dir)
# populate templates
for namespace in parse_tree.namespaces:
......@@ -168,7 +177,6 @@ if __name__ == "__main__":
"""
# parse the input options
import sys, re, os, time
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('--jinja2')
......@@ -185,13 +193,6 @@ if __name__ == "__main__":
sys.path.append(args.hdrparser)
sys.path.append(args.rstparser)
from string import Template
from hdr_parser import CppHeaderParser
import rst_parser
from parse_tree import ParseTree, todict, constants
from filters import *
from jinja2 import Environment, FileSystemLoader
# create the generator
mwg = MatlabWrapperGenerator()
mwg.gen(args.moduleroot, args.modules, args.extra, args.outdir)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment