Commit f4e2c043 authored by Raul Tambre's avatar Raul Tambre Committed by Commit Bot

usb_ids: Use io.open() instead of codecs.open() to avoid newline issues

Using codecs.open() results in a CR at the end of every product name's string.
E.g.

    static const UsbProduct vendor_0001_products[] = {CRLF
      {0x7778, "Counterfeit flash drive [Kingston]CR
    "},CRLF
    };CRLF

Use io.open() instead, which works as expected on both Python 2 and 3.

Bug: 1058804
Change-Id: I3d77df0a248ccab57e1980a09977cf87720e5714
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2089696
Auto-Submit: Raul Tambre <raul@tambre.ee>
Commit-Queue: Ken Rockot <rockot@google.com>
Reviewed-by: default avatarKen Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#747351}
parent dbbc4eb8
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import codecs import io
import itertools import itertools
import optparse import optparse
import re import re
...@@ -17,7 +17,7 @@ def EscapeName(name): ...@@ -17,7 +17,7 @@ def EscapeName(name):
return name return name
def ParseTable(input_path): def ParseTable(input_path):
input_file = codecs.open(input_path, "r", encoding="ascii", errors="ignore") input_file = io.open(input_path, "r", encoding="ascii", errors="ignore")
input = input_file.read().split("\n") input = input_file.read().split("\n")
input_file.close() input_file.close()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment