Ana Guerrero 2025-03-03 15:05:05 +00:00 committed by Git OBS Bridge
commit 6c44d09b4d
6 changed files with 37 additions and 248 deletions

3
texworks-0.6.10.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bbc29d5aba451355222b29dd02ef318fd7fec55a721a61fc6d9cd933a0abd270
size 11479436

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a0c8e4b9f2fbb38f681b9d91f331366e5cdcb35dba7a94cb2988ccfca113ac2b
size 12505487

View File

@ -1,124 +0,0 @@
From dae1586af7a218e9bbe9ce3031a97e8efcac980a Mon Sep 17 00:00:00 2001
From: Atri Bhattacharya <A.Bhattacharya@uliege.be>
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 )
- SET(PYTHON_LIBRARIES "-F/System/Library/Frameworks -framework Python" CACHE PATH "Python library.")
- SET(PYTHON_INCLUDE_DIR "/System/Library/Framework/Python.framework/Headers" CACHE PATH "Python framework.")
- MARK_AS_ADVANCED(PYTHON_LIBRARIES)
- MARK_AS_ADVANCED(PYTHON_INCLUDE_DIR)
- SET(PYTHONLIBS_FOUND TRUE)
+ SET(Python_LIBRARIES "-F/System/Library/Frameworks -framework Python" CACHE PATH "Python library.")
+ SET(Python_INCLUDE_DIR "/System/Library/Framework/Python.framework/Headers" CACHE PATH "Python framework.")
+ MARK_AS_ADVANCED(Python_LIBRARIES)
+ MARK_AS_ADVANCED(Python_INCLUDE_DIR)
+ SET(Python_Interpreter_FOUND TRUE)
+ SET(Python_Development_FOUND TRUE)
ELSE ()
- # **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)
+ 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 +354,7 @@ IF ( LUA_FOUND AND WITH_LUA AND NOT ${BUILD_SHARED_PLUGINS})
ADD_DEFINITIONS(-DQT_STATICPLUGIN -DSTATIC_LUA_SCRIPTING_PLUGIN)
ENDIF ()
-IF ( PYTHONLIBS_FOUND AND WITH_PYTHON AND NOT ${BUILD_SHARED_PLUGINS})
+IF ( Python_Interpreter_FOUND AND Python_Development_FOUND AND WITH_PYTHON AND NOT ${BUILD_SHARED_PLUGINS})
ADD_DEFINITIONS(-DQT_STATICPLUGIN -DSTATIC_PYTHON_SCRIPTING_PLUGIN)
ENDIF ()
@@ -406,7 +416,7 @@ IF ( LUA_FOUND AND WITH_LUA )
ADD_SUBDIRECTORY(${TeXworks_SOURCE_DIR}/plugins-src/TWLuaPlugin)
ENDIF ()
-IF ( PYTHONLIBS_FOUND AND WITH_PYTHON )
+IF ( Python_Interpreter_FOUND AND Python_Development_FOUND AND WITH_PYTHON )
ADD_SUBDIRECTORY(${TeXworks_SOURCE_DIR}/plugins-src/TWPythonPlugin)
ENDIF ()
@@ -509,7 +519,7 @@ IF ( WITH_LUA )
CONFIG_VERSION("Lua" "${LUA_VERSION_STRING}")
ENDIF()
if (WITH_PYTHON)
- CONFIG_VERSION("Python" "${PYTHON_VERSION_STRING}")
+ CONFIG_VERSION("Python" "${Python_VERSION}")
endif()
CONFIG_VERSION("Qt" ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH})
CONFIG_VERSION("SyncTeX" "${SYNCTEX_VERSION_STRING}")
@@ -520,7 +530,7 @@ message(" Scripting")
CONFIG_YESNO(" ECMA scripting" ON)
CONFIG_YESNO(" QtScript scripting" WITH_QTSCRIPT)
CONFIG_YESNO(" Lua scripting plugin" LUA_FOUND)
-CONFIG_YESNO(" Python scripting plugin" PYTHONLIBS_FOUND)
+CONFIG_YESNO(" Python scripting plugin" Python_Development_FOUND)
message("")
CONFIG_INFO("Build ID" ${TW_BUILD_ID})
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 ()
-target_include_directories(TWPythonPlugin SYSTEM PRIVATE ${PYTHON_INCLUDE_DIRS})
+target_include_directories(TWPythonPlugin SYSTEM PRIVATE ${Python_INCLUDE_DIRS})
target_include_directories(TWPythonPlugin PRIVATE ${TeXworks_SOURCE_DIR}/src)
# Specify link libraries even if the plugin is built statically so all the
# interface properties of the Qt targets (include directories, lib directories,
# etc.) are available
-TARGET_LINK_LIBRARIES(TWPythonPlugin ${QT_LIBRARIES} ${PYTHON_LIBRARIES} ${TEXWORKS_ADDITIONAL_LIBS})
+TARGET_LINK_LIBRARIES(TWPythonPlugin ${QT_LIBRARIES} ${Python_LIBRARIES} ${TEXWORKS_ADDITIONAL_LIBS})
IF (${BUILD_SHARED_PLUGINS})
INSTALL(TARGETS TWPythonPlugin
LIBRARY DESTINATION ${TeXworks_PLUGIN_DIR}
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})
ENDIF()
- IF (WITH_PYTHON AND PYTHONLIBS_FOUND)
- LIST(INSERT TeXworks_LIBS 0 TWPythonPlugin ${PYTHON_LIBRARIES})
+ IF (WITH_PYTHON AND Python_Development_FOUND)
+ LIST(INSERT TeXworks_LIBS 0 TWPythonPlugin ${Python_LIBRARIES})
ENDIF()
ENDIF()

