Bug 1115489

Summary: Please port unbound to Python 3
Product: [Fedora] Fedora Reporter: Bohuslav "Slavek" Kabrda <bkabrda>
Component: unboundAssignee: Pavel Šimerda (pavlix) <psimerda>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: rawhideCC: fedora, psimerda, pwouters, thozza, vonsch
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: unbound-1.4.22-6.fc22 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-25 08:56:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 1144112    
Bug Blocks:    
Description Flags
handle python 3.x in configure
use Python 2.x/3.x C API correctly
fedora dist-git patch to build against python3
fedora dist-git patch to build against python3 none

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:


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:


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


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