mirror of https://github.com/openXC7/prjxray.git
rempips: maketodo logging, --no-strict option
Signed-off-by: John McMaster <johndmcmaster@gmail.com>
This commit is contained in:
parent
81c3582c17
commit
9bb3b49619
|
|
@ -1,26 +1,67 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os, re
|
||||
import os, re, sys
|
||||
from prjxray import util
|
||||
|
||||
|
||||
def maketodo(pipfile, dbfile):
|
||||
def maketodo(pipfile, dbfile, strict=True):
|
||||
'''Print name of all pips in pipfile but not dbfile'''
|
||||
todos = set()
|
||||
with open(pipfile, "r") as f:
|
||||
for line in f:
|
||||
line = line.split()
|
||||
todos.add(line[0])
|
||||
print('%s: %u entries' % (pipfile, len(todos)), file=sys.stderr)
|
||||
with open(dbfile, "r") as f:
|
||||
for line in f:
|
||||
line = line.split()
|
||||
todos.remove(line[0])
|
||||
pip = line[0]
|
||||
try:
|
||||
todos.remove(pip)
|
||||
except KeyError:
|
||||
# DB (incorrectly) had multiple entries
|
||||
# Workaround for testing on old DB revision
|
||||
if strict:
|
||||
raise
|
||||
print(
|
||||
'WARNING: failed to remove pip %s' % pip, file=sys.stderr)
|
||||
print('Remove %s: %u entries' % (dbfile, len(todos)), file=sys.stderr)
|
||||
drops = 0
|
||||
lines = 0
|
||||
for line in todos:
|
||||
if not line.endswith(".VCC_WIRE"):
|
||||
print(line)
|
||||
if line.endswith(".VCC_WIRE"):
|
||||
drops += 1
|
||||
continue
|
||||
print(line)
|
||||
lines += 1
|
||||
print('Print %u entries w/ %u drops' % (lines, drops), file=sys.stderr)
|
||||
|
||||
|
||||
maketodo(
|
||||
"pips_int_l.txt", "%s/%s/segbits_int_l.db" %
|
||||
(os.getenv("XRAY_DATABASE_DIR"), os.getenv("XRAY_DATABASE")))
|
||||
maketodo(
|
||||
"pips_int_r.txt", "%s/%s/segbits_int_r.db" %
|
||||
(os.getenv("XRAY_DATABASE_DIR"), os.getenv("XRAY_DATABASE")))
|
||||
def run(strict=True):
|
||||
maketodo(
|
||||
"pips_int_l.txt",
|
||||
"%s/%s/segbits_int_l.db" %
|
||||
(os.getenv("XRAY_DATABASE_DIR"), os.getenv("XRAY_DATABASE")),
|
||||
strict=strict)
|
||||
maketodo(
|
||||
"pips_int_r.txt",
|
||||
"%s/%s/segbits_int_r.db" %
|
||||
(os.getenv("XRAY_DATABASE_DIR"), os.getenv("XRAY_DATABASE")),
|
||||
strict=strict)
|
||||
|
||||
|
||||
def main():
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Print list of known but unsolved PIPs")
|
||||
|
||||
# util.db_root_arg(parser)
|
||||
parser.add_argument('--no-strict', action='store_true', help='')
|
||||
args = parser.parse_args()
|
||||
|
||||
run(strict=not args.no_strict)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
|||
Loading…
Reference in New Issue