Bug 1115489 - Please port unbound to Python 3
Summary: Please port unbound to Python 3
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: unbound
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Pavel Šimerda (pavlix)
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1173867 (view as bug list)
Depends On: 1144112
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-07-02 12:55 UTC by Bohuslav "Slavek" Kabrda
Modified: 2015-01-19 12:02 UTC (History)
5 users (show)

Fixed In Version: unbound-1.4.22-6.fc22
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-09-25 08:56:22 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
handle python 3.x in configure (15.06 KB, patch)
2014-09-16 14:30 UTC, Pavel Šimerda (pavlix)
no flags Details | Diff
use Python 2.x/3.x C API correctly (2.69 KB, text/plain)
2014-09-16 15:38 UTC, Pavel Šimerda (pavlix)
no flags Details
fedora dist-git patch to build against python3 (10.93 KB, patch)
2014-09-18 17:14 UTC, Pavel Šimerda (pavlix)
no flags Details | Diff
fedora dist-git patch to build against python3 (11.04 KB, patch)
2014-09-19 09:42 UTC, Pavel Šimerda (pavlix)
no flags Details | Diff

Description Bohuslav "Slavek" Kabrda 2014-07-02 12:55:43 UTC
Hi, since the "Python 3 as a Default" change [1] has been accepted and Fedora 22 is slowly approaching, I'd like to ask you to port unbound to Python 3.
The guidelines are pretty simple ATM - if it makes sense to provide bindings to both Python 2 and Python 3 at the same time, you can add python3- subpackage already. If the package is more of an "application" than "library" and it only makes sense for it to compile/run with one Python release, please make sure that it's Python 3 compatible and keep building it with Python 2 at least until Fedora 21 is branched and then switch. Thanks!

[1] https://fedoraproject.org/wiki/Changes/Python_3_as_Default

Comment 1 Pavel Šimerda (pavlix) 2014-09-11 15:40:51 UTC
Started working on this. After first steps, it looks like unbound supports some sort of python plugins plus there's a pythonic API for libunbound. More details coming soon. The configure script fails badly with Python 3.x, so we'll see what can be done.

Comment 2 Pavel Šimerda (pavlix) 2014-09-16 14:30:43 UTC
Created attachment 938042 [details]
handle python 3.x in configure

Comment 3 Pavel Šimerda (pavlix) 2014-09-16 15:38:30 UTC
Created attachment 938094 [details]
use Python 2.x/3.x C API correctly

Comment 4 Pavel Šimerda (pavlix) 2014-09-18 17:14:33 UTC
Created attachment 938995 [details]
fedora dist-git patch to build against python3

The former two patches were both accepted upstream. Replacing with a patch for dist-git. Not pushing yet, as it won't build against the current python3 package, let's see what python3 maintainer can say about this.

Comment 5 Pavel Šimerda (pavlix) 2014-09-19 08:01:53 UTC
As you replied to the blocker, we can move forward and see all the stuff that's wrong with:

http://unbound.nlnetlabs.nl/svn/trunk/acx_python.m4

Comment 6 Bohuslav "Slavek" Kabrda 2014-09-19 08:18:43 UTC
(In reply to Pavel Šimerda (pavlix) from comment #5)
> As you replied to the blocker, we can move forward and see all the stuff
> that's wrong with:
> 
> http://unbound.nlnetlabs.nl/svn/trunk/acx_python.m4

There is one problem that I can see:
Using "print(conf('LOCALMODLIBS'), conf('LIBS'))" in Python 2 prints:

('', '-lpthread -ldl  -lutil')

and in Python 3 it (correctly) prints:

 -lpthread -ldl  -lutil

You should put "from __future__ import print_function" in the beginning of every python invocation that uses print() to print multiple values in order to make this run properly on Python 2.6 and 2.7.

Otherwise it looks fine to me.

Comment 7 Pavel Šimerda (pavlix) 2014-09-19 09:42:52 UTC
Created attachment 939159 [details]
fedora dist-git patch to build against python3

Updated the patch to get over the py3 library path issue.

Comment 8 Pavel Šimerda (pavlix) 2014-09-19 10:02:50 UTC
Scratch build:

http://koji.fedoraproject.org/koji/taskinfo?taskID=7628455

Comment 9 Pavel Šimerda (pavlix) 2014-09-25 08:56:22 UTC
Fixed also the swig templates and examples, almost all of them work, there's still a swig issue of not accepting a file for logging in python 3.x but that seems to be independent of unbound.

All patches were accepted upstream and propagated to Fedora using the following command:

git diff 25746188a0a207d57bd245a6bcc461e3bcd199e2..890249811e656c612100bce0f3907927e6044778 -- acx_python.m4 configure.ac libunbound/python pythonmod > ~/fedora/unbound/unbound-1.4.22-python3.patch

http://koji.fedoraproject.org/koji/buildinfo?buildID=580571

Comment 10 Pavel Šimerda (pavlix) 2015-01-19 12:02:25 UTC
*** Bug 1173867 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.