make getenv script Python 3 compatible

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2016-11-07 16:37:55 +00:00
parent 666a24802f
commit 3d930c875a

View file

@ -10,8 +10,10 @@ 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()):
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)