@@ -84,7 +84,6 @@ def skip_line(cmd, reason):
84
84
85
85
# Process build log
86
86
for line in build_log :
87
- # logger.debug("-------------> Line: {}".format(line))
88
87
lineno += 1
89
88
# Concatenate line if need
90
89
accumulate_line = line
@@ -118,13 +117,9 @@ def skip_line(cmd, reason):
118
117
if not commands :
119
118
result .skipped += 1
120
119
121
- # logger.debug("-------------> Commands: {}".format(commands))
122
-
123
120
for c in commands :
124
121
filepath = c ['filepath' ]
125
- # logger.debug("-------------> Filepath: {}".format(filepath))
126
122
cmd = c ['cmd' ]
127
- # logger.debug("-------------> Command: {}".format(cmd))
128
123
if filepath is None :
129
124
skip_line (cmd , 'Empty file name' )
130
125
continue
@@ -143,7 +138,7 @@ def skip_line(cmd, reason):
143
138
144
139
# add entry to database
145
140
tokens = c ['tokens' ]
146
- arguments = [unescape ( a ) for a in tokens [len (wrappers ):]]
141
+ arguments = [a for a in tokens [len (wrappers ):]]
147
142
148
143
compiler = get_compiler (arguments [0 ])
149
144
@@ -192,8 +187,9 @@ def cross_platform_argline(s, platform='this'):
192
187
1 = POSIX;
193
188
0 = Windows/CMD
194
189
(other values reserved)
190
+
191
+ Cudos: https://stackoverflow.com/a/35900070/2349761
195
192
"""
196
- logger .debug ("-------------> Platform: {} - {}" .format (platform , sys .platform ))
197
193
if platform == 'this' :
198
194
platform = (sys .platform != 'win32' )
199
195
if platform == 1 :
@@ -205,9 +201,7 @@ def cross_platform_argline(s, platform='this'):
205
201
206
202
args = []
207
203
accu = None # collects pieces of one arg
208
- # logger.debug("-------------> String: {}".format(s))
209
204
for qs , qss , esc , pipe , word , white , fail in re .findall (RE_CMD_LEX , s ):
210
- # logger.debug("-------------> Regex: qs:{} qss:{} esc:{} pipe:{} word:{} white:{} fail:{}".format(qs, qss, esc, pipe, word, white, fail))
211
205
if word :
212
206
if platform == 0 :
213
207
word = word .replace ('\\ \\ ' , '\\ ' ).replace ('\\ ' , '\\ \\ ' )
@@ -223,10 +217,8 @@ def cross_platform_argline(s, platform='this'):
223
217
elif fail :
224
218
raise ValueError ("invalid or incomplete shell string" )
225
219
elif qs :
226
- # word = qs.replace('\\"', '"').replace('\\\\', '\\')
227
220
if platform == 0 :
228
221
word = word .replace ('""' , '"' )
229
- # word = word.replace('\\\\', '\\').replace('\\', '\\\\')
230
222
word = repr (qs ).encode ().decode ('unicode_escape' )
231
223
else :
232
224
word = qss # may be even empty; must be last
@@ -243,10 +235,7 @@ class CommandProcessor(bashlex.ast.nodevisitor):
243
235
looking for and extracting compilation commands."""
244
236
def process (line , wd ):
245
237
args = cross_platform_argline (line )
246
- # for arg in args:
247
- # logger.debug("-------------> Arg: {}".format(arg))
248
238
line = " " .join (args )
249
- # logger.debug("-------------> Argline: {}".format(line))
250
239
trees = bashlex .parser .parse (line )
251
240
if not trees :
252
241
return []
@@ -303,7 +292,6 @@ def visitword(self, node, word):
303
292
self .compiler = word
304
293
else :
305
294
self .wrappers .append (word )
306
- logger .debug ('Not a compiler: {}' .format (word ))
307
295
elif (file_regex .match (word )):
308
296
self .filepath = word
309
297
@@ -318,8 +306,4 @@ def check_last_cmd(self):
318
306
# reset state to process new command
319
307
self .reset ()
320
308
321
-
322
- def unescape (s ):
323
- return s
324
-
325
309
# ex: ts=2 sw=4 et filetype=python
0 commit comments