forked from Archive/PX4-Autopilot
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:
parent
1e17a86a39
commit
177d14c8ea
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue