Skip to content

Commit

Permalink
Make cmake python3 compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
gengjiawen committed Oct 27, 2019
1 parent ec4d403 commit 31a4540
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion gyp/pylib/gyp/generator/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
import subprocess
import gyp.common

PY3 = bytes != str

generator_default_variables = {
'EXECUTABLE_PREFIX': '',
'EXECUTABLE_SUFFIX': '',
Expand Down Expand Up @@ -239,7 +241,10 @@ def StringToCMakeTargetName(a):
Invalid for make: ':'
Invalid for unknown reasons but cause failures: '.'
"""
return a.translate(string.maketrans(' /():."', '_______'))
try:
return a.translate(str.maketrans(' /():."', '_______'))
except AttributeError:
return a.translate(string.maketrans(' /():."', '_______'))


def WriteActions(target_name, actions, extra_sources, extra_deps,
Expand Down

0 comments on commit 31a4540

Please sign in to comment.