cppcms: switch to python3

This commit is contained in:
classabbyamp 2023-09-28 00:37:38 -04:00
parent 909c7f0677
commit bd14202461
No known key found for this signature in database
GPG Key ID: 6BE0755918A4C7F5
2 changed files with 146 additions and 3 deletions

View File

@ -0,0 +1,143 @@
--- 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

View File

@ -1,9 +1,9 @@
# Template file for 'cppcms' # Template file for 'cppcms'
pkgname=cppcms pkgname=cppcms
version=1.2.1 version=1.2.1
revision=1 revision=2
build_style=cmake build_style=cmake
hostmakedepends="python" hostmakedepends="python3"
makedepends="gnutls-devel pcre-devel" makedepends="gnutls-devel pcre-devel"
short_desc="High Performance C++ Web Framework" short_desc="High Performance C++ Web Framework"
maintainer="Asaf Ohayon <asaf@sysbind.co.il>" maintainer="Asaf Ohayon <asaf@sysbind.co.il>"
@ -11,7 +11,7 @@ license="MIT"
homepage="http://cppcms.com" homepage="http://cppcms.com"
distfiles="${SOURCEFORGE_SITE}/cppcms/cppcms/${version}/cppcms-${version}.tar.bz2" distfiles="${SOURCEFORGE_SITE}/cppcms/cppcms/${version}/cppcms-${version}.tar.bz2"
checksum=10fec7710409c949a229b9019ea065e25ff5687103037551b6f05716bf6cac52 checksum=10fec7710409c949a229b9019ea065e25ff5687103037551b6f05716bf6cac52
python_version=2 #unverified python_version=3
post_install() { post_install() {
vlicense COPYING.TXT vlicense COPYING.TXT