mirror of https://github.com/openXC7/prjxray.git
rempips todo: remove --strict hack, build-dir arg
Signed-off-by: John McMaster <johndmcmaster@gmail.com>
This commit is contained in:
parent
ed5d1b07e5
commit
4583a35ed6
|
|
@ -4,31 +4,24 @@ import os, re, sys
|
|||
from prjxray import util
|
||||
|
||||
|
||||
def maketodo(pipfile, dbfile, strict=True):
|
||||
def maketodo(pipfile, dbfile, verbose=False):
|
||||
'''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)
|
||||
verbose and print(
|
||||
'%s: %u entries' % (pipfile, len(todos)), file=sys.stderr)
|
||||
# Support generate without existing DB
|
||||
if os.path.exists(dbfile) or strict:
|
||||
if os.path.exists(dbfile):
|
||||
with open(dbfile, "r") as f:
|
||||
for line in f:
|
||||
line = line.split()
|
||||
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)
|
||||
todos.remove(pip)
|
||||
verbose and print(
|
||||
'Remove %s: %u entries' % (dbfile, len(todos)), file=sys.stderr)
|
||||
drops = 0
|
||||
lines = 0
|
||||
for line in todos:
|
||||
|
|
@ -37,20 +30,16 @@ def maketodo(pipfile, dbfile, strict=True):
|
|||
continue
|
||||
print(line)
|
||||
lines += 1
|
||||
print('Print %u entries w/ %u drops' % (lines, drops), file=sys.stderr)
|
||||
verbose and print(
|
||||
'Print %u entries w/ %u drops' % (lines, drops), file=sys.stderr)
|
||||
|
||||
|
||||
def run(strict=True):
|
||||
maketodo(
|
||||
"build/pips_int_l.txt",
|
||||
"%s/%s/segbits_int_l.db" %
|
||||
(os.getenv("XRAY_DATABASE_DIR"), os.getenv("XRAY_DATABASE")),
|
||||
strict=strict)
|
||||
maketodo(
|
||||
"build/pips_int_r.txt",
|
||||
"%s/%s/segbits_int_r.db" %
|
||||
(os.getenv("XRAY_DATABASE_DIR"), os.getenv("XRAY_DATABASE")),
|
||||
strict=strict)
|
||||
def run(build_dir):
|
||||
db_dir = "%s/%s" % (
|
||||
os.getenv("XRAY_DATABASE_DIR"), os.getenv("XRAY_DATABASE"))
|
||||
|
||||
maketodo("%s/pips_int_l.txt" % build_dir, "%s/segbits_int_l.db" % db_dir)
|
||||
maketodo("%s/pips_int_r.txt" % build_dir, "%s/segbits_int_r.db" % db_dir)
|
||||
|
||||
|
||||
def main():
|
||||
|
|
@ -59,11 +48,10 @@ def main():
|
|||
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='')
|
||||
parser.add_argument('--build-dir', default="build", help='')
|
||||
args = parser.parse_args()
|
||||
|
||||
run(strict=not args.no_strict)
|
||||
run(build_dir=args.build_dir)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
|||
Loading…
Reference in New Issue