TelepathyIM / telepathy-qt

Telepathy Qt bindings
https://telepathy.freedesktop.org
GNU Lesser General Public License v2.1
25 stars 14 forks source link

Port to Python3 #29

Closed a-andreyev closed 5 years ago

a-andreyev commented 5 years ago

Fixes #28. Initial move with 2to3, manual changes with package and dependent packages rebuilding check.

Kaffeine commented 5 years ago

Mostly a note for myself

In this configuration CMake unable to find python-3 on my system. find_package(PythonInterp ${REQUIRED_PY} REQUIRED) finds python 3 correctly, but I'm not sure if it is a correct replacement. The project compiles on works correctly.

a-andreyev commented 5 years ago

Proposing to add both PythonLibrary and PythonInterp, checked with my configuration, seems ok. (Have problems with PYTHON_SHORT_VERSION variable without PythonLibrary req)

Kaffeine commented 5 years ago

https://cmake.org/cmake/help/latest/module/FindPythonInterp.html says: Deprecated since version 3.12: Use FindPython3, FindPython2 or FindPython instead.

https://cmake.org/cmake/help/latest/module/FindPython.html says: This module looks preferably for version 3 of Python. If not found, version 2 is searched. To manage concurrent versions 3 and 2 of Python, use FindPython3 and FindPython2 modules rather than this one.

It seems that we need to use FindPython3 to ensure the correct python version.

Kaffeine commented 5 years ago

I just verified that the generated code is almost identical to the python2 version. The only diff is in headers:

+<?xml version="1.0" ?><tp:spec ...>
-<?xml version="1.0" encoding="utf-8"?><tp:spec ...>

that is hundred percent fine :+1:

a-andreyev commented 5 years ago

thanks! checked with FindPython3, working for me, updated the commit

Kaffeine commented 5 years ago

Guess what? https://github.com/TelepathyIM/telepathy-glib/commit/ff1eea1e3abdc78665bb8b72c65bb19c8b1084b3#diff-ff4e2dc4962dc25a1512353299992c8dR9 :open_mouth:

While verifying the python3 port I found that we didn't (ever?) build with glib tests support. I think that in the long term we'll drop glib stuff from telepathy-qt (AFAIU it is used for service side because telepathy-qt had no service side API). However, I would like to keep it working as much as possible for the next release. I updated tools from telepathy-glib (hey, we even have a cmake target for that!) and now we need to rebase your PR with the follow little adjustments:

I think that the code should look like this one (this is what I tested):

 # Find python version >= 3
find_package(Python3 REQUIRED)

set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})

 # Check for dbus-python