From 3d930c875a12a193d4a47ae51b01a50c9d3383c8 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Mon, 7 Nov 2016 16:37:55 +0000 Subject: [PATCH] make getenv script Python 3 compatible Signed-off-by: Ivailo Monev --- scripts/getenv.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/getenv.py b/scripts/getenv.py index 70a60109f..889ef33de 100755 --- a/scripts/getenv.py +++ b/scripts/getenv.py @@ -10,10 +10,12 @@ for root, subdirs, files in os.walk('%s/../src' % cwd): for sfile in files: if sfile.endswith(('.cpp', '.h')): sfull = '%s/%s' % (root, sfile) - with open(sfull, 'r') as f: - for smatch in regex.findall(f.read()): - smatch = smatch.strip('"\'') - if not smatch in lmatches: - lmatches.append(smatch) + with open(sfull, 'rb') as f: + scontent = f.read() + scontent = scontent.decode('utf-8') + for smatch in regex.findall(scontent): + smatch = smatch.strip('"\'') + if not smatch in lmatches: + lmatches.append(smatch) -print('\n'.join(sorted(lmatches))) \ No newline at end of file +print('\n'.join(sorted(lmatches)))