1
0
mirror of https://github.com/OlafvdSpek/ctemplate.git synced 2025-10-05 19:16:54 +08:00

Merge pull request #139 from pinotree/switch-to-python3

Switch to Python 3
This commit is contained in:
Olaf van der Spek 2020-01-22 19:59:14 +01:00 committed by GitHub
commit 9a1ef5f8a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 6 deletions

View File

@ -1,5 +1,3 @@
#!/usr/bin/env python
#
# Copyright (c) 2008, Google Inc. # Copyright (c) 2008, Google Inc.
# All rights reserved. # All rights reserved.
# #

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
# #
# Copyright (c) 2008, Google Inc. # Copyright (c) 2008, Google Inc.
# All rights reserved. # All rights reserved.
@ -282,7 +282,8 @@ class FSMGenerateC(FSMGenerateAbstract):
for state in self._config.states: for state in self._config.states:
transition_row = [] transition_row = []
for c in range(0, 255): for c in range(0, 255):
transition_row.append(' /* %06s */ %s' % (repr(chr(c)), ch_repr = str(repr(chr(c)).encode("ASCII", "backslashreplace"), "ASCII")
transition_row.append(' /* %06s */ %s' % (ch_repr,
state_table[state][c])) state_table[state][c]))
out.append(self._CreateStructList('%stransition_row_%s' % out.append(self._CreateStructList('%stransition_row_%s' %

View File

@ -48,8 +48,8 @@ GENERATE_FSM="$TOOLS_DIR/generate_fsm.py"
EXPECTED="`cat $OUTPUT_FILE`" EXPECTED="`cat $OUTPUT_FILE`"
if [ -z "$EXPECTED" ]; then die "Error reading $OUTPUT_FILE"; fi if [ -z "$EXPECTED" ]; then die "Error reading $OUTPUT_FILE"; fi
# Let's make sure the script works with python2.2 and above # Let's make sure the script works with python3.5 and above
for PYTHON in "" "python2.2" "python2.3" "python2.4" "python2.5" "python2.6"; do for PYTHON in "" "python3.5" "python3.6" "python3.7" "python3.8" "python3.9"; do
# Skip the versions of python that are not installed. # Skip the versions of python that are not installed.
if [ -n "$PYTHON" ]; then if [ -n "$PYTHON" ]; then
$PYTHON -h >/dev/null 2>/dev/null || continue $PYTHON -h >/dev/null 2>/dev/null || continue