Skip to content

Commit

Permalink
feat: Added BL/WL input flags
Browse files Browse the repository at this point in the history
feat: added input flags for black- and whitelisting paths
refactor: minor design changes
refactor: removed web dependencies in html file
refactor: duration unit is now obtained from xml (not hardcoded anymore)
  • Loading branch information
philip-harr committed Jul 3, 2019
1 parent 5f21fe1 commit dd81ff9
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 21,514 deletions.
36 changes: 32 additions & 4 deletions drace-gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
g_JSPATH = "templates/js"
DEBUG = True

#info: blacklisting overrules whitelisting
SOURCEFILE_BL = list()
SOURCEFILE_WL = list()
WHITELISTING = False
Expand Down Expand Up @@ -66,6 +67,7 @@ def __getHeader(self):
header.append(self.adjText(date))
header.append(self.adjText(time))
header.append(self.adjText(status.find('duration').text))
header.append(self.adjText(status.find('duration').get('unit')))

arguments = str()
for arg in self.__reportRoot.find('args').find('vargv').findall('arg'):
Expand Down Expand Up @@ -198,10 +200,11 @@ def __createHeader(self):
self.htmlReport = self.htmlReport.replace('*DATE*', headerInformation[0])
self.htmlReport = self.htmlReport.replace('*TIME*', headerInformation[1])
self.htmlReport = self.htmlReport.replace('*DURATION*', headerInformation[2])
self.htmlReport = self.htmlReport.replace('*ARGS*', headerInformation[3])
self.htmlReport = self.htmlReport.replace('*EXE*', headerInformation[4])
self.htmlReport = self.htmlReport.replace('*PROTOCOLVERSION*', headerInformation[5])
self.htmlReport = self.htmlReport.replace('*PROTOCOLTOOL*', headerInformation[6])
self.htmlReport = self.htmlReport.replace('*DURATION_UNIT*', headerInformation[3])
self.htmlReport = self.htmlReport.replace('*ARGS*', headerInformation[4])
self.htmlReport = self.htmlReport.replace('*EXE*', headerInformation[5])
self.htmlReport = self.htmlReport.replace('*PROTOCOLVERSION*', headerInformation[6])
self.htmlReport = self.htmlReport.replace('*PROTOCOLTOOL*', headerInformation[7])
self.htmlReport = self.htmlReport.replace('*NUMBER_OF_ERRORS*', str(self.__numberOfErrors))
self.htmlReport = self.htmlReport.replace('*ERROR_ENTRIES*', self.__strErrors)

Expand Down Expand Up @@ -357,15 +360,40 @@ def adjText(self, text): #change html symbols
return text


def addListEntries(fileList, strEntries):
strEntries = strEntries.replace("\\","/")
listEntries = strEntries.split(',')
for entry in listEntries:
#remove potential leading and trailing whitespaces
while entry[0] == ' ':
entry = entry[1:]
while entry[-1] == ' ':
entry = entry[:-1]

fileList.append(entry)



def main():
global SOURCEFILE_BL, SOURCEFILE_WL, WHITELISTING
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--inputFile", help='input file', type=str)
parser.add_argument("-o", "--outputDirectory", help='output directory', type=str)
parser.add_argument("-b", "--blacklist", help='add blacklist entries <entry1,entry2 ...>', type=str)
parser.add_argument("-w", "--whitelist", help='add whitelist entries entries <entry1,entry2 ...>', type=str)
args = parser.parse_args()

inFile = args.inputFile
targetDirectory = args.outputDirectory

if args.blacklist != None:
addListEntries(SOURCEFILE_BL, args.blacklist)


if args.whitelist != None:
addListEntries(SOURCEFILE_WL, args.whitelist)
WHITELISTING = True

if DEBUG:
if inFile == None:
inFile = 'test_files/test.xml'
Expand Down
Loading

0 comments on commit dd81ff9

Please sign in to comment.