From bd142024612a752b56ff333c29beb5f78ed09739 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Thu, 28 Sep 2023 00:37:38 -0400 Subject: [PATCH] cppcms: switch to python3 --- srcpkgs/cppcms/patches/python3.patch | 143 +++++++++++++++++++++++++++ srcpkgs/cppcms/template | 6 +- 2 files changed, 146 insertions(+), 3 deletions(-) create mode 100644 srcpkgs/cppcms/patches/python3.patch diff --git a/srcpkgs/cppcms/patches/python3.patch b/srcpkgs/cppcms/patches/python3.patch new file mode 100644 index 00000000000..60d4c491dea --- /dev/null +++ b/srcpkgs/cppcms/patches/python3.patch @@ -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 diff --git a/srcpkgs/cppcms/template b/srcpkgs/cppcms/template index 613f8f39cee..f34fee27705 100644 --- a/srcpkgs/cppcms/template +++ b/srcpkgs/cppcms/template @@ -1,9 +1,9 @@ # Template file for 'cppcms' pkgname=cppcms version=1.2.1 -revision=1 +revision=2 build_style=cmake -hostmakedepends="python" +hostmakedepends="python3" makedepends="gnutls-devel pcre-devel" short_desc="High Performance C++ Web Framework" maintainer="Asaf Ohayon " @@ -11,7 +11,7 @@ license="MIT" homepage="http://cppcms.com" distfiles="${SOURCEFORGE_SITE}/cppcms/cppcms/${version}/cppcms-${version}.tar.bz2" checksum=10fec7710409c949a229b9019ea065e25ff5687103037551b6f05716bf6cac52 -python_version=2 #unverified +python_version=3 post_install() { vlicense COPYING.TXT