Bug 310220 - pate doesn't build
Summary: pate doesn't build
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: application (show other bugs)
Version: Git
Platform: Compiled Sources Linux
: NOR major
Target Milestone: ---
Assignee: Shaheed Haque
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-16 17:26 UTC by Andrea Scarpino
Modified: 2012-11-18 22:46 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrea Scarpino 2012-11-16 17:26:43 UTC
I'm building kate from the 4.10beta1 tarball, and the build fails with:

[ 93%] Building CXX object kate/plugins/pate/src/CMakeFiles/pateplugin.dir/plugin.o
In file included from /usr/include/python3.3m/pytime.h:6:0,
                 from /usr/include/python3.3m/Python.h:65,
                 from /build/src/kate-4.9.80/kate/plugins/pate/src/plugin.h:32,
                 from /build/src/kate-4.9.80/kate/plugins/pate/src/plugin.cpp:21:
/usr/include/python3.3m/object.h:432:23: error: expected unqualified-id before ‘;’ token
/build/src/kate-4.9.80/kate/plugins/pate/src/plugin.cpp: In member function ‘virtual QString Pate::Plugin::configPageName(uint) const’:
/build/src/kate-4.9.80/kate/plugins/pate/src/plugin.cpp:200:34: error: ‘PyString_AsString’ was not declared in this scope
/build/src/kate-4.9.80/kate/plugins/pate/src/plugin.cpp: In member function ‘virtual QString Pate::Plugin::configPageFullName(uint) const’:
/build/src/kate-4.9.80/kate/plugins/pate/src/plugin.cpp:216:38: error: ‘PyString_AsString’ was not declared in this scope
/build/src/kate-4.9.80/kate/plugins/pate/src/plugin.cpp: In member function ‘void Pate::ConfigPage::infoTopicChanged(int)’:
/build/src/kate-4.9.80/kate/plugins/pate/src/plugin.cpp:356:67: error: ‘PyString_AsString’ was not declared in this scope
/build/src/kate-4.9.80/kate/plugins/pate/src/plugin.cpp:373:71: error: ‘PyString_AsString’ was not declared in this scope
/build/src/kate-4.9.80/kate/plugins/pate/src/plugin.cpp: In member function ‘void Pate::ConfigPage::infoPluginActionsChanged(int)’:
/build/src/kate-4.9.80/kate/plugins/pate/src/plugin.cpp:402:48: error: ‘PyString_AsString’ was not declared in this scope
/build/src/kate-4.9.80/kate/plugins/pate/src/plugin.cpp:405:35: error: ‘PyString_Check’ was not declared in this scope
/build/src/kate-4.9.80/kate/plugins/pate/src/plugin.cpp:408:72: error: ‘PyCObject_AsVoidPtr’ was not declared in this scope
/build/src/kate-4.9.80/kate/plugins/pate/src/plugin.cpp: In member function ‘void Pate::ConfigPage::infoPluginConfigPagesChanged(int)’:
/build/src/kate-4.9.80/kate/plugins/pate/src/plugin.cpp:435:48: error: ‘PyString_AsString’ was not declared in this scope
/build/src/kate-4.9.80/kate/plugins/pate/src/plugin.cpp:439:35: error: ‘PyString_Check’ was not declared in this scope
/build/src/kate-4.9.80/kate/plugins/pate/src/plugin.cpp: In member function ‘virtual QString Pate::Plugin::configPageFullName(uint) const’:
/build/src/kate-4.9.80/kate/plugins/pate/src/plugin.cpp:217:1: error: control reaches end of non-void function [-Werror=return-type]
/build/src/kate-4.9.80/kate/plugins/pate/src/plugin.cpp: In member function ‘virtual QString Pate::Plugin::configPageName(uint) const’:
/build/src/kate-4.9.80/kate/plugins/pate/src/plugin.cpp:201:1: error: control reaches end of non-void function [-Werror=return-type]
cc1plus: some warnings being treated as errors
make[2]: *** [kate/plugins/pate/src/CMakeFiles/pateplugin.dir/plugin.o] Error 1
make[1]: *** [kate/plugins/pate/src/CMakeFiles/pateplugin.dir/all] Error 2
make: *** [all] Error 2

