void-packages/srcpkgs/cppcms/patches/python3.patch

144 lines
5.9 KiB
Diff

--- a/bin/cppcms_tmpl_cc
+++ b/bin/cppcms_tmpl_cc
@@ -11,7 +11,7 @@
import os
import re
import sys
-import StringIO
+from io import StringIO
str_match=r'"([^"\\]|\\[^"]|\\")*"'
single_var_param_match=r'(?:-?\d+|"(?:[^"\\]|\\[^"]|\\")*")'
@@ -64,7 +64,7 @@
if namespace_name == '':
if name == '':
- error_ext("Skin name is not defined implicitly or explicitly")
+ error_exit("Skin name is not defined implicitly or explicitly")
else:
namespace_name = name
elif namespace_name != name and name:
@@ -1056,74 +1056,74 @@
global inline_templates
unsafe_build = False
write_loader = True
- while indx < len(os.sys.argv):
- if os.sys.argv[indx]=='-s' or os.sys.argv[indx]=='-n' or os.sys.argv[indx]=='--skin':
- if indx+1>=len(os.sys.argv):
- sys.stderr.write("%s should be followed by skin name\n" % (os.sys.argv[indx]))
+ while indx < len(sys.argv):
+ if sys.argv[indx]=='-s' or sys.argv[indx]=='-n' or sys.argv[indx]=='--skin':
+ if indx+1>=len(sys.argv):
+ sys.stderr.write("%s should be followed by skin name\n" % (sys.argv[indx]))
help()
exit_flag=1
return
else:
- namespace_name=os.sys.argv[indx+1];
+ namespace_name=sys.argv[indx+1];
indx+=1
- elif os.sys.argv[indx]=='-o' or os.sys.argv[indx]=='--code':
- if indx+1>=len(os.sys.argv):
- sys.stderr.write("%s should be followed by output file name\n" % (os.sys.argv[indx]))
+ elif sys.argv[indx]=='-o' or sys.argv[indx]=='--code':
+ if indx+1>=len(sys.argv):
+ sys.stderr.write("%s should be followed by output file name\n" % (sys.argv[indx]))
help()
exit_flag=1
return
else:
- output_file=os.sys.argv[indx+1]
+ output_file=sys.argv[indx+1]
indx+=1
- elif os.sys.argv[indx]=='-I' or os.sys.argv[indx]=='-include':
- if indx+1>=len(os.sys.argv):
- sys.stderr.write("%s should be followed by directory name\n" % (os.sys.argv[indx]))
+ elif sys.argv[indx]=='-I' or sys.argv[indx]=='-include':
+ if indx+1>=len(sys.argv):
+ sys.stderr.write("%s should be followed by directory name\n" % (sys.argv[indx]))
help()
exit_flag=1
return
else:
- include_directory=os.sys.argv[indx+1]
+ include_directory=sys.argv[indx+1]
if not include_directory.endswith('/') and not include_directory.endswith('\\'):
include_directory=include_directory + '/';
indx+=1
- elif os.sys.argv[indx]=='-H' or os.sys.argv[indx]=='--header':
- if indx+1>=len(os.sys.argv):
- sys.stderr.write("%s should be followed by output header file name\n" % (os.sys.argv[indx]))
+ elif sys.argv[indx]=='-H' or sys.argv[indx]=='--header':
+ if indx+1>=len(sys.argv):
+ sys.stderr.write("%s should be followed by output header file name\n" % (sys.argv[indx]))
help()
exit_flag=1
return
else:
- header_file=os.sys.argv[indx+1]
+ header_file=sys.argv[indx+1]
indx+=1
- elif os.sys.argv[indx]=='-i' or os.sys.argv[indx]=='--inline-templates':
- if indx+1>=len(os.sys.argv):
- sys.stderr.write("%s should be followed by inline value.\n" % (os.sys.argv[indx]))
+ elif sys.argv[indx]=='-i' or sys.argv[indx]=='--inline-templates':
+ if indx+1>=len(sys.argv):
+ sys.stderr.write("%s should be followed by inline value.\n" % (sys.argv[indx]))
help()
exit_flag=1
return
else:
- inline_templates=os.sys.argv[indx+1]
+ inline_templates=sys.argv[indx+1]
indx+=1
- elif os.sys.argv[indx]=='-d':
- if indx+1>=len(os.sys.argv):
+ elif sys.argv[indx]=='-d':
+ if indx+1>=len(sys.argv):
sys.stderr.write("-d should followed by gettext domain name\n")
help()
exit_flag=1
return
else:
global spec_gettext
- spec_gettext=os.sys.argv[indx+1]
+ spec_gettext=sys.argv[indx+1]
indx+=1
- elif os.sys.argv[indx]=='-u' or os.sys.argv[indx]=='--unsafe-cast':
+ elif sys.argv[indx]=='-u' or sys.argv[indx]=='--unsafe-cast':
unsafe_build = True
- elif os.sys.argv[indx]=='-l' or os.sys.argv[indx]=='--no-loader':
+ elif sys.argv[indx]=='-l' or sys.argv[indx]=='--no-loader':
write_loader = False
- elif os.sys.argv[indx]=='--help' or os.sys.argv[indx]=='-h':
+ elif sys.argv[indx]=='--help' or sys.argv[indx]=='-h':
help()
exit_flag=1
return
else:
- all.append(os.sys.argv[indx])
+ all.append(sys.argv[indx])
indx+=1
if not all:
sys.stderr.write("No input file names given\n")
@@ -1153,7 +1153,7 @@
from hashlib import md5
else:
from md5 import md5
- dll_api = 'VIEW_%s_API' % md5(header_define).hexdigest().upper()
+ dll_api = 'VIEW_%s_API' % md5(header_define.encode()).hexdigest().upper()
global output_fd
if output_file!='':
@@ -1244,8 +1244,8 @@
scope_filter='cppcms::filters::escape'
view_name = ''
-declarations = StringIO.StringIO();
-definitions = StringIO.StringIO();
+declarations = StringIO();
+definitions = StringIO();
inline_cpp_to = output_declaration
inline_templates = "default"
output_template = output_definition