Jan Alexander Steffens (heftig) pushed to branch main at Arch Linux / Packaging / Packages / itstool
Commits: b6d0daf1 by Fabian Bornschein at 2024-04-07T08:22:46+00:00 Python 3.12 support - - - - - 2 changed files: - + 0002-Fix-insufficiently-quoted-regular-expressions.patch - PKGBUILD Changes: ===================================== 0002-Fix-insufficiently-quoted-regular-expressions.patch ===================================== @@ -0,0 +1,73 @@ +From 32c7d07664dc37765100285d1202d488cd6a27e8 Mon Sep 17 00:00:00 2001 +From: Nils Philippsen <[email protected]> +Date: Mon, 9 Oct 2023 14:26:43 +0200 +Subject: [PATCH] Fix insufficiently quoted regular expressions + +These went under the radar until Python 3.12 started warning about them. + +Signed-off-by: Nils Philippsen <[email protected]> +--- + itstool.in | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/itstool.in b/itstool.in +index c21ad4b..4452616 100755 +--- a/itstool.in ++++ b/itstool.in +@@ -220,7 +220,7 @@ class Message (object): + if not isinstance(text, ustr_type): + text = ustr(text, 'utf-8') + self._message[-1] += text.replace('&', '&').replace('<', '<').replace('>', '>') +- if re.sub('\s+', ' ', text).strip() != '': ++ if re.sub(r'\s+', ' ', text).strip() != '': + self._empty = False + + def add_entity_ref (self, name): +@@ -318,7 +318,7 @@ class Message (object): + message += '<_:%s-%i/>' % (msg.name, placeholder) + placeholder += 1 + if not self._preserve: +- message = re.sub('\s+', ' ', message).strip() ++ message = re.sub(r'\s+', ' ', message).strip() + return message + + def get_preserve_space (self): +@@ -456,9 +456,9 @@ class LocNote (object): + if self._preserve_space: + return self.locnote + else: +- return re.sub('\s+', ' ', self.locnote).strip() ++ return re.sub(r'\s+', ' ', self.locnote).strip() + elif self.locnoteref is not None: +- return '(itstool) link: ' + re.sub('\s+', ' ', self.locnoteref).strip() ++ return '(itstool) link: ' + re.sub(r'\s+', ' ', self.locnoteref).strip() + return '' + + +@@ -889,7 +889,7 @@ class Document (object): + trans = translations.ugettext('_\x04translator-credits') + if trans is None or trans == 'translator-credits': + return +- regex = re.compile('(.*) \<(.*)\>, (.*)') ++ regex = re.compile(r'(.*) \<(.*)\>, (.*)') + for credit in trans.split('\n'): + match = regex.match(credit) + if not match: +@@ -924,7 +924,7 @@ class Document (object): + prevnode = None + if node.prev is not None and node.prev.type == 'text': + prevtext = node.prev.content +- if re.sub('\s+', '', prevtext) == '': ++ if re.sub(r'\s+', '', prevtext) == '': + prevnode = node.prev + for lang in sorted(list(translations.keys()), reverse=True): + locale = self.get_its_locale_filter(node) +@@ -1468,7 +1468,7 @@ def match_locale(extrange, locale): + localei += 1 + return True + +-_locale_pattern = re.compile('([a-zA-Z0-9-]+)(_[A-Za-z0-9]+)?(@[A-Za-z0-9]+)?(\.[A-Za-z0-9]+)?') ++_locale_pattern = re.compile(r'([a-zA-Z0-9-]+)(_[A-Za-z0-9]+)?(@[A-Za-z0-9]+)?(\.[A-Za-z0-9]+)?') + def convert_locale (locale): + # Automatically convert POSIX-style locales to BCP47 + match = _locale_pattern.match(locale) ===================================== PKGBUILD ===================================== @@ -8,19 +8,15 @@ epoch=1 pkgdesc="XML to PO and back again" arch=(any) url="http://itstool.org/" -license=(GPL3) +license=(GPL-3.0-only) depends=(python libxml2 docbook-xml) makedepends=(git) -_commit=f1c6544dcd83a73a5ccea9e0c48cf9a47e006190 # tags/2.0.7^0 -source=("git+https://github.com/itstool/itstool#commit=$_commit" - 0001-Fix-the-crash-from-912099.patch) -sha256sums=('SKIP' - 'b43cea38118aaefa6724136d142dcc7099cd6de04cf2e226f53d4310dfe207cc') - -pkgver() { - cd $pkgname - git describe --tags | sed 's/-/+/g' -} +source=("git+https://github.com/itstool/itstool#tag=$pkgver" + 0001-Fix-the-crash-from-912099.patch + 0002-Fix-insufficiently-quoted-regular-expressions.patch) +sha256sums=('7e782e2948e05c82eb21e528811212fc55776b4af412fab2a66447f95c8a0310' + 'b43cea38118aaefa6724136d142dcc7099cd6de04cf2e226f53d4310dfe207cc' + '4e64a2e884f9d4cbc493732fcbde9f1d5bed534f9a66330bbcc1cbeb54808c1e') prepare() { cd $pkgname @@ -28,6 +24,10 @@ prepare() { # https://src.fedoraproject.org/rpms/itstool/blob/rawhide/f/itstool-2.0.5-fix-crash-wrong-encoding.patch git apply -3 ../0001-Fix-the-crash-from-912099.patch + # Fix insufficiently quoted regular expressions / Python 3.12 + ## https://github.com/itstool/itstool/pull/51 + git apply -3 ../0002-Fix-insufficiently-quoted-regular-expressions.patch + autoreconf -fvi } View it on GitLab: https://gitlab.archlinux.org/archlinux/packaging/packages/itstool/-/commit/b6d0daf1ccea31ff8970ae1912348df4827d39de -- View it on GitLab: https://gitlab.archlinux.org/archlinux/packaging/packages/itstool/-/commit/b6d0daf1ccea31ff8970ae1912348df4827d39de You're receiving this email because of your account on gitlab.archlinux.org.
