[packages/lasso] - rel 5, pull all fixes ad updates from upstream git
baggins
baggins at pld-linux.org
Tue May 27 05:03:12 CEST 2025
commit eeb6428f60f98c6b615df475368b53f9579f22ab
Author: Jan Rękorajski <baggins at pld-linux.org>
Date: Tue May 27 05:25:03 2025 +0200
- rel 5, pull all fixes ad updates from upstream git
git.patch | 7918 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
lasso.spec | 4 +-
2 files changed, 7921 insertions(+), 1 deletion(-)
---
diff --git a/lasso.spec b/lasso.spec
index 8322aeb..c1eb028 100644
--- a/lasso.spec
+++ b/lasso.spec
@@ -19,11 +19,12 @@ Summary: Liberty Alliance Single Sign On
Summary(pl.UTF-8): Implementacja Liberty Alliance Single Sign On
Name: lasso
Version: 2.8.2
-Release: 4
+Release: 5
License: GPL v2+
Group: Libraries
Source0: https://dev.entrouvert.org/lasso/%{name}-%{version}.tar.gz
# Source0-md5: ad2e167973cc1c21cd16329bfbcd3d16
+Patch0: git.patch
URL: https://lasso.entrouvert.org/
BuildRequires: autoconf >= 2.53
BuildRequires: automake >= 1:1.11
@@ -165,6 +166,7 @@ On).
%prep
%setup -q
+%patch -P0 -p1
%{__sed} -i -e 's|OPTIMIZE="-g"|CC="%{__cc}" OPTIMIZE="%{rpmcflags}" INSTALLDIRS=vendor|' \
bindings/perl/Makefile.am
diff --git a/git.patch b/git.patch
new file mode 100644
index 0000000..b93f3f6
--- /dev/null
+++ b/git.patch
@@ -0,0 +1,7918 @@
+diff --git a/INSTALL b/INSTALL
+index b4ed0f73..c1544bb4 100644
+--- a/INSTALL
++++ b/INSTALL
+@@ -26,9 +26,6 @@ In all cases you need to install development packages for dependencies. On Debia
+ aptitude install libxml2-dev libxslt1-dev libxmlsec1-dev libxmlsec1-openssl \
+ libglib2.0-dev python-all-dev fastjar php5-dev php5-cli python-lxml
+
+-Python bindings require the "six" library:
+-
+- pip install six
+
+ Basic Installation
+ ==================
+diff --git a/NEWS b/NEWS
+index 1d98536d..cc0c3d92 100644
+--- a/NEWS
++++ b/NEWS
+@@ -1,6 +1,17 @@
+ NEWS
+ ====
+
++Future
++------
++
++- Fix symbol deprecation of XMLSEC_CRYPTO macro in libxmlsec 1.3.0 (Patch
++ provided by Simo Sorce of RedHat) (#78280)
++- Annotate lasso_*_signature_method functions with LASSO_EXPORT (#86076)
++- Fix implicit function declaration errors, patch provided by Rob Crittenden
++ from RedHat (#85340)
++- Adjust to structured error callback argument change in libxml2 2.12, patch
++ provided by Florian Wiemer of RedHat (#86080)
++
+ 2.8.2 - March 14th 2023
+ -----------------------
+
+diff --git a/autogen.sh b/autogen.sh
+index bf0e0d3a..7067b634 100755
+--- a/autogen.sh
++++ b/autogen.sh
+@@ -27,40 +27,26 @@ cd "$srcdir"
+ DIE=1
+ }
+
+-if automake-1.16 --version < /dev/null > /dev/null 2>&1; then
+- AUTOMAKE=automake-1.16
+- ACLOCAL=aclocal-1.16
+-elif automake-1.15 --version < /dev/null > /dev/null 2>&1; then
+- AUTOMAKE=automake-1.15
+- ACLOCAL=aclocal-1.15
+-elif automake-1.14 --version < /dev/null > /dev/null 2>&1; then
+- AUTOMAKE=automake-1.14
+- ACLOCAL=aclocal-1.14
+-elif automake-1.13 --version < /dev/null > /dev/null 2>&1; then
+- AUTOMAKE=automake-1.13
+- ACLOCAL=aclocal-1.13
+-elif automake-1.12 --version < /dev/null > /dev/null 2>&1; then
+- AUTOMAKE=automake-1.12
+- ACLOCAL=aclocal-1.12
+-elif automake-1.11 --version < /dev/null > /dev/null 2>&1; then
+- AUTOMAKE=automake-1.11
+- ACLOCAL=aclocal-1.11
+-elif automake-1.10 --version < /dev/null > /dev/null 2>&1; then
+- AUTOMAKE=automake-1.10
+- ACLOCAL=aclocal-1.10
+-elif automake-1.9 --version < /dev/null > /dev/null 2>&1; then
+- AUTOMAKE=automake-1.9
+- ACLOCAL=aclocal-1.9
+-elif automake-1.8 --version < /dev/null > /dev/null 2>&1; then
+- AUTOMAKE=automake-1.8
+- ACLOCAL=aclocal-1.8
+-elif automake-1.7 --version < /dev/null > /dev/null 2>&1; then
+- AUTOMAKE=automake-1.7
+- ACLOCAL=aclocal-1.7
+-elif automake-1.6 --version < /dev/null > /dev/null 2>&1; then
+- AUTOMAKE=automake-1.6
+- ACLOCAL=aclocal-1.6
+-else
++am_versions() {
++ major=$1
++ minor_min=$2
++ minor_max=$3
++ seq "$minor_max" -1 "$minor_min" | xargs -I {} echo "$major.{}"
++}
++
++AM_VERSIONS_SUPPORT=$(am_versions 1 6 17)
++AUTOMAKE=""
++ACLOCAL=""
++for VERSION in $AM_VERSIONS_SUPPORT
++do
++ if which automake-${VERSION} < /dev/null > /dev/null 2>&1; then
++ AUTOMAKE=automake-${VERSION}
++ ACLOCAL=aclocal-${VERSION}
++ break
++ fi
++done
++if [ -z "$AUTOMAKE" ]
++then
+ echo
+ echo "You must have automake installed to compile $PROJECT."
+ echo "Download the appropriate package for your distribution,"
+diff --git a/bindings/bindings.py b/bindings/bindings.py
+index b8f9d503..ef3f9fbd 100644
+--- a/bindings/bindings.py
++++ b/bindings/bindings.py
+@@ -23,16 +23,9 @@
+
+ import os
+ import re
+-from six import print_, PY3
+ import sys
+ from utils import *
+
+-if PY3:
+- do_open = lambda *args, **kwargs: open(*args, encoding='utf-8', **kwargs)
+-else:
+- do_open = open
+-
+-
+ from optparse import OptionParser
+
+ try:
+@@ -166,10 +159,10 @@ class BindingData:
+ if not 'Makefile.am' in filenames:
+ # not a source dir
+ continue
+- makefile_am = do_open(os.path.join(base, 'Makefile.am')).read()
++ makefile_am = open(os.path.join(base, 'Makefile.am')).read()
+ filenames = [x for x in filenames if x.endswith('.c') if x in makefile_am]
+ for filename in filenames:
+- s = do_open(os.path.join(base, filename)).read()
++ s = open(os.path.join(base, filename)).read()
+ docstrings = regex.findall(s)
+ for d in docstrings:
+ docstring = '\n'.join([x[3:] for x in d.splitlines()])
+@@ -247,7 +240,7 @@ class Function:
+ try:
+ arg = [x for x in self.args if x[1] == param.attrib.get('name')][0]
+ except IndexError:
+- print_('W: no such param (%s) in function (%s)' % (
++ print('W: no such param (%s) in function (%s)' % (
+ param.attrib.get('name'), self.name), file=sys.stderr)
+ continue
+ if param.attrib.get('optional') == 'true':
+@@ -410,7 +403,7 @@ def parse_header(header_file):
+ in_struct_private = False
+ in_ifdef_zero = False
+
+- lines = do_open(header_file).readlines()
++ lines = open(header_file).readlines()
+ i = 0
+ while i < len(lines):
+ line = lines[i]
+@@ -435,7 +428,7 @@ def parse_header(header_file):
+ enum_name = line[2:].strip().strip(';')
+ binding.enums.append(enum_name)
+ else:
+- m = re.match('\s*([a-zA-Z0-9_]+)', line)
++ m = re.match(r'\s*([a-zA-Z0-9_]+)', line)
+ if m:
+ binding.constants.append(('i', m.group(1)))
+ elif line.startswith('#define'):
+@@ -475,7 +468,7 @@ def parse_header(header_file):
+ if not in_struct.name in binding.structs_toskip:
+ binding.structs.append(in_struct)
+ else:
+- print_('W: skipping structure %s due to overrides.xml' % in_struct.name, file=sys.stderr)
++ print('W: skipping structure %s due to overrides.xml' % in_struct.name, file=sys.stderr)
+ in_struct = None
+ elif '/*< public >*/' in line:
+ in_struct_private = False
+@@ -489,13 +482,13 @@ def parse_header(header_file):
+ # TODO: Add parsing of OFTYPE
+ # Transform struct to typedef
+ # example: "struct _LassoAssertion" -> "LassoAssertion"
+- line = re.sub('\s+struct _', ' ', line)
+- member_match = re.match('\s+(\w+)\s+(\*?\w+)', line)
++ line = re.sub(r'\s+struct _', ' ', line)
++ member_match = re.match(r'\s+(\w+)\s+(\*?\w+)', line)
+ if member_match:
+ member_type, member_name = normalise_var(member_match.group(1), member_match.group(2))
+ field = (member_type, member_name, {})
+ if member_type == 'void*':
+- print_('W: skipping field %s.%s' % (in_struct.name, member_name), file=sys.stderr)
++ print('W: skipping field %s.%s' % (in_struct.name, member_name), file=sys.stderr)
+ else:
+ if is_glist(field) or is_hashtable(field):
+ found = re.search(r' of ([^*]*)', line)
+@@ -544,13 +537,13 @@ def parse_header(header_file):
+ type = clean_type(type)
+ f.args.append(list((type, name, {})))
+ else:
+- print_('failed to process:', arg, 'in line:', line, file=sys.stderr)
++ print('failed to process:', arg, 'in line:', line, file=sys.stderr)
+ f.skip = True
+ f.apply_overrides()
+ if not f.skip:
+ binding.functions.append(f)
+ else:
+- print_('W: skipping function', f, file=sys.stderr)
++ print('W: skipping function', f, file=sys.stderr)
+
+ i += 1
+
+diff --git a/bindings/overrides.xml b/bindings/overrides.xml
+index 9bb08e01..ce92fb15 100644
+--- a/bindings/overrides.xml
++++ b/bindings/overrides.xml
+@@ -23,6 +23,7 @@
+ <func name="lasso_registry_default_get_mapping" skip="true"/>
+ <!-- LassoProvider -->
+ <func name="lasso_provider_get_metadata_list" return_owner="false"/>
++ <func name="lasso_provider_verify_saml_signature" skip="true"/>
+ <!-- LassoProfile -->
+ <func name="lasso_profile_get_server" skip="true"/>
+ <func name="lasso_profile_get_nameIdentifier"
+diff --git a/bindings/perl/glist_handling.c b/bindings/perl/glist_handling.c
+index 01deb274..f7e24ed6 100644
+--- a/bindings/perl/glist_handling.c
++++ b/bindings/perl/glist_handling.c
+@@ -70,6 +70,7 @@ xmlnode_to_pv(xmlNode *node, gboolean do_free)
+ } else {
+ pestring = newSVpv((char*)xmlBufferContent(buf), 0);
+ }
++ xmlBufferFree(buf);
+ if (do_free) {
+ lasso_release_xml_node(node);
+ }
+diff --git a/bindings/perl/lang.py b/bindings/perl/lang.py
+index f412ff95..867e1b0c 100644
+--- a/bindings/perl/lang.py
++++ b/bindings/perl/lang.py
+@@ -22,20 +22,19 @@ import os
+ import os.path
+ import sys
+ import re
+-from six import print_
+ from utils import *
+
+-class Output(object):
++class Output:
+ def __init__(self, filename, indent = 4):
+ self.fd = open(filename, 'w')
+ self.indent_stack = [0]
+ self.indent_size = indent
+
+ def pn(self, s = ''):
+- print_((' ' * self.indent_stack[-1]) + s, file=self.fd)
++ print((' ' * self.indent_stack[-1]) + s, file=self.fd)
+
+ def p(self, s = ''):
+- print_(s, file=self.fd, end="")
++ print(s, file=self.fd, end="")
+
+ def close(self):
+ self.fd.close()
+@@ -95,8 +94,8 @@ class Binding:
+ self.typemap.pn('''
+ string_or_null\tT_STRING_OR_NULL
+ string_non_null\tT_STRING_NON_NULL
+-const gchar *\tT_PV
+ gchar *\tT_PV
++const gchar *\tT_PV
+ gboolean\tT_IV
+ const LassoProvider *\tT_GOBJECT_WRAPPER
+ xmlNode*\tT_XMLNODE
+@@ -277,7 +276,7 @@ INCLUDE: LassoNode.xs
+ try:
+ self.xs.pn(self.glist_type(func.return_arg))
+ except:
+- print_('failed', func.return_arg, func, file=sys.stderr)
++ print('failed', func.return_arg, func, file=sys.stderr)
+ raise
+ self.xs.p(name + '(')
+ arg_list = []
+@@ -376,12 +375,24 @@ INCLUDE: LassoNode.xs
+ self.xs.pn(''' OUTPUT:
+ RETVAL''')
+ cleanup.append('lasso_unref(RETVAL);')
+- elif func.return_type and is_object(func.return_type) and not is_int(func.return_type, self.binding_data) and func.return_owner:
+- cleanup.append('lasso_unref(RETVAL);')
+ elif is_rc(func.return_arg):
+ if name == 'lasso_check_version':
+ cleanup.append('if (RETVAL != 1)')
+ cleanup.append('gperl_lasso_error(RETVAL);')
++ elif func.return_type:
++ if is_transfer_full(func.return_arg, default=True):
++ if is_cstring(func.return_arg):
++ cleanup.append('lasso_release_string(RETVAL);')
++ elif is_int(func.return_type, self.binding_data) or is_boolean(func.return_type):
++ pass
++ elif is_xml_node(func.return_arg):
++ pass
++ elif is_glist(func.return_arg):
++ pass
++ elif is_object(func.return_arg):
++ cleanup.append('lasso_unref(RETVAL);')
++ else:
++ raise Exception('Unsupported caller owned return type %s' % ((repr(func.return_arg), func),))
+ # Output cleanup code
+ if cleanup:
+ self.xs.pn(' CLEANUP:')
+@@ -448,7 +459,7 @@ INCLUDE: LassoNode.xs
+ kind = "objects"
+ else:
+ kind = "strings"
+- self.xs.pn('''
++ self.xs.pn(r'''
+ HV*
+ %(field)s(%(clss)s* obj, ...)
+ PROTOTYPE:
+@@ -587,12 +598,12 @@ HV*
+ self.generate_xs_function(func, prefix = prefix)
+ for member in struct.members:
+ if arg_type(member) == 'void*':
+- print_('Skipping %s' % member)
++ print('Skipping %s' % member)
+ continue
+ try:
+ self.generate_xs_getter_setter(struct, member)
+ except:
+- print_('failed', struct, member)
++ print('failed', struct, member)
+ raise
+
+ def generate_wrapper(self):
+diff --git a/bindings/php5/php_code.py b/bindings/php5/php_code.py
+index 7e94d16e..6794465c 100644
+--- a/bindings/php5/php_code.py
++++ b/bindings/php5/php_code.py
+@@ -20,7 +20,6 @@
+
+ import re
+ import sys
+-import six
+
+ from utils import *
+
+@@ -40,7 +39,7 @@ class PhpCode:
+ self.generate_footer()
+
+ def generate_header(self):
+- six.print_('''\
++ print('''\
+ <?php
+
+ /* this file has been generated automatically; do not edit */
+@@ -108,27 +107,27 @@ function lassoGetRequestTypeFromSoapMsg($mesg) {
+ else:
+ inheritence = ' extends LassoObject'
+
+- six.print_('/**', file=self.fd)
+- six.print_(' * @package Lasso', file=self.fd)
+- six.print_(' */', file=self.fd)
+- six.print_('class %(class_name)s%(inheritence)s {' % locals(), file=self.fd)
++ print('/**', file=self.fd)
++ print(' * @package Lasso', file=self.fd)
++ print(' */', file=self.fd)
++ print('class %(class_name)s%(inheritence)s {' % locals(), file=self.fd)
+
+ if klass.members or klass.methods:
+ self.generate_constructors(klass)
+ self.generate_getters_and_setters(klass)
+ self.generate_methods(klass)
+
+- six.print_('}', file=self.fd)
+- six.print_('', file=self.fd)
++ print('}', file=self.fd)
++ print('', file=self.fd)
+
+ # Add a special class to get an object instance without initialising
+- six.print_('/**', file=self.fd)
+- six.print_(' * @package Lasso', file=self.fd)
+- six.print_(' */', file=self.fd)
+- six.print_('class %(class_name)sNoInit extends %(class_name)s {' % locals(), file=self.fd)
+- six.print_(' public function __construct() {}', file=self.fd)
+- six.print_('}', file=self.fd)
+- six.print_('', file=self.fd)
++ print('/**', file=self.fd)
++ print(' * @package Lasso', file=self.fd)
++ print(' */', file=self.fd)
++ print('class %(class_name)sNoInit extends %(class_name)s {' % locals(), file=self.fd)
++ print(' public function __construct() {}', file=self.fd)
++ print('}', file=self.fd)
++ print('', file=self.fd)
+
+ def generate_constructors(self, klass):
+ method_prefix = format_as_underscored(klass.name) + '_'
+@@ -153,13 +152,13 @@ function lassoGetRequestTypeFromSoapMsg($mesg) {
+ c_args = ', '.join(c_args)
+ # XXX: could check $this->_cptr->typename to see if it got the
+ # right class type
+- six.print_(' public $_cptr = null;', file=self.fd)
+- six.print_('', file=self.fd)
+- six.print_(' public function __construct(%s) {' % php_args, file=self.fd)
+- six.print_(' $this->_cptr = %s(%s);' % (m.name, c_args), file=self.fd)
+- six.print_(' if (is_null($this->_cptr)) { throw new Exception("Constructor for ', klass.name, ' failed "); }', file=self.fd)
+- six.print_(' }', file=self.fd)
+- six.print_('', file=self.fd)
++ print(' public $_cptr = null;', file=self.fd)
++ print('', file=self.fd)
++ print(' public function __construct(%s) {' % php_args, file=self.fd)
++ print(' $this->_cptr = %s(%s);' % (m.name, c_args), file=self.fd)
++ print(' if (is_null($this->_cptr)) { throw new Exception("Constructor for ', klass.name, ' failed "); }', file=self.fd)
++ print(' }', file=self.fd)
++ print('', file=self.fd)
+
+ elif name.startswith(method_prefix) and m.args \
+ and clean_type(unconstify(m.args[0][0])) != klass.name:
+@@ -186,10 +185,10 @@ function lassoGetRequestTypeFromSoapMsg($mesg) {
+ c_args.append('$%s' % arg_name)
+ php_args = ', '.join(php_args)
+ c_args = ', '.join(c_args)
+- six.print_(' public static function %s(%s) {' % (php_name, php_args), file=self.fd)
+- six.print_(' return cptrToPhp(%s(%s));' % (m.name, c_args), file=self.fd)
+- six.print_(' }', file=self.fd)
+- six.print_('', file=self.fd)
++ print(' public static function %s(%s) {' % (php_name, php_args), file=self.fd)
++ print(' return cptrToPhp(%s(%s));' % (m.name, c_args), file=self.fd)
++ print(' }', file=self.fd)
++ print('', file=self.fd)
+
+
+
+@@ -201,50 +200,50 @@ function lassoGetRequestTypeFromSoapMsg($mesg) {
+ 'class': c.name
+ }
+
+- six.print_('''\
++ print('''\
+ /**
+ * @return %(docstring)s
+ */
+ protected function get_%(name)s() {''' % d, file=self.fd)
+- six.print_(' $t = %(class)s_%(name)s_get($this->_cptr);' % d, file=self.fd)
++ print(' $t = %(class)s_%(name)s_get($this->_cptr);' % d, file=self.fd)
+ if self.is_object(m):
+- six.print_(' $t = cptrToPhp($t);', file=self.fd)
++ print(' $t = cptrToPhp($t);', file=self.fd)
+ elif (is_glist(m) or is_hashtable(m)) and self.is_object(element_type(m)):
+- six.print_(' foreach ($t as $key => $item) {', file=self.fd)
+- six.print_(' $t[$key] = cptrToPhp($item);', file=self.fd)
+- six.print_(' }', file=self.fd)
++ print(' foreach ($t as $key => $item) {', file=self.fd)
++ print(' $t[$key] = cptrToPhp($item);', file=self.fd)
++ print(' }', file=self.fd)
+ elif is_hashtable(m) or (is_glist(m) and (is_cstring(element_type(m)) \
+ or is_xml_node(element_type(m)))) or is_int(m, self.binding_data) \
+ or is_boolean(m) or is_cstring(m) or is_xml_node(m):
+ pass
+ else:
+ raise Exception('Cannot generate a Php getter %s.%s' % (c,m))
+- six.print_(' return $t;', file=self.fd)
+- six.print_(' }', file=self.fd)
++ print(' return $t;', file=self.fd)
++ print(' }', file=self.fd)
+
+ def generate_setter(self, c, m):
+ d = { 'type': arg_type(m), 'name': format_as_camelcase(arg_name(m)),
+ 'docstring': self.get_docstring_return_type(arg_type(m)), 'class': c.name }
+- six.print_(' protected function set_%(name)s($value) {' % d, file=self.fd)
++ print(' protected function set_%(name)s($value) {' % d, file=self.fd)
+ if self.is_object(m):
+- six.print_(' $value = $value->_cptr;', file=self.fd)
++ print(' $value = $value->_cptr;', file=self.fd)
+ elif (is_glist(m) or is_hashtable(m)) and self.is_object(element_type(m)):
+- six.print_(' $array = array();', file=self.fd)
+- six.print_(' if (!is_null($value)) {', file=self.fd)
+- six.print_(' foreach ($value as $key => $item) {', file=self.fd)
+- six.print_(' $array[$key] = $item->_cptr;', file=self.fd)
+- six.print_(' }', file=self.fd)
+- six.print_(' }', file=self.fd)
+- six.print_(' $value = $array;', file=self.fd)
++ print(' $array = array();', file=self.fd)
++ print(' if (!is_null($value)) {', file=self.fd)
++ print(' foreach ($value as $key => $item) {', file=self.fd)
++ print(' $array[$key] = $item->_cptr;', file=self.fd)
++ print(' }', file=self.fd)
++ print(' }', file=self.fd)
++ print(' $value = $array;', file=self.fd)
+ elif is_hashtable(m) or (is_glist(m) and (is_cstring(element_type(m)) \
+ or is_xml_node(element_type(m)))) or is_int(m, self.binding_data) \
+ or is_boolean(m) or is_cstring(m) or is_xml_node(m):
+ pass
+ else:
+ raise Exception('Cannot generate a Php setter %s.%s' % (c,m))
+- six.print_(' %(class)s_%(name)s_set($this->_cptr, $value);' % d, file=self.fd)
+- six.print_(' }', file=self.fd)
+- six.print_('', file=self.fd)
++ print(' %(class)s_%(name)s_set($this->_cptr, $value);' % d, file=self.fd)
++ print(' }', file=self.fd)
++ print('', file=self.fd)
+
+ def generate_getters_and_setters(self, klass):
+ for m in klass.members:
+@@ -272,27 +271,27 @@ function lassoGetRequestTypeFromSoapMsg($mesg) {
+ mname = re.match(r'lasso_.*_get_(\w+)', meth_name).group(1)
+ mname = format_as_camelcase(mname)
+
+- six.print_(' /**', file=self.fd)
+- six.print_(' * @return %s' % self.get_docstring_return_type(m.return_type), file=self.fd)
+- six.print_(' */', file=self.fd)
+- six.print_(' protected function get_%s() {' % mname, file=self.fd)
++ print(' /**', file=self.fd)
++ print(' * @return %s' % self.get_docstring_return_type(m.return_type), file=self.fd)
++ print(' */', file=self.fd)
++ print(' protected function get_%s() {' % mname, file=self.fd)
+ if self.is_object(m.return_type):
+- six.print_(' $cptr = %s($this->_cptr);' % meth_name, file=self.fd)
+- six.print_(' if (! is_null($cptr)) {', file=self.fd)
+- six.print_(' return cptrToPhp($cptr);', file=self.fd)
+- six.print_(' }', file=self.fd)
+- six.print_(' return null;', file=self.fd)
++ print(' $cptr = %s($this->_cptr);' % meth_name, file=self.fd)
++ print(' if (! is_null($cptr)) {', file=self.fd)
++ print(' return cptrToPhp($cptr);', file=self.fd)
++ print(' }', file=self.fd)
++ print(' return null;', file=self.fd)
+ else:
+- six.print_(' return %s($this->_cptr);' % meth_name, file=self.fd)
+- six.print_(' }', file=self.fd)
++ print(' return %s($this->_cptr);' % meth_name, file=self.fd)
++ print(' }', file=self.fd)
+ if setter:
+- six.print_(' protected function set_%s($value) {' % mname, file=self.fd)
++ print(' protected function set_%s($value) {' % mname, file=self.fd)
+ if self.is_object(m.return_type):
+- six.print_(' %s($this->_cptr, $value->_cptr);' % setter.name, file=self.fd)
++ print(' %s($this->_cptr, $value->_cptr);' % setter.name, file=self.fd)
+ else:
+- six.print_(' %s($this->_cptr, $value);' % setter.name, file=self.fd)
+- six.print_(' }', file=self.fd)
+- six.print_('', file=self.fd)
++ print(' %s($this->_cptr, $value);' % setter.name, file=self.fd)
++ print(' }', file=self.fd)
++ print('', file=self.fd)
+
+ # second pass on methods, real methods
+ method_prefix = format_as_underscored(klass.name) + '_'
+@@ -301,7 +300,7 @@ function lassoGetRequestTypeFromSoapMsg($mesg) {
+ m.name.endswith('_new_full'):
+ continue
+ if not m.name.startswith(method_prefix):
+- six.print_('W:', m.name, 'vs', method_prefix, file=sys.stderr)
++ print('W:', m.name, 'vs', method_prefix, file=sys.stderr)
+ continue
+
+ if m.rename:
+@@ -327,7 +326,7 @@ function lassoGetRequestTypeFromSoapMsg($mesg) {
+ elif defval.startswith('b:'): # boolean
+ php_args.append('%s = %s' % (arg_name, defval[2:]))
+ else:
+- six.print_("E: don't know what to do with %s" % defval, file=sys.stderr)
++ print("E: don't know what to do with %s" % defval, file=sys.stderr)
+ sys.exit(1)
+ else:
+ php_args.append('%s = null' % arg_name)
+@@ -357,26 +356,26 @@ function lassoGetRequestTypeFromSoapMsg($mesg) {
+ c_args = ''
+
+ if m.docstring:
+- six.print_(self.generate_docstring(m, mname, 4), file=self.fd)
+- six.print_(' public function %s(%s) {' % (
++ print(self.generate_docstring(m, mname, 4), file=self.fd)
++ print(' public function %s(%s) {' % (
+ format_underscore_as_camelcase(mname), php_args), file=self.fd)
+ if m.return_type == 'void':
+- six.print_(' %s($this->_cptr%s);' % (cname, c_args), file=self.fd)
++ print(' %s($this->_cptr%s);' % (cname, c_args), file=self.fd)
+ elif is_rc(m.return_type):
+- six.print_(' $rc = %s($this->_cptr%s);' % (cname, c_args), file=self.fd)
+- six.print_(' if ($rc == 0) {', file=self.fd)
+- six.print_(' return 0;', file=self.fd)
+- six.print_(' } else if ($rc > 0) {', file=self.fd) # recoverable error
+- six.print_(' return $rc;', file=self.fd)
+- six.print_(' } else if ($rc < 0) {', file=self.fd) # unrecoverable error
+- six.print_(' LassoError::throw_on_rc($rc);', file=self.fd)
+- six.print_(' }', file=self.fd)
++ print(' $rc = %s($this->_cptr%s);' % (cname, c_args), file=self.fd)
++ print(' if ($rc == 0) {', file=self.fd)
++ print(' return 0;', file=self.fd)
++ print(' } else if ($rc > 0) {', file=self.fd) # recoverable error
++ print(' return $rc;', file=self.fd)
++ print(' } else if ($rc < 0) {', file=self.fd) # unrecoverable error
++ print(' LassoError::throw_on_rc($rc);', file=self.fd)
++ print(' }', file=self.fd)
+ else:
+- six.print_(' return %s($this->_cptr%s);' % (cname, c_args), file=self.fd)
+- six.print_(' }', file=self.fd)
+- six.print_('', file=self.fd)
++ print(' return %s($this->_cptr%s);' % (cname, c_args), file=self.fd)
++ print(' }', file=self.fd)
++ print('', file=self.fd)
+
+- six.print_('', file=self.fd)
++ print('', file=self.fd)
+
+ def generate_docstring(self, func, method_name, indent):
+ docstring = func.docstring.orig_docstring
+@@ -393,7 +392,7 @@ function lassoGetRequestTypeFromSoapMsg($mesg) {
+ elif type == '%': # %TRUE, %FALSE
+ if var in ('TRUE', 'FALSE'):
+ return var
+- six.print_('W: unknown docstring thingie \'%s\' in \'%s\'' % (s.group(1), func.docstring.orig_docstring),
++ print('W: unknown docstring thingie \'%s\' in \'%s\'' % (s.group(1), func.docstring.orig_docstring),
+ file=sys.stderr)
+ elif type == '@':
+ if var == first_arg_name:
+@@ -437,7 +436,7 @@ function lassoGetRequestTypeFromSoapMsg($mesg) {
+ cat = exc_cat.attrib.get('name')
+ done_cats.append(cat)
+ parent_cat = exc_cat.attrib.get('parent', '')
+- six.print_('''\
++ print('''\
+ /**
+ * @package Lasso
+ */
+@@ -462,7 +461,7 @@ class Lasso%sError extends Lasso%sError {}
+ else:
+ parent_cat = ''
+
+- six.print_('''\
++ print('''\
+ /**
+ * @package Lasso
+ */
+@@ -470,7 +469,7 @@ class Lasso%sError extends Lasso%sError {}
+ ''' % (cat, parent_cat), file=self.fd)
+
+ if detail not in exceptions_dict:
+- six.print_('''\
++ print('''\
+ /**
+ * @package Lasso
+ */
+@@ -480,7 +479,7 @@ class Lasso%sError extends Lasso%sError {
+ ''' % (detail, cat, c[1]), file=self.fd)
+ exceptions_dict[detail] = c[1]
+
+- six.print_('''\
++ print('''\
+ /**
+ * @package Lasso
+ */
+@@ -488,9 +487,9 @@ class LassoError extends Exception {
+ private static $exceptions_dict = array(''', file=self.fd)
+
+ for k, v in exceptions_dict.items():
+- six.print_(' %s => "Lasso%sError",' % (v, k), file=self.fd)
++ print(' %s => "Lasso%sError",' % (v, k), file=self.fd)
+
+- six.print_('''\
++ print('''\
+ );
+
+ public static function throw_on_rc($rc) {
+@@ -504,6 +503,6 @@ class LassoError extends Exception {
+ ''', file=self.fd)
+
+ def generate_footer(self):
+- six.print_('''\
++ print('''\
+ ?>''', file=self.fd)
+
+diff --git a/bindings/php5/wrapper_header.py b/bindings/php5/wrapper_header.py
+index 5236571a..22908945 100644
+--- a/bindings/php5/wrapper_header.py
++++ b/bindings/php5/wrapper_header.py
+@@ -17,7 +17,6 @@
+ #
+ # You should have received a copy of the GNU General Public License
+ # along with this program; if not, see <http://www.gnu.org/licenses/>.
+-import six
+
+ class WrapperHeader:
+ def __init__(self, binding_data, fd, functions_list):
+@@ -32,7 +31,7 @@ class WrapperHeader:
+
+ def generate_header(self):
+ # FIXME: Get the current version and name
+- six.print_('''\
++ print('''\
+ /* this file has been generated automatically; do not edit */
+
+ #include "../../config.h"
+@@ -51,11 +50,11 @@ PHP_MSHUTDOWN_FUNCTION(lasso);
+
+ def generate_functions_list(self):
+ for m in self.functions_list:
+- six.print_('PHP_FUNCTION(%s);' % m, file=self.fd)
+- six.print_('', file=self.fd)
++ print('PHP_FUNCTION(%s);' % m, file=self.fd)
++ print('', file=self.fd)
+
+ def generate_footer(self):
+- six.print_('''\
++ print('''\
+ extern zend_module_entry lasso_module_entry;
+ #define phpext_lasso_ptr &lasso_module_entry
+
+diff --git a/bindings/php5/wrapper_source.py b/bindings/php5/wrapper_source.py
+index d84b6fdb..5ddd90e5 100644
+--- a/bindings/php5/wrapper_source.py
++++ b/bindings/php5/wrapper_source.py
+@@ -20,7 +20,6 @@
+
+ import sys
+ import os
+-import six
+
+ from utils import *
+
+@@ -53,17 +52,17 @@ class WrapperSource:
+ self.functions_list.append('lasso_init')
+ self.functions_list.append('lasso_shutdown')
+
+- six.print_('''\
++ print('''\
+ /* this file has been generated automatically; do not edit */
+ ''', file=self.fd)
+
+- six.print_(open(os.path.join(self.src_dir,'wrapper_source_top.c')).read(), file=self.fd)
++ print(open(os.path.join(self.src_dir,'wrapper_source_top.c')).read(), file=self.fd)
+
+ for h in self.binding_data.headers:
+- six.print_('#include <%s>' % h, file=self.fd)
+- six.print_('', file=self.fd)
++ print('#include <%s>' % h, file=self.fd)
++ print('', file=self.fd)
+
+- six.print_('''\
++ print('''\
+ PHP_MINIT_FUNCTION(lasso)
+ {
+ le_lasso_server = zend_register_list_destructors_ex(php_gobject_generic_destructor, NULL, PHP_LASSO_SERVER_RES_NAME, module_number);
+@@ -71,25 +70,25 @@ PHP_MINIT_FUNCTION(lasso)
+ ''', file=self.fd)
+
+ def generate_constants(self):
+- six.print_(' /* Constants (both enums and defines) */', file=self.fd)
++ print(' /* Constants (both enums and defines) */', file=self.fd)
+ for c in self.binding_data.constants:
+ if c[0] == 'i':
+- six.print_(' REGISTER_LONG_CONSTANT("%s", %s, CONST_CS|CONST_PERSISTENT);' % (c[1], c[1]), file=self.fd)
++ print(' REGISTER_LONG_CONSTANT("%s", %s, CONST_CS|CONST_PERSISTENT);' % (c[1], c[1]), file=self.fd)
+ elif c[0] == 's':
+- six.print_(' REGISTER_STRING_CONSTANT("%s", (char*) %s, CONST_CS|CONST_PERSISTENT);' % (c[1], c[1]), file=self.fd)
++ print(' REGISTER_STRING_CONSTANT("%s", (char*) %s, CONST_CS|CONST_PERSISTENT);' % (c[1], c[1]), file=self.fd)
+ elif c[0] == 'b':
+- six.print_('''\
++ print('''\
+ #ifdef %s
+ REGISTER_LONG_CONSTANT("%s", 1, CONST_CS|CONST_PERSISTENT);
+ #else
+ REGISTER_LONG_CONSTANT("%s", 0, CONST_CS|CONST_PERSISTENT);
+ #endif''' % (c[1], c[1], c[1]), file=self.fd)
+ else:
+- six.print_('E: unknown constant type: %r' % c[0], file=sys.stderr)
+- six.print_('', file=self.fd)
++ print('E: unknown constant type: %r' % c[0], file=sys.stderr)
++ print('', file=self.fd)
+
+ def generate_middle(self):
+- six.print_('''\
++ print('''\
+ return SUCCESS;
+ }
+
+@@ -107,21 +106,21 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+ # first we free the previous value
+ p = (zval_name, c_variable)
+ q = { 'zval_name' : zval_name, 'c_variable' : c_variable }
+- six.print_(' zval_dtor(%s);' % zval_name, file=self.fd)
++ print(' zval_dtor(%s);' % zval_name, file=self.fd)
+ if is_pointer(type):
+- six.print_(' if (! %s) {' % c_variable, file=self.fd)
+- six.print_(' ZVAL_NULL(%s);' % zval_name, file=self.fd)
+- six.print_(' } else {', file=self.fd)
++ print(' if (! %s) {' % c_variable, file=self.fd)
++ print(' ZVAL_NULL(%s);' % zval_name, file=self.fd)
++ print(' } else {', file=self.fd)
+ if is_int(type, self.binding_data):
+- six.print_(' ZVAL_LONG(%s, %s);' % p, file=self.fd)
++ print(' ZVAL_LONG(%s, %s);' % p, file=self.fd)
+ elif is_boolean(type):
+- six.print_(' ZVAL_BOOL(%s, %s);' % p, file=self.fd)
++ print(' ZVAL_BOOL(%s, %s);' % p, file=self.fd)
+ elif is_cstring(type):
+- six.print_(' ZVAL_STRING(%s, (char*)%s, 1);' % p, file=self.fd)
++ print(' ZVAL_STRING(%s, (char*)%s, 1);' % p, file=self.fd)
+ if free and not is_const(type):
+- six.print_('g_free(%s)' % c_variable, file=self.fd)
++ print('g_free(%s)' % c_variable, file=self.fd)
+ elif arg_type(type) == 'xmlNode*':
+- six.print_('''\
++ print('''\
+ {
+ char* xmlString = get_string_from_xml_node(%(c_variable)s);
+ if (xmlString) {
+@@ -146,11 +145,11 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+ free_function = 'g_list_free(%(c_variable)s);'
+ else:
+ raise Exception('unknown element-type: ' + repr(type))
+- six.print_(' %s((GList*)%s, &%s);' % (function, c_variable, zval_name), file=self.fd)
++ print(' %s((GList*)%s, &%s);' % (function, c_variable, zval_name), file=self.fd)
+ if free:
+- six.print_(' ', free_function % q, file=self.fd)
++ print(' ', free_function % q, file=self.fd)
+ elif is_object(type):
+- six.print_('''\
++ print('''\
+ if (G_IS_OBJECT(%(c_variable)s)) {
+ PhpGObjectPtr *obj = PhpGObjectPtr_New(G_OBJECT(%(c_variable)s));
+ ZEND_REGISTER_RESOURCE(%(zval_name)s, obj, le_lasso_server);
+@@ -158,7 +157,7 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+ ZVAL_NULL(%(zval_name)s);
+ }''' % q, file=self.fd)
+ if free:
+- six.print_('''\
++ print('''\
+ if (%(c_variable)s) {
+ g_object_unref(%(c_variable)s); // If constructor ref is off by one'
+ }''' % q, file=self.fd)
+@@ -166,7 +165,7 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+ else:
+ raise Exception('unknown type: ' + repr(type) + unconstify(arg_type(type)))
+ if is_pointer(type):
+- six.print_(' }', file=self.fd)
++ print(' }', file=self.fd)
+
+
+
+@@ -175,20 +174,20 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+ return
+
+ if is_boolean(arg):
+- six.print_(' RETVAL_BOOL(return_c_value);', file=self.fd)
++ print(' RETVAL_BOOL(return_c_value);', file=self.fd)
+ elif is_int(arg, self.binding_data):
+- six.print_(' RETVAL_LONG(return_c_value);', file=self.fd)
++ print(' RETVAL_LONG(return_c_value);', file=self.fd)
+ elif is_cstring(arg):
+- six.print_('''\
++ print('''\
+ if (return_c_value) {
+ RETVAL_STRING((char*)return_c_value, 1);
+ } else {
+ RETVAL_NULL();
+ }''', file=self.fd)
+ if free:
+- six.print_(' free(return_c_value);', file=self.fd)
++ print(' free(return_c_value);', file=self.fd)
+ elif is_xml_node(arg):
+- six.print_('''\
++ print('''\
+ {
+ char* xmlString = get_string_from_xml_node(return_c_value);
+ if (xmlString) {
+@@ -199,44 +198,44 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+ }
+ ''', file=self.fd)
+ if free:
+- six.print_(' lasso_release_xml_node(return_c_value);', file=self.fd)
++ print(' lasso_release_xml_node(return_c_value);', file=self.fd)
+ elif is_glist(arg):
+ el_type = element_type(arg)
+ if is_cstring(el_type):
+- six.print_('''\
++ print('''\
+ set_array_from_list_of_strings((GList*)return_c_value, &return_value);
+ ''', file=self.fd)
+ if free:
+- six.print_(' lasso_release_list_of_strings(return_c_value);', file=self.fd)
++ print(' lasso_release_list_of_strings(return_c_value);', file=self.fd)
+ elif is_xml_node(el_type):
+- six.print_('''\
++ print('''\
+ set_array_from_list_of_xmlnodes((GList*)return_c_value, &return_value);
+ ''', file=self.fd)
+ if free or is_transfer_full(arg):
+- six.print_(' lasso_release_list_of_xml_node(return_c_value);', file=self.fd)
++ print(' lasso_release_list_of_xml_node(return_c_value);', file=self.fd)
+ elif is_object(el_type):
+- six.print_('''\
++ print('''\
+ set_array_from_list_of_objects((GList*)return_c_value, &return_value);
+ ''', file=self.fd)
+ if free:
+- six.print_(' lasso_release_list_of_gobjects(return_c_value);', file=self.fd)
++ print(' lasso_release_list_of_gobjects(return_c_value);', file=self.fd)
+ else:
+ raise Exception('cannot return value for %s' % (arg,))
+ elif is_hashtable(arg):
+ el_type = element_type(arg)
+ if is_object(el_type):
+- six.print_('''\
++ print('''\
+ set_array_from_hashtable_of_objects(return_c_value, &return_value);
+ ''', file=self.fd)
+ else:
+ if not is_cstring(arg):
+- six.print_('W: %s has no explicit string annotation' % (arg,),
++ print('W: %s has no explicit string annotation' % (arg,),
+ file=sys.stderr)
+- six.print_('''\
++ print('''\
+ set_array_from_hashtable_of_strings(return_c_value, &return_value);
+ ''', file=self.fd)
+ elif is_object(arg):
+- six.print_('''\
++ print('''\
+ if (return_c_value) {
+ PhpGObjectPtr *self;
+ self = PhpGObjectPtr_New(G_OBJECT(return_c_value));
+@@ -245,7 +244,7 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+ RETVAL_NULL();
+ }''', file=self.fd)
+ if free:
+- six.print_(' lasso_release_gobject(return_c_value);', file=self.fd)
++ print(' lasso_release_gobject(return_c_value);', file=self.fd)
+ else:
+ raise Exception('cannot return value for %s' % (arg,))
+
+@@ -257,61 +256,61 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+ else:
+ name = m.name
+ self.functions_list.append(name)
+- six.print_('''PHP_FUNCTION(%s)
++ print('''PHP_FUNCTION(%s)
+ {''' % name, file=self.fd)
+ parse_tuple_format = []
+ parse_tuple_args = []
+ for arg in m.args:
+ if is_out(arg):
+- six.print_(' zval *php_out_%s = NULL;' % arg_name(arg), file=self.fd)
+- six.print_(' %s %s;' % (var_type(arg), arg_name(arg)), file=self.fd)
++ print(' zval *php_out_%s = NULL;' % arg_name(arg), file=self.fd)
++ print(' %s %s;' % (var_type(arg), arg_name(arg)), file=self.fd)
+ parse_tuple_format.append('z!')
+ parse_tuple_args.append('&php_out_%s' % arg_name(arg))
+ elif is_cstring(arg):
+ parse_tuple_format.append('s!')
+ parse_tuple_args.append('&%s_str, &%s_len' % (arg_name(arg), arg_name(arg)))
+- six.print_(' %s %s = NULL;' % ('char*', arg_name(arg)), file=self.fd)
+- six.print_(' %s %s_str = NULL;' % ('char*', arg_name(arg)), file=self.fd)
+- six.print_(' %s %s_len = 0;' % ('int', arg_name(arg)), file=self.fd)
++ print(' %s %s = NULL;' % ('char*', arg_name(arg)), file=self.fd)
++ print(' %s %s_str = NULL;' % ('char*', arg_name(arg)), file=self.fd)
++ print(' %s %s_len = 0;' % ('int', arg_name(arg)), file=self.fd)
+ elif is_int(arg, self.binding_data) or is_boolean(arg):
+ parse_tuple_format.append('l')
+ parse_tuple_args.append('&%s' % arg_name(arg))
+- six.print_(' %s %s;' % ('long', arg_name(arg)), file=self.fd)
++ print(' %s %s;' % ('long', arg_name(arg)), file=self.fd)
+ elif is_time_t_pointer(arg):
+ parse_tuple_format.append('l')
+ parse_tuple_args.append('&%s' % (arg_name(arg),))
+- six.print_(' time_t %s = 0;' % (arg_name(arg),), file=self.fd)
++ print(' time_t %s = 0;' % (arg_name(arg),), file=self.fd)
+ elif is_xml_node(arg):
+ parse_tuple_format.append('s!')
+ parse_tuple_args.append('&%s_str, &%s_len' % (arg_name(arg), arg_name(arg)))
+- six.print_(' %s %s = NULL;' % ('xmlNode*', arg_name(arg)), file=self.fd)
+- six.print_(' %s %s_str = NULL;' % ('char*', arg_name(arg)), file=self.fd)
+- six.print_(' %s %s_len = 0;' % ('int', arg_name(arg)), file=self.fd)
++ print(' %s %s = NULL;' % ('xmlNode*', arg_name(arg)), file=self.fd)
++ print(' %s %s_str = NULL;' % ('char*', arg_name(arg)), file=self.fd)
++ print(' %s %s_len = 0;' % ('int', arg_name(arg)), file=self.fd)
+ elif is_glist(arg):
+ parse_tuple_format.append('a!')
+ parse_tuple_args.append('&zval_%s' % arg_name(arg))
+- six.print_(' %s zval_%s = NULL;' % ('zval*', arg_name(arg)), file=self.fd)
+- six.print_(' %s %s = NULL;' % ('GList*', arg_name(arg)), file=self.fd)
++ print(' %s zval_%s = NULL;' % ('zval*', arg_name(arg)), file=self.fd)
++ print(' %s %s = NULL;' % ('GList*', arg_name(arg)), file=self.fd)
+ elif is_object(arg):
+ parse_tuple_format.append('r')
+ parse_tuple_args.append('&zval_%s' % arg_name(arg))
+- six.print_(' %s %s = NULL;' % (arg_type(arg), arg_name(arg)), file=self.fd)
+- six.print_(' %s zval_%s = NULL;' % ('zval*', arg_name(arg)), file=self.fd)
+- six.print_(' %s cvt_%s = NULL;' % ('PhpGObjectPtr*', arg_name(arg)), file=self.fd)
++ print(' %s %s = NULL;' % (arg_type(arg), arg_name(arg)), file=self.fd)
++ print(' %s zval_%s = NULL;' % ('zval*', arg_name(arg)), file=self.fd)
++ print(' %s cvt_%s = NULL;' % ('PhpGObjectPtr*', arg_name(arg)), file=self.fd)
+ else:
+ raise Exception('Unsupported type %s %s' % (arg, m))
+
+ if m.return_type:
+- six.print_(' %s return_c_value;' % m.return_type, file=self.fd)
++ print(' %s return_c_value;' % m.return_type, file=self.fd)
+ if m.return_type is not None and self.is_object(m.return_arg):
+- six.print_(' G_GNUC_UNUSED PhpGObjectPtr *self;', file=self.fd)
+- six.print_('', file=self.fd)
++ print(' G_GNUC_UNUSED PhpGObjectPtr *self;', file=self.fd)
++ print('', file=self.fd)
+
+ parse_tuple_args = ', '.join(parse_tuple_args)
+ if parse_tuple_args:
+ parse_tuple_args = ', ' + parse_tuple_args
+
+- six.print_('''\
++ print('''\
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "%s"%s) == FAILURE) {
+ RETURN_FALSE;
+ }
+@@ -321,22 +320,22 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+ if is_out(arg):
+ continue
+ elif is_xml_node(arg):
+- six.print_('''\
++ print('''\
+ %(name)s = get_xml_node_from_string(%(name)s_str);''' % {'name': arg[1]}, file=self.fd)
+ elif f.startswith('s'):
+- six.print_('''\
++ print('''\
+ %(name)s = %(name)s_str;''' % {'name': arg[1]}, file=self.fd)
+ elif f.startswith('r'):
+- six.print_(' ZEND_FETCH_RESOURCE(cvt_%s, PhpGObjectPtr *, &zval_%s, -1, PHP_LASSO_SERVER_RES_NAME, le_lasso_server);' % (arg[1], arg[1]), file=self.fd)
+- six.print_(' %s = (%s)cvt_%s->obj;' % (arg[1], arg[0], arg[1]), file=self.fd)
++ print(' ZEND_FETCH_RESOURCE(cvt_%s, PhpGObjectPtr *, &zval_%s, -1, PHP_LASSO_SERVER_RES_NAME, le_lasso_server);' % (arg[1], arg[1]), file=self.fd)
++ print(' %s = (%s)cvt_%s->obj;' % (arg[1], arg[0], arg[1]), file=self.fd)
+ elif f.startswith('a'):
+ el_type = element_type(arg)
+ if is_cstring(el_type):
+- six.print_(' %(name)s = get_list_from_array_of_strings(zval_%(name)s);' % {'name': arg[1]}, file=self.fd)
++ print(' %(name)s = get_list_from_array_of_strings(zval_%(name)s);' % {'name': arg[1]}, file=self.fd)
+ elif is_object(el_type):
+- six.print_(' %(name)s = get_list_from_array_of_objects(zval_%(name)s);' % {'name': arg[1]}, file=self.fd)
++ print(' %(name)s = get_list_from_array_of_objects(zval_%(name)s);' % {'name': arg[1]}, file=self.fd)
+ else:
+- six.print_('E: In %(function)s arg %(name)s is of type GList<%(elem)s>' % { 'function': m.name, 'name': arg[1], 'elem': el_type }, file=sys.stderr)
++ print('E: In %(function)s arg %(name)s is of type GList<%(elem)s>' % { 'function': m.name, 'name': arg[1], 'elem': el_type }, file=sys.stderr)
+ elif f == 'l':
+ pass
+ else:
+@@ -344,17 +343,17 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+
+
+ if m.return_type is not None:
+- six.print_(' return_c_value = ', file=self.fd)
++ print(' return_c_value = ', file=self.fd)
+ if 'new' in m.name:
+- six.print_('(%s)' % m.return_type, file=self.fd)
++ print('(%s)' % m.return_type, file=self.fd)
+ else:
+- six.print_(' ', file=self.fd)
++ print(' ', file=self.fd)
+ def special(x):
+ if is_time_t_pointer(x):
+ return '%(name)s ? &%(name)s : NULL' % { 'name': arg_name(x) }
+ else:
+ return ref_name(x)
+- six.print_('%s(%s);' % (m.name, ', '.join([special(x) for x in m.args])), file=self.fd)
++ print('%s(%s);' % (m.name, ', '.join([special(x) for x in m.args])), file=self.fd)
+ # Free the converted arguments
+
+ for f, arg in zip(parse_tuple_format, m.args):
+@@ -365,21 +364,21 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+ self.set_zval('php_out_%s' % argname, argname, unref_type(arg), free = free)
+ pass
+ elif argtype == 'xmlNode*':
+- six.print_(' xmlFree(%s);' % argname, file=self.fd)
++ print(' xmlFree(%s);' % argname, file=self.fd)
+ elif f.startswith('a'):
+ el_type = element_type(arg)
+ if is_cstring(el_type):
+- six.print_(' if (%(name)s) {' % { 'name': arg[1] }, file=self.fd)
+- six.print_(' free_glist(&%(name)s,(GFunc)free);' % { 'name': arg[1] }, file=self.fd)
+- six.print_(' }', file=self.fd)
++ print(' if (%(name)s) {' % { 'name': arg[1] }, file=self.fd)
++ print(' free_glist(&%(name)s,(GFunc)free);' % { 'name': arg[1] }, file=self.fd)
++ print(' }', file=self.fd)
+
+ try:
+ self.return_value(m.return_arg, is_transfer_full(m.return_arg, default=True))
+ except:
+ raise Exception('Cannot return value for function %s' % m)
+
+- six.print_('}', file=self.fd)
+- six.print_('', file=self.fd)
++ print('}', file=self.fd)
++ print('', file=self.fd)
+
+ def generate_members(self, c):
+ for m in c.members:
+@@ -392,16 +391,16 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+ type = arg_type(m)
+
+ function_name = '%s_%s_get' % (klassname, format_as_camelcase(name))
+- six.print_('''PHP_FUNCTION(%s)
++ print('''PHP_FUNCTION(%s)
+ {''' % function_name, file=self.fd)
+ self.functions_list.append(function_name)
+
+- six.print_(' %s return_c_value;' % type, file=self.fd)
+- six.print_(' %s* this;' % klassname, file=self.fd)
+- six.print_(' zval* zval_this;', file=self.fd)
+- six.print_(' PhpGObjectPtr *cvt_this;', file=self.fd)
+- six.print_('', file=self.fd)
+- six.print_('''\
++ print(' %s return_c_value;' % type, file=self.fd)
++ print(' %s* this;' % klassname, file=self.fd)
++ print(' zval* zval_this;', file=self.fd)
++ print(' PhpGObjectPtr *cvt_this;', file=self.fd)
++ print('', file=self.fd)
++ print('''\
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zval_this) == FAILURE) {
+ RETURN_FALSE;
+ }
+@@ -409,23 +408,23 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+ ZEND_FETCH_RESOURCE(cvt_this, PhpGObjectPtr *, &zval_this, -1, PHP_LASSO_SERVER_RES_NAME, le_lasso_server);
+ this = (%s*)cvt_this->obj;
+ ''' % (klassname), file=self.fd)
+- six.print_(' return_c_value = (%s)this->%s;' % (type, name), file=self.fd)
++ print(' return_c_value = (%s)this->%s;' % (type, name), file=self.fd)
+ self.return_value(m)
+- six.print_('}', file=self.fd)
+- six.print_('', file=self.fd)
++ print('}', file=self.fd)
++ print('', file=self.fd)
+
+ def generate_setter(self, c, m):
+ klassname = c.name
+ name = arg_name(m)
+ type = arg_type(m)
+ function_name = '%s_%s_set' % (klassname, format_as_camelcase(name))
+- six.print_('''PHP_FUNCTION(%s)
++ print('''PHP_FUNCTION(%s)
+ {''' % function_name, file=self.fd)
+ self.functions_list.append(function_name)
+
+- six.print_(' %s* this;' % klassname, file=self.fd)
+- six.print_(' zval* zval_this;', file=self.fd)
+- six.print_(' PhpGObjectPtr *cvt_this;', file=self.fd)
++ print(' %s* this;' % klassname, file=self.fd)
++ print(' zval* zval_this;', file=self.fd)
++ print(' PhpGObjectPtr *cvt_this;', file=self.fd)
+
+ # FIXME: This bloc should be factorised
+ parse_tuple_format = ''
+@@ -434,41 +433,41 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+ # arg_type = arg_type.replace('const ', '')
+ parse_tuple_format += 's'
+ parse_tuple_args.append('&%s_str, &%s_len' % (name, name))
+- six.print_(' %s %s_str = NULL;' % ('char*', name), file=self.fd)
+- six.print_(' %s %s_len = 0;' % ('int', name), file=self.fd)
++ print(' %s %s_str = NULL;' % ('char*', name), file=self.fd)
++ print(' %s %s_len = 0;' % ('int', name), file=self.fd)
+ elif is_int(m, self.binding_data) or is_boolean(m):
+ parse_tuple_format += 'l'
+ parse_tuple_args.append('&%s' % name)
+- six.print_(' %s %s;' % ('long', name), file=self.fd)
++ print(' %s %s;' % ('long', name), file=self.fd)
+ # Must also handle lists of Objects
+ elif is_glist(m) or is_hashtable(m):
+ parse_tuple_format += 'a'
+ parse_tuple_args.append('&zval_%s' % name)
+- six.print_(' %s zval_%s;' % ('zval*', name), file=self.fd)
++ print(' %s zval_%s;' % ('zval*', name), file=self.fd)
+ elif is_object(m):
+ parse_tuple_format += 'r'
+ parse_tuple_args.append('&zval_%s' % name)
+- six.print_(' %s zval_%s = NULL;' % ('zval*', name), file=self.fd)
+- six.print_(' %s cvt_%s = NULL;' % ('PhpGObjectPtr*', name), file=self.fd)
++ print(' %s zval_%s = NULL;' % ('zval*', name), file=self.fd)
++ print(' %s cvt_%s = NULL;' % ('PhpGObjectPtr*', name), file=self.fd)
+ else:
+ raise Exception('Cannot make a setter for %s.%s' % (c,m))
+
+ if parse_tuple_args:
+ parse_tuple_arg = parse_tuple_args[0]
+ else:
+- six.print_('}', file=self.fd)
+- six.print_('', file=self.fd)
++ print('}', file=self.fd)
++ print('', file=self.fd)
+ return
+
+- six.print_('', file=self.fd)
+- six.print_('''\
++ print('', file=self.fd)
++ print('''\
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r%s", &zval_this, %s) == FAILURE) {
+ return;
+ }
+ ''' % (parse_tuple_format, parse_tuple_arg), file=self.fd)
+
+ # Get 'this' object
+- six.print_('''\
++ print('''\
+ ZEND_FETCH_RESOURCE(cvt_this, PhpGObjectPtr *, &zval_this, -1, PHP_LASSO_SERVER_RES_NAME, le_lasso_server);
+ this = (%s*)cvt_this->obj;
+ ''' % klassname, file=self.fd)
+@@ -476,51 +475,51 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+ # Set new value
+ d = { 'name': name, 'type': type }
+ if is_int(m, self.binding_data) or is_boolean(m):
+- six.print_(' this->%s = %s;' % (name, name), file=self.fd)
++ print(' this->%s = %s;' % (name, name), file=self.fd)
+ elif is_cstring(m):
+- six.print_(' lasso_assign_string(this->%(name)s, %(name)s_str);' % d, file=self.fd)
++ print(' lasso_assign_string(this->%(name)s, %(name)s_str);' % d, file=self.fd)
+ elif is_xml_node(m):
+- six.print_(' lasso_assign_new_xml_node(this->%(name)s, get_xml_node_from_string(%(name)s_str));' % d, file=self.fd)
++ print(' lasso_assign_new_xml_node(this->%(name)s, get_xml_node_from_string(%(name)s_str));' % d, file=self.fd)
+ elif is_glist(m):
+ el_type = element_type(m)
+ if is_cstring(el_type):
+- six.print_(' lasso_assign_new_list_of_strings(this->%(name)s, get_list_from_array_of_strings(zval_%(name)s));' % d, file=self.fd)
++ print(' lasso_assign_new_list_of_strings(this->%(name)s, get_list_from_array_of_strings(zval_%(name)s));' % d, file=self.fd)
+ elif is_xml_node(el_type):
+- six.print_(' lasso_assign_new_list_of_xml_node(this->%(name)s, get_list_from_array_of_xmlnodes(zval_%(name)s))' % d, file=self.fd)
++ print(' lasso_assign_new_list_of_xml_node(this->%(name)s, get_list_from_array_of_xmlnodes(zval_%(name)s))' % d, file=self.fd)
+ elif is_object(el_type):
+- six.print_(' lasso_assign_new_list_of_gobjects(this->%(name)s, get_list_from_array_of_objects(zval_%(name)s));' % d, file=self.fd)
++ print(' lasso_assign_new_list_of_gobjects(this->%(name)s, get_list_from_array_of_objects(zval_%(name)s));' % d, file=self.fd)
+ else:
+ raise Exception('Cannot create C setter for %s.%s' % (c,m))
+ elif is_hashtable(m):
+ el_type = element_type(m)
+- six.print_('''\
++ print('''\
+ {
+ GHashTable *oldhash = this->%(name)s;''' % d, file=self.fd)
+ if is_object(el_type):
+- six.print_(' this->%(name)s = get_hashtable_from_array_of_objects(zval_%(name)s);' % d, file=self.fd)
++ print(' this->%(name)s = get_hashtable_from_array_of_objects(zval_%(name)s);' % d, file=self.fd)
+ else:
+- six.print_(' this->%(name)s = get_hashtable_from_array_of_strings(zval_%(name)s);' % d, file=self.fd)
+- six.print_(' g_hash_table_destroy(oldhash);', file=self.fd)
+- six.print_(' }', file=self.fd)
++ print(' this->%(name)s = get_hashtable_from_array_of_strings(zval_%(name)s);' % d, file=self.fd)
++ print(' g_hash_table_destroy(oldhash);', file=self.fd)
++ print(' }', file=self.fd)
+ elif is_object(m):
+- six.print_(' ZEND_FETCH_RESOURCE(cvt_%(name)s, PhpGObjectPtr*, &zval_%(name)s, -1, PHP_LASSO_SERVER_RES_NAME, le_lasso_server);' % d, file=self.fd)
+- six.print_(' lasso_assign_gobject(this->%(name)s, cvt_%(name)s->obj);' % d, file=self.fd)
++ print(' ZEND_FETCH_RESOURCE(cvt_%(name)s, PhpGObjectPtr*, &zval_%(name)s, -1, PHP_LASSO_SERVER_RES_NAME, le_lasso_server);' % d, file=self.fd)
++ print(' lasso_assign_gobject(this->%(name)s, cvt_%(name)s->obj);' % d, file=self.fd)
+
+- six.print_('}', file=self.fd)
+- six.print_('', file=self.fd)
++ print('}', file=self.fd)
++ print('', file=self.fd)
+
+ def generate_functions_list(self):
+- six.print_('''\
++ print('''\
+ static zend_function_entry lasso_functions[] = {''', file=self.fd)
+ for m in self.functions_list:
+- six.print_(' PHP_FE(%s, NULL)' % m, file=self.fd)
+- six.print_('''\
++ print(' PHP_FE(%s, NULL)' % m, file=self.fd)
++ print('''\
+ {NULL, NULL, NULL, 0, 0}
+ };
+ ''', file=self.fd)
+
+ def generate_footer(self):
+- six.print_('''\
++ print('''\
+ zend_module_entry lasso_module_entry = {
+ #if ZEND_MODULE_API_NO >= 20010901
+ STANDARD_MODULE_HEADER,
+diff --git a/bindings/php7/php_code.py b/bindings/php7/php_code.py
+index a4eaf929..3f7b1a36 100644
+--- a/bindings/php7/php_code.py
++++ b/bindings/php7/php_code.py
+@@ -20,7 +20,6 @@
+
+ import re
+ import sys
+-import six
+
+ from utils import *
+
+@@ -40,7 +39,7 @@ class PhpCode:
+ self.generate_footer()
+
+ def generate_header(self):
+- six.print_('''\
++ print('''\
+ <?php
+
+ /* this file has been generated automatically; do not edit */
+@@ -107,27 +106,27 @@ function lassoGetRequestTypeFromSoapMsg($mesg) {
+ else:
+ inheritence = ' extends LassoObject'
+
+- six.print_('/**', file=self.fd)
+- six.print_(' * @package Lasso', file=self.fd)
+- six.print_(' */', file=self.fd)
+- six.print_('class %(class_name)s%(inheritence)s {' % locals(), file=self.fd)
++ print('/**', file=self.fd)
++ print(' * @package Lasso', file=self.fd)
++ print(' */', file=self.fd)
++ print('class %(class_name)s%(inheritence)s {' % locals(), file=self.fd)
+
+ if klass.members or klass.methods:
+ self.generate_constructors(klass)
+ self.generate_getters_and_setters(klass)
+ self.generate_methods(klass)
+
+- six.print_('}', file=self.fd)
+- six.print_('', file=self.fd)
++ print('}', file=self.fd)
++ print('', file=self.fd)
+
+ # Add a special class to get an object instance without initialising
+- six.print_('/**', file=self.fd)
+- six.print_(' * @package Lasso', file=self.fd)
+- six.print_(' */', file=self.fd)
+- six.print_('class %(class_name)sNoInit extends %(class_name)s {' % locals(), file=self.fd)
+- six.print_(' public function __construct() {}', file=self.fd)
+- six.print_('}', file=self.fd)
+- six.print_('', file=self.fd)
++ print('/**', file=self.fd)
++ print(' * @package Lasso', file=self.fd)
++ print(' */', file=self.fd)
++ print('class %(class_name)sNoInit extends %(class_name)s {' % locals(), file=self.fd)
++ print(' public function __construct() {}', file=self.fd)
++ print('}', file=self.fd)
++ print('', file=self.fd)
+
+ def generate_constructors(self, klass):
+ method_prefix = format_as_underscored(klass.name) + '_'
+@@ -152,13 +151,13 @@ function lassoGetRequestTypeFromSoapMsg($mesg) {
+ c_args = ', '.join(c_args)
+ # XXX: could check $this->_cptr->typename to see if it got the
+ # right class type
+- six.print_(' public $_cptr = null;', file=self.fd)
+- six.print_('', file=self.fd)
+- six.print_(' public function __construct(%s) {' % php_args, file=self.fd)
+- six.print_(' $this->_cptr = %s(%s);' % (m.name, c_args), file=self.fd)
+- six.print_(' if (is_null($this->_cptr)) { throw new Exception("Constructor for ', klass.name, ' failed "); }', file=self.fd)
+- six.print_(' }', file=self.fd)
+- six.print_('', file=self.fd)
++ print(' public $_cptr = null;', file=self.fd)
++ print('', file=self.fd)
++ print(' public function __construct(%s) {' % php_args, file=self.fd)
++ print(' $this->_cptr = %s(%s);' % (m.name, c_args), file=self.fd)
++ print(' if (is_null($this->_cptr)) { throw new Exception("Constructor for ', klass.name, ' failed "); }', file=self.fd)
++ print(' }', file=self.fd)
++ print('', file=self.fd)
+
+ elif name.startswith(method_prefix) and m.args \
+ and clean_type(unconstify(m.args[0][0])) != klass.name:
+@@ -185,10 +184,10 @@ function lassoGetRequestTypeFromSoapMsg($mesg) {
+ c_args.append('$%s' % arg_name)
+ php_args = ', '.join(php_args)
+ c_args = ', '.join(c_args)
+- six.print_(' public static function %s(%s) {' % (php_name, php_args), file=self.fd)
+- six.print_(' return cptrToPhp(%s(%s));' % (m.name, c_args), file=self.fd)
+- six.print_(' }', file=self.fd)
+- six.print_('', file=self.fd)
++ print(' public static function %s(%s) {' % (php_name, php_args), file=self.fd)
++ print(' return cptrToPhp(%s(%s));' % (m.name, c_args), file=self.fd)
++ print(' }', file=self.fd)
++ print('', file=self.fd)
+
+
+
+@@ -200,50 +199,50 @@ function lassoGetRequestTypeFromSoapMsg($mesg) {
+ 'class': c.name
+ }
+
+- six.print_('''\
++ print('''\
+ /**
+ * @return %(docstring)s
+ */
+ protected function get_%(name)s() {''' % d, file=self.fd)
+- six.print_(' $t = %(class)s_%(name)s_get($this->_cptr);' % d, file=self.fd)
++ print(' $t = %(class)s_%(name)s_get($this->_cptr);' % d, file=self.fd)
+ if self.is_object(m):
+- six.print_(' $t = cptrToPhp($t);', file=self.fd)
++ print(' $t = cptrToPhp($t);', file=self.fd)
+ elif (is_glist(m) or is_hashtable(m)) and self.is_object(element_type(m)):
+- six.print_(' foreach ($t as $key => $item) {', file=self.fd)
+- six.print_(' $t[$key] = cptrToPhp($item);', file=self.fd)
+- six.print_(' }', file=self.fd)
++ print(' foreach ($t as $key => $item) {', file=self.fd)
++ print(' $t[$key] = cptrToPhp($item);', file=self.fd)
++ print(' }', file=self.fd)
+ elif is_hashtable(m) or (is_glist(m) and (is_cstring(element_type(m)) \
+ or is_xml_node(element_type(m)))) or is_int(m, self.binding_data) \
+ or is_boolean(m) or is_cstring(m) or is_xml_node(m):
+ pass
+ else:
+ raise Exception('Cannot generate a Php getter %s.%s' % (c,m))
+- six.print_(' return $t;', file=self.fd)
+- six.print_(' }', file=self.fd)
++ print(' return $t;', file=self.fd)
++ print(' }', file=self.fd)
+
+ def generate_setter(self, c, m):
+ d = { 'type': arg_type(m), 'name': format_as_camelcase(arg_name(m)),
+ 'docstring': self.get_docstring_return_type(arg_type(m)), 'class': c.name }
+- six.print_(' protected function set_%(name)s($value) {' % d, file=self.fd)
++ print(' protected function set_%(name)s($value) {' % d, file=self.fd)
+ if self.is_object(m):
+- six.print_(' $value = $value->_cptr;', file=self.fd)
++ print(' $value = $value->_cptr;', file=self.fd)
+ elif (is_glist(m) or is_hashtable(m)) and self.is_object(element_type(m)):
+- six.print_(' $array = array();', file=self.fd)
+- six.print_(' if (!is_null($value)) {', file=self.fd)
+- six.print_(' foreach ($value as $key => $item) {', file=self.fd)
+- six.print_(' $array[$key] = $item->_cptr;', file=self.fd)
+- six.print_(' }', file=self.fd)
+- six.print_(' }', file=self.fd)
+- six.print_(' $value = $array;', file=self.fd)
++ print(' $array = array();', file=self.fd)
++ print(' if (!is_null($value)) {', file=self.fd)
++ print(' foreach ($value as $key => $item) {', file=self.fd)
++ print(' $array[$key] = $item->_cptr;', file=self.fd)
++ print(' }', file=self.fd)
++ print(' }', file=self.fd)
++ print(' $value = $array;', file=self.fd)
+ elif is_hashtable(m) or (is_glist(m) and (is_cstring(element_type(m)) \
+ or is_xml_node(element_type(m)))) or is_int(m, self.binding_data) \
+ or is_boolean(m) or is_cstring(m) or is_xml_node(m):
+ pass
+ else:
+ raise Exception('Cannot generate a Php setter %s.%s' % (c,m))
+- six.print_(' %(class)s_%(name)s_set($this->_cptr, $value);' % d, file=self.fd)
+- six.print_(' }', file=self.fd)
+- six.print_('', file=self.fd)
++ print(' %(class)s_%(name)s_set($this->_cptr, $value);' % d, file=self.fd)
++ print(' }', file=self.fd)
++ print('', file=self.fd)
+
+ def generate_getters_and_setters(self, klass):
+ for m in klass.members:
+@@ -271,27 +270,27 @@ function lassoGetRequestTypeFromSoapMsg($mesg) {
+ mname = re.match(r'lasso_.*_get_(\w+)', meth_name).group(1)
+ mname = format_as_camelcase(mname)
+
+- six.print_(' /**', file=self.fd)
+- six.print_(' * @return %s' % self.get_docstring_return_type(m.return_type), file=self.fd)
+- six.print_(' */', file=self.fd)
+- six.print_(' protected function get_%s() {' % mname, file=self.fd)
++ print(' /**', file=self.fd)
++ print(' * @return %s' % self.get_docstring_return_type(m.return_type), file=self.fd)
++ print(' */', file=self.fd)
++ print(' protected function get_%s() {' % mname, file=self.fd)
+ if self.is_object(m.return_type):
+- six.print_(' $cptr = %s($this->_cptr);' % meth_name, file=self.fd)
+- six.print_(' if (! is_null($cptr)) {', file=self.fd)
+- six.print_(' return cptrToPhp($cptr);', file=self.fd)
+- six.print_(' }', file=self.fd)
+- six.print_(' return null;', file=self.fd)
++ print(' $cptr = %s($this->_cptr);' % meth_name, file=self.fd)
++ print(' if (! is_null($cptr)) {', file=self.fd)
++ print(' return cptrToPhp($cptr);', file=self.fd)
++ print(' }', file=self.fd)
++ print(' return null;', file=self.fd)
+ else:
+- six.print_(' return %s($this->_cptr);' % meth_name, file=self.fd)
+- six.print_(' }', file=self.fd)
++ print(' return %s($this->_cptr);' % meth_name, file=self.fd)
++ print(' }', file=self.fd)
+ if setter:
+- six.print_(' protected function set_%s($value) {' % mname, file=self.fd)
++ print(' protected function set_%s($value) {' % mname, file=self.fd)
+ if self.is_object(m.return_type):
+- six.print_(' %s($this->_cptr, $value->_cptr);' % setter.name, file=self.fd)
++ print(' %s($this->_cptr, $value->_cptr);' % setter.name, file=self.fd)
+ else:
+- six.print_(' %s($this->_cptr, $value);' % setter.name, file=self.fd)
+- six.print_(' }', file=self.fd)
+- six.print_('', file=self.fd)
++ print(' %s($this->_cptr, $value);' % setter.name, file=self.fd)
++ print(' }', file=self.fd)
++ print('', file=self.fd)
+
+ # second pass on methods, real methods
+ method_prefix = format_as_underscored(klass.name) + '_'
+@@ -356,26 +355,26 @@ function lassoGetRequestTypeFromSoapMsg($mesg) {
+ c_args = ''
+
+ if m.docstring:
+- six.print_(self.generate_docstring(m, mname, 4), file=self.fd)
+- six.print_(' public function %s(%s) {' % (
++ print(self.generate_docstring(m, mname, 4), file=self.fd)
++ print(' public function %s(%s) {' % (
+ format_underscore_as_camelcase(mname), php_args), file=self.fd)
+ if m.return_type == 'void':
+- six.print_(' %s($this->_cptr%s);' % (cname, c_args), file=self.fd)
++ print(' %s($this->_cptr%s);' % (cname, c_args), file=self.fd)
+ elif is_rc(m.return_type):
+- six.print_(' $rc = %s($this->_cptr%s);' % (cname, c_args), file=self.fd)
+- six.print_(' if ($rc == 0) {', file=self.fd)
+- six.print_(' return 0;', file=self.fd)
+- six.print_(' } else if ($rc > 0) {', file=self.fd) # recoverable error
+- six.print_(' return $rc;', file=self.fd)
+- six.print_(' } else if ($rc < 0) {', file=self.fd) # unrecoverable error
+- six.print_(' LassoError::throw_on_rc($rc);', file=self.fd)
+- six.print_(' }', file=self.fd)
++ print(' $rc = %s($this->_cptr%s);' % (cname, c_args), file=self.fd)
++ print(' if ($rc == 0) {', file=self.fd)
++ print(' return 0;', file=self.fd)
++ print(' } else if ($rc > 0) {', file=self.fd) # recoverable error
++ print(' return $rc;', file=self.fd)
++ print(' } else if ($rc < 0) {', file=self.fd) # unrecoverable error
++ print(' LassoError::throw_on_rc($rc);', file=self.fd)
++ print(' }', file=self.fd)
+ else:
+- six.print_(' return %s($this->_cptr%s);' % (cname, c_args), file=self.fd)
+- six.print_(' }', file=self.fd)
+- six.print_('', file=self.fd)
++ print(' return %s($this->_cptr%s);' % (cname, c_args), file=self.fd)
++ print(' }', file=self.fd)
++ print('', file=self.fd)
+
+- six.print_('', file=self.fd)
++ print('', file=self.fd)
+
+ def generate_docstring(self, func, method_name, indent):
+ docstring = func.docstring.orig_docstring
+@@ -435,7 +434,7 @@ function lassoGetRequestTypeFromSoapMsg($mesg) {
+ cat = exc_cat.attrib.get('name')
+ done_cats.append(cat)
+ parent_cat = exc_cat.attrib.get('parent', '')
+- six.print_('''\
++ print('''\
+ /**
+ * @package Lasso
+ */
+@@ -460,7 +459,7 @@ class Lasso%sError extends Lasso%sError {}
+ else:
+ parent_cat = ''
+
+- six.print_('''\
++ print('''\
+ /**
+ * @package Lasso
+ */
+@@ -468,7 +467,7 @@ class Lasso%sError extends Lasso%sError {}
+ ''' % (cat, parent_cat), file=self.fd)
+
+ if detail not in exceptions_dict:
+- six.print_('''\
++ print('''\
+ /**
+ * @package Lasso
+ */
+@@ -478,7 +477,7 @@ class Lasso%sError extends Lasso%sError {
+ ''' % (detail, cat, c[1]), file=self.fd)
+ exceptions_dict[detail] = c[1]
+
+- six.print_('''\
++ print('''\
+ /**
+ * @package Lasso
+ */
+@@ -486,9 +485,9 @@ class LassoError extends Exception {
+ private static $exceptions_dict = array(''', file=self.fd)
+
+ for k, v in exceptions_dict.items():
+- six.print_(' %s => "Lasso%sError",' % (v, k), file=self.fd)
++ print(' %s => "Lasso%sError",' % (v, k), file=self.fd)
+
+- six.print_('''\
++ print('''\
+ );
+
+ public static function throw_on_rc($rc) {
+@@ -502,6 +501,6 @@ class LassoError extends Exception {
+ ''', file=self.fd)
+
+ def generate_footer(self):
+- six.print_('''\
++ print('''\
+ ?>''', file=self.fd)
+
+diff --git a/bindings/php7/wrapper_header.py b/bindings/php7/wrapper_header.py
+index 5236571a..22908945 100644
+--- a/bindings/php7/wrapper_header.py
++++ b/bindings/php7/wrapper_header.py
+@@ -17,7 +17,6 @@
+ #
+ # You should have received a copy of the GNU General Public License
+ # along with this program; if not, see <http://www.gnu.org/licenses/>.
+-import six
+
+ class WrapperHeader:
+ def __init__(self, binding_data, fd, functions_list):
+@@ -32,7 +31,7 @@ class WrapperHeader:
+
+ def generate_header(self):
+ # FIXME: Get the current version and name
+- six.print_('''\
++ print('''\
+ /* this file has been generated automatically; do not edit */
+
+ #include "../../config.h"
+@@ -51,11 +50,11 @@ PHP_MSHUTDOWN_FUNCTION(lasso);
+
+ def generate_functions_list(self):
+ for m in self.functions_list:
+- six.print_('PHP_FUNCTION(%s);' % m, file=self.fd)
+- six.print_('', file=self.fd)
++ print('PHP_FUNCTION(%s);' % m, file=self.fd)
++ print('', file=self.fd)
+
+ def generate_footer(self):
+- six.print_('''\
++ print('''\
+ extern zend_module_entry lasso_module_entry;
+ #define phpext_lasso_ptr &lasso_module_entry
+
+diff --git a/bindings/php7/wrapper_source.py b/bindings/php7/wrapper_source.py
+index c429e563..3d434402 100644
+--- a/bindings/php7/wrapper_source.py
++++ b/bindings/php7/wrapper_source.py
+@@ -20,7 +20,6 @@
+
+ import sys
+ import os
+-import six
+
+ from utils import *
+
+@@ -53,17 +52,17 @@ class WrapperSource:
+ self.functions_list.append('lasso_init')
+ self.functions_list.append('lasso_shutdown')
+
+- six.print_('''\
++ print('''\
+ /* this file has been generated automatically; do not edit */
+ ''', file=self.fd)
+
+- six.print_(open(os.path.join(self.src_dir,'wrapper_source_top.c')).read(), file=self.fd)
++ print(open(os.path.join(self.src_dir,'wrapper_source_top.c')).read(), file=self.fd)
+
+ for h in self.binding_data.headers:
+- six.print_('#include <%s>' % h, file=self.fd)
+- six.print_('', file=self.fd)
++ print('#include <%s>' % h, file=self.fd)
++ print('', file=self.fd)
+
+- six.print_('''\
++ print('''\
+ PHP_MINIT_FUNCTION(lasso)
+ {
+ le_lasso_server = zend_register_list_destructors_ex(php_gobject_generic_destructor, NULL, PHP_LASSO_SERVER_RES_NAME, module_number);
+@@ -71,25 +70,25 @@ PHP_MINIT_FUNCTION(lasso)
+ ''', file=self.fd)
+
+ def generate_constants(self):
+- six.print_(' /* Constants (both enums and defines) */', file=self.fd)
++ print(' /* Constants (both enums and defines) */', file=self.fd)
+ for c in self.binding_data.constants:
+ if c[0] == 'i':
+- six.print_(' REGISTER_LONG_CONSTANT("%s", %s, CONST_CS|CONST_PERSISTENT);' % (c[1], c[1]), file=self.fd)
++ print(' REGISTER_LONG_CONSTANT("%s", %s, CONST_CS|CONST_PERSISTENT);' % (c[1], c[1]), file=self.fd)
+ elif c[0] == 's':
+- six.print_(' REGISTER_STRING_CONSTANT("%s", (char*) %s, CONST_CS|CONST_PERSISTENT);' % (c[1], c[1]), file=self.fd)
++ print(' REGISTER_STRING_CONSTANT("%s", (char*) %s, CONST_CS|CONST_PERSISTENT);' % (c[1], c[1]), file=self.fd)
+ elif c[0] == 'b':
+- six.print_('''\
++ print('''\
+ #ifdef %s
+ REGISTER_LONG_CONSTANT("%s", 1, CONST_CS|CONST_PERSISTENT);
+ #else
+ REGISTER_LONG_CONSTANT("%s", 0, CONST_CS|CONST_PERSISTENT);
+ #endif''' % (c[1], c[1], c[1]), file=self.fd)
+ else:
+- six.print_('E: unknown constant type: %r' % c[0], file=sys.stderr)
+- six.print_('', file=self.fd)
++ print('E: unknown constant type: %r' % c[0], file=sys.stderr)
++ print('', file=self.fd)
+
+ def generate_middle(self):
+- six.print_('''\
++ print('''\
+ return SUCCESS;
+ }
+
+@@ -107,21 +106,21 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+ # first we free the previous value
+ p = (zval_name, c_variable)
+ q = { 'zval_name' : zval_name, 'c_variable' : c_variable }
+- six.print_(' zval_dtor(%s);' % zval_name, file=self.fd)
++ print(' zval_dtor(%s);' % zval_name, file=self.fd)
+ if is_pointer(type):
+- six.print_(' if (! %s) {' % c_variable, file=self.fd)
+- six.print_(' ZVAL_NULL(%s);' % zval_name, file=self.fd)
+- six.print_(' } else {', file=self.fd)
++ print(' if (! %s) {' % c_variable, file=self.fd)
++ print(' ZVAL_NULL(%s);' % zval_name, file=self.fd)
++ print(' } else {', file=self.fd)
+ if is_int(type, self.binding_data):
+- six.print_(' ZVAL_LONG(%s, %s);' % p, file=self.fd)
++ print(' ZVAL_LONG(%s, %s);' % p, file=self.fd)
+ elif is_boolean(type):
+- six.print_(' ZVAL_BOOL(%s, %s);' % p, file=self.fd)
++ print(' ZVAL_BOOL(%s, %s);' % p, file=self.fd)
+ elif is_cstring(type):
+- six.print_(' ZVAL_STRING(%s, (char*)%s);' % p, file=self.fd)
++ print(' ZVAL_STRING(%s, (char*)%s);' % p, file=self.fd)
+ if free and not is_const(type):
+- six.print_('g_free(%s)' % c_variable, file=self.fd)
++ print('g_free(%s)' % c_variable, file=self.fd)
+ elif arg_type(type) == 'xmlNode*':
+- six.print_('''\
++ print('''\
+ {
+ char* xmlString = get_string_from_xml_node(%(c_variable)s);
+ if (xmlString) {
+@@ -146,11 +145,11 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+ free_function = 'g_list_free(%(c_variable)s);'
+ else:
+ raise Exception('unknown element-type: ' + repr(type))
+- six.print_(' %s((GList*)%s, &%s);' % (function, c_variable, zval_name), file=self.fd)
++ print(' %s((GList*)%s, &%s);' % (function, c_variable, zval_name), file=self.fd)
+ if free:
+- six.print_(' ', free_function % q, file=self.fd)
++ print(' ', free_function % q, file=self.fd)
+ elif is_object(type):
+- six.print_('''\
++ print('''\
+ if (G_IS_OBJECT(%(c_variable)s)) {
+ PhpGObjectPtr *obj = PhpGObjectPtr_New(G_OBJECT(%(c_variable)s));
+ zend_resource *res = zend_register_resource(obj, le_lasso_server);
+@@ -159,7 +158,7 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+ ZVAL_NULL(%(zval_name)s);
+ }''' % q, file=self.fd)
+ if free:
+- six.print_('''\
++ print('''\
+ if (%(c_variable)s) {
+ g_object_unref(%(c_variable)s); // If constructor ref is off by one'
+ }''' % q, file=self.fd)
+@@ -167,7 +166,7 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+ else:
+ raise Exception('unknown type: ' + repr(type) + unconstify(arg_type(type)))
+ if is_pointer(type):
+- six.print_(' }', file=self.fd)
++ print(' }', file=self.fd)
+
+
+
+@@ -176,20 +175,20 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+ return
+
+ if is_boolean(arg):
+- six.print_(' RETVAL_BOOL(return_c_value);', file=self.fd)
++ print(' RETVAL_BOOL(return_c_value);', file=self.fd)
+ elif is_int(arg, self.binding_data):
+- six.print_(' RETVAL_LONG(return_c_value);', file=self.fd)
++ print(' RETVAL_LONG(return_c_value);', file=self.fd)
+ elif is_cstring(arg):
+- six.print_('''\
++ print('''\
+ if (return_c_value) {
+ RETVAL_STRING((char*)return_c_value);
+ } else {
+ RETVAL_NULL();
+ }''', file=self.fd)
+ if free:
+- six.print_(' free(return_c_value);', file=self.fd)
++ print(' free(return_c_value);', file=self.fd)
+ elif is_xml_node(arg):
+- six.print_('''\
++ print('''\
+ {
+ char* xmlString = get_string_from_xml_node(return_c_value);
+ if (xmlString) {
+@@ -200,43 +199,43 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+ }
+ ''', file=self.fd)
+ if free:
+- six.print_(' lasso_release_xml_node(return_c_value);', file=self.fd)
++ print(' lasso_release_xml_node(return_c_value);', file=self.fd)
+ elif is_glist(arg):
+ el_type = element_type(arg)
+ if is_cstring(el_type):
+- six.print_('''\
++ print('''\
+ set_array_from_list_of_strings((GList*)return_c_value, &return_value);
+ ''', file=self.fd)
+ if free:
+- six.print_(' lasso_release_list_of_strings(return_c_value);', file=self.fd)
++ print(' lasso_release_list_of_strings(return_c_value);', file=self.fd)
+ elif is_xml_node(el_type):
+- six.print_('''\
++ print('''\
+ set_array_from_list_of_xmlnodes((GList*)return_c_value, &return_value);
+ ''', file=self.fd)
+ if free or is_transfer_full(arg):
+- six.print_(' lasso_release_list_of_xml_node(return_c_value);', file=self.fd)
++ print(' lasso_release_list_of_xml_node(return_c_value);', file=self.fd)
+ elif is_object(el_type):
+- six.print_('''\
++ print('''\
+ set_array_from_list_of_objects((GList*)return_c_value, &return_value);
+ ''', file=self.fd)
+ if free:
+- six.print_(' lasso_release_list_of_gobjects(return_c_value);', file=self.fd)
++ print(' lasso_release_list_of_gobjects(return_c_value);', file=self.fd)
+ else:
+ raise Exception('cannot return value for %s' % (arg,))
+ elif is_hashtable(arg):
+ el_type = element_type(arg)
+ if is_object(el_type):
+- six.print_('''\
++ print('''\
+ set_array_from_hashtable_of_objects(return_c_value, &return_value);
+ ''', file=self.fd)
+ else:
+ if not is_cstring(arg):
+ print >>sys.stderr, 'W: %s has no explicit string annotation' % (arg,)
+- six.print_('''\
++ print('''\
+ set_array_from_hashtable_of_strings(return_c_value, &return_value);
+ ''', file=self.fd)
+ elif is_object(arg):
+- six.print_('''\
++ print('''\
+ if (return_c_value) {
+ PhpGObjectPtr *self;
+ self = PhpGObjectPtr_New(G_OBJECT(return_c_value));
+@@ -246,7 +245,7 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+ RETVAL_NULL();
+ }''', file=self.fd)
+ if free:
+- six.print_(' lasso_release_gobject(return_c_value);', file=self.fd)
++ print(' lasso_release_gobject(return_c_value);', file=self.fd)
+ else:
+ raise Exception('cannot return value for %s' % (arg,))
+
+@@ -258,26 +257,26 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+ else:
+ name = m.name
+ self.functions_list.append(name)
+- six.print_('''PHP_FUNCTION(%s)
++ print('''PHP_FUNCTION(%s)
+ {''' % name, file=self.fd)
+ parse_tuple_format = []
+ parse_tuple_args = []
+ for arg in m.args:
+ if is_out(arg):
+- six.print_(' zval *php_out_%s = NULL;' % arg_name(arg), file=self.fd)
+- six.print_(' %s %s;' % (var_type(arg), arg_name(arg)), file=self.fd)
++ print(' zval *php_out_%s = NULL;' % arg_name(arg), file=self.fd)
++ print(' %s %s;' % (var_type(arg), arg_name(arg)), file=self.fd)
+ parse_tuple_format.append('z!')
+ parse_tuple_args.append('&php_out_%s' % arg_name(arg))
+ elif is_cstring(arg):
+ parse_tuple_format.append('s!')
+ parse_tuple_args.append('&%s_str, &%s_len' % (arg_name(arg), arg_name(arg)))
+- six.print_(' %s %s = NULL;' % ('char*', arg_name(arg)), file=self.fd)
+- six.print_(' %s %s_str = NULL;' % ('char*', arg_name(arg)), file=self.fd)
+- six.print_(' %s %s_len = 0;' % ('size_t', arg_name(arg)), file=self.fd)
++ print(' %s %s = NULL;' % ('char*', arg_name(arg)), file=self.fd)
++ print(' %s %s_str = NULL;' % ('char*', arg_name(arg)), file=self.fd)
++ print(' %s %s_len = 0;' % ('size_t', arg_name(arg)), file=self.fd)
+ elif is_int(arg, self.binding_data) or is_boolean(arg):
+ parse_tuple_format.append('l')
+ parse_tuple_args.append('&%s' % arg_name(arg))
+- six.print_(' %s %s;' % ('long', arg_name(arg)), file=self.fd)
++ print(' %s %s;' % ('long', arg_name(arg)), file=self.fd)
+ elif is_time_t_pointer(arg):
+ parse_tuple_format.append('l')
+ parse_tuple_args.append('&%s' % (arg_name(arg),))
+@@ -285,34 +284,34 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+ elif is_xml_node(arg):
+ parse_tuple_format.append('s!')
+ parse_tuple_args.append('&%s_str, &%s_len' % (arg_name(arg), arg_name(arg)))
+- six.print_(' %s %s = NULL;' % ('xmlNode*', arg_name(arg)), file=self.fd)
+- six.print_(' %s %s_str = NULL;' % ('char*', arg_name(arg)), file=self.fd)
+- six.print_(' %s %s_len = 0;' % ('size_t', arg_name(arg)), file=self.fd)
++ print(' %s %s = NULL;' % ('xmlNode*', arg_name(arg)), file=self.fd)
++ print(' %s %s_str = NULL;' % ('char*', arg_name(arg)), file=self.fd)
++ print(' %s %s_len = 0;' % ('size_t', arg_name(arg)), file=self.fd)
+ elif is_glist(arg):
+ parse_tuple_format.append('a!')
+ parse_tuple_args.append('&zval_%s' % arg_name(arg))
+- six.print_(' %s zval_%s = NULL;' % ('zval*', arg_name(arg)), file=self.fd)
+- six.print_(' %s %s = NULL;' % ('GList*', arg_name(arg)), file=self.fd)
++ print(' %s zval_%s = NULL;' % ('zval*', arg_name(arg)), file=self.fd)
++ print(' %s %s = NULL;' % ('GList*', arg_name(arg)), file=self.fd)
+ elif is_object(arg):
+ parse_tuple_format.append('r')
+ parse_tuple_args.append('&zval_%s' % arg_name(arg))
+- six.print_(' %s %s = NULL;' % (arg_type(arg), arg_name(arg)), file=self.fd)
+- six.print_(' %s zval_%s = NULL;' % ('zval*', arg_name(arg)), file=self.fd)
+- six.print_(' %s cvt_%s = NULL;' % ('PhpGObjectPtr*', arg_name(arg)), file=self.fd)
++ print(' %s %s = NULL;' % (arg_type(arg), arg_name(arg)), file=self.fd)
++ print(' %s zval_%s = NULL;' % ('zval*', arg_name(arg)), file=self.fd)
++ print(' %s cvt_%s = NULL;' % ('PhpGObjectPtr*', arg_name(arg)), file=self.fd)
+ else:
+ raise Exception('Unsupported type %s %s' % (arg, m))
+
+ if m.return_type:
+- six.print_(' %s return_c_value;' % m.return_type, file=self.fd)
++ print(' %s return_c_value;' % m.return_type, file=self.fd)
+ if m.return_type is not None and self.is_object(m.return_arg):
+- six.print_(' G_GNUC_UNUSED PhpGObjectPtr *self;', file=self.fd)
+- six.print_('', file=self.fd)
++ print(' G_GNUC_UNUSED PhpGObjectPtr *self;', file=self.fd)
++ print('', file=self.fd)
+
+ parse_tuple_args = ', '.join(parse_tuple_args)
+ if parse_tuple_args:
+ parse_tuple_args = ', ' + parse_tuple_args
+
+- six.print_('''\
++ print('''\
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "%s"%s) == FAILURE) {
+ RETURN_FALSE;
+ }
+@@ -322,24 +321,24 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+ if is_out(arg):
+ continue
+ elif is_xml_node(arg):
+- six.print_('''\
++ print('''\
+ %(name)s = get_xml_node_from_string(%(name)s_str);''' % {'name': arg[1]}, file=self.fd)
+ elif f.startswith('s'):
+- six.print_('''\
++ print('''\
+ %(name)s = %(name)s_str;''' % {'name': arg[1]}, file=self.fd)
+ elif f.startswith('r'):
+- six.print_(' if ((cvt_%s = (PhpGObjectPtr *)zend_fetch_resource(Z_RES_P(zval_%s), PHP_LASSO_SERVER_RES_NAME, le_lasso_server)) == NULL) {' % (arg[1], arg[1]), file=self.fd)
+- six.print_(' RETURN_FALSE;', file=self.fd)
+- six.print_(' }', file=self.fd)
+- six.print_(' %s = (%s)cvt_%s->obj;' % (arg[1], arg[0], arg[1]), file=self.fd)
++ print(' if ((cvt_%s = (PhpGObjectPtr *)zend_fetch_resource(Z_RES_P(zval_%s), PHP_LASSO_SERVER_RES_NAME, le_lasso_server)) == NULL) {' % (arg[1], arg[1]), file=self.fd)
++ print(' RETURN_FALSE;', file=self.fd)
++ print(' }', file=self.fd)
++ print(' %s = (%s)cvt_%s->obj;' % (arg[1], arg[0], arg[1]), file=self.fd)
+ elif f.startswith('a'):
+ el_type = element_type(arg)
+ if is_cstring(el_type):
+- six.print_(' %(name)s = get_list_from_array_of_strings(zval_%(name)s);' % {'name': arg[1]}, file=self.fd)
++ print(' %(name)s = get_list_from_array_of_strings(zval_%(name)s);' % {'name': arg[1]}, file=self.fd)
+ elif is_object(el_type):
+- six.print_(' %(name)s = get_list_from_array_of_objects(zval_%(name)s);' % {'name': arg[1]}, file=self.fd)
++ print(' %(name)s = get_list_from_array_of_objects(zval_%(name)s);' % {'name': arg[1]}, file=self.fd)
+ else:
+- six.print_('E: In %(function)s arg %(name)s is of type GList<%(elem)s>' % { 'function': m.name, 'name': arg[1], 'elem': el_type }, file=sys.stderr)
++ print('E: In %(function)s arg %(name)s is of type GList<%(elem)s>' % { 'function': m.name, 'name': arg[1], 'elem': el_type }, file=sys.stderr)
+ elif f == 'l':
+ pass
+ else:
+@@ -347,17 +346,17 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+
+
+ if m.return_type is not None:
+- six.print_(' return_c_value = ', file=self.fd)
++ print(' return_c_value = ', file=self.fd)
+ if 'new' in m.name:
+- six.print_('(%s)' % m.return_type, file=self.fd)
++ print('(%s)' % m.return_type, file=self.fd)
+ else:
+- six.print_(' ', file=self.fd)
++ print(' ', file=self.fd)
+ def special(x):
+ if is_time_t_pointer(x):
+ return '%(name)s ? &%(name)s : NULL' % { 'name': arg_name(x) }
+ else:
+ return ref_name(x)
+- six.print_('%s(%s);' % (m.name, ', '.join([special(x) for x in m.args])), file=self.fd)
++ print('%s(%s);' % (m.name, ', '.join([special(x) for x in m.args])), file=self.fd)
+ # Free the converted arguments
+
+ for f, arg in zip(parse_tuple_format, m.args):
+@@ -368,21 +367,21 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+ self.set_zval('php_out_%s' % argname, argname, unref_type(arg), free = free)
+ pass
+ elif argtype == 'xmlNode*':
+- six.print_(' xmlFree(%s);' % argname, file=self.fd)
++ print(' xmlFree(%s);' % argname, file=self.fd)
+ elif f.startswith('a'):
+ el_type = element_type(arg)
+ if is_cstring(el_type):
+- six.print_(' if (%(name)s) {' % { 'name': arg[1] }, file=self.fd)
+- six.print_(' free_glist(&%(name)s,(GFunc)free);' % { 'name': arg[1] }, file=self.fd)
+- six.print_(' }', file=self.fd)
++ print(' if (%(name)s) {' % { 'name': arg[1] }, file=self.fd)
++ print(' free_glist(&%(name)s,(GFunc)free);' % { 'name': arg[1] }, file=self.fd)
++ print(' }', file=self.fd)
+
+ try:
+ self.return_value(m.return_arg, is_transfer_full(m.return_arg, default=True))
+ except:
+ raise Exception('Cannot return value for function %s' % m)
+
+- six.print_('}', file=self.fd)
+- six.print_('', file=self.fd)
++ print('}', file=self.fd)
++ print('', file=self.fd)
+
+ def generate_members(self, c):
+ for m in c.members:
+@@ -395,16 +394,16 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+ type = arg_type(m)
+
+ function_name = '%s_%s_get' % (klassname, format_as_camelcase(name))
+- six.print_('''PHP_FUNCTION(%s)
++ print('''PHP_FUNCTION(%s)
+ {''' % function_name, file=self.fd)
+ self.functions_list.append(function_name)
+
+- six.print_(' %s return_c_value;' % type, file=self.fd)
+- six.print_(' %s* this;' % klassname, file=self.fd)
+- six.print_(' zval* zval_this;', file=self.fd)
+- six.print_(' PhpGObjectPtr *cvt_this;', file=self.fd)
+- six.print_('', file=self.fd)
+- six.print_('''\
++ print(' %s return_c_value;' % type, file=self.fd)
++ print(' %s* this;' % klassname, file=self.fd)
++ print(' zval* zval_this;', file=self.fd)
++ print(' PhpGObjectPtr *cvt_this;', file=self.fd)
++ print('', file=self.fd)
++ print('''\
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zval_this) == FAILURE) {
+ RETURN_FALSE;
+ }
+@@ -414,23 +413,23 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+ }
+ this = (%s*)cvt_this->obj;
+ ''' % (klassname), file=self.fd)
+- six.print_(' return_c_value = (%s)this->%s;' % (type, name), file=self.fd)
++ print(' return_c_value = (%s)this->%s;' % (type, name), file=self.fd)
+ self.return_value(m)
+- six.print_('}', file=self.fd)
+- six.print_('', file=self.fd)
++ print('}', file=self.fd)
++ print('', file=self.fd)
+
+ def generate_setter(self, c, m):
+ klassname = c.name
+ name = arg_name(m)
+ type = arg_type(m)
+ function_name = '%s_%s_set' % (klassname, format_as_camelcase(name))
+- six.print_('''PHP_FUNCTION(%s)
++ print('''PHP_FUNCTION(%s)
+ {''' % function_name, file=self.fd)
+ self.functions_list.append(function_name)
+
+- six.print_(' %s* this;' % klassname, file=self.fd)
+- six.print_(' zval* zval_this;', file=self.fd)
+- six.print_(' PhpGObjectPtr *cvt_this;', file=self.fd)
++ print(' %s* this;' % klassname, file=self.fd)
++ print(' zval* zval_this;', file=self.fd)
++ print(' PhpGObjectPtr *cvt_this;', file=self.fd)
+
+ # FIXME: This bloc should be factorised
+ parse_tuple_format = ''
+@@ -439,41 +438,41 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+ # arg_type = arg_type.replace('const ', '')
+ parse_tuple_format += 's'
+ parse_tuple_args.append('&%s_str, &%s_len' % (name, name))
+- six.print_(' %s %s_str = NULL;' % ('char*', name), file=self.fd)
+- six.print_(' %s %s_len = 0;' % ('size_t', name), file=self.fd)
++ print(' %s %s_str = NULL;' % ('char*', name), file=self.fd)
++ print(' %s %s_len = 0;' % ('size_t', name), file=self.fd)
+ elif is_int(m, self.binding_data) or is_boolean(m):
+ parse_tuple_format += 'l'
+ parse_tuple_args.append('&%s' % name)
+- six.print_(' %s %s;' % ('long', name), file=self.fd)
++ print(' %s %s;' % ('long', name), file=self.fd)
+ # Must also handle lists of Objects
+ elif is_glist(m) or is_hashtable(m):
+ parse_tuple_format += 'a'
+ parse_tuple_args.append('&zval_%s' % name)
+- six.print_(' %s zval_%s;' % ('zval*', name), file=self.fd)
++ print(' %s zval_%s;' % ('zval*', name), file=self.fd)
+ elif is_object(m):
+ parse_tuple_format += 'r'
+ parse_tuple_args.append('&zval_%s' % name)
+- six.print_(' %s zval_%s = NULL;' % ('zval*', name), file=self.fd)
+- six.print_(' %s cvt_%s = NULL;' % ('PhpGObjectPtr*', name), file=self.fd)
++ print(' %s zval_%s = NULL;' % ('zval*', name), file=self.fd)
++ print(' %s cvt_%s = NULL;' % ('PhpGObjectPtr*', name), file=self.fd)
+ else:
+ raise Exception('Cannot make a setter for %s.%s' % (c,m))
+
+ if parse_tuple_args:
+ parse_tuple_arg = parse_tuple_args[0]
+ else:
+- six.print_('}', file=self.fd)
+- six.print_('', file=self.fd)
++ print('}', file=self.fd)
++ print('', file=self.fd)
+ return
+
+- six.print_('', file=self.fd)
+- six.print_('''\
++ print('', file=self.fd)
++ print('''\
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r%s", &zval_this, %s) == FAILURE) {
+ return;
+ }
+ ''' % (parse_tuple_format, parse_tuple_arg), file=self.fd)
+
+ # Get 'this' object
+- six.print_('''\
++ print('''\
+ if ((cvt_this = (PhpGObjectPtr *)zend_fetch_resource(Z_RES_P(zval_this), PHP_LASSO_SERVER_RES_NAME, le_lasso_server)) == NULL) {
+ RETURN_FALSE;
+ }
+@@ -483,53 +482,53 @@ PHP_MSHUTDOWN_FUNCTION(lasso)
+ # Set new value
+ d = { 'name': name, 'type': type }
+ if is_int(m, self.binding_data) or is_boolean(m):
+- six.print_(' this->%s = %s;' % (name, name), file=self.fd)
++ print(' this->%s = %s;' % (name, name), file=self.fd)
+ elif is_cstring(m):
+- six.print_(' lasso_assign_string(this->%(name)s, %(name)s_str);' % d, file=self.fd)
++ print(' lasso_assign_string(this->%(name)s, %(name)s_str);' % d, file=self.fd)
+ elif is_xml_node(m):
+- six.print_(' lasso_assign_new_xml_node(this->%(name)s, get_xml_node_from_string(%(name)s_str));' % d, file=self.fd)
++ print(' lasso_assign_new_xml_node(this->%(name)s, get_xml_node_from_string(%(name)s_str));' % d, file=self.fd)
+ elif is_glist(m):
+ el_type = element_type(m)
+ if is_cstring(el_type):
+- six.print_(' lasso_assign_new_list_of_strings(this->%(name)s, get_list_from_array_of_strings(zval_%(name)s));' % d, file=self.fd)
++ print(' lasso_assign_new_list_of_strings(this->%(name)s, get_list_from_array_of_strings(zval_%(name)s));' % d, file=self.fd)
+ elif is_xml_node(el_type):
+- six.print_(' lasso_assign_new_list_of_xml_node(this->%(name)s, get_list_from_array_of_xmlnodes(zval_%(name)s))' % d, file=self.fd)
++ print(' lasso_assign_new_list_of_xml_node(this->%(name)s, get_list_from_array_of_xmlnodes(zval_%(name)s))' % d, file=self.fd)
+ elif is_object(el_type):
+- six.print_(' lasso_assign_new_list_of_gobjects(this->%(name)s, get_list_from_array_of_objects(zval_%(name)s));' % d, file=self.fd)
++ print(' lasso_assign_new_list_of_gobjects(this->%(name)s, get_list_from_array_of_objects(zval_%(name)s));' % d, file=self.fd)
+ else:
+ raise Exception('Cannot create C setter for %s.%s' % (c,m))
+ elif is_hashtable(m):
+ el_type = element_type(m)
+- six.print_('''\
++ print('''\
+ {
+ GHashTable *oldhash = this->%(name)s;''' % d, file=self.fd)
+ if is_object(el_type):
+- six.print_(' this->%(name)s = get_hashtable_from_array_of_objects(zval_%(name)s);' % d, file=self.fd)
++ print(' this->%(name)s = get_hashtable_from_array_of_objects(zval_%(name)s);' % d, file=self.fd)
+ else:
+- six.print_(' this->%(name)s = get_hashtable_from_array_of_strings(zval_%(name)s);' % d, file=self.fd)
+- six.print_(' g_hash_table_destroy(oldhash);', file=self.fd)
+- six.print_(' }', file=self.fd)
++ print(' this->%(name)s = get_hashtable_from_array_of_strings(zval_%(name)s);' % d, file=self.fd)
++ print(' g_hash_table_destroy(oldhash);', file=self.fd)
++ print(' }', file=self.fd)
+ elif is_object(m):
+- six.print_(' if ((cvt_%(name)s = (PhpGObjectPtr*)zend_fetch_resource(Z_RES_P(zval_%(name)s), PHP_LASSO_SERVER_RES_NAME, le_lasso_server)) == NULL) {' % d, file=self.fd)
+- six.print_(' RETURN_FALSE;', file=self.fd)
+- six.print_(' }', file=self.fd)
+- six.print_(' lasso_assign_gobject(this->%(name)s, cvt_%(name)s->obj);' % d, file=self.fd)
++ print(' if ((cvt_%(name)s = (PhpGObjectPtr*)zend_fetch_resource(Z_RES_P(zval_%(name)s), PHP_LASSO_SERVER_RES_NAME, le_lasso_server)) == NULL) {' % d, file=self.fd)
++ print(' RETURN_FALSE;', file=self.fd)
++ print(' }', file=self.fd)
++ print(' lasso_assign_gobject(this->%(name)s, cvt_%(name)s->obj);' % d, file=self.fd)
+
+- six.print_('}', file=self.fd)
+- six.print_('', file=self.fd)
++ print('}', file=self.fd)
++ print('', file=self.fd)
+
+ def generate_functions_list(self):
+- six.print_('''\
++ print('''\
+ static zend_function_entry lasso_functions[] = {''', file=self.fd)
+ for m in self.functions_list:
+- six.print_(' PHP_FE(%s, NULL)' % m, file=self.fd)
+- six.print_('''\
++ print(' PHP_FE(%s, NULL)' % m, file=self.fd)
++ print('''\
+ {NULL, NULL, NULL, 0, 0}
+ };
+ ''', file=self.fd)
+
+ def generate_footer(self):
+- six.print_('''\
++ print('''\
+ zend_module_entry lasso_module_entry = {
+ #if ZEND_MODULE_API_NO >= 20010901
+ STANDARD_MODULE_HEADER,
+diff --git a/bindings/python/examples/get_attributes_from_assertion.py b/bindings/python/examples/get_attributes_from_assertion.py
+index 8f37a337..87236b91 100644
+--- a/bindings/python/examples/get_attributes_from_assertion.py
++++ b/bindings/python/examples/get_attributes_from_assertion.py
+@@ -1,10 +1,9 @@
+ # Example SP Python code to get attributes from an assertion
+
+-from six import print_
+
+ for attribute in assertion.attributeStatement[0].attribute:
+ if attribute.name == lasso.SAML2_ATTRIBUTE_NAME_EPR:
+ continue
+- print_('attribute : ' + attribute.name)
++ print('attribute : ' + attribute.name)
+ for value in attribute.attributeValue:
+- print_(' value : ' + value.any[0].content)
++ print(' value : ' + value.any[0].content)
+diff --git a/bindings/python/lang.py b/bindings/python/lang.py
+index 5ba4265c..1e7b36e1 100644
+--- a/bindings/python/lang.py
++++ b/bindings/python/lang.py
+@@ -19,7 +19,6 @@
+ # along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ import os
+-from six import print_
+ import sys
+ import re
+ import textwrap
+@@ -34,9 +33,9 @@ def remove_bad_optional(args):
+ if not '=' in x:
+ non_opt = True
+ elif non_opt:
+- print_('W: changed', x, file=sys.stderr, end=' ')
++ print('W: changed', x, file=sys.stderr, end=' ')
+ x = re.sub(' *=.*', '', x)
+- print_('to', x, file=sys.stderr)
++ print('to', x, file=sys.stderr)
+ new_args.append(x)
+ new_args.reverse()
+ return new_args
+@@ -73,17 +72,17 @@ class Binding:
+ if not name:
+ raise Exception('Cannot free, missing a name')
+ if is_cstring(type):
+- print_(' lasso_release_string(%s);' % name, file=fd)
++ print(' lasso_release_string(%s);' % name, file=fd)
+ elif is_int(type, self.binding_data) or is_boolean(type):
+ pass
+ elif is_xml_node(type):
+- print_(' lasso_release_xml_node(%s);' % name, file=fd)
++ print(' lasso_release_xml_node(%s);' % name, file=fd)
+ elif is_glist(type):
+ etype = element_type(type)
+ if is_cstring(etype):
+- print_(' lasso_release_list_of_strings(%s);' % name, file=fd)
++ print(' lasso_release_list_of_strings(%s);' % name, file=fd)
+ elif is_object(etype):
+- print_(' lasso_release_list_of_gobjects(%s);' % name, file=fd)
++ print(' lasso_release_list_of_gobjects(%s);' % name, file=fd)
+ else:
+ raise Exception('Unsupported caller owned return type %s' % ((repr(type), name),))
+ elif is_hashtable(type):
+@@ -91,11 +90,11 @@ class Binding:
+ k_type = key_type(type)
+ v_type = value_type(type)
+ if is_cstring(el_type) or (is_cstring(k_type) and is_cstring(v_type)):
+- print_(' if (%s) { g_hash_table_destroy(%s); }' % (name, name), file=fd)
++ print(' if (%s) { g_hash_table_destroy(%s); }' % (name, name), file=fd)
+ else:
+ raise Exception('Unsupported free value of type GHashTable: %s' % type)
+ elif is_object(type):
+- print_(' if (return_value) g_object_unref(%s);' % name, file=fd)
++ print(' if (return_value) g_object_unref(%s);' % name, file=fd)
+ else:
+ raise Exception('Unsupported caller owned return type %s' % ((repr(type), name),))
+
+@@ -116,7 +115,7 @@ class Binding:
+ fd.close()
+
+ def generate_header(self, fd):
+- print_('''\
++ print('''\
+ # this file has been generated automatically; do not edit
+
+ import _lasso
+@@ -172,7 +171,7 @@ class frozendict(dict):
+
+ def generate_exceptions(self, fd):
+ done_cats = []
+- print_('''\
++ print('''\
+ class Error(Exception):
+ code = None
+
+@@ -206,7 +205,7 @@ class Error(Exception):
+ cat = exc_cat.attrib.get('name')
+ done_cats.append(cat)
+ parent_cat = exc_cat.attrib.get('parent', '')
+- print_('''\
++ print('''\
+ class %sError(%sError):
+ pass
+ ''' % (cat, parent_cat), file=fd)
+@@ -229,7 +228,7 @@ class %sError(%sError):
+ else:
+ parent_cat = ''
+
+- print_('''\
++ print('''\
+ class %sError(%sError):
+ pass
+ ''' % (cat, parent_cat), file=fd)
+@@ -247,19 +246,19 @@ class %sError(%sError):
+ # ordering would change)
+ continue
+
+- print_('''\
++ print('''\
+ class %sError(%sError):
+ pass
+ ''' % (detail, cat), file=fd)
+
+- print_('exceptions_dict = {', file=fd)
++ print('exceptions_dict = {', file=fd)
+ for k, v in exceptions_dict.items():
+- print_(' _lasso.%s: %sError,' % (v, k), file=fd)
+- print_('}', file=fd)
+- print_('', file=fd)
++ print(' _lasso.%s: %sError,' % (v, k), file=fd)
++ print('}', file=fd)
++ print('', file=fd)
+
+ def generate_footer(self, fd):
+- print_('''
++ print('''
+
+ def _profileGetIssuer(cls, *args, **kwargs):
+ return profileGetIssuer(*args, **kwargs)
+@@ -304,19 +303,19 @@ StringDict = dict
+ ''', file=fd)
+
+ def generate_constants(self, fd):
+- print_('### Constants (both enums and defines)', file=fd)
++ print('### Constants (both enums and defines)', file=fd)
+ for c in self.binding_data.constants:
+- print_('%s = _lasso.%s' % (c[1][6:], c[1][6:]), file=fd)
++ print('%s = _lasso.%s' % (c[1][6:], c[1][6:]), file=fd)
+ for c in self.binding_data.overrides.findall('constant'):
+ name = c.attrib.get('name')
+ if c.attrib.get('value'):
+ name = name[6:] # dropping LASSO_
+ value = c.attrib.get('value')
+ if value == 'True':
+- print_('%s = True' % name, file=fd)
++ print('%s = True' % name, file=fd)
+ else:
+- print_('E: unknown value for constant: %r' % value, file=sys.stderr)
+- print_('', file=fd)
++ print('E: unknown value for constant: %r' % value, file=sys.stderr)
++ print('', file=fd)
+
+ def generate_class(self, clss, fd):
+ klassname = clss.name[5:] # remove Lasso from class name
+@@ -325,7 +324,7 @@ StringDict = dict
+ else:
+ parentname = clss.parent[5:]
+
+- print_('''class %(klassname)s(%(parentname)s):''' % locals(), file=fd)
++ print('''class %(klassname)s(%(parentname)s):''' % locals(), file=fd)
+
+ methods = clss.methods[:]
+ # constructor(s)
+@@ -348,14 +347,14 @@ StringDict = dict
+
+ c_args = ', '.join(c_args)
+ py_args = ', ' + ', '.join(py_args)
+- print_(' def __init__(self%s):' % py_args, file=fd)
++ print(' def __init__(self%s):' % py_args, file=fd)
+ # XXX: could check self._cptr.typename to see if it got the
+ # right class type
+- print_(' self._cptr = _lasso.%s(%s)' % (
++ print(' self._cptr = _lasso.%s(%s)' % (
+ m.name[6:], c_args), file=fd)
+- print_(' if self._cptr is None:', file=fd)
+- print_(' raise Error(\'failed to create object\')', file=fd)
+- print_('', file=fd)
++ print(' if self._cptr is None:', file=fd)
++ print(' raise Error(\'failed to create object\')', file=fd)
++ print('', file=fd)
+
+ for m in self.binding_data.functions:
+ if m.name.startswith(method_prefix + 'new_'):
+@@ -379,13 +378,13 @@ StringDict = dict
+ if '=' in x:
+ opt = True
+ elif opt:
+- print_('W: non-optional follows optional,', m, file=sys.stderr)
++ print('W: non-optional follows optional,', m, file=sys.stderr)
+ c_args = ', '.join(c_args)
+ py_args = ', ' + ', '.join(py_args)
+- print_(' @classmethod', file=fd)
+- print_(' def %s(cls%s):' % (constructor_name, py_args), file=fd)
+- print_(' return cptrToPy(_lasso.%s(%s))' % (m.name[6:], c_args), file=fd)
+- print_('', file=fd)
++ print(' @classmethod', file=fd)
++ print(' def %s(cls%s):' % (constructor_name, py_args), file=fd)
++ print(' return cptrToPy(_lasso.%s(%s))' % (m.name[6:], c_args), file=fd)
++ print('', file=fd)
+
+ # create properties for members
+ for m in clss.members:
+@@ -393,13 +392,13 @@ StringDict = dict
+ mname = format_as_camelcase(m[1])
+ options = m[2]
+ # getter
+- print_(' def get_%s(self):' % mname, file=fd)
+- print_(' t = _lasso.%s_%s_get(self._cptr)' % (
++ print(' def get_%s(self):' % mname, file=fd)
++ print(' t = _lasso.%s_%s_get(self._cptr)' % (
+ klassname, mname), file=fd)
+ if is_int(m, self.binding_data) or is_xml_node(m) or is_cstring(m) or is_boolean(m):
+ pass
+ elif is_object(m):
+- print_(' t = cptrToPy(t)', file=fd)
++ print(' t = cptrToPy(t)', file=fd)
+ elif is_glist(m):
+ el_type = element_type(m)
+ if is_cstring(el_type):
+@@ -407,54 +406,54 @@ StringDict = dict
+ elif is_xml_node(el_type):
+ pass
+ elif is_object(el_type):
+- print_(' if not t: return t', file=fd)
+- print_(' t = tuple([cptrToPy(x) for x in t])', file=fd)
++ print(' if not t: return t', file=fd)
++ print(' t = tuple([cptrToPy(x) for x in t])', file=fd)
+ else:
+ raise Exception('Unsupported python getter %s.%s' % (clss, m))
+ elif is_hashtable(m):
+ el_type = element_type(m)
+- print_(' if not t: return t', file=fd)
++ print(' if not t: return t', file=fd)
+ if is_object(el_type):
+- print_(' d2 = {}', file=fd)
+- print_(' for k, v in t.items():', file=fd)
+- print_(' d2[k] = cptrToPy(v)', file=fd)
+- print_(' t = frozendict(d2)', file=fd)
++ print(' d2 = {}', file=fd)
++ print(' for k, v in t.items():', file=fd)
++ print(' d2[k] = cptrToPy(v)', file=fd)
++ print(' t = frozendict(d2)', file=fd)
+ else:
+- print_(' t = frozendict(t)', file=fd)
++ print(' t = frozendict(t)', file=fd)
+ elif is_boolean(m) or is_int(m, self.binding_data) or is_xml_node(m) or is_cstring(m):
+ pass
+ else:
+ raise Exception('Unsupported python getter %s.%s' % (clss, m))
+- print_(' return t;', file=fd)
++ print(' return t;', file=fd)
+ # setter
+- print_(' def set_%s(self, value):' % mname, file=fd)
++ print(' def set_%s(self, value):' % mname, file=fd)
+ if is_int(m, self.binding_data) or is_xml_node(m) or is_boolean(m):
+ pass
+ elif is_cstring(m):
+- print_(' value = str2lasso(value)', file=fd)
++ print(' value = str2lasso(value)', file=fd)
+ elif is_object(m):
+- print_(' if value is not None:', file=fd)
+- print_(' value = value and value._cptr', file=fd)
++ print(' if value is not None:', file=fd)
++ print(' value = value and value._cptr', file=fd)
+ elif is_glist(m):
+ el_type = element_type(m)
+ if is_cstring(el_type) or is_xml_node(el_type):
+ pass
+ elif is_object(el_type):
+- print_(' if value is not None:', file=fd)
+- print_(' value = tuple([x._cptr for x in value])', file=fd)
++ print(' if value is not None:', file=fd)
++ print(' value = tuple([x._cptr for x in value])', file=fd)
+ else:
+ raise Exception('Unsupported python setter %s.%s' % (clss, m))
+ elif is_hashtable(m):
+- print_('W: unsupported setter for hashtable %s' % (m,), file=sys.stderr)
++ print('W: unsupported setter for hashtable %s' % (m,), file=sys.stderr)
+ else:
+- print_('W: unsupported setter for %s' % (m,), file=sys.stderr)
+- print_(' _lasso.%s_%s_set(self._cptr, value)' % (
++ print('W: unsupported setter for %s' % (m,), file=sys.stderr)
++ print(' _lasso.%s_%s_set(self._cptr, value)' % (
+ klassname, mname), file=fd)
+- print_(' %s = property(get_%s, set_%s)' % (mname, mname, mname), file=fd)
++ print(' %s = property(get_%s, set_%s)' % (mname, mname, mname), file=fd)
+ old_mname = old_format_as_camelcase(m[1])
+ if mname != old_mname:
+- print_(' %s = %s' % (old_mname, mname), file=fd)
+- print_('', file=fd)
++ print(' %s = %s' % (old_mname, mname), file=fd)
++ print('', file=fd)
+
+ # first pass on methods, getting accessors
+ # second pass on methods, real methods
+@@ -464,7 +463,7 @@ StringDict = dict
+ m.name.endswith('_new_full'):
+ continue
+ if not m.name.startswith(method_prefix):
+- print_('W:', m.name, 'vs', method_prefix, file=sys.stderr)
++ print('W:', m.name, 'vs', method_prefix, file=sys.stderr)
+ continue
+
+ if m.rename:
+@@ -501,7 +500,7 @@ StringDict = dict
+ if '=' in x:
+ opt = True
+ elif opt:
+- print_('W: non-optional follow optional,', m, file=sys.stderr)
++ print('W: non-optional follow optional,', m, file=sys.stderr)
+
+ if py_args:
+ py_args = ', ' + ', '.join(py_args)
+@@ -512,51 +511,51 @@ StringDict = dict
+ else:
+ c_args = ''
+
+- print_(' def %s(self%s):' % (
++ print(' def %s(self%s):' % (
+ format_underscore_as_camelcase(mname), py_args), file=fd)
+ if m.docstring:
+- print_(" '''", file=fd)
+- print_(self.format_docstring(m, mname, 8), file=fd)
+- print_(" '''", file=fd)
++ print(" '''", file=fd)
++ print(self.format_docstring(m, mname, 8), file=fd)
++ print(" '''", file=fd)
+
+ if outarg:
+- print_(" %s = list((None,))" % outvar, file=fd)
++ print(" %s = list((None,))" % outvar, file=fd)
+ return_type = m.return_type
+ return_type_qualifier = m.return_type_qualifier
+ assert is_int(make_arg(return_type),self.binding_data) or not outarg
+ if return_type in (None, 'void'):
+- print_(' _lasso.%s(self._cptr%s)' % (
++ print(' _lasso.%s(self._cptr%s)' % (
+ function_name, c_args), file=fd)
+ elif is_rc(m.return_arg):
+- print_(' rc = _lasso.%s(self._cptr%s)' % (
++ print(' rc = _lasso.%s(self._cptr%s)' % (
+ function_name, c_args), file=fd)
+- print_(' Error.raise_on_rc(rc)', file=fd)
++ print(' Error.raise_on_rc(rc)', file=fd)
+ elif (is_int(m.return_arg, self.binding_data) or is_xml_node(m.return_arg) or
+ is_cstring(m.return_arg) or is_boolean(m.return_arg) or
+ is_hashtable(m.return_arg)):
+- print_(' return _lasso.%s(self._cptr%s)' % (
++ print(' return _lasso.%s(self._cptr%s)' % (
+ function_name, c_args), file=fd)
+ elif is_glist(m.return_arg):
+ el_type = element_type(m.return_arg)
+ if is_object(el_type):
+- print_(' value = _lasso.%s(self._cptr%s)' % (
++ print(' value = _lasso.%s(self._cptr%s)' % (
+ function_name, c_args), file=fd)
+- print_(' if value is not None:', file=fd)
+- print_(' value = tuple([cptrToPy(x) for x in value])', file=fd)
+- print_(' return value', file=fd)
++ print(' if value is not None:', file=fd)
++ print(' value = tuple([cptrToPy(x) for x in value])', file=fd)
++ print(' return value', file=fd)
+ elif is_cstring(el_type) or is_xml_node(el_type):
+- print_(' return _lasso.%s(self._cptr%s)' % (
++ print(' return _lasso.%s(self._cptr%s)' % (
+ function_name, c_args), file=fd)
+ else:
+ raise Exception('Return Type GList<%s> is not supported' % el_type)
+ elif is_object(m.return_arg):
+- print_(' return cptrToPy(_lasso.%s(self._cptr%s))' % (
++ print(' return cptrToPy(_lasso.%s(self._cptr%s))' % (
+ function_name, c_args), file=fd)
+ else:
+ raise Exception('Return type %s is unsupported' % (m.return_arg,))
+ if outarg:
+- print_(' return %s[0]' % outvar, file=fd)
+- print_('', file=fd)
++ print(' return %s[0]' % outvar, file=fd)
++ print('', file=fd)
+ # transform methods to properties
+ for m in methods:
+ if len(m.args) > 1:
+@@ -564,7 +563,7 @@ StringDict = dict
+ name = m.rename or m.name
+ suffix = name[len(method_prefix)+len('get_'):]
+ if clss.getMember(suffix):
+- print_('W: method %s and member %s clashes' % (m.name, arg_name(clss.getMember(suffix))), file=sys.stderr)
++ print('W: method %s and member %s clashes' % (m.name, arg_name(clss.getMember(suffix))), file=sys.stderr)
+ continue
+ if not name.startswith(method_prefix) or not name[len(method_prefix):].startswith('get_'):
+ continue
+@@ -576,13 +575,13 @@ StringDict = dict
+ pname = format_as_camelcase(name[len(method_prefix)+len('get_'):])
+ fname = format_as_camelcase(name[len(method_prefix):])
+ if not setter:
+- print_(' %s = property(%s)' % (pname, fname), file=fd)
++ print(' %s = property(%s)' % (pname, fname), file=fd)
+ else:
+ f2name = format_as_camelcase(setter.name[len(method_prefix):])
+- print_(' %s = property(%s, %s)' % (pname, fname, f2name), file=fd)
++ print(' %s = property(%s, %s)' % (pname, fname, f2name), file=fd)
+ if empty:
+- print_(' pass', file=fd)
+- print_('', file=fd)
++ print(' pass', file=fd)
++ print('', file=fd)
+
+ def format_docstring(self, func, method_name, indent):
+ if func.args:
+@@ -601,7 +600,7 @@ StringDict = dict
+ return 'True'
+ if var == 'FALSE':
+ return 'False'
+- print_('W: unknown docstring thingie: %s' % s.group(1), file=sys.stderr)
++ print('W: unknown docstring thingie: %s' % s.group(1), file=sys.stderr)
+ elif type == '@':
+ if var == first_arg_name:
+ var = 'self'
+@@ -686,14 +685,14 @@ StringDict = dict
+ else:
+ name = m.name[6:]
+ pname = format_as_camelcase(name)
+- print_('%s = _lasso.%s' % (pname, name), file=fd)
++ print('%s = _lasso.%s' % (pname, name), file=fd)
+
+
+ def generate_wrapper(self, fd):
+- print_(open(os.path.join(self.src_dir,'wrapper_top.c')).read(), file=fd)
++ print(open(os.path.join(self.src_dir,'wrapper_top.c')).read(), file=fd)
+ for h in self.binding_data.headers:
+- print_('#include <%s>' % h, file=fd)
+- print_('', file=fd)
++ print('#include <%s>' % h, file=fd)
++ print('', file=fd)
+
+ self.generate_constants_wrapper(fd)
+
+@@ -705,33 +704,33 @@ StringDict = dict
+ for m in c.methods:
+ self.generate_function_wrapper(m, fd)
+ self.generate_wrapper_list(fd)
+- print_(open(os.path.join(self.src_dir,'wrapper_bottom.c')).read(), file=fd)
++ print(open(os.path.join(self.src_dir,'wrapper_bottom.c')).read(), file=fd)
+
+ def generate_constants_wrapper(self, fd):
+- print_('''static void
++ print('''static void
+ register_constants(PyObject *d)
+ {
+ PyObject *obj;
+ ''', file=fd)
+ for c in self.binding_data.constants:
+ if c[0] == 'i':
+- print_(' obj = PyInt_FromLong(%s);' % c[1], file=fd)
++ print(' obj = PyInt_FromLong(%s);' % c[1], file=fd)
+ elif c[0] == 's':
+- print_(' obj = PyString_FromString((char*)%s);' % c[1], file=fd)
++ print(' obj = PyString_FromString((char*)%s);' % c[1], file=fd)
+ elif c[0] == 'b':
+- print_('''\
++ print('''\
+ #ifdef %s
+ obj = Py_True;
+ #else
+ obj = Py_False;
+ #endif''' % c[1], file=fd)
+ else:
+- print_('E: unknown constant type: %r' % c[0], file=sys.stderr)
+- print_(' PyDict_SetItemString(d, "%s", obj);' % c[1][6:], file=fd)
++ print('E: unknown constant type: %r' % c[0], file=sys.stderr)
++ print(' PyDict_SetItemString(d, "%s", obj);' % c[1][6:], file=fd)
+ if c[0] != 'b': # refcount of Py_True/False should not be changed
+- print_(' Py_DECREF(obj);', file=fd)
+- print_('}', file=fd)
+- print_('', file=fd)
++ print(' Py_DECREF(obj);', file=fd)
++ print('}', file=fd)
++ print('', file=fd)
+
+
+ def generate_member_wrapper(self, c, fd):
+@@ -740,7 +739,7 @@ register_constants(PyObject *d)
+ name = arg_name(m)
+ mname = format_as_camelcase(arg_name(m))
+ # getter
+- print_('''static PyObject*
++ print('''static PyObject*
+ %s_%s_get(G_GNUC_UNUSED PyObject *self, PyObject *args)
+ {''' % (klassname[5:], mname), file=fd)
+ self.wrapper_list.append('%s_%s_get' % (klassname[5:], mname))
+@@ -748,140 +747,140 @@ register_constants(PyObject *d)
+ ftype = arg_type(m)
+ if is_cstring(m):
+ ftype = 'char*'
+- print_(' %s return_value;' % ftype, file=fd)
+- print_(' PyObject* return_pyvalue;', file=fd)
+- print_(' PyGObjectPtr* cvt_this;', file=fd)
+- print_(' %s* this;' % klassname, file=fd)
+- print_('', file=fd)
+- print_(' if (! PyArg_ParseTuple(args, "O", &cvt_this)) return NULL;', file=fd)
+- print_(' this = (%s*)cvt_this->obj;' % klassname, file=fd)
+- print_(' return_value = this->%s;' % arg_name(m), file=fd)
++ print(' %s return_value;' % ftype, file=fd)
++ print(' PyObject* return_pyvalue;', file=fd)
++ print(' PyGObjectPtr* cvt_this;', file=fd)
++ print(' %s* this;' % klassname, file=fd)
++ print('', file=fd)
++ print(' if (! PyArg_ParseTuple(args, "O", &cvt_this)) return NULL;', file=fd)
++ print(' this = (%s*)cvt_this->obj;' % klassname, file=fd)
++ print(' return_value = this->%s;' % arg_name(m), file=fd)
+ try:
+ self.return_value(fd, m)
+ except:
+- print_('W: cannot make an assignment for', c, m, file=sys.stderr)
++ print('W: cannot make an assignment for', c, m, file=sys.stderr)
+ raise
+- print_(' return return_pyvalue;', file=fd)
+- print_('}', file=fd)
+- print_('', file=fd)
++ print(' return return_pyvalue;', file=fd)
++ print('}', file=fd)
++ print('', file=fd)
+
+ # setter
+- print_('''static PyObject*
++ print('''static PyObject*
+ %s_%s_set(G_GNUC_UNUSED PyObject *self, PyObject *args)
+ {''' % (klassname[5:], mname), file=fd)
+ self.wrapper_list.append('%s_%s_set' % (klassname[5:], mname))
+
+- print_(' PyGObjectPtr* cvt_this;', file=fd)
+- print_(' %s* this;' % klassname, file=fd)
++ print(' PyGObjectPtr* cvt_this;', file=fd)
++ print(' %s* this;' % klassname, file=fd)
+ type = m[0]
+ # Determine type class
+ if is_cstring(m):
+ type = type.replace('const ', '')
+ parse_format = 'z'
+ parse_arg = '&value'
+- print_(' %s value;' % type, file=fd)
++ print(' %s value;' % type, file=fd)
+ elif is_int(m, self.binding_data):
+ parse_format = 'l'
+ parse_arg = '&value'
+- print_(' long value;', file=fd)
++ print(' long value;', file=fd)
+ elif is_glist(m) or is_hashtable(m) or is_xml_node(m) or is_boolean(m):
+ parse_format = 'O'
+- print_(' PyObject *cvt_value;', file=fd)
++ print(' PyObject *cvt_value;', file=fd)
+ parse_arg = '&cvt_value'
+ elif is_object(m):
+ parse_format = 'O'
+- print_(' PyGObjectPtr *cvt_value;', file=fd)
++ print(' PyGObjectPtr *cvt_value;', file=fd)
+ parse_arg = '&cvt_value'
+ else:
+ raise Exception('Unsupported field: %s' % (m,))
+ # Get GObject
+- print_(' if (! PyArg_ParseTuple(args, "O%s", &cvt_this, %s)) return NULL;' % (
++ print(' if (! PyArg_ParseTuple(args, "O%s", &cvt_this, %s)) return NULL;' % (
+ parse_format, parse_arg), file=fd)
+- print_(' this = (%s*)cvt_this->obj;' % klassname, file=fd)
++ print(' this = (%s*)cvt_this->obj;' % klassname, file=fd)
+ # Change value
+ if is_int(m, self.binding_data):
+- print_(' this->%s = value;' % name, file=fd)
++ print(' this->%s = value;' % name, file=fd)
+ elif is_boolean(m):
+- print_(' this->%s = PyInt_AS_LONG(cvt_value) ? TRUE : FALSE;' % name, file=fd)
++ print(' this->%s = PyInt_AS_LONG(cvt_value) ? TRUE : FALSE;' % name, file=fd)
+ elif is_cstring(m):
+- print_(' lasso_assign_string(this->%s, value);' % name, file=fd)
++ print(' lasso_assign_string(this->%s, value);' % name, file=fd)
+ elif is_xml_node(m):
+- print_(' if (this->%s) xmlFreeNode(this->%s);' % (name, name), file=fd)
+- print_(' this->%s = get_xml_node_from_pystring(cvt_value);' % name, file=fd)
++ print(' if (this->%s) xmlFreeNode(this->%s);' % (name, name), file=fd)
++ print(' this->%s = get_xml_node_from_pystring(cvt_value);' % name, file=fd)
+ elif is_glist(m):
+ el_type = element_type(m)
+ if is_cstring(el_type):
+- print_(' RETURN_IF_FAIL(set_list_of_strings(&this->%s, cvt_value));' % name, file=fd)
++ print(' RETURN_IF_FAIL(set_list_of_strings(&this->%s, cvt_value));' % name, file=fd)
+ elif is_xml_node(el_type):
+- print_(' RETURN_IF_FAIL(set_list_of_xml_nodes(&this->%s, cvt_value));' % name, file=fd)
++ print(' RETURN_IF_FAIL(set_list_of_xml_nodes(&this->%s, cvt_value));' % name, file=fd)
+ elif is_object(el_type):
+- print_(' RETURN_IF_FAIL(set_list_of_pygobject(&this->%s, cvt_value));' % name, file=fd)
++ print(' RETURN_IF_FAIL(set_list_of_pygobject(&this->%s, cvt_value));' % name, file=fd)
+ else:
+ raise Exception('Unsupported setter for %s' % (m,))
+ elif is_hashtable(m):
+ el_type = element_type(m)
+ if is_object(el_type):
+- print_(' RETURN_IF_FAIL(set_hashtable_of_pygobject(this->%s, cvt_value));' % name, file=fd)
++ print(' RETURN_IF_FAIL(set_hashtable_of_pygobject(this->%s, cvt_value));' % name, file=fd)
+ else:
+- print_(' RETURN_IF_FAIL(set_hashtable_of_strings(this->%s, cvt_value));' % name, file=fd)
++ print(' RETURN_IF_FAIL(set_hashtable_of_strings(this->%s, cvt_value));' % name, file=fd)
+ elif is_object(m):
+- print_(' set_object_field((GObject**)&this->%s, cvt_value);' % name, file=fd)
++ print(' set_object_field((GObject**)&this->%s, cvt_value);' % name, file=fd)
+ else:
+ raise Exception('Unsupported member %s.%s' % (klassname, m))
+- print_(' return noneRef();', file=fd)
+- print_('}', file=fd)
+- print_('', file=fd)
++ print(' return noneRef();', file=fd)
++ print('}', file=fd)
++ print('', file=fd)
+
+
+ def return_value(self, fd, arg, return_var_name = 'return_value', return_pyvar_name = 'return_pyvalue'):
+ if is_boolean(arg):
+- print_(' if (%s) {' % return_var_name, file=fd)
+- print_(' Py_INCREF(Py_True);', file=fd)
+- print_(' %s = Py_True;' % return_pyvar_name, file=fd)
+- print_(' } else {', file=fd)
+- print_(' Py_INCREF(Py_False);', file=fd)
+- print_(' %s = Py_False;' % return_pyvar_name, file=fd)
+- print_(' }', file=fd)
++ print(' if (%s) {' % return_var_name, file=fd)
++ print(' Py_INCREF(Py_True);', file=fd)
++ print(' %s = Py_True;' % return_pyvar_name, file=fd)
++ print(' } else {', file=fd)
++ print(' Py_INCREF(Py_False);', file=fd)
++ print(' %s = Py_False;' % return_pyvar_name, file=fd)
++ print(' }', file=fd)
+ elif is_int(arg, self.binding_data):
+- print_(' %s = PyInt_FromLong(%s);' % (return_pyvar_name, return_var_name), file=fd)
++ print(' %s = PyInt_FromLong(%s);' % (return_pyvar_name, return_var_name), file=fd)
+ elif is_cstring(arg) and is_transfer_full(arg):
+- print_(' if (%s) {' % return_var_name, file=fd)
+- print_(' %s = PyString_FromString(%s);' % (return_pyvar_name, return_var_name), file=fd)
+- print_(' } else {', file=fd)
+- print_(' %s = noneRef();' % return_pyvar_name, file=fd)
+- print_(' }', file=fd)
++ print(' if (%s) {' % return_var_name, file=fd)
++ print(' %s = PyString_FromString(%s);' % (return_pyvar_name, return_var_name), file=fd)
++ print(' } else {', file=fd)
++ print(' %s = noneRef();' % return_pyvar_name, file=fd)
++ print(' }', file=fd)
+ elif is_cstring(arg):
+- print_(' if (%s) {' % return_var_name, file=fd)
+- print_(' %s = PyString_FromString(%s);' % (return_pyvar_name, return_var_name), file=fd)
+- print_(' } else {', file=fd)
+- print_(' %s = noneRef();' % return_pyvar_name, file=fd)
+- print_(' }', file=fd)
++ print(' if (%s) {' % return_var_name, file=fd)
++ print(' %s = PyString_FromString(%s);' % (return_pyvar_name, return_var_name), file=fd)
++ print(' } else {', file=fd)
++ print(' %s = noneRef();' % return_pyvar_name, file=fd)
++ print(' }', file=fd)
+ elif is_glist(arg):
+ el_type = element_type(arg)
+ if is_object(el_type):
+- print_(' %s = get_list_of_pygobject(%s);' % (return_pyvar_name, return_var_name), file=fd)
++ print(' %s = get_list_of_pygobject(%s);' % (return_pyvar_name, return_var_name), file=fd)
+ elif is_cstring(el_type):
+- print_(' %s = get_list_of_strings(%s);' % (return_pyvar_name, return_var_name), file=fd)
++ print(' %s = get_list_of_strings(%s);' % (return_pyvar_name, return_var_name), file=fd)
+ elif is_xml_node(el_type):
+- print_(' %s = get_list_of_xml_nodes(%s);' % (return_pyvar_name, return_var_name), file=fd)
++ print(' %s = get_list_of_xml_nodes(%s);' % (return_pyvar_name, return_var_name), file=fd)
+ else:
+ raise Exception('failed to make an assignment for %s' % (arg,))
+ elif is_hashtable(arg):
+ el_type = element_type(arg)
+ if is_object(el_type):
+- print_(' %s = get_dict_from_hashtable_of_objects(%s);' % (return_pyvar_name, return_var_name), file=fd)
++ print(' %s = get_dict_from_hashtable_of_objects(%s);' % (return_pyvar_name, return_var_name), file=fd)
+ else:
+- print_(' %s = get_dict_from_hashtable_of_strings(%s);' % (return_pyvar_name, return_var_name), file=fd)
++ print(' %s = get_dict_from_hashtable_of_strings(%s);' % (return_pyvar_name, return_var_name), file=fd)
+ elif is_xml_node(arg):
+ # convert xmlNode* to strings
+- print_(' if (%s) {' % return_var_name, file=fd)
+- print_(' %s = get_pystring_from_xml_node(%s);' % (return_pyvar_name, return_var_name), file=fd)
+- print_(' } else {', file=fd)
+- print_(' %s = noneRef();' % return_pyvar_name, file=fd)
+- print_(' }', file=fd)
++ print(' if (%s) {' % return_var_name, file=fd)
++ print(' %s = get_pystring_from_xml_node(%s);' % (return_pyvar_name, return_var_name), file=fd)
++ print(' } else {', file=fd)
++ print(' %s = noneRef();' % return_pyvar_name, file=fd)
++ print(' }', file=fd)
+ elif is_object(arg):
+ # return a PyGObjectPtr (wrapper around GObject)
+- print_('''\
++ print('''\
+ if (%s) {
+ %s = PyGObjectPtr_New(G_OBJECT(%s));
+ } else {
+@@ -899,7 +898,7 @@ register_constants(PyObject *d)
+ else:
+ name = m.name[6:]
+ self.wrapper_list.append(name)
+- print_('''static PyObject*
++ print('''static PyObject*
+ %s(G_GNUC_UNUSED PyObject *self, PyObject *args)
+ {
+ int ok = 1;''' % name, file=fd)
+@@ -951,21 +950,21 @@ register_constants(PyObject *d)
+ parse_tuple_args.pop()
+ parse_tuple_args.append('&cvt_%s_out' % aname)
+ python_cvt_def = ' PyObject *cvt_%s_out = NULL;' % aname
+- print_(' PyObject *out_pyvalue = NULL;', file=fd)
+- print_(arg_def, file=fd)
++ print(' PyObject *out_pyvalue = NULL;', file=fd)
++ print(arg_def, file=fd)
+ if python_cvt_def:
+- print_(python_cvt_def, file=fd)
++ print(python_cvt_def, file=fd)
+
+ if m.return_type:
+- print_(' %s return_value;' % m.return_type, file=fd)
+- print_(' PyObject* return_pyvalue = NULL;', file=fd)
+- print_('', file=fd)
++ print(' %s return_value;' % m.return_type, file=fd)
++ print(' PyObject* return_pyvalue = NULL;', file=fd)
++ print('', file=fd)
+
+ parse_tuple_args = ', '.join(parse_tuple_args)
+ if parse_tuple_args:
+ parse_tuple_args = ', ' + parse_tuple_args
+
+- print_(' if (! PyArg_ParseTuple(args, "%s"%s)) return NULL;' % (
++ print(' if (! PyArg_ParseTuple(args, "%s"%s)) return NULL;' % (
+ ''.join(parse_tuple_format), parse_tuple_args), file=fd)
+
+ for f, arg in zip([ x for x in parse_tuple_format if x != '|'], m.args):
+@@ -974,48 +973,48 @@ register_constants(PyObject *d)
+ if is_list(arg):
+ qualifier = element_type(arg)
+ if is_cstring(qualifier):
+- print_(' EXIT_IF_FAIL(set_list_of_strings(&%s, cvt_%s));' % (arg[1], arg[1]), file=fd)
++ print(' EXIT_IF_FAIL(set_list_of_strings(&%s, cvt_%s));' % (arg[1], arg[1]), file=fd)
+ elif is_xml_node(qualifier):
+- print_(' EXIT_IF_FAIL(set_list_of_xml_nodes(&%s, cvt_%s));' % (arg[1], arg[1]), file=fd)
++ print(' EXIT_IF_FAIL(set_list_of_xml_nodes(&%s, cvt_%s));' % (arg[1], arg[1]), file=fd)
+ elif isinstance(qualifier, str) and qualifier.startswith('Lasso'):
+- print_(' EXIT_IF_FAIL(set_list_of_pygobject(&%s, cvt_%s));' % (arg[1], arg[1]), file=fd)
++ print(' EXIT_IF_FAIL(set_list_of_pygobject(&%s, cvt_%s));' % (arg[1], arg[1]), file=fd)
+ else:
+- print_('E: unqualified GList argument in', name, qualifier, arg, file=sys.stderr)
++ print('E: unqualified GList argument in', name, qualifier, arg, file=sys.stderr)
+ elif is_xml_node(arg):
+- print_(' %s = get_xml_node_from_pystring(cvt_%s);' % (arg[1], arg[1]), file=fd)
++ print(' %s = get_xml_node_from_pystring(cvt_%s);' % (arg[1], arg[1]), file=fd)
+ elif is_time_t_pointer(arg):
+- print_(' %s = get_time_t(cvt_%s);' % (arg[1], arg[1]), file=fd)
++ print(' %s = get_time_t(cvt_%s);' % (arg[1], arg[1]), file=fd)
+ elif is_hashtable(arg):
+ el_type = element_type(arg)
+ k_type = key_type(arg)
+ v_type = value_type(arg)
+ if is_cstring(el_type) or (is_cstring(k_type) and is_cstring(v_type)):
+
+- print_(' %s = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);' % arg[1], file=fd)
+- print_(' EXIT_IF_FAIL(set_hashtable_of_strings(%s, cvt_%s));' % (arg[1], arg[1]), file=fd)
++ print(' %s = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);' % arg[1], file=fd)
++ print(' EXIT_IF_FAIL(set_hashtable_of_strings(%s, cvt_%s));' % (arg[1], arg[1]), file=fd)
+ elif f == 'O':
+ if is_optional(arg):
+- print_(' if (PyObject_TypeCheck((PyObject*)cvt_%s, &PyGObjectPtrType)) {' % arg[1], file=fd)
+- print_(' %s = (%s)cvt_%s->obj;' % (arg[1], arg[0], arg[1]), file=fd)
+- print_(' } else {', file=fd)
+- print_(' %s = NULL;' % arg[1], file=fd)
+- print_(' }', file=fd)
++ print(' if (PyObject_TypeCheck((PyObject*)cvt_%s, &PyGObjectPtrType)) {' % arg[1], file=fd)
++ print(' %s = (%s)cvt_%s->obj;' % (arg[1], arg[0], arg[1]), file=fd)
++ print(' } else {', file=fd)
++ print(' %s = NULL;' % arg[1], file=fd)
++ print(' }', file=fd)
+ else:
+- print_(' if (PyObject_TypeCheck((PyObject*)cvt_%s, &PyGObjectPtrType)) {' % arg[1], file=fd)
+- print_(' %s = (%s)cvt_%s->obj;' % (arg[1], arg[0], arg[1]), file=fd)
+- print_(' } else {', file=fd)
+- print_(' PyErr_SetString(PyExc_TypeError, "value should be a PyGObject");', file=fd)
+- print_(' return NULL;', file=fd)
+- print_(' }', file=fd)
++ print(' if (PyObject_TypeCheck((PyObject*)cvt_%s, &PyGObjectPtrType)) {' % arg[1], file=fd)
++ print(' %s = (%s)cvt_%s->obj;' % (arg[1], arg[0], arg[1]), file=fd)
++ print(' } else {', file=fd)
++ print(' PyErr_SetString(PyExc_TypeError, "value should be a PyGObject");', file=fd)
++ print(' return NULL;', file=fd)
++ print(' }', file=fd)
+
+
+ if m.return_type:
+- print_(' return_value = ', file=fd, end='')
++ print(' return_value = ', file=fd, end='')
+ if 'new' in m.name:
+- print_('(%s)' % m.return_type, file=fd)
++ print('(%s)' % m.return_type, file=fd)
+ else:
+- print_(' ', file=fd, end='')
+- print_('%s(%s);' % (m.name, ', '.join([ref_name(x) for x in m.args])), file=fd)
++ print(' ', file=fd, end='')
++ print('%s(%s);' % (m.name, ', '.join([ref_name(x) for x in m.args])), file=fd)
+
+ if m.return_type:
+ # Constructor so decrease refcount (it was incremented by PyGObjectPtr_New called
+@@ -1023,7 +1022,7 @@ register_constants(PyObject *d)
+ try:
+ self.return_value(fd, m.return_arg)
+ except:
+- print_('W: cannot assign return value of', m, file=sys.stderr)
++ print('W: cannot assign return value of', m, file=sys.stderr)
+ raise
+
+ if is_transfer_full(m.return_arg, default=True):
+@@ -1033,48 +1032,48 @@ register_constants(PyObject *d)
+ if is_out(arg):
+ self.return_value(fd, arg, return_var_name = arg[1], return_pyvar_name = 'out_pyvalue')
+
+- print_(' EXIT_IF_FAIL(%s);' % arg[1], file=fd)
+- print_(' if (PyList_SetItem(cvt_%s_out, 0, out_pyvalue) == -1) {' % arg[1], file=fd)
+- print_(' ok = 0;', file=fd)
+- print_(' Py_XDECREF(out_pyvalue);', file=fd)
+- print_(' }', file=fd)
++ print(' EXIT_IF_FAIL(%s);' % arg[1], file=fd)
++ print(' if (PyList_SetItem(cvt_%s_out, 0, out_pyvalue) == -1) {' % arg[1], file=fd)
++ print(' ok = 0;', file=fd)
++ print(' Py_XDECREF(out_pyvalue);', file=fd)
++ print(' }', file=fd)
+ elif arg[0] == 'GList*':
+ qualifier = arg[2].get('element-type')
+ if is_cstring(qualifier):
+- print_(' free_list(&%s, (GFunc)g_free);' % arg[1], file=fd)
++ print(' free_list(&%s, (GFunc)g_free);' % arg[1], file=fd)
+ elif is_xml_node(qualifier):
+- print_(' free_list(&%s, (GFunc)xmlFreeNode);' % arg[1], file=fd)
++ print(' free_list(&%s, (GFunc)xmlFreeNode);' % arg[1], file=fd)
+ elif is_object(qualifier):
+- print_(' free_list(&%s, (GFunc)g_object_unref);' % arg[1], file=fd)
++ print(' free_list(&%s, (GFunc)g_object_unref);' % arg[1], file=fd)
+ elif is_time_t_pointer(arg):
+- print_(' if (%s) free(%s);' % (arg[1], arg[1]), file=fd)
++ print(' if (%s) free(%s);' % (arg[1], arg[1]), file=fd)
+ elif not is_transfer_full(arg) and is_hashtable(arg):
+ self.free_value(fd, arg)
+ elif not is_transfer_full(arg) and is_xml_node(arg):
+ self.free_value(fd, arg)
+
+- print_('failure:', file=fd)
++ print('failure:', file=fd)
+
+ if not m.return_type:
+- print_(' if (ok) {', file=fd)
+- print_(' return noneRef();', file=fd)
++ print(' if (ok) {', file=fd)
++ print(' return noneRef();', file=fd)
+ else:
+- print_(' if (ok && return_pyvalue) {', file=fd)
+- print_(' return return_pyvalue;', file=fd)
+- print_(' } else {', file=fd)
++ print(' if (ok && return_pyvalue) {', file=fd)
++ print(' return return_pyvalue;', file=fd)
++ print(' } else {', file=fd)
+ if m.return_type:
+- print_(' Py_XDECREF(return_pyvalue);', file=fd)
+- print_(' return NULL;', file=fd)
+- print_(' }', file=fd)
+- print_('}', file=fd)
+- print_('', file=fd)
++ print(' Py_XDECREF(return_pyvalue);', file=fd)
++ print(' return NULL;', file=fd)
++ print(' }', file=fd)
++ print('}', file=fd)
++ print('', file=fd)
+
+ def generate_wrapper_list(self, fd):
+- print_('''
++ print('''
+ static PyMethodDef lasso_methods[] = {''', file=fd)
+ for m in self.wrapper_list:
+- print_(' {"%s", %s, METH_VARARGS, NULL},' % (m, m), file=fd)
+- print_(' {NULL, NULL, 0, NULL}', file=fd)
+- print_('};', file=fd)
+- print_('', file=fd)
++ print(' {"%s", %s, METH_VARARGS, NULL},' % (m, m), file=fd)
++ print(' {NULL, NULL, 0, NULL}', file=fd)
++ print('};', file=fd)
++ print('', file=fd)
+
+diff --git a/bindings/python/tests/XmlTestRunner.py b/bindings/python/tests/XmlTestRunner.py
+index 7a4150b4..d27d7da0 100644
+--- a/bindings/python/tests/XmlTestRunner.py
++++ b/bindings/python/tests/XmlTestRunner.py
+@@ -1,4 +1,3 @@
+-# -*- coding: utf-8 -*-
+ #
+ # $Id: XmlTestRunner.py 3254 2007-06-05 21:23:57Z fpeters $
+ #
+@@ -25,7 +24,6 @@
+ import unittest
+ import time
+ import sys
+-from six import print_
+
+ def xml(text):
+ if not text:
+@@ -34,14 +32,14 @@ def xml(text):
+
+ class XmlTestResult(unittest.TestResult):
+ def addSuccess(self, test):
+- print_(""" <test result="success">
++ print(""" <test result="success">
+ <id>%s</id>
+ <description>%s</description>
+ </test>""" % (test.id(), xml(test.shortDescription())))
+
+ def addError(self, test, err):
+ unittest.TestResult.addError(self, test, err)
+- print_(""" <test result="error">
++ print(""" <test result="error">
+ <id>%s</id>
+ <description>%s</description>
+ </test>""" % (test.id(), xml(test.shortDescription())))
+@@ -49,7 +47,7 @@ class XmlTestResult(unittest.TestResult):
+
+ def addFailure(self, test, err):
+ unittest.TestResult.addFailure(self, test, err)
+- print_(""" <test result="failure">
++ print(""" <test result="failure">
+ <id>%s</id>
+ <description>%s</description>
+ </test>""" % (test.id(), xml(test.shortDescription())))
+@@ -61,14 +59,14 @@ class XmlTestRunner:
+ return XmlTestResult()
+
+ def run(self, test):
+- print_("<suite>")
++ print("<suite>")
+ result = self._makeResult()
+ startTime = time.time()
+ test(result)
+ stopTime = time.time()
+ timeTaken = float(stopTime - startTime)
+- print_(" <duration>%s</duration>" % timeTaken)
+- print_("</suite>")
++ print(" <duration>%s</duration>" % timeTaken)
++ print("</suite>")
+
+ return result
+
+diff --git a/bindings/python/tests/binding_tests.py b/bindings/python/tests/binding_tests.py
+index 4fe7fde6..e074b893 100755
+--- a/bindings/python/tests/binding_tests.py
++++ b/bindings/python/tests/binding_tests.py
+@@ -254,10 +254,13 @@ class BindingTestCase(unittest.TestCase):
+ def test07(self):
+ '''Check reference counting'''
+ s = lasso.Samlp2AuthnRequest()
+- cptr = s._cptr
++ # Starting with Python 3.14 some reference count changes
++ # are avoided.
++ # Creating a reference in a dict still increments refcount
++ data = {'cptr': s._cptr}
+ a = sys.getrefcount(s._cptr)
+ del(s)
+- b = sys.getrefcount(cptr)
++ b = sys.getrefcount(data['cptr'])
+ self.assertEqual(b, a-1)
+
+ def test08(self):
+@@ -339,6 +342,12 @@ class BindingTestCase(unittest.TestCase):
+ self.assertEqual(str(cm.exception),
+ '<lasso.XmlSchemaInvalidFragmentError(17): An XML tree does not respect at least an XML schema of its namespaces.>')
+
++ def test_provider_get_key_encryption_method(self):
++ # check getKeyEncryptionMethod is a Provider method #101250
++ with self.assertRaises(AttributeError):
++ getattr(lasso, 'providerGetKeyEncryptionMethod')
++ getattr(lasso.Provider, 'getKeyEncryptionMethod')
++
+ def test_set_list_of_strings(self):
+ node = lasso.Samlp2RequestedAuthnContext()
+ with self.assertRaises(TypeError, msg='value should be a tuple of strings'):
+@@ -353,7 +362,91 @@ class BindingTestCase(unittest.TestCase):
+ with self.assertRaises(TypeError, msg='value should be a tuple of PyGobject'):
+ node.attributeValue = value
+
+-bindingSuite = unittest.makeSuite(BindingTestCase, 'test')
++ def test_saml1_soap_attributes(self):
++ # Test AttributeStatement AttributeValue text extraction
++ # Example SAML 1.1 validation response taken from
++ # https://github.com/apereo/cas/blob/master/docs/cas-server-documentation/protocol/CAS-Protocol-Specification.md
++ soap_content = """
++<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">
++ <SOAP-ENV:Header />
++ <SOAP-ENV:Body>
++ <Response xmlns=\"urn:oasis:names:tc:SAML:1.0:protocol\" xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\"
++ xmlns:samlp=\"urn:oasis:names:tc:SAML:1.0:protocol\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
++ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" IssueInstant=\"2008-12-10T14:12:14.817Z\"
++ MajorVersion=\"1\" MinorVersion=\"1\" Recipient=\"https://eiger.iad.vt.edu/dat/home.do\"
++ ResponseID=\"_5c94b5431c540365e5a70b2874b75996\">
++ <Status>
++ <StatusCode Value=\"samlp:Success\">
++ </StatusCode>
++ </Status>
++ <Assertion xmlns=\"urn:oasis:names:tc:SAML:1.0:assertion\" AssertionID=\"_e5c23ff7a3889e12fa01802a47331653\"
++ IssueInstant=\"2008-12-10T14:12:14.817Z\" Issuer=\"localhost\" MajorVersion=\"1\"
++ MinorVersion=\"1\">
++ <Conditions NotBefore=\"2008-12-10T14:12:14.817Z\" NotOnOrAfter=\"2008-12-10T14:12:44.817Z\">
++ <AudienceRestrictionCondition>
++ <Audience>
++ https://some-service.example.com/app/
++ </Audience>
++ </AudienceRestrictionCondition>
++ </Conditions>
++ <AttributeStatement>
++ <Subject>
++ <NameIdentifier>johnq</NameIdentifier>
++ <SubjectConfirmation>
++ <ConfirmationMethod>
++ urn:oasis:names:tc:SAML:1.0:cm:artifact
++ </ConfirmationMethod>
++ </SubjectConfirmation>
++ </Subject>
++ <Attribute AttributeName=\"uid\" AttributeNamespace=\"http://www.ja-sig.org/products/cas/\">
++ <AttributeValue>12345</AttributeValue>
++ </Attribute>
++ <Attribute AttributeName=\"groupMembership\" AttributeNamespace=\"http://www.ja-sig.org/products/cas/\">
++ <AttributeValue>
++ uugid=middleware.staff,ou=Groups,dc=vt,dc=edu
++ </AttributeValue>
++ </Attribute>
++ <Attribute AttributeName=\"eduPersonAffiliation\" AttributeNamespace=\"http://www.ja-sig.org/products/cas/\">
++ <AttributeValue>staff</AttributeValue>
++ </Attribute>
++ <Attribute AttributeName=\"accountState\" AttributeNamespace=\"http://www.ja-sig.org/products/cas/\">
++ <AttributeValue>ACTIVE</AttributeValue>
++ </Attribute>
++ </AttributeStatement>
++ <AuthenticationStatement AuthenticationInstant=\"2008-12-10T14:12:14.741Z\"
++ AuthenticationMethod=\"urn:oasis:names:tc:SAML:1.0:am:password\">
++ <Subject>
++ <NameIdentifier>johnq</NameIdentifier>
++ <SubjectConfirmation>
++ <ConfirmationMethod>
++ urn:oasis:names:tc:SAML:1.0:cm:artifact
++ </ConfirmationMethod>
++ </SubjectConfirmation>
++ </Subject>
++ </AuthenticationStatement>
++ </Assertion>
++ </Response>
++ </SOAP-ENV:Body>
++</SOAP-ENV:Envelope>
++"""
++ expt_attrs = {'uid': '12345',
++ 'groupMembership': 'uugid=middleware.staff,ou=Groups,dc=vt,dc=edu',
++ 'eduPersonAffiliation': 'staff',
++ 'accountState': 'ACTIVE'}
++ node = lasso.Node.newFromSoap(soap_content)
++ assert len(node.assertion) == 1
++ assertion = node.assertion[0]
++ for attribute in assertion.attributeStatement.attribute:
++ attr_name = attribute.attributeName
++ with self.subTest(name=attr_name):
++ self.assertEqual(len(attribute.attributeValue), 1)
++ value = attribute.attributeValue[0]
++ self.assertEqual(len(value.any), 1)
++ content = value.any[0].content
++ self.assertIn(attr_name, expt_attrs)
++ self.assertEqual(expt_attrs[attr_name], content.strip())
++
++bindingSuite = unittest.defaultTestLoader.loadTestsFromTestCase(BindingTestCase)
+
+ allTests = unittest.TestSuite((bindingSuite, ))
+
+diff --git a/bindings/python/tests/profiles_tests.py b/bindings/python/tests/profiles_tests.py
+index 03f33ea9..8679d663 100755
+--- a/bindings/python/tests/profiles_tests.py
++++ b/bindings/python/tests/profiles_tests.py
+@@ -330,6 +330,12 @@ class LoginTestCase(unittest.TestCase):
+ sp_login.setSignatureVerifyHint(lasso.PROFILE_SIGNATURE_VERIFY_HINT_FORCE)
+ sp_login.processAuthnResponseMsg(idp_login.msgBody)
+ sp_login.acceptSso()
++
++ if key_encryption_method:
++ expected_key_encryption_method = key_encryption_method
++ else:
++ expected_key_encryption_method = lasso.getDefaultKeyEncryptionMethod()
++ assert provider.getKeyEncryptionMethod() == expected_key_encryption_method
+ return sp_login.response.debug()
+
+ os.environ['LASSO_DEFAULT_KEY_ENCRYPTION_METHOD'] = 'rsa-pkcs1'
+@@ -543,12 +549,12 @@ class AttributeAuthorityTestCase(unittest.TestCase):
+ assert aq.response.assertion[0].attributeStatement[0].attribute[0]
+ assert aq.response.assertion[0].attributeStatement[0].attribute[0].attributeValue[0]
+
+-serverSuite = unittest.makeSuite(ServerTestCase, 'test')
+-loginSuite = unittest.makeSuite(LoginTestCase, 'test')
+-logoutSuite = unittest.makeSuite(LogoutTestCase, 'test')
+-defederationSuite = unittest.makeSuite(DefederationTestCase, 'test')
+-identitySuite = unittest.makeSuite(IdentityTestCase, 'test')
+-attributeSuite = unittest.makeSuite(AttributeAuthorityTestCase, 'test')
++serverSuite = unittest.defaultTestLoader.loadTestsFromTestCase(ServerTestCase)
++loginSuite = unittest.defaultTestLoader.loadTestsFromTestCase(LoginTestCase)
++logoutSuite = unittest.defaultTestLoader.loadTestsFromTestCase(LogoutTestCase)
++defederationSuite = unittest.defaultTestLoader.loadTestsFromTestCase(DefederationTestCase)
++identitySuite = unittest.defaultTestLoader.loadTestsFromTestCase(IdentityTestCase)
++attributeSuite = unittest.defaultTestLoader.loadTestsFromTestCase(AttributeAuthorityTestCase)
+
+ allTests = unittest.TestSuite((serverSuite, loginSuite, logoutSuite, defederationSuite,
+ identitySuite, attributeSuite))
+diff --git a/bindings/python/tests/tests.py b/bindings/python/tests/tests.py
+index efed53d1..5f2f0c8d 100755
+--- a/bindings/python/tests/tests.py
++++ b/bindings/python/tests/tests.py
+@@ -1,5 +1,4 @@
+ #! /usr/bin/env python
+-# -*- coding: utf-8 -*-
+ #
+ # $Id: tests.py 3425 2007-10-10 09:31:03Z dlaniel $
+ #
+@@ -31,7 +30,6 @@ import os
+ import sys
+ import time
+ import unittest
+-from six import print_
+
+ from XmlTestRunner import XmlTestRunner
+
+@@ -61,10 +59,10 @@ parser.add_option(
+ __builtin__.__dict__['dataDir'] = os.path.join(options.srcDir, '../../../tests/data')
+
+ if options.xmlMode:
+- print_('<?xml version="1.0"?>')
+- print_('<testsuites xmlns="http://check.sourceforge.net/ns">')
+- print_(' <title>Python Bindings</title>')
+- print_(' <datetime>%s</datetime>' % time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()))
++ print('<?xml version="1.0"?>')
++ print('<testsuites xmlns="http://check.sourceforge.net/ns">')
++ print(' <title>Python Bindings</title>')
++ print(' <datetime>%s</datetime>' % time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()))
+
+ success = True
+ for testSuite in testSuites:
+@@ -75,7 +73,7 @@ for testSuite in testSuites:
+ if fp:
+ fp.close()
+ if not module:
+- print_('Unable to load test suite:', testSuite, file=sys.stderr)
++ print('Unable to load test suite:', testSuite, file=sys.stderr)
+ continue
+
+ if module.__doc__:
+@@ -88,13 +86,13 @@ for testSuite in testSuites:
+ else:
+ runner = unittest.TextTestRunner(verbosity=2)
+ print
+- print_('-' * len(doc))
+- print_(doc)
+- print_('-' * len(doc))
++ print('-' * len(doc))
++ print(doc)
++ print('-' * len(doc))
+ result = runner.run(module.allTests)
+ success = success and result.wasSuccessful()
+
+ if options.xmlMode:
+- print_('</testsuites>')
++ print('</testsuites>')
+
+ sys.exit(not success)
+diff --git a/configure.ac b/configure.ac
+index 79d06985..cb9be5d5 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -90,6 +90,7 @@ fi
+ dnl
+ dnl Check for programs
+ dnl
++CFLAGS="$CFLAGS -Werror=undef -Werror=implicit-function-declaration"
+ AC_PROG_CC
+ AM_CFLAGS=""
+ AC_HEADER_STDC
+@@ -133,7 +134,7 @@ AC_CHECK_PROGS(PHP5, php5 php)
+ AC_CHECK_PROGS(PHP5_CONFIG, php-config5 php-config)
+ AC_CHECK_PROGS(PHP7, php7.4 php7.3 php7.2 php7.1 php7.0 php7 php)
+ AC_CHECK_PROGS(PHP7_CONFIG, php-config7.4 php-config7.3 php-config7.2 php-config7.1 php-config7.0 php-config7 php-config)
+-AC_CHECK_PROGS(PYTHON, python3 python python2)
++AC_CHECK_PROGS(PYTHON, python3 python)
+ AC_CHECK_PROGS(SWIG, swig)
+
+ dnl Make sure we have an ANSI compiler
+@@ -325,25 +326,49 @@ if test "X$with_python" != "X"; then
+ PYTHON=$with_python
+ fi
+
++test "x$PYTHON" != "x" || AC_MSG_ERROR(Python must be installed to compile lasso)
+
+ dnl need to change quotes to allow square brackets
+ changequote(<<, >>)dnl
+-PYTHON_VERSION=`$PYTHON -c 'from distutils import sysconfig ; print(sysconfig.get_config_var("VERSION"))'`
++PYTHON_VERSION=`$PYTHON -c '
++try:
++ import sysconfig
++except ImportError:
++ from distutils import sysconfig
++print(sysconfig.get_config_var("VERSION"))'`
+ changequote([, ])dnl
+
+-test "x$PYTHON" != "x" || AC_MSG_ERROR(Python must be installed to compile lasso)
+-
+ AC_MSG_CHECKING(for Python development files)
+ dnl Check if we were be able to extract a good version number.
+ if test "X$PYTHON_VERSION" != "X"; then
+ changequote(<<, >>)dnl
+- PYTHON_INC=`$PYTHON -c 'from distutils import sysconfig ; print(sysconfig.get_python_inc())'`
+- PYTHON_LIB=`$PYTHON -c 'from distutils import sysconfig ; print(sysconfig.get_python_lib(1))'`
++ PYTHON_INC=`$PYTHON -c '
++try:
++ import sysconfig
++ print(sysconfig.get_path("include"))
++except ImportError:
++ from distutils import sysconfig
++ print(sysconfig.get_python_inc())
++'`
++ PYTHON_LIB=`$PYTHON -c '
++try:
++ import sysconfig
++ print(sysconfig.get_path("platlib"))
++except ImportError:
++ from distutils import sysconfig
++ print(sysconfig.get_python_lib(True))
++'`
+ changequote([, ])dnl
+ PYTHON_H=$PYTHON_INC/Python.h
+ if test -f $PYTHON_H; then
+ PY_CFLAGS="-I$PYTHON_INC"
+- PY_MAKEFILE=`$PYTHON -c 'from distutils import sysconfig ; print(sysconfig.get_makefile_filename())'`
++ PY_MAKEFILE=`$PYTHON -c '
++try:
++ import sysconfig
++except ImportError:
++ from distutils import sysconfig
++print(sysconfig.get_makefile_filename())
++'`
+ PY_OTHER_LIBS=`$SED -n -e 's/^LIBS=\(.*\)/\1/p' $PY_MAKEFILE`
+ PY_EXTRA_LIBS="$PY_LOCALMODLIBS $PY_BASEMODLIBS $PY_OTHER_LIBS"
+ dnl this extracts the $libdir out of python lib directory,
+diff --git a/lasso/build_strerror.py b/lasso/build_strerror.py
+index 908638d5..041c23a2 100644
+--- a/lasso/build_strerror.py
++++ b/lasso/build_strerror.py
+@@ -4,14 +4,14 @@ import glob
+ import re
+ import sys
+ import os
+-from six import print_, StringIO
++from io import StringIO
+
+ srcdir = sys.argv[1]
+
+ messages = dict()
+ description = ''
+
+-with open('%s/errors.h' % srcdir,'r') as f:
++with open('%s/errors.h' % srcdir) as f:
+ for line in f:
+ m = re.match(r'^ \* LASSO.*ERROR', line)
+ if m:
+@@ -30,13 +30,13 @@ with open('%s/errors.h' % srcdir,'r') as f:
+ if m:
+ messages[m.group(1)] = m.group(1)
+
+-with open('%s/errors.c.in' % srcdir,'r') as f:
++with open('%s/errors.c.in' % srcdir) as f:
+ for line in f:
+ if '@ERROR_CASES@' in line:
+ keys = sorted(messages.keys())
+ for k in keys:
+- print_(' case %s:\n'
++ print(' case %s:\n'
+ ' return "%s";' %
+ (k,messages[k].rstrip('\n')))
+ else:
+- print_(line, end="")
++ print(line, end="")
+diff --git a/lasso/extract_sections.py b/lasso/extract_sections.py
+index a03d8551..0130480d 100644
+--- a/lasso/extract_sections.py
++++ b/lasso/extract_sections.py
+@@ -5,7 +5,6 @@ import re
+ import sys
+ import os
+ import os.path
+-from six import print_
+
+ if len(sys.argv) == 2:
+ srcdir = sys.argv[1]
+@@ -19,21 +18,21 @@ for root, dirs, files in os.walk(srcdir):
+ prefixes.append(os.path.splitext(file)[0])
+ for prefix in prefixes:
+ try:
+- header = io.open(os.path.join(root, prefix + '.h'), encoding='utf-8').read()
+- implementation = io.open(os.path.join(root, prefix + '.c'), encoding='utf-8').read()
+- exported_functions = re.findall('LASSO_EXPORT.*(lasso_\w*)', header)
++ header = open(os.path.join(root, prefix + '.h'), encoding='utf-8').read()
++ implementation = open(os.path.join(root, prefix + '.c'), encoding='utf-8').read()
++ exported_functions = re.findall(r'LASSO_EXPORT.*(lasso_\w*)', header)
+ normal_functions = sorted ([ x for x in exported_functions if not x.endswith('get_type') ])
+ get_type = [ x for x in exported_functions if x.endswith('get_type') ][0]
+ file_name = re.findall('lasso_(.*)_get_type', get_type)[0]
+ try:
+- macro_type = re.findall('LASSO_(\w*)_CLASS\(', header)[0]
++ macro_type = re.findall(r'LASSO_(\w*)_CLASS\(', header)[0]
+ except:
+ macro_type = None
+ try:
+ type = re.findall(r'^struct _(Lasso\w*)', header, re.MULTILINE)[0]
+ except:
+ type = None
+- types = re.findall('^} (Lasso\w*);', header)
++ types = re.findall(r'^} (Lasso\w*);', header)
+ def convert(x):
+ if '%s' in x:
+ return x % macro_type
+@@ -41,17 +40,17 @@ for root, dirs, files in os.walk(srcdir):
+ return x
+ if type and macro_type:
+ standard_decl = [ convert(x) for x in [ 'LASSO_%s', 'LASSO_IS_%s', 'LASSO_TYPE_%s', get_type, 'LASSO_%s_CLASS', 'LASSO_IS_%s_CLASS', 'LASSO_%s_GET_CLASS' ] ]
+- print_('')
+- print_('<SECTION>')
+- print_('<FILE>%s</FILE>' % file_name)
+- print_('<TITLE>%s</TITLE>' % type)
+- print_(type)
++ print('')
++ print('<SECTION>')
++ print('<FILE>%s</FILE>' % file_name)
++ print('<TITLE>%s</TITLE>' % type)
++ print(type)
+ for x in types + normal_functions:
+- print_(x)
+- print_('<SUBSECTION Standard>')
++ print(x)
++ print('<SUBSECTION Standard>')
+ for x in standard_decl:
+- print_(x)
+- print_('</SECTION>')
++ print(x)
++ print('</SECTION>')
+ except:
+ continue
+
+diff --git a/lasso/extract_symbols.py b/lasso/extract_symbols.py
+index fc34e405..3bbe6160 100644
+--- a/lasso/extract_symbols.py
++++ b/lasso/extract_symbols.py
+@@ -4,7 +4,6 @@ import io
+ import glob
+ import re
+ import sys
+-import six
+
+ if len(sys.argv) == 2:
+ srcdir = sys.argv[1]
+@@ -17,8 +16,8 @@ symbols = []
+ for header_file in glob.glob('%s/*/*.h' % srcdir) + glob.glob('%s/*.h' % srcdir) + \
+ glob.glob('%s/*/*/*.h' % srcdir):
+ assert not ('/id-wsf/' in header_file or '/id-wsf-2.0' in header_file)
+- symbols.extend(regex.findall(io.open(header_file, encoding='utf-8').read().replace('\\\n', '')))
++ symbols.extend(regex.findall(open(header_file, encoding='utf-8').read().replace('\\\n', '')))
+
+ for s in symbols:
+- six.print_(s)
++ print(s)
+
+diff --git a/lasso/extract_types.py b/lasso/extract_types.py
+index f1ac26e2..9c0a12be 100644
+--- a/lasso/extract_types.py
++++ b/lasso/extract_types.py
+@@ -4,7 +4,6 @@ import io
+ import glob
+ import re
+ import sys
+-import six
+
+ if len(sys.argv) == 2:
+ srcdir = sys.argv[1]
+@@ -14,30 +13,30 @@ else:
+
+ fd = io.StringIO()
+
+-six.print_(u"/* This file has been autogenerated; changes will be lost */", file=fd)
+-six.print_(u"", file=fd)
+-six.print_(u"typedef GType (*type_function) ();", file=fd)
+-six.print_(u"", file=fd)
++print("/* This file has been autogenerated; changes will be lost */", file=fd)
++print("", file=fd)
++print("typedef GType (*type_function) ();", file=fd)
++print("", file=fd)
+
+ header_files = []
+ for header_file in sorted(glob.glob('%s/*/*.h' % srcdir) + glob.glob('%s/*/*/*.h' % srcdir)):
+ assert not ('/id-wsf/' in header_file or '/id-wsf-2.0' in header_file)
+ header_files.append(header_file)
+ try:
+- type = re.findall('lasso_.*get_type', io.open(header_file, encoding='utf-8').read())[0]
++ type = re.findall('lasso_.*get_type', open(header_file, encoding='utf-8').read())[0]
+ except IndexError:
+ continue
+- six.print_("extern GType %s();" % type, file=fd)
++ print("extern GType %s();" % type, file=fd)
+
+-six.print_(u"", file=fd)
+-six.print_(u"type_function functions[] = {", file=fd)
++print("", file=fd)
++print("type_function functions[] = {", file=fd)
+ for header_file in header_files:
+ try:
+- type = re.findall('lasso_.*get_type', io.open(header_file, encoding='utf-8').read())[0]
++ type = re.findall('lasso_.*get_type', open(header_file, encoding='utf-8').read())[0]
+ except IndexError:
+ continue
+- six.print_(u"\t%s," % type, file=fd)
+-six.print_(u"\tNULL", file=fd)
+-six.print_(u"};", file=fd)
++ print("\t%s," % type, file=fd)
++print("\tNULL", file=fd)
++print("};", file=fd)
+
+-io.open('types.c', 'w', encoding='utf-8').write(fd.getvalue())
++open('types.c', 'w', encoding='utf-8').write(fd.getvalue())
+diff --git a/lasso/id-ff/login.c b/lasso/id-ff/login.c
+index bc3b2249..09b0b1bb 100644
+--- a/lasso/id-ff/login.c
++++ b/lasso/id-ff/login.c
+@@ -270,9 +270,8 @@
+ #include "../saml-2.0/loginprivate.h"
+ #include "../lasso_config.h"
+
+-#define LASSO_LOGIN_GET_PRIVATE(o) \
+- (G_TYPE_INSTANCE_GET_PRIVATE ((o), LASSO_TYPE_LOGIN, LassoLoginPrivate))
+
++G_DEFINE_TYPE_WITH_PRIVATE(LassoLogin, lasso_login, LASSO_TYPE_PROFILE);
+
+ static void lasso_login_build_assertion_artifact(LassoLogin *login);
+
+@@ -623,6 +622,7 @@ lasso_login_process_response_status_and_assertion(LassoLogin *login)
+ LassoSamlSubjectStatementAbstract *sssa = NULL;
+ LassoSamlSubjectStatementAbstract *sas = NULL;
+ int rc = 0;
++ LassoLoginPrivate *private_data = lasso_login_get_instance_private(login);
+
+ g_return_val_if_fail(LASSO_IS_LOGIN(login), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
+
+@@ -672,7 +672,7 @@ lasso_login_process_response_status_and_assertion(LassoLogin *login)
+
+ /* Validate AuthnRequest RequestID and InResponseTo */
+ {
+- char *previous_reqid = login->private_data->request_id;
++ char *previous_reqid = private_data->request_id;
+ if (previous_reqid) {
+ if (lib_assertion == NULL ||
+ lib_assertion->InResponseTo == NULL ||
+@@ -852,7 +852,7 @@ lasso_login_build_assertion_artifact(LassoLogin *login)
+ b64_samlArt = xmlSecBase64Encode(samlArt, 42, 0);
+
+ lasso_assign_string(login->assertionArtifact, (char*)b64_samlArt);
+- lasso_assign_string(login->parent.private_data->artifact,
++ lasso_profile_set_artifact(&login->parent,
+ (char*)b64_samlArt);
+ lasso_release_xml_string(b64_samlArt);
+ }
+@@ -1024,13 +1024,12 @@ lasso_login_build_artifact_msg(LassoLogin *login, LassoHttpMethod http_method)
+ profile->remote_providerID,
+ profile->response));
+ /* comply with the new way of storing artifacts */
+- lasso_assign_string(profile->private_data->artifact,
+- login->assertionArtifact);
++ lasso_profile_set_artifact(profile, login->assertionArtifact);
+ /* Artifact profile for ID-FF 1.2 is special, this is not the full message which is relayed
+ * but only its assertion content, the Response container is changed from a
+ * lib:AuthnResponse to a samlp:Response.
+ */
+- lasso_assign_new_string(profile->private_data->artifact_message,
++ lasso_profile_set_new_artifact_message(profile,
+ lasso_node_export_to_xml((LassoNode*)login->assertion));
+ cleanup:
+ lasso_release_string(url);
+@@ -1380,6 +1379,7 @@ lasso_login_build_response_msg(LassoLogin *login, gchar *remote_providerID)
+ LassoProvider *remote_provider = NULL;
+ LassoProfile *profile = NULL;
+ lasso_error_t rc = 0;
++ LassoLoginPrivate *private_data = lasso_login_get_instance_private(login);
+
+ g_return_val_if_fail(LASSO_IS_LOGIN(login), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
+ profile = LASSO_PROFILE(login);
+@@ -1402,9 +1402,9 @@ lasso_login_build_response_msg(LassoLogin *login, gchar *remote_providerID)
+ lasso_assign_string(profile->remote_providerID, remote_providerID);
+ remote_provider = lasso_server_get_provider(profile->server, profile->remote_providerID);
+ rc = lasso_provider_verify_signature(remote_provider,
+- login->private_data->soap_request_msg,
++ private_data->soap_request_msg,
+ "RequestID", LASSO_MESSAGE_FORMAT_SOAP);
+- lasso_release_string(login->private_data->soap_request_msg);
++ lasso_release_string(private_data->soap_request_msg);
+
+ /* lasso_profile_set_session_from_dump has not been called */
+ if (profile->session == NULL) {
+@@ -1440,9 +1440,9 @@ lasso_login_build_response_msg(LassoLogin *login, gchar *remote_providerID)
+ lasso_profile_set_response_status(profile,
+ LASSO_SAML_STATUS_CODE_SUCCESS);
+ lasso_session_remove_status(profile->session, remote_providerID);
+- } else if (profile->private_data->artifact_message) {
++ } else if (lasso_profile_get_artifact_message(profile)) {
+ xmlDoc *doc;
+- char *artifact_message = profile->private_data->artifact_message;
++ const char *artifact_message = lasso_profile_get_artifact_message(profile);
+ doc = lasso_xml_parse_memory(artifact_message,
+ strlen(artifact_message));
+ lasso_profile_set_response_status(profile,
+@@ -1519,6 +1519,7 @@ lasso_login_init_authn_request(LassoLogin *login, const gchar *remote_providerID
+ LassoServer *server = NULL;
+ LassoSamlpRequestAbstract *request;
+ lasso_error_t rc = 0;
++ LassoLoginPrivate *private_data = lasso_login_get_instance_private(login);
+
+ g_return_val_if_fail(LASSO_IS_LOGIN(login), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
+
+@@ -1569,7 +1570,7 @@ lasso_login_init_authn_request(LassoLogin *login, const gchar *remote_providerID
+
+ request = LASSO_SAMLP_REQUEST_ABSTRACT(profile->request);
+ request->RequestID = lasso_build_unique_id(32);
+- lasso_assign_string(login->private_data->request_id, request->RequestID);
++ lasso_assign_string(private_data->request_id, request->RequestID);
+ request->MajorVersion = LASSO_LIB_MAJOR_VERSION_N;
+ request->MinorVersion = LASSO_LIB_MINOR_VERSION_N;
+ if (remote_provider &&
+@@ -2241,6 +2242,7 @@ lasso_login_process_request_msg(LassoLogin *login, gchar *request_msg)
+ {
+ gint ret = 0;
+ LassoProfile *profile = LASSO_PROFILE(login);
++ LassoLoginPrivate *private_data = lasso_login_get_instance_private(login);
+
+ g_return_val_if_fail(LASSO_IS_LOGIN(login), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
+ g_return_val_if_fail(request_msg != NULL, LASSO_PARAM_ERROR_INVALID_VALUE);
+@@ -2257,13 +2259,12 @@ lasso_login_process_request_msg(LassoLogin *login, gchar *request_msg)
+ /* get AssertionArtifact */
+ lasso_assign_string(login->assertionArtifact,
+ LASSO_SAMLP_REQUEST(profile->request)->AssertionArtifact);
+- lasso_assign_string(login->parent.private_data->artifact,
+- login->assertionArtifact);
++ lasso_profile_set_artifact(&login->parent, login->assertionArtifact);
+
+ /* Keep a copy of request msg so signature can be verified when we get
+ * the providerId in lasso_login_build_response_msg()
+ */
+- lasso_assign_string(login->private_data->soap_request_msg, request_msg);
++ lasso_assign_string(private_data->soap_request_msg, request_msg);
+
+ return ret;
+ }
+@@ -2441,10 +2442,11 @@ static void
+ dispose(GObject *object)
+ {
+ LassoLogin *login = LASSO_LOGIN(object);
++ LassoLoginPrivate *private_data = lasso_login_get_instance_private(login);
+
+- lasso_release_string(login->private_data->soap_request_msg);
+- lasso_release_gobject(login->private_data->saml2_assertion);
+- lasso_release_string(login->private_data->request_id);
++ lasso_release_string(private_data->soap_request_msg);
++ lasso_release_gobject(private_data->saml2_assertion);
++ lasso_release_string(private_data->request_id);
+ G_OBJECT_CLASS(parent_class)->dispose(object);
+ }
+
+@@ -2453,9 +2455,12 @@ dispose(GObject *object)
+ /*****************************************************************************/
+
+ static void
+-instance_init(LassoLogin *login, G_GNUC_UNUSED void *unused)
++lasso_login_init(LassoLogin *login)
+ {
+- login->private_data = LASSO_LOGIN_GET_PRIVATE(login);
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
++ login->private_data = lasso_login_get_instance_private(login);
++#pragma GCC diagnostic pop
+ login->protocolProfile = 0;
+ login->assertionArtifact = NULL;
+ login->nameIDPolicy = NULL;
+@@ -2463,7 +2468,7 @@ instance_init(LassoLogin *login, G_GNUC_UNUSED void *unused)
+ }
+
+ static void
+-class_init(LassoLoginClass *klass, void *unused G_GNUC_UNUSED)
++lasso_login_class_init(LassoLoginClass *klass)
+ {
+ LassoNodeClass *nclass = LASSO_NODE_CLASS(klass);
+
+@@ -2474,36 +2479,10 @@ class_init(LassoLoginClass *klass, void *unused G_GNUC_UNUSED)
+ lasso_node_class_set_nodename(nclass, "Login");
+ lasso_node_class_set_ns(nclass, LASSO_LASSO_HREF, LASSO_LASSO_PREFIX);
+ lasso_node_class_add_snippets(nclass, schema_snippets);
+- g_type_class_add_private(klass, sizeof(LassoLoginPrivate));
+
+ G_OBJECT_CLASS(klass)->dispose = dispose;
+ }
+
+-GType
+-lasso_login_get_type()
+-{
+- static GType this_type = 0;
+-
+- if (!this_type) {
+- static const GTypeInfo this_info = {
+- sizeof(LassoLoginClass),
+- NULL,
+- NULL,
+- (GClassInitFunc) class_init,
+- NULL,
+- NULL,
+- sizeof(LassoLogin),
+- 0,
+- (GInstanceInitFunc) instance_init,
+- NULL
+- };
+-
+- this_type = g_type_register_static(LASSO_TYPE_PROFILE,
+- "LassoLogin", &this_info, 0);
+- }
+- return this_type;
+-}
+-
+ /**
+ * lasso_login_new
+ * @server: the #LassoServer
+@@ -2670,9 +2649,44 @@ LassoNode*
+ lasso_login_get_assertion(LassoLogin *login)
+ {
+ g_return_val_if_fail (LASSO_IS_LOGIN (login), NULL);
++ LassoLoginPrivate *private_data = lasso_login_get_instance_private(login);
+
+- if (login->private_data && login->private_data->saml2_assertion)
+- return (LassoNode*)g_object_ref(login->private_data->saml2_assertion);
++ if (private_data && private_data->saml2_assertion)
++ return (LassoNode*)g_object_ref(private_data->saml2_assertion);
+
+ return (LassoNode*)g_object_ref(login->assertion);
+ }
++
++/*****************************************************************************/
++/* not exported private accessors for saml-2.0/login.c */
++/* headers in profileprivate.h*/
++/*****************************************************************************/
++
++LassoSaml2Assertion*
++lasso_login_get_saml2_assertion(LassoLogin *login)
++{
++ LassoLoginPrivate *private_data = lasso_login_get_instance_private(login);
++ return private_data->saml2_assertion;
++}
++
++void
++lasso_login_set_saml2_assertion(LassoLogin *login, LassoSaml2Assertion *assertion)
++{
++ LassoLoginPrivate *private_data = lasso_login_get_instance_private(login);
++ lasso_assign_gobject(private_data->saml2_assertion, assertion);
++}
++
++const char*
++lasso_login_get_request_id(LassoLogin *login)
++{
++ LassoLoginPrivate *private_data = lasso_login_get_instance_private(login);
++ return private_data->request_id;
++}
++
++void
++lasso_login_set_request_id(LassoLogin *login, char *request_id)
++{
++ LassoLoginPrivate *private_data = lasso_login_get_instance_private(login);
++ lasso_assign_string(private_data->request_id, request_id);
++}
++
+diff --git a/lasso/id-ff/login.h b/lasso/id-ff/login.h
+index 485e4a48..ef2394d5 100644
+--- a/lasso/id-ff/login.h
++++ b/lasso/id-ff/login.h
+@@ -98,7 +98,8 @@ struct _LassoLogin {
+ gchar *nameIDPolicy;
+ LassoHttpMethod http_method;
+
+- LassoLoginPrivate *private_data;
++ /* keeping it to preserve struct size */
++ LassoLoginPrivate *private_data __attribute__ ((deprecated));
+ };
+
+ struct _LassoLoginClass {
+diff --git a/lasso/id-ff/loginprivate.h b/lasso/id-ff/loginprivate.h
+index b88ecb95..0802e9e8 100644
+--- a/lasso/id-ff/loginprivate.h
++++ b/lasso/id-ff/loginprivate.h
+@@ -39,6 +39,11 @@ struct _LassoLoginPrivate
+ char *request_id;
+ };
+
++LassoSaml2Assertion *lasso_login_get_saml2_assertion(LassoLogin *login);
++void lasso_login_set_saml2_assertion(LassoLogin *login, LassoSaml2Assertion *assertion);
++const char *lasso_login_get_request_id(LassoLogin *login);
++void lasso_login_set_request_id(LassoLogin *login, char *request_id);
++
+ #ifdef __cplusplus
+ }
+ #endif /* __cplusplus */
+diff --git a/lasso/id-ff/logout.c b/lasso/id-ff/logout.c
+index f6307e54..dc6c20fc 100644
+--- a/lasso/id-ff/logout.c
++++ b/lasso/id-ff/logout.c
+@@ -378,7 +378,7 @@ lasso_logout_build_response_msg(LassoLogout *logout)
+ profile = &logout->parent;
+ lasso_profile_clean_msg_info(profile);
+
+- if (! profile->private_data || ! logout->private_data) {
++ if (! lasso_profile_is_init(profile) || ! logout->private_data) {
+ return LASSO_PARAM_ERROR_NON_INITIALIZED_OBJECT;
+ }
+
+diff --git a/lasso/id-ff/profile.c b/lasso/id-ff/profile.c
+index d8e1d1d3..21a90ba4 100644
+--- a/lasso/id-ff/profile.c
++++ b/lasso/id-ff/profile.c
+@@ -52,6 +52,8 @@
+
+ #include <stdio.h>
+
++G_DEFINE_TYPE_WITH_PRIVATE(LassoProfile, lasso_profile, LASSO_TYPE_NODE);
++
+ /*****************************************************************************/
+ /* public functions */
+ /*****************************************************************************/
+@@ -434,7 +436,8 @@ lasso_profile_set_session_from_dump(LassoProfile *profile, const gchar *dump)
+ char*
+ lasso_profile_get_artifact(LassoProfile *profile)
+ {
+- return g_strdup(profile->private_data->artifact);
++ LassoProfilePrivate *private_data = lasso_profile_get_instance_private(profile);
++ return g_strdup(private_data->artifact);
+ }
+
+ /**
+@@ -448,7 +451,8 @@ lasso_profile_get_artifact(LassoProfile *profile)
+ char*
<Skipped 3975 lines>
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/lasso.git/commitdiff/eeb6428f60f98c6b615df475368b53f9579f22ab
More information about the pld-cvs-commit
mailing list