(count=0)
| 294 | queueForRemoval(tree) |
| 295 | |
| 296 | def 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 |
| 339 | removeList(1) |
no test coverage detected
searching dependent graphs…