Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] kvirc: add a patch for python3 support
@ 2022-03-01 13:26 paper42
  2022-03-03 19:20 ` [PR PATCH] [Merged]: " paper42
  0 siblings, 1 reply; 2+ messages in thread
From: paper42 @ 2022-03-01 13:26 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1229 bytes --]

There is a new pull request by paper42 against master on the void-packages repository

https://github.com/paper42/void-packages kvirc-py3
https://github.com/void-linux/void-packages/pull/35905

kvirc: add a patch for python3 support
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**

<!--
#### New package
- This new package conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration)
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!-- 
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/35905.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-kvirc-py3-35905.patch --]
[-- Type: text/x-diff, Size: 9977 bytes --]

From fa3b31054cde4a5ffe303a7f9b13206d0418daee Mon Sep 17 00:00:00 2001
From: Michal Vasilek <michal@vasilek.cz>
Date: Tue, 1 Mar 2022 14:21:58 +0100
Subject: [PATCH] kvirc: add a patch for python3 support

---
 srcpkgs/kvirc/patches/python3.patch | 239 ++++++++++++++++++++++++++++
 srcpkgs/kvirc/template              |   4 +-
 2 files changed, 241 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/kvirc/patches/python3.patch

diff --git a/srcpkgs/kvirc/patches/python3.patch b/srcpkgs/kvirc/patches/python3.patch
new file mode 100644
index 000000000000..b3aa3ee1951b
--- /dev/null
+++ b/srcpkgs/kvirc/patches/python3.patch
@@ -0,0 +1,239 @@
+From dbe8ef6dad916124c3714abc469403ed9991261c Mon Sep 17 00:00:00 2001
+From: wodim <neikokz@gmail.com>
+Date: Sat, 26 Aug 2017 15:02:56 +0200
+Subject: [PATCH 1/5] Add support for Python 3
+
+---
+ CMakeLists.txt                               |  7 ++----
+ src/modules/python/libkvipython.cpp          | 26 ++++++++++++++++++++
+ src/modules/pythoncore/kvircmodule.cpp       |  2 +-
+ src/modules/pythoncore/pythonheaderwrapper.h |  6 +++++
+ 4 files changed, 35 insertions(+), 6 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 96659b5c3..c3d103726 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -69,9 +69,6 @@ set(CMAKE_KVIRC_BUILD_CPU ${CMAKE_SYSTEM_PROCESSOR})
+ 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)"
+@@ -786,10 +783,10 @@ endif()
+ # 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()
+diff --git a/src/modules/python/libkvipython.cpp b/src/modules/python/libkvipython.cpp
+index 6bdd56a80..700e8939b 100644
+--- a/src/modules/python/libkvipython.cpp
++++ b/src/modules/python/libkvipython.cpp
+@@ -502,6 +502,31 @@ static bool python_kvs_fnc_isAvailable(KviKvsModuleFunctionCall * c)
+ 	return true;
+ }
+ 
++/*
++	@doc: python.version
++	@type:
++		function
++	@title:
++		$python.version
++	@short:
++		Check which version of Python is supported in this build of KVIrc
++	@syntax:
++		$python.version
++	@description:
++		Returns which major version of Python is KVIrc linked to ([b]2[/b] or [b]3[/b])
++		or [b]0[/b] if Python is not supported at all.
++*/
++
++static bool python_kvs_fnc_version(KviKvsModuleFunctionCall * c)
++{
++#ifdef COMPILE_PYTHON_SUPPORT
++	c->returnValue()->setInteger(PY_MAJOR_VERSION);
++#else
++	c->returnValue()->setBoolean(false);
++#endif
++	return true;
++}
++
+ static bool python_module_init(KviModule * m)
+ {
+ 	// register the command anyway
+@@ -509,6 +534,7 @@ static bool python_module_init(KviModule * m)
+ 	KVSM_REGISTER_SIMPLE_COMMAND(m, "destroy", python_kvs_cmd_destroy);
+ 
+ 	KVSM_REGISTER_FUNCTION(m, "isAvailable", python_kvs_fnc_isAvailable);
++	KVSM_REGISTER_FUNCTION(m, "version", python_kvs_fnc_version);
+ #ifdef COMPILE_PYTHON_SUPPORT
+ 	g_pPythonCoreModule = g_pModuleManager->getModule("pythoncore");
+ #endif
+diff --git a/src/modules/pythoncore/kvircmodule.cpp b/src/modules/pythoncore/kvircmodule.cpp
+index 8937b6a63..659345d7e 100644
+--- a/src/modules/pythoncore/kvircmodule.cpp
++++ b/src/modules/pythoncore/kvircmodule.cpp
+@@ -423,7 +423,7 @@ PyMODINIT_FUNC python_init()
+ 	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);
+ 	}
+diff --git a/src/modules/pythoncore/pythonheaderwrapper.h b/src/modules/pythoncore/pythonheaderwrapper.h
+index 47f60d361..2b34066c3 100644
+--- a/src/modules/pythoncore/pythonheaderwrapper.h
++++ b/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)
+
+From 77983c1ac38efa87a3c644b3918dd1648040aee0 Mon Sep 17 00:00:00 2001
+From: wodim <neikokz@gmail.com>
+Date: Mon, 1 Apr 2019 15:02:39 +0200
+Subject: [PATCH 2/5] This is not necessary anymore
+
+---
+ src/modules/python/libkvipython.cpp | 26 --------------------------
+ 1 file changed, 26 deletions(-)
+
+diff --git a/src/modules/python/libkvipython.cpp b/src/modules/python/libkvipython.cpp
+index 700e8939b..6bdd56a80 100644
+--- a/src/modules/python/libkvipython.cpp
++++ b/src/modules/python/libkvipython.cpp
+@@ -502,31 +502,6 @@ static bool python_kvs_fnc_isAvailable(KviKvsModuleFunctionCall * c)
+ 	return true;
+ }
+ 
+-/*
+-	@doc: python.version
+-	@type:
+-		function
+-	@title:
+-		$python.version
+-	@short:
+-		Check which version of Python is supported in this build of KVIrc
+-	@syntax:
+-		$python.version
+-	@description:
+-		Returns which major version of Python is KVIrc linked to ([b]2[/b] or [b]3[/b])
+-		or [b]0[/b] if Python is not supported at all.
+-*/
+-
+-static bool python_kvs_fnc_version(KviKvsModuleFunctionCall * c)
+-{
+-#ifdef COMPILE_PYTHON_SUPPORT
+-	c->returnValue()->setInteger(PY_MAJOR_VERSION);
+-#else
+-	c->returnValue()->setBoolean(false);
+-#endif
+-	return true;
+-}
+-
+ static bool python_module_init(KviModule * m)
+ {
+ 	// register the command anyway
+@@ -534,7 +509,6 @@ static bool python_module_init(KviModule * m)
+ 	KVSM_REGISTER_SIMPLE_COMMAND(m, "destroy", python_kvs_cmd_destroy);
+ 
+ 	KVSM_REGISTER_FUNCTION(m, "isAvailable", python_kvs_fnc_isAvailable);
+-	KVSM_REGISTER_FUNCTION(m, "version", python_kvs_fnc_version);
+ #ifdef COMPILE_PYTHON_SUPPORT
+ 	g_pPythonCoreModule = g_pModuleManager->getModule("pythoncore");
+ #endif
+
+From 2c881f711d518bbe4db95bf183ddc946c12f7751 Mon Sep 17 00:00:00 2001
+From: Alexey Sokolov <sokolov@google.com>
+Date: Sun, 29 Dec 2019 23:26:31 +0000
+Subject: [PATCH 3/5] Replace FindPythonLibs with FindPython3 in CMake
+
+---
+ CMakeLists.txt | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 385bbbd4d..e7fee2820 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -34,7 +34,7 @@
+ ###############################################################################
+ 
+ # Minimum CMake version
+-cmake_minimum_required(VERSION 3.1.0)
++cmake_minimum_required(VERSION 3.12)
+ 
+ # Name of the project
+ project(kvirc)
+@@ -748,12 +748,12 @@ endif()
+ # Check for Python support
+ option(WANT_PYTHON "Compile Python support" ON)
+ if(WANT_PYTHON)
+-	find_package(PythonLibs)
+-	if(PYTHONLIBS_FOUND)
++	find_package(Python3 COMPONENTS Development)
++	if(Python3_FOUND)
+ 		set(COMPILE_PYTHON_SUPPORT 1)
+-		set(CMAKE_STATUS_PYTHON_SUPPORT "Yes, Python ${PYTHONLIBS_VERSION_STRING}")
+-		list(APPEND LIBS ${PYTHON_LIBRARIES})
+-		include_directories(${PYTHON_INCLUDE_DIRS})
++		set(CMAKE_STATUS_PYTHON_SUPPORT "Yes, Python ${Python3_VERSION}")
++		list(APPEND LIBS ${Python3_LIBRARIES})
++		include_directories(${Python3_INCLUDE_DIRS})
+ 	else()
+ 		set(CMAKE_STATUS_PYTHON_SUPPORT "No, not found.")
+ 	endif()
+
+From 79dbba4260113b453fcea155881ecb4c6f82963b Mon Sep 17 00:00:00 2001
+From: Alexey Sokolov <sokolov@google.com>
+Date: Mon, 30 Dec 2019 07:32:51 +0000
+Subject: [PATCH 5/5] Stop unsetting _DEBUG when including Python.h
+
+Because of https://stackoverflow.com/questions/59126760/building-a-python-c-extension-on-windows-with-a-debug-python-installation
+---
+ src/modules/pythoncore/pythonheaderwrapper.h | 10 +---------
+ 1 file changed, 1 insertion(+), 9 deletions(-)
+
+diff --git a/src/modules/pythoncore/pythonheaderwrapper.h b/src/modules/pythoncore/pythonheaderwrapper.h
+index 2b34066c3..173e3c289 100644
+--- a/src/modules/pythoncore/pythonheaderwrapper.h
++++ b/src/modules/pythoncore/pythonheaderwrapper.h
+@@ -7,14 +7,6 @@
+ // 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)
+-# undef _DEBUG
+-# include <Python.h>
+-# define _DEBUG 1
+-#else
+-# include <Python.h>
+-#endif
++#include <Python.h>
+ 
+ #endif
diff --git a/srcpkgs/kvirc/template b/srcpkgs/kvirc/template
index 77042b4970b9..29cdda4153ff 100644
--- a/srcpkgs/kvirc/template
+++ b/srcpkgs/kvirc/template
@@ -1,12 +1,12 @@
 # Template file for 'kvirc'
 pkgname=kvirc
 version=5.0.0
-revision=8
+revision=9
 wrksrc="KVIrc-$version"
 build_style=cmake
 configure_args="-DWANT_ENV_FLAGS=1 -DWANT_KDE=0"
 hostmakedepends="perl"
-makedepends="zlib-devel qt5-devel qt5-webkit-devel openssl-devel python-devel perl
+makedepends="zlib-devel qt5-devel qt5-webkit-devel openssl-devel python3-devel perl
 qt5-multimedia-devel qt5-plugin-mysql qt5-plugin-odbc qt5-plugin-pgsql
 qt5-plugin-sqlite qt5-plugin-tds"
 short_desc="Qt-based IRC client"

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PR PATCH] [Merged]: kvirc: add a patch for python3 support
  2022-03-01 13:26 [PR PATCH] kvirc: add a patch for python3 support paper42
@ 2022-03-03 19:20 ` paper42
  0 siblings, 0 replies; 2+ messages in thread
From: paper42 @ 2022-03-03 19:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1076 bytes --]

There's a merged pull request on the void-packages repository

kvirc: add a patch for python3 support
https://github.com/void-linux/void-packages/pull/35905

Description:
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**

<!--
#### New package
- This new package conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please [skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration)
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!-- 
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-03 19:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-01 13:26 [PR PATCH] kvirc: add a patch for python3 support paper42
2022-03-03 19:20 ` [PR PATCH] [Merged]: " paper42

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).