MCPcopy Index your code
hub / github.com/nodejs/node / removeList

Function removeList

tools/icu/icutrim.py:296–336  ·  view source on GitHub ↗
(count=0)

Source from the content-addressed store, hash-verified

294 queueForRemoval(tree)
295
296def removeList(count=0):
297 # don't allow "keep" items to creep in here.
298 global remove
299 remove = remove - keep
300 if(count > 10):
301 print("Giving up - %dth attempt at removal." % count)
302 sys.exit(1)
303 if(options.verbose>1):
304 print("%d items to remove - try #%d" % (len(remove),count))
305 if(len(remove)>0):
306 oldcount = len(remove)
307 hackerrfile=os.path.join(options.tmpdir, "REMOVE.err")
308 removefile = os.path.join(options.tmpdir, "REMOVE.lst")
309 with open(removefile, 'wb') as fi:
310 fi.write('\n'.join(remove).encode("utf-8") + b'\n')
311 rc = runcmd("icupkg","-r %s %s 2> %s" % (removefile,outfile,hackerrfile),True)
312 if rc != 0:
313 if(options.verbose>5):
314 print("## Damage control, trying to parse stderr from icupkg..")
315 fi = open(hackerrfile, 'rb')
316 erritems = fi.readlines()
317 fi.close()
318 #Item zone/zh_Hant_TW.res depends on missing item zone/zh_Hant.res
319 pat = re.compile(br"^Item ([^ ]+) depends on missing item ([^ ]+).*")
320 for i in range(len(erritems)):
321 line = erritems[i].strip()
322 m = pat.match(line)
323 if m:
324 toDelete = m.group(1).decode("utf-8")
325 if(options.verbose > 5):
326 print("<< %s added to delete" % toDelete)
327 remove.add(toDelete)
328 else:
329 print("ERROR: could not match errline: %s" % line)
330 sys.exit(1)
331 if(options.verbose > 5):
332 print(" now %d items to remove" % len(remove))
333 if(oldcount == len(remove)):
334 print(" ERROR: could not add any mor eitems to remove. Fail.")
335 sys.exit(1)
336 removeList(count+1)
337
338# fire it up
339removeList(1)

Callers 1

icutrim.pyFile · 0.85

Calls 13

runcmdFunction · 0.85
encodeMethod · 0.80
closeMethod · 0.65
matchMethod · 0.65
decodeMethod · 0.65
addMethod · 0.65
printFunction · 0.50
openFunction · 0.50
rangeFunction · 0.50
exitMethod · 0.45
joinMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…