net-irc/kvirc: Support Python 3.
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Thu, 15 Aug 2019 19:19:58 +0000 (19:19 +0000)
committerMike Gilbert <floppym@gentoo.org>
Fri, 16 Aug 2019 17:02:29 +0000 (13:02 -0400)
Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
net-irc/kvirc/files/kvirc-5.2_pre20190628041642-python-3.patch [new file with mode: 0644]
net-irc/kvirc/kvirc-5.2_pre20190628041642.ebuild
net-irc/kvirc/kvirc-9999.ebuild

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 (file)
index 0000000..14e9e6f
--- /dev/null
@@ -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)
index 9b9efe89389c97a906000e4ee896464e1cec37d3..7e84f4e5ca9b35455201f74588621dce79b8a68e 100644 (file)
@@ -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() {
index 3e4e206a18d64566f2befc8ac382025e534bf233..46a0772c275885647ca5988c347e8ea58f84f27f 100644 (file)
@@ -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() {