commit:     1538263608179c516b9f6f1347538dedaf181a16
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Thu Aug 15 19:19:58 2019 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Fri Aug 16 17:02:29 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=15382636

net-irc/kvirc: Support Python 3.

Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache.Org>
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 .../kvirc-5.2_pre20190628041642-python-3.patch     | 53 ++++++++++++++++++++++
 net-irc/kvirc/kvirc-5.2_pre20190628041642.ebuild   |  6 ++-
 net-irc/kvirc/kvirc-9999.ebuild                    |  6 ++-
 3 files changed, 63 insertions(+), 2 deletions(-)

diff --git a/net-irc/kvirc/files/kvirc-5.2_pre20190628041642-python-3.patch 
b/net-irc/kvirc/files/kvirc-5.2_pre20190628041642-python-3.patch
new file mode 100644
index 00000000000..14e9e6f795c
--- /dev/null
+++ b/net-irc/kvirc/files/kvirc-5.2_pre20190628041642-python-3.patch
@@ -0,0 +1,53 @@
+https://github.com/kvirc/KVIrc/pull/2269
+
+--- /CMakeLists.txt
++++ /CMakeLists.txt
+@@ -67,9 +67,6 @@
+ set(CMAKE_KVIRC_BUILD_COMPILER ${CMAKE_CXX_COMPILER})
+ set(CMAKE_KVIRC_BUILD_COMPILER_FLAGS ${CMAKE_CXX_FLAGS})
+ 
+-# Prefer Python 2.7 over 3.x (which is currently incompatible) - GitHub issue 
#2020
+-set(Python_ADDITIONAL_VERSIONS "2.7")
+-
+ # Suffix for GNU/Linux
+ set(LIB_SUFFIX
+       CACHE STRING "Define suffix of directory name (32/64)"
+@@ -751,10 +748,10 @@
+ # Check for Python support
+ option(WANT_PYTHON "Compile Python support" ON)
+ if(WANT_PYTHON)
+-      find_package(PythonLibs 2.7)
++      find_package(PythonLibs)
+       if(PYTHONLIBS_FOUND)
+               set(COMPILE_PYTHON_SUPPORT 1)
+-              set(CMAKE_STATUS_PYTHON_SUPPORT "Yes")
++              set(CMAKE_STATUS_PYTHON_SUPPORT "Yes, Python 
${PYTHONLIBS_VERSION_STRING}")
+               list(APPEND LIBS ${PYTHON_LIBRARIES})
+               include_directories(${PYTHON_INCLUDE_DIRS})
+       else()
+--- /src/modules/pythoncore/kvircmodule.cpp
++++ /src/modules/pythoncore/kvircmodule.cpp
+@@ -413,7 +413,7 @@
+       else
+       {
+               // Create a CObject containing the API pointer array's address
+-              PyObject * pC_API_Object = PyCObject_FromVoidPtr(PyKVIrc_API, 
nullptr);
++              PyObject * pC_API_Object = PyCapsule_New((void *)PyKVIrc_API, 
"kvirc._C_API", nullptr);
+               if(pC_API_Object)
+                       PyModule_AddObject(pModule, "_C_API", pC_API_Object);
+       }
+--- /src/modules/pythoncore/pythonheaderwrapper.h
++++ /src/modules/pythoncore/pythonheaderwrapper.h
+@@ -1,6 +1,12 @@
+ #ifndef _PYTHONHEADERWRAPPER_H_
+ #define _PYTHONHEADERWRAPPER_H_
+ 
++// As of Python 3, something inside <Python.h> defines a struct with a member
++// called "slots" which conflicts with the builtin Qt keyword. But since we
++// include stuff from KVIrc itself back into the python module, we can't just
++// use QT_NO_KEYWORDS.
++#undef slots
++
+ // See 
http://stackoverflow.com/questions/16200997/why-doesnt-include-python-h-work 
and 
http://stackoverflow.com/questions/19716859/puzzling-dependency-of-boost-python-1-54-debug-build-to-python27-lib-on-window
+ 
+ #if defined(_DEBUG) && defined(_MSC_VER)

diff --git a/net-irc/kvirc/kvirc-5.2_pre20190628041642.ebuild 
b/net-irc/kvirc/kvirc-5.2_pre20190628041642.ebuild
index 9b9efe89389..7e84f4e5ca9 100644
--- a/net-irc/kvirc/kvirc-5.2_pre20190628041642.ebuild
+++ b/net-irc/kvirc/kvirc-5.2_pre20190628041642.ebuild
@@ -3,7 +3,7 @@
 
 EAPI="7"
 CMAKE_MAKEFILE_GENERATOR="emake"
-PYTHON_COMPAT=(python2_7)
+PYTHON_COMPAT=(python{2_7,3_6,3_7})
 
 inherit cmake-utils flag-o-matic python-single-r1 xdg-utils
 
@@ -79,6 +79,10 @@ if [[ "${PV}" != "9999" ]]; then
        S="${WORKDIR}/KVIrc-${KVIRC_GIT_REVISION}"
 fi
 
+PATCHES=(
+       "${FILESDIR}/${PN}-5.2_pre20190628041642-python-3.patch"
+)
+
 DOCS=()
 
 pkg_setup() {

diff --git a/net-irc/kvirc/kvirc-9999.ebuild b/net-irc/kvirc/kvirc-9999.ebuild
index 3e4e206a18d..46a0772c275 100644
--- a/net-irc/kvirc/kvirc-9999.ebuild
+++ b/net-irc/kvirc/kvirc-9999.ebuild
@@ -3,7 +3,7 @@
 
 EAPI="7"
 CMAKE_MAKEFILE_GENERATOR="emake"
-PYTHON_COMPAT=(python2_7)
+PYTHON_COMPAT=(python{2_7,3_6,3_7})
 
 inherit cmake-utils flag-o-matic python-single-r1 xdg-utils
 
@@ -79,6 +79,10 @@ if [[ "${PV}" != "9999" ]]; then
        S="${WORKDIR}/KVIrc-${KVIRC_GIT_REVISION}"
 fi
 
+PATCHES=(
+       "${FILESDIR}/${PN}-5.2_pre20190628041642-python-3.patch"
+)
+
 DOCS=()
 
 pkg_setup() {

Reply via email to