View File

@ -1,111 +0,0 @@
From f8962bca2db2cae3183cad201a4726e7726caccb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20L=C3=B6ffler?= <st.loeffler@gmail.com>
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

View File

@ -1,3 +1,33 @@
-------------------------------------------------------------------
Mon Mar 3 02:24:50 UTC 2025 - Atri Bhattacharya <badshah400@gmail.com>
- Update to version 0.6.10:
* New features and improvements:
- Add first support for PDF 2.0 /Info metadata
- Include ConTeXt style scripts
- Add a macOS arm build
* Changes:
- Prevent file corruption when saving is interrupted
- Enhance configuration for ConTeXt
- Use --synctex=repeat for ConTeXt (Luatex) synctex
- Don't set the line height if it's not necessary to work
around a Qt 6 bug
- Refactor and modernize parts of the code
- Update the libraries for the pre-built binaries
* Fixes:
- Display all spellchecking languages in the preferences
dialog
- Fix selection of a language alias in the spellcheck menu
- Fix focus when switching to a PDF from the "Windows" menu
- Ensure the input field in the find/replace dialog is
initially focused
- Fix overescaping of \n in "Copy to Find"
- Fix Wayland appId
- Drop upstreamed patches:
* texworks-cmake-find-python.patch
* texworks-python-plugin-buildfix.patch
- Drop use of deprecated %suse_update_desktop_file macro.
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Jan 28 07:51:12 UTC 2025 - Bernhard Wiedemann <bwiedemann@suse.com> Tue Jan 28 07:51:12 UTC 2025 - Bernhard Wiedemann <bwiedemann@suse.com>

View File

@ -1,7 +1,7 @@
# #
# spec file for package texworks # spec file for package texworks
# #
# Copyright (c) 2024 SUSE LLC # Copyright (c) 2025 SUSE LLC
# Copyright (c) 2007-09 by Jonathan Kew. # Copyright (c) 2007-09 by Jonathan Kew.
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
@ -27,17 +27,13 @@
%bcond_without python %bcond_without python
%endif %endif
Name: texworks Name: texworks
Version: 0.6.9 Version: 0.6.10
Release: 0 Release: 0
Summary: TeXshop-like TeX Editor Summary: TeXshop-like TeX Editor
License: GPL-2.0-or-later License: GPL-2.0-or-later
Group: Productivity/Publishing/TeX/Frontends Group: Productivity/Publishing/TeX/Frontends
URL: https://www.tug.org/texworks/ URL: https://www.tug.org/texworks/
Source0: https://github.com/TeXworks/texworks/archive/release-%{version}.tar.gz#/%{name}-%{version}.tar.gz 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 badshah400@gmail.com -- cmake has dropped support for PythonInterp and PythonLibs, use FindPython instead
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 badshah400@gmail.com -- Fix building the python scripting plugin
Patch1: https://github.com/TeXworks/texworks/commit/f8962bca2db2cae3183cad201a4726e7726caccb.patch#/texworks-python-plugin-buildfix.patch
BuildRequires: cmake BuildRequires: cmake
BuildRequires: dbus-1-devel BuildRequires: dbus-1-devel
BuildRequires: desktop-file-utils BuildRequires: desktop-file-utils
@ -54,7 +50,6 @@ BuildRequires: python-rpm-macros
BuildRequires: python3-devel BuildRequires: python3-devel
%endif %endif
BuildRequires: texlive-tex-bin BuildRequires: texlive-tex-bin
BuildRequires: update-desktop-files
BuildRequires: pkgconfig(Qt6Concurrent) BuildRequires: pkgconfig(Qt6Concurrent)
BuildRequires: pkgconfig(Qt6Core) BuildRequires: pkgconfig(Qt6Core)
BuildRequires: pkgconfig(Qt6Core5Compat) BuildRequires: pkgconfig(Qt6Core5Compat)
@ -118,7 +113,6 @@ This package adds lua scripting abitilies to TeXworks.
%install %install
%cmake_install %cmake_install
%suse_update_desktop_file texworks Publishing WordProcessor
# Package doc files using %%doc, remove them here # Package doc files using %%doc, remove them here
for i in COPYING README.md NEWS for i in COPYING README.md NEWS
@ -130,9 +124,9 @@ done
%doc README.md NEWS %doc README.md NEWS
%license COPYING %license COPYING
%dir %{_datadir}/metainfo %dir %{_datadir}/metainfo
%{_datadir}/metainfo/texworks.appdata.xml %{_datadir}/metainfo/*.xml
%{_bindir}/texworks %{_bindir}/texworks
%{_datadir}/applications/texworks.desktop %{_datadir}/applications/*.desktop
%{_datadir}/icons/hicolor/*/apps/*.png %{_datadir}/icons/hicolor/*/apps/*.png
%{_mandir}/man1/texworks.1%{?ext_man} %{_mandir}/man1/texworks.1%{?ext_man}