aboutsummaryrefslogtreecommitdiff
path: root/textproc/google-ctemplate
diff options
context:
space:
mode:
authorVanilla I. Shu <vanilla@FreeBSD.org>2020-09-26 14:57:08 +0000
committerVanilla I. Shu <vanilla@FreeBSD.org>2020-09-26 14:57:08 +0000
commit8ab9c7824e653f52e866e8f5f38b56712101641d (patch)
tree4f4a8c3d2a3175a4036f15d0fd8ef09df8eb0d56 /textproc/google-ctemplate
parent1f64efe9b8879415623bcb2c87247c3a0a23781a (diff)
downloadports-8ab9c7824e653f52e866e8f5f38b56712101641d.tar.gz
ports-8ab9c7824e653f52e866e8f5f38b56712101641d.zip
Switch to python3.
PR: 249779 Reported by: swills@
Notes
Notes: svn path=/head/; revision=550192
Diffstat (limited to 'textproc/google-ctemplate')
-rw-r--r--textproc/google-ctemplate/Makefile2
-rw-r--r--textproc/google-ctemplate/files/patch-src_htmlparser_fsm__config.py15
-rw-r--r--textproc/google-ctemplate/files/patch-src_htmlparser_generate__fsm.py41
3 files changed, 57 insertions, 1 deletions
diff --git a/textproc/google-ctemplate/Makefile b/textproc/google-ctemplate/Makefile
index 84f2acd5d4db..b9e004c51e2e 100644
--- a/textproc/google-ctemplate/Makefile
+++ b/textproc/google-ctemplate/Makefile
@@ -15,7 +15,7 @@ LICENSE_FILE= ${WRKSRC}/COPYING
OPTIONS_DEFINE= DOCS
-USES= libtool pathfix pkgconfig python:2.7 shebangfix
+USES= libtool pathfix pkgconfig python:build shebangfix
GNU_CONFIGURE= yes
SHEBANG_FILES= src/template-converter src/htmlparser/generate_fsm.py src/htmlparser/fsm_config.py
USE_LDCONFIG= yes
diff --git a/textproc/google-ctemplate/files/patch-src_htmlparser_fsm__config.py b/textproc/google-ctemplate/files/patch-src_htmlparser_fsm__config.py
new file mode 100644
index 000000000000..4a4dd4c619d5
--- /dev/null
+++ b/textproc/google-ctemplate/files/patch-src_htmlparser_fsm__config.py
@@ -0,0 +1,15 @@
+--- src/htmlparser/fsm_config.py.orig 2020-09-26 14:52:15 UTC
++++ src/htmlparser/fsm_config.py
+@@ -210,7 +210,11 @@ class FSMConfig(object):
+
+ self.sm['state'] = self.AddState
+ self.sm['condition'] = self.AddCondition
+- execfile(filename, self.sm)
++
++ with open(filename) as f:
++ code = compile(f.read(), filename, 'exec')
++ exec(code, self.sm)
++
+ self.name = self.sm['name']
+ if not self.name.isalnum():
+ raise Exception("State machine name must consist of only alphanumeric"
diff --git a/textproc/google-ctemplate/files/patch-src_htmlparser_generate__fsm.py b/textproc/google-ctemplate/files/patch-src_htmlparser_generate__fsm.py
new file mode 100644
index 000000000000..952a2f6b6aba
--- /dev/null
+++ b/textproc/google-ctemplate/files/patch-src_htmlparser_generate__fsm.py
@@ -0,0 +1,41 @@
+--- src/htmlparser/generate_fsm.py.orig 2020-09-26 14:51:40 UTC
++++ src/htmlparser/generate_fsm.py
+@@ -264,7 +264,7 @@ class FSMGenerateC(FSMGenerateAbstract):
+ state_table = {}
+
+ for state in self._config.states:
+- state_table[state] = [default_state for col in xrange(255)]
++ state_table[state] = [default_state for col in range(255)]
+
+ # We process the transition in reverse order while updating the table.
+ for i_transition in range(len(self._config.transitions) - 1, -1, -1):
+@@ -281,7 +281,7 @@ class FSMGenerateC(FSMGenerateAbstract):
+ # Create the inner lists which map input characters to destination states.
+ for state in self._config.states:
+ transition_row = []
+- for c in xrange(0, 255):
++ for c in range(0, 255):
+ transition_row.append(' /* %06s */ %s' % (repr(chr(c)),
+ state_table[state][c]))
+
+@@ -306,17 +306,17 @@ class FSMGenerateC(FSMGenerateAbstract):
+ def Generate(self):
+ """Returns the generated the C include statements for the statemachine."""
+
+- print '\n'.join((self._CreateHeader(),
++ print('\n'.join((self._CreateHeader(),
+ self._CreateNumStates(),
+ self._CreateStatesEnum(),
+ self._CreateStatesExternal(),
+ self._CreateStatesInternalNames(),
+- self._CreateTransitionTable()))
++ self._CreateTransitionTable())))
+
+
+ def main():
+ if len(sys.argv) != 2:
+- print "usage: generate_fsm.py config_file"
++ print("usage: generate_fsm.py config_file")
+ sys.exit(1)
+
+ config = FSMConfig()