mirror of https://github.com/VLSIDA/OpenRAM.git
made the add_db code much simpler
This commit is contained in:
parent
83e810f8b8
commit
c1770036ac
|
|
@ -14,36 +14,25 @@ def get_file_tree(path):
|
|||
|
||||
def parse_html(file, comment):
|
||||
start_tag = '<!--'+comment
|
||||
end_tag = '-->'
|
||||
end_tag = comment+'-->'
|
||||
|
||||
with open(file, 'r+') as f:
|
||||
with open(file, 'r') as f:
|
||||
|
||||
file_string = f.read()
|
||||
start_byte = file_string.find(start_tag)
|
||||
|
||||
while(start_byte != -1):
|
||||
f.seek(0)
|
||||
file_string = f.read()
|
||||
start_byte = file_string.find(start_tag)
|
||||
end_byte = file_string.find(end_tag) + start_byte + len(end_tag)
|
||||
|
||||
f.seek(start_byte)
|
||||
found = f.read(end_byte - start_byte)
|
||||
|
||||
file_string = "%s%s%s" % (
|
||||
file_string[:start_byte], found[len(start_tag):len(found)-len(end_tag)] , file_string[end_byte:])
|
||||
|
||||
f.seek(0)
|
||||
f.write(file_string)
|
||||
start_byte = file_string.find(start_tag)
|
||||
end_byte = file_string.find(end_tag) + start_byte + len(end_tag)
|
||||
with open(file, 'w') as f:
|
||||
|
||||
file_string = file_string.replace(start_tag,"")
|
||||
file_string = file_string.replace(end_tag,"")
|
||||
|
||||
f.write(file_string)
|
||||
|
||||
def uncomment(comments):
|
||||
comment_files = []
|
||||
for datasheet in datasheet_list:
|
||||
for comment in comments:
|
||||
if glob.glob(os.path.dirname(datasheet)+'/*' + comment):
|
||||
comment_files = list(Path(os.path.dirname(datasheet)).rglob('*'+comment))
|
||||
for comment_file in comment_files:
|
||||
parse_html(datasheet, comment)
|
||||
parse_html(datasheet, comment)
|
||||
|
||||
datasheet_list = get_file_tree(path_to_files)
|
||||
comments = ['.db']
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class table_gen:
|
|||
html += '<!--'+row[0]+'<tr>'
|
||||
for col in row:
|
||||
html += '<td>' + str(col) + '</td>'
|
||||
html += '</tr>-->'
|
||||
html += '</tr>'+row[0]+'-->'
|
||||
|
||||
html += '</tr>'
|
||||
html += '</tbody>'
|
||||
|
|
|
|||
Loading…
Reference in New Issue