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`.
This commit is contained in:
Julian Oes 2018-11-20 14:27:44 +01:00 committed by Beat Küng
parent 1e17a86a39
commit 177d14c8ea
1 changed files with 2 additions and 1 deletions

View File

@ -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():
# 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;