Skip to content

Commit

Permalink
Implement parse the dep file of MDK project
Browse files Browse the repository at this point in the history
  • Loading branch information
tianxiaoMCU committed Jun 30, 2018
1 parent e9c1736 commit aa64e11
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions si4project_filelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import sys
import xml.etree.ElementTree as ET
from datetime import datetime
import re

# 1、Find .dep file
projectfilename = ''
Expand Down Expand Up @@ -71,7 +72,6 @@
#2、parse the seleted dep file
parsefile = open(sourcefile, 'r')
si4filelist = []
print(projectfilename)
if projectfilename.endswith('.eww'):
tree = ET.ElementTree(file=parsefile)
tag_cfg_list = tree.findall('configuration')
Expand Down Expand Up @@ -109,7 +109,12 @@
si4filelist.append(os.path.abspath(elem.text.replace('$PROJ_DIR$', os.getcwd()))+'\n')

elif projectfilename.endswith('.uvproj') or projectfilename.endswith('.uvprojx'):
print('Parse MDK dep file')
for line in parsefile.readlines():
m = re.search(r"^F \(.*?\)|^I \(.*?\)", line)
if None != m:
relpath = m.group(0)[3:-1]
si4filelist.append(os.path.abspath(relpath)+'\n')
si4filelist = set(si4filelist)

#3、save the lists
outputfile = open(outputfile + '.si4project_filelist.txt', 'w')
Expand Down

0 comments on commit aa64e11

Please sign in to comment.