Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
fc696a9f
Commit
fc696a9f
authored
Mar 27, 2014
by
Hilton Bristow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved standalone importing behaviour and creation of nested directories
parent
6f190bb9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
13 deletions
+14
-13
gen_matlab.py
modules/matlab/generator/gen_matlab.py
+14
-13
No files found.
modules/matlab/generator/gen_matlab.py
View file @
fc696a9f
#!/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
.
m
kdir
(
output_source_dir
)
os
.
m
akedirs
(
output_source_dir
)
if
not
os
.
path
.
isdir
(
output_private_dir
):
os
.
m
kdir
(
output_private_dir
)
os
.
m
akedirs
(
output_private_dir
)
if
not
os
.
path
.
isdir
(
output_class_dir
):
os
.
m
kdir
(
output_class_dir
)
os
.
m
akedirs
(
output_class_dir
)
if
not
os
.
path
.
isdir
(
output_map_dir
):
os
.
m
kdir
(
output_map_dir
)
os
.
m
akedirs
(
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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment