gyp: python3 fixes: utf8 decode, use of 'None' in eval

PR-URL: https://github.com/nodejs/node-gyp/pull/1925
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
This commit is contained in:
Wilfried Goesgens 2019-10-16 16:29:38 +02:00 committed by Rod Vagg
parent c0282daa48
commit 1b11be63cc
No known key found for this signature in database
GPG key ID: C273792F7D83545D
2 changed files with 3 additions and 3 deletions

View file

@ -1776,7 +1776,7 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD
# - The multi-output rule will have an do-nothing recipe.
# Hash the target name to avoid generating overlong filenames.
cmddigest = hashlib.sha1(command if command else self.target).hexdigest()
cmddigest = hashlib.sha1((command or self.target).encode('utf-8')).hexdigest()
intermediate = "%s.intermediate" % cmddigest
self.WriteLn('%s: %s' % (' '.join(outputs), intermediate))
self.WriteLn('\t%s' % '@:')

View file

@ -240,7 +240,7 @@ def LoadOneBuildFile(build_file_path, data, aux_data, includes,
if check:
build_file_data = CheckedEval(build_file_contents)
else:
build_file_data = eval(build_file_contents, {'__builtins__': None},
build_file_data = eval(build_file_contents, {'__builtins__': {}},
None)
except SyntaxError as e:
e.filename = build_file_path
@ -1094,7 +1094,7 @@ def EvalSingleCondition(
else:
ast_code = compile(cond_expr_expanded, '<string>', 'eval')
cached_conditions_asts[cond_expr_expanded] = ast_code
if eval(ast_code, {'__builtins__': None}, variables):
if eval(ast_code, {'__builtins__': {}}, variables):
return true_dict
return false_dict
except SyntaxError as e: