[packages/gtk-doc] Newer pythons3 fixes
arekm
arekm at pld-linux.org
Sat Jul 19 21:18:35 CEST 2025
commit 725e2e008225f993418c49e276d609e0d845770f
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Sat Jul 19 21:18:31 2025 +0200
Newer pythons3 fixes
gtk-doc.spec | 5 ++++-
python3.patch | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 71 insertions(+), 1 deletion(-)
---
diff --git a/gtk-doc.spec b/gtk-doc.spec
index 637f146..d1b3af9 100644
--- a/gtk-doc.spec
+++ b/gtk-doc.spec
@@ -9,7 +9,7 @@ Summary(pl.UTF-8): Narzędzie do generowania dokumentacji API do GTK+ i GNOME
Summary(pt_BR.UTF-8): O gerador de documentação do GTK
Name: gtk-doc
Version: 1.34.0
-Release: 1
+Release: 2
License: GPL v2+
Group: Development/Tools
Source0: https://download.gnome.org/sources/gtk-doc/1.34/%{name}-%{version}.tar.xz
@@ -17,6 +17,7 @@ Source0: https://download.gnome.org/sources/gtk-doc/1.34/%{name}-%{version}.tar.
Patch0: %{name}-noarch.patch
Patch1: %{name}-cmake.patch
Patch2: %{name}-struct-end.patch
+Patch3: python3.patch
URL: https://wiki.gnome.org/DocumentationProject/GtkDoc
BuildRequires: autoconf >= 2.63
BuildRequires: automake >= 1:1.11
@@ -88,6 +89,7 @@ pomocą gtk-doc.
%{!?with_tests:%patch -P0 -p1}
%patch -P1 -p1
%patch -P2 -p1
+%patch -P3 -p1
%{__mv} doc/README doc/README.docs
@@ -99,6 +101,7 @@ install -d build-aux
%{__automake}
%configure \
PKG_CONFIG=/usr/bin/pkg-config \
+ PYTHON=%{__python3} \
--disable-silent-rules
%{__make}
diff --git a/python3.patch b/python3.patch
new file mode 100644
index 0000000..b4eaa15
--- /dev/null
+++ b/python3.patch
@@ -0,0 +1,67 @@
+From 6fafd62a12a86b774c3a48c00ee2c7bda1459ce4 Mon Sep 17 00:00:00 2001
+From: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
+Date: Sat, 14 Sep 2024 08:30:18 -0400
+Subject: [PATCH] Avoid SyntaxWarning with python 3.12 on raw regex strings.
+
+Without this change, we see the following warnings with python 3.12:
+
+scan.py:44: SyntaxWarning: invalid escape sequence '\s'
+ VAR_TYPE_MODIFIER = '(?:' + '|'.join([t + '\s+' for t in TYPE_MODIFIERS]) + ')*'
+scan.py:45: SyntaxWarning: invalid escape sequence '\s'
+ RET_TYPE_MODIFIER = '(?:' + '|'.join([t + '\s+' for t in TYPE_MODIFIERS + ['G_CONST_RETURN']]) + ')*'
+scan.py:238: SyntaxWarning: invalid escape sequence '\('
+ ignore_decorators = '|' + options.ignore_decorators.replace('()', '\(\w*\)')
+scan.py:239: SyntaxWarning: invalid escape sequence '\s'
+ optional_decorators_regex = '(?:\s+(?:%s))?' % ignore_decorators[1:]
+scan.py:487: SyntaxWarning: invalid escape sequence '\('
+ ignore_decorators = '|' + options.ignore_decorators.replace('()', '\(\w*\)')
+scan.py:488: SyntaxWarning: invalid escape sequence '\s'
+ optional_decorators_regex = '(?:\s+(?:%s))?' % ignore_decorators[1:]
+
+Given that these are not intended to be escape sequences in the python
+string formatter (they'll be used as character classes in the regex
+parser), marking them as raw strings solves the issue.
+---
+ gtkdoc/scan.py | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/gtkdoc/scan.py b/gtkdoc/scan.py
+index 6b18099c..4a660aa8 100644
+--- a/gtkdoc/scan.py
++++ b/gtkdoc/scan.py
+@@ -41,8 +41,8 @@ import shutil
+ from . import common
+
+ TYPE_MODIFIERS = ['const', 'signed', 'unsigned', 'long', 'short', 'struct', 'union', 'enum']
+-VAR_TYPE_MODIFIER = '(?:' + '|'.join([t + '\s+' for t in TYPE_MODIFIERS]) + ')*'
+-RET_TYPE_MODIFIER = '(?:' + '|'.join([t + '\s+' for t in TYPE_MODIFIERS + ['G_CONST_RETURN']]) + ')*'
++VAR_TYPE_MODIFIER = '(?:' + '|'.join([t + r'\s+' for t in TYPE_MODIFIERS]) + ')*'
++RET_TYPE_MODIFIER = '(?:' + '|'.join([t + r'\s+' for t in TYPE_MODIFIERS + ['G_CONST_RETURN']]) + ')*'
+
+ # Matchers for current line
+ CLINE_MATCHER = [
+@@ -235,8 +235,8 @@ def InitScanner(options):
+ ignore_decorators = ''
+ optional_decorators_regex = ''
+ if options.ignore_decorators:
+- ignore_decorators = '|' + options.ignore_decorators.replace('()', '\(\w*\)')
+- optional_decorators_regex = '(?:\s+(?:%s))?' % ignore_decorators[1:]
++ ignore_decorators = '|' + options.ignore_decorators.replace('()', r'\(\w*\)')
++ optional_decorators_regex = r'(?:\s+(?:%s))?' % ignore_decorators[1:]
+
+ # FUNCTION POINTER VARIABLES
+ CLINE_MATCHER[4] = re.compile(
+@@ -484,8 +484,8 @@ def ScanHeaderContent(input_lines, decl_list, get_types, options):
+ ignore_decorators = '' # 1 uses
+ optional_decorators_regex = '' # 4 uses
+ if options.ignore_decorators:
+- ignore_decorators = '|' + options.ignore_decorators.replace('()', '\(\w*\)')
+- optional_decorators_regex = '(?:\s+(?:%s))?' % ignore_decorators[1:]
++ ignore_decorators = '|' + options.ignore_decorators.replace('()', r'\(\w*\)')
++ optional_decorators_regex = r'(?:\s+(?:%s))?' % ignore_decorators[1:]
+
+ for line in input_lines:
+ # If this is a private header, skip it.
+--
+GitLab
+
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/gtk-doc.git/commitdiff/725e2e008225f993418c49e276d609e0d845770f
More information about the pld-cvs-commit
mailing list