Update generator.py

This commit is contained in:
dekerr 2018-06-12 23:51:46 -04:00 committed by Willem Melching
parent 031acc58e0
commit d86d7f1ffb
1 changed files with 32 additions and 29 deletions

View File

@ -6,22 +6,7 @@ def read_dbc(filename):
with open(os.path.join(dir_name, filename), 'r') as file_in:
return file_in.read()
cur_path = os.path.dirname(os.path.realpath(__file__))
generator_path = os.path.join(cur_path, '../')
include_pattern = re.compile(r'CM_ "IMPORT (.*?)"')
for dir_name, _, filenames in os.walk(cur_path):
if dir_name == cur_path:
continue
print dir_name
for filename in filenames:
if filename.startswith('_'):
continue
print filename
def create_dbc(filename):
dbc_file_in = read_dbc(filename)
includes = include_pattern.findall(dbc_file_in)
@ -47,3 +32,21 @@ for dir_name, _, filenames in os.walk(cur_path):
core_dbc = include_pattern.sub('', dbc_file_in)
dbc_file_out.write(core_dbc)
cur_path = os.path.dirname(os.path.realpath(__file__))
generator_path = os.path.join(cur_path, '../')
include_pattern = re.compile(r'CM_ "IMPORT (.*?)"')
for dir_name, _, filenames in os.walk(cur_path):
if dir_name == cur_path:
continue
print dir_name
for filename in filenames:
if filename.startswith('_'):
continue
print filename
create_dbc(filename)