Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions flow/util/addDummyToLef.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
import os
import re
import sys
import argparse # argument parsing
Expand All @@ -14,9 +15,12 @@
args = parser.parse_args()


f = open(args.inputLef)
content = f.read()
f.close()
if not os.path.isfile(args.inputLef):
print(f"Error: Input LEF not found: {args.inputLef}", file=sys.stderr)
sys.exit(1)

with open(args.inputLef) as f:
content = f.read()

# refMacro = "BUFH_X1M_A12TR"

Expand All @@ -26,9 +30,8 @@
result, count = re.subn(pattern, replace, content, 1, re.S)

if count > 0:
f = open(args.outputLef, "w")
f.write(result)
f.close()
with open(args.outputLef, "w") as f:
f.write(result)
else:
print("Error: Pattern not found")
print("Error: Pattern not found", file=sys.stderr)
sys.exit(1)