KDE 4.9.80
PyQt 4.9.5
Python 3.3.0
Comment 1 Christoph Cullmann 2012-11-16 22:09:57 UTC
Justed compiled it here, seems to work. Problem with Python 2.x vs. 3.x?
Comment 2 Shaheed Haque 2012-11-17 11:37:22 UTC
(In reply to comment #1)
> Justed compiled it here, seems to work. Problem with Python 2.x vs. 3.x?

It does indeed seem to be a Python 3 issue. Not being an expert, I did a bit of Gooling and it seems that Python 3 support is still immature, so I am seeking advice on whether there is a reasonable way for me to proceed, or whether this just has to wait. (I cannot remove Python2 from my systems without major breakage it seems).

Andrea, do you have the Python 2 development libraries installed? Or is there some reason you *must* have Python3?
Comment 3 Andrea Scarpino 2012-11-17 12:02:39 UTC
I didn't know this was supposed to don't work with Py3.

Builds fine with -DPYTHON_EXECUTABLE=/usr/bin/python2
Comment 4 Shaheed Haque 2012-11-17 12:05:21 UTC
I have the impression that Python3 support generally, across the
Python world is coming, but not yet common by any means. For example,
the KDE build system is being updated to support it. One there is a
bit more infrastructure in place, I hope to support it.

On 17 November 2012 12:02, Andrea Scarpino <andrea@archlinux.org> wrote:
> https://bugs.kde.org/show_bug.cgi?id=310220
>
> --- Comment #3 from Andrea Scarpino <andrea@archlinux.org> ---
> I didn't know this was supposed to don't work with Py3.
>
> Builds fine with -DPYTHON_EXECUTABLE=/usr/bin/python2
>
> --
> You are receiving this mail because:
> You are the assignee for the bug.
Comment 5 Luca Beltrame 2012-11-17 13:09:27 UTC
It looks to me as a clash between "slots" as defined in Python 3's object.h and the "slots" used in plugin.h. Does it work if instead of "slots" the Q_SLOTS macro is used?
Comment 6 Luca Beltrame 2012-11-17 15:16:38 UTC
I found the actual error. The functions used are renamed in python3 (from PyString to PyBytes), so it will need some adjustments (and probably #ifdef'ing).
Comment 7 Luca Beltrame 2012-11-17 15:25:17 UTC
FYI, patch in progress. I should be done before the end of the weekend, I hope.
Comment 8 Luca Beltrame 2012-11-18 08:26:18 UTC
Patch is up for review: https://git.reviewboard.kde.org/r/107362/ - notice that I only tested compile time.
Comment 9 Shaheed Haque 2012-11-18 21:23:17 UTC
Thanks Luca...see review. Commit and I'll make sure it works etc. and
refactor the C++ aspects.

On 18 November 2012 08:26, Luca Beltrame <lbeltrame@kde.org> wrote:
> https://bugs.kde.org/show_bug.cgi?id=310220
>
> --- Comment #8 from Luca Beltrame <lbeltrame@kde.org> ---
> Patch is up for review: https://git.reviewboard.kde.org/r/107362/ - notice that
> I only tested compile time.
>
> --
> You are receiving this mail because:
> You are the assignee for the bug.
Comment 10 Luca Beltrame 2012-11-18 22:46:17 UTC
Git commit 9b937109adb858100f8021bc8849ed57ccc645ad by Luca Beltrame.
Committed on 18/11/2012 at 23:43.
Pushed by lbeltrame into branch 'master'.

Fix building Pate with Python 3.

Python's C API changed a lot between version 2 and 3, and in particular
Python 3.2 removed a lot of the old CObject API. At the moment
simultaneous compatibility is achieved by a series of #if blocks,
possibly some refactoring is in order.

Pate builds with both Python 2 and Python 3 now.
REVIEW: 107362

M  +21   -1    kate/plugins/pate/src/engine.cpp
M  +45   -0    kate/plugins/pate/src/plugin.cpp
M  +3    -2    kate/plugins/pate/src/plugin.h
M  +32   -0    kate/plugins/pate/src/utilities.cpp

http://commits.kde.org/kate/9b937109adb858100f8021bc8849ed57ccc645ad