diff options
| author | Christian Clauss <cclauss@me.com> | 2019-08-19 19:24:22 +0200 |
|---|---|---|
| committer | cclauss <cclauss@me.com> | 2019-08-21 11:22:17 +0200 |
| commit | ecda222809fb93d5c5a0c3980dc56bc5bf25b772 (patch) | |
| tree | 077279c851b2c3878f4a639b188d136e97489b99 | |
| parent | f70261fb3089b8acf5f68584ef0285a1c11f54fd (diff) | |
| download | node-new-GN-scraper.decode.tar.gz | |
tools: fix mixup with bytes.decode() and str.encode()GN-scraper.decode
We want to read a bytes file and decode the contents as utf-8 so we can compare against a utf-8 pattern.
| -rw-r--r-- | tools/v8_gypfiles/GN-scraper.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/v8_gypfiles/GN-scraper.py b/tools/v8_gypfiles/GN-scraper.py index 59818ad737..ec72f1d47e 100644 --- a/tools/v8_gypfiles/GN-scraper.py +++ b/tools/v8_gypfiles/GN-scraper.py @@ -7,8 +7,8 @@ PLAIN_SOURCE_RE = re.compile('\s*"([^/$].+)"\s*') def DoMain(args): gn_filename, pattern = args src_root = os.path.dirname(gn_filename) - with open(gn_filename, 'r') as gn_file: - gn_content = gn_file.read().encode('utf-8') + with open(gn_filename, 'rb') as gn_file: + gn_content = gn_file.read().decode('utf-8') scraper_re = re.compile(pattern + r'\[([^\]]+)', re.DOTALL) matches = scraper_re.search(gn_content) |
