Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package texworks for openSUSE:Factory checked in at 2024-02-16 21:42:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/texworks (Old) and /work/SRC/openSUSE:Factory/.texworks.new.1815 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "texworks" Fri Feb 16 21:42:48 2024 rev:29 rq:1147083 version:0.6.9 Changes: -------- --- /work/SRC/openSUSE:Factory/texworks/texworks.changes 2024-02-13 22:43:58.447711354 +0100 +++ /work/SRC/openSUSE:Factory/.texworks.new.1815/texworks.changes 2024-02-16 21:42:53.702867963 +0100 @@ -1,0 +2,13 @@ +Thu Feb 15 19:27:12 UTC 2024 - Atri Bhattacharya <[email protected]> + +- Add texworks-python-plugin-buildfix.patch to fix building python + scripting plugin (gh#TeXworks/texworks#1038); patch taken from + upstream commit. +- Refresh texworks-cmake-find-python.patch with version committed + upstream. +- Enable python scripting plugin; Requires at least Python 3.8, + disable plugin for openSUSE < 1650. +- Require gcc9 for openSUSE < 1650 as GCC >= 8 is required by Lua + scripting plugin for filesystem support. + +------------------------------------------------------------------- New: ---- texworks-python-plugin-buildfix.patch BETA DEBUG BEGIN: New: - Add texworks-python-plugin-buildfix.patch to fix building python scripting plugin (gh#TeXworks/texworks#1038); patch taken from BETA DEBUG END: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ texworks.spec ++++++ --- /var/tmp/diff_new_pack.0OWb1J/_old 2024-02-16 21:42:54.258888025 +0100 +++ /var/tmp/diff_new_pack.0OWb1J/_new 2024-02-16 21:42:54.262888170 +0100 @@ -18,7 +18,14 @@ %define __builder ninja +%if 0%{?suse_version} < 1650 +# Lua plugin requires GCC >= 8 for filesystem support +%define gcc_ver 9 +# Python plugin requires Python >= 3.8 %bcond_with python +%else +%bcond_without python +%endif Name: texworks Version: 0.6.9 Release: 0 @@ -28,10 +35,13 @@ URL: https://www.tug.org/texworks/ Source0: https://github.com/TeXworks/texworks/archive/release-%{version}.tar.gz#/%{name}-%{version}.tar.gz # PATCH-FIX-UPSTREAM texworks-cmake-find-python.patch gh#TeXworks/texworks#1039 [email protected] -- cmake has dropped support for PythonInterp and PythonLibs, use FindPython instead -Patch0: texworks-cmake-find-python.patch +Patch0: https://github.com/TeXworks/texworks/commit/dae1586af7a218e9bbe9ce3031a97e8efcac980a.patch#/texworks-cmake-find-python.patch +# PATCH-FIX-UPSTREAM texworks-python-plugin-buildfix.patch gh#/TeXworks/texworks#1038 [email protected] -- Fix building the python scripting plugin +Patch1: https://github.com/TeXworks/texworks/commit/f8962bca2db2cae3183cad201a4726e7726caccb.patch#/texworks-python-plugin-buildfix.patch BuildRequires: cmake BuildRequires: dbus-1-devel BuildRequires: desktop-file-utils +BuildRequires: gcc%{?gcc_ver}-c++ BuildRequires: hicolor-icon-theme BuildRequires: hunspell-devel BuildRequires: libpoppler-devel >= 0.24 @@ -93,7 +103,8 @@ %autosetup -p1 -n texworks-release-%{version} %build -%cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} \ +%cmake -DCMAKE_CXX_COMPILER=g++%{?gcc_ver:-%{gcc_ver}} \ + -DCMAKE_INSTALL_PREFIX=%{_prefix} \ -DTW_BUILD_ID="openSUSE" \ -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=%{_lib} \ -DQT_DEFAULT_MAJOR_VERSION=6 \ ++++++ texworks-cmake-find-python.patch ++++++ --- /var/tmp/diff_new_pack.0OWb1J/_old 2024-02-16 21:42:54.282888891 +0100 +++ /var/tmp/diff_new_pack.0OWb1J/_new 2024-02-16 21:42:54.282888891 +0100 @@ -1,8 +1,19 @@ -Index: texworks-release-0.6.9/CMakeLists.txt -=================================================================== ---- texworks-release-0.6.9.orig/CMakeLists.txt -+++ texworks-release-0.6.9/CMakeLists.txt -@@ -326,17 +326,14 @@ ENDIF() +From dae1586af7a218e9bbe9ce3031a97e8efcac980a Mon Sep 17 00:00:00 2001 +From: Atri Bhattacharya <[email protected]> +Date: Thu, 15 Feb 2024 20:03:50 +0100 +Subject: [PATCH] Fix finding Python with CMake >= 3.27 (fixes #1039) + +--- + CMakeLists.txt | 38 ++++++++++++++--------- + plugins-src/TWPythonPlugin/CMakeLists.txt | 4 +-- + src/CMakeLists.txt | 4 +-- + 3 files changed, 28 insertions(+), 18 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f245e5192..9682c3933 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -326,17 +326,27 @@ ENDIF() IF ( WITH_PYTHON ) IF ( USE_SYSTEM_PYTHON ) @@ -23,11 +34,24 @@ - # In order to find the correct version of 'PythonInterp', we need to set 'PYTHONHOME' environment variable - FIND_PACKAGE(PythonInterp) - FIND_PACKAGE(PythonLibs) -+ FIND_PACKAGE(Python COMPONENTS Interpreter Development) ++ IF (CMAKE_VERSION VERSION_LESS "3.12") ++ # **NOTE** ++ # In order to find the correct version of 'PythonLibs', it seems that we need to run 'FIND_PACKAGE(PythonInterp)' firstly. ++ # In order to find the correct version of 'PythonInterp', we need to set 'PYTHONHOME' environment variable ++ FIND_PACKAGE(PythonInterp) ++ FIND_PACKAGE(PythonLibs) ++ SET(Python_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS}) ++ SET(Python_LIBRARIES ${PYTHON_LIBRARIES}) ++ SET(Python_VERSION ${PYTHON_VERSION_STRING}) ++ SET(Python_Interpreter_FOUND ${PYTHONINTERP_FOUND}) ++ SET(Python_Development_FOUND ${PYTHONLIBS_FOUND}) ++ ELSE () ++ FIND_PACKAGE(Python COMPONENTS Interpreter Development) ++ ENDIF () ENDIF () ENDIF() -@@ -344,7 +341,7 @@ IF ( LUA_FOUND AND WITH_LUA AND NOT ${BU +@@ -344,7 +354,7 @@ IF ( LUA_FOUND AND WITH_LUA AND NOT ${BUILD_SHARED_PLUGINS}) ADD_DEFINITIONS(-DQT_STATICPLUGIN -DSTATIC_LUA_SCRIPTING_PLUGIN) ENDIF () @@ -36,7 +60,7 @@ ADD_DEFINITIONS(-DQT_STATICPLUGIN -DSTATIC_PYTHON_SCRIPTING_PLUGIN) ENDIF () -@@ -406,7 +403,7 @@ IF ( LUA_FOUND AND WITH_LUA ) +@@ -406,7 +416,7 @@ IF ( LUA_FOUND AND WITH_LUA ) ADD_SUBDIRECTORY(${TeXworks_SOURCE_DIR}/plugins-src/TWLuaPlugin) ENDIF () @@ -45,7 +69,7 @@ ADD_SUBDIRECTORY(${TeXworks_SOURCE_DIR}/plugins-src/TWPythonPlugin) ENDIF () -@@ -509,7 +506,7 @@ IF ( WITH_LUA ) +@@ -509,7 +519,7 @@ IF ( WITH_LUA ) CONFIG_VERSION("Lua" "${LUA_VERSION_STRING}") ENDIF() if (WITH_PYTHON) @@ -54,7 +78,7 @@ endif() CONFIG_VERSION("Qt" ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}) CONFIG_VERSION("SyncTeX" "${SYNCTEX_VERSION_STRING}") -@@ -520,7 +517,7 @@ message(" Scripting") +@@ -520,7 +530,7 @@ message(" Scripting") CONFIG_YESNO(" ECMA scripting" ON) CONFIG_YESNO(" QtScript scripting" WITH_QTSCRIPT) CONFIG_YESNO(" Lua scripting plugin" LUA_FOUND) @@ -63,10 +87,10 @@ message("") CONFIG_INFO("Build ID" ${TW_BUILD_ID}) -Index: texworks-release-0.6.9/plugins-src/TWPythonPlugin/CMakeLists.txt -=================================================================== ---- texworks-release-0.6.9.orig/plugins-src/TWPythonPlugin/CMakeLists.txt -+++ texworks-release-0.6.9/plugins-src/TWPythonPlugin/CMakeLists.txt +diff --git a/plugins-src/TWPythonPlugin/CMakeLists.txt b/plugins-src/TWPythonPlugin/CMakeLists.txt +index 255937f17..6d99c5a68 100644 +--- a/plugins-src/TWPythonPlugin/CMakeLists.txt ++++ b/plugins-src/TWPythonPlugin/CMakeLists.txt @@ -37,13 +37,13 @@ if (NOT MSVC) target_compile_options(TWPythonPlugin PRIVATE -Wno-old-style-cast) endif () @@ -83,10 +107,10 @@ IF (${BUILD_SHARED_PLUGINS}) INSTALL(TARGETS TWPythonPlugin LIBRARY DESTINATION ${TeXworks_PLUGIN_DIR} -Index: texworks-release-0.6.9/src/CMakeLists.txt -=================================================================== ---- texworks-release-0.6.9.orig/src/CMakeLists.txt -+++ texworks-release-0.6.9/src/CMakeLists.txt +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index ba2f40351..3f91ab887 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt @@ -207,8 +207,8 @@ IF (NOT ${BUILD_SHARED_PLUGINS}) IF (WITH_LUA AND LUA_FOUND) LIST(INSERT TeXworks_LIBS 0 TWLuaPlugin ${LUA_LIBRARIES}) ++++++ texworks-python-plugin-buildfix.patch ++++++ >From f8962bca2db2cae3183cad201a4726e7726caccb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20L=C3=B6ffler?= <[email protected]> Date: Thu, 15 Feb 2024 20:05:39 +0100 Subject: [PATCH] Fix building the python scripting plugin (fixes #1038) --- plugins-src/TWPythonPlugin/PythonScript.cpp | 31 +++++++++++++-------- plugins-src/TWPythonPlugin/PythonScript.h | 4 ++- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/plugins-src/TWPythonPlugin/PythonScript.cpp b/plugins-src/TWPythonPlugin/PythonScript.cpp index 752783b60..5c218e66e 100644 --- a/plugins-src/TWPythonPlugin/PythonScript.cpp +++ b/plugins-src/TWPythonPlugin/PythonScript.cpp @@ -21,6 +21,9 @@ #include "PythonScript.h" +// https://docs.python.org/3/c-api/arg.html#strings-and-buffers +#define PY_SSIZE_T_CLEAN + // Python uses the name "slots", which Qt hijacks. So we temporarily undefine // it, then include the python headers, then redefine it #undef slots @@ -376,22 +379,26 @@ PyObject * PythonScript::VariantToPython(const QVariant & v) { if (v.isNull()) Py_RETURN_NONE; +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) switch (static_cast<int>(v.type())) { - case QVariant::Double: +#else + switch (v.metaType().id()) { +#endif + case QMetaType::Double: return Py_BuildValue("d", v.toDouble()); - case QVariant::Bool: + case QMetaType::Bool: if (v.toBool()) Py_RETURN_TRUE; else Py_RETURN_FALSE; - case QVariant::Int: + case QMetaType::Int: return Py_BuildValue("i", v.toInt()); - case QVariant::LongLong: + case QMetaType::LongLong: return Py_BuildValue("L", v.toLongLong()); - case QVariant::UInt: + case QMetaType::UInt: return Py_BuildValue("I", v.toUInt()); - case QVariant::ULongLong: + case QMetaType::ULongLong: return Py_BuildValue("K", v.toULongLong()); - case QVariant::Char: - case QVariant::String: + case QMetaType::Char: + case QMetaType::QString: #ifdef Py_UNICODE_WIDE { QVector<uint> tmp = v.toString().toUcs4(); @@ -400,8 +407,8 @@ PyObject * PythonScript::VariantToPython(const QVariant & v) #else return Py_BuildValue("u", v.toString().constData()); #endif - case QVariant::List: - case QVariant::StringList: + case QMetaType::QVariantList: + case QMetaType::QStringList: { QVariantList list = v.toList(); @@ -412,7 +419,7 @@ PyObject * PythonScript::VariantToPython(const QVariant & v) } return pyList; } - case QVariant::Hash: + case QMetaType::QVariantHash: { QVariantHash hash = v.toHash(); @@ -422,7 +429,7 @@ PyObject * PythonScript::VariantToPython(const QVariant & v) } return pyDict; } - case QVariant::Map: + case QMetaType::QVariantMap: { QVariantMap map = v.toMap(); diff --git a/plugins-src/TWPythonPlugin/PythonScript.h b/plugins-src/TWPythonPlugin/PythonScript.h index 35d420aa9..658d4330a 100644 --- a/plugins-src/TWPythonPlugin/PythonScript.h +++ b/plugins-src/TWPythonPlugin/PythonScript.h @@ -26,6 +26,8 @@ #include "scripting/Script.h" #include "scripting/ScriptAPIInterface.h" +#include <QCoreApplication> + // Forward declaration taken from the Python headers to avoid having to include // Python in this header file struct _object; @@ -37,8 +39,8 @@ namespace Scripting { /** \brief Class for handling python scripts */ class PythonScript : public Script { - Q_OBJECT Q_INTERFACES(Tw::Scripting::Script) + Q_DECLARE_TR_FUNCTIONS(Tw::Scripting::ECMAScript) public: /** \brief Constructor
