mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
mibuild/tools/write_to_file: use context manager
This commit is contained in:
parent
90c5512b25
commit
8ce683964a
1 changed files with 2 additions and 3 deletions
|
@ -19,9 +19,8 @@ def write_to_file(filename, contents, force_unix=False):
|
|||
newline = None
|
||||
if force_unix:
|
||||
newline = "\n"
|
||||
f = open(filename, "w", newline=newline)
|
||||
f.write(contents)
|
||||
f.close()
|
||||
with open(filename, "w", newline=newline) as f:
|
||||
f.write(contents)
|
||||
|
||||
def arch_bits():
|
||||
return struct.calcsize("P")*8
|
||||
|
|
Loading…
Reference in a new issue