mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-21 01:12:11 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user