[redland-dev] [Redland Language Bindings 0000549]: add python 3 support to redland-bindings

Mantis Bug Tracker mantis-bug-sender at librdf.org
Wed Jul 31 20:14:49 EDT 2013


The following issue has been SUBMITTED. 
====================================================================== 
http://bugs.librdf.org/mantis/view.php?id=549 
====================================================================== 
Reported By:                detrout
Assigned To:                
====================================================================== 
Project:                    Redland Language Bindings
Issue ID:                   549
Category:                   api
Reproducibility:            always
Severity:                   feature
Priority:                   normal
Status:                     new
Binding Language (java, perl, php, python, ruby, tcl): python 
====================================================================== 
Date Submitted:             2013-08-01 00:14
Last Modified:              2013-08-01 00:14
====================================================================== 
Summary:                    add python 3 support to redland-bindings
Description: 
The python community is working its way to transitioning to a new incompatible
version of the python language. 

It would be really nice if redland-bindings supported python 3.

Steps to Reproduce: 
./configure --with-python=python3.3

Redland build summary:
  Redland:              1.0.16
  Language APIs built:   



Additional Information: 
With this patch the tests in python/redlandtest.py and python/test/test.py seem
to run under both python 2.7.5 and python 3.3.2.

There's some messiness introduced by this patch because I tried to keep both
python2 and python3 support.

To keep the same behavior print statements/functions have to be a single string
wrapped in () like:

print("a %s" % (var,))

print "a", var or print("a",var)

wont work the same on both versions.

The default string type changed to unicode which led to some tricks to keep the
behaviors of all the unicode casting that RDF.py was doing acting the same.

I also tweaked the python tests in configure.ac to work with both 2.7 and 3.3

To get the patch I ran the RDF.py through 2to3 and then undid some of the
unicode -> str changes.

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-08-01 00:14 detrout        New Issue                                    
2013-08-01 00:14 detrout        File Added: python3_compat.patch                
   
======================================================================



More information about the redland-dev mailing list