Browse Source

px_romfs_pruner.py: remove deprecation warning

The open flag `U` causes a deprecation warning starting with Python 3.4.
The option to open all kinds of newlines as `\n` has been replaced with
the argument `newline=None`. However, this argument is not available for
Python 2 unless we use `io.open` instead of `open`.
sbg
Julian Oes 6 years ago committed by Beat Küng
parent
commit
177d14c8ea
  1. 3
      Tools/px_romfs_pruner.py

3
Tools/px_romfs_pruner.py

@ -49,6 +49,7 @@ from __future__ import print_function @@ -49,6 +49,7 @@ from __future__ import print_function
import argparse
import re
import os
import io
def main():
@ -88,7 +89,7 @@ def main(): @@ -88,7 +89,7 @@ def main():
# read file line by line
pruned_content = ""
board_excluded = False
with open(file_path, "rU") as f:
with io.open(file_path, "r", newline=None) as f:
for line in f:
if re.search(r'\b{0} exclude\b'.format(args.board),line):
board_excluded = True;

Loading…
Cancel
Save