Marcel Telka
2023-09-15 2a7610595518463e30ff8c388f140afd49126b74
itstool: fix escape sequences

1 files added
4 files modified
78 ■■■■ changed files
components/text/itstool/Makefile 5 ●●●●● patch | view | raw | blame | history
components/text/itstool/itstool.p5m 5 ●●●● patch | view | raw | blame | history
components/text/itstool/manifests/sample-manifest.p5m 3 ●●●● patch | view | raw | blame | history
components/text/itstool/patches/02-fix-escape-sequences.patch 61 ●●●●● patch | view | raw | blame | history
components/text/itstool/pkg5 4 ●●● patch | view | raw | blame | history
components/text/itstool/Makefile
@@ -27,6 +27,7 @@
COMPONENT_NAME=        itstool
COMPONENT_VERSION=    2.0.7
COMPONENT_REVISION=    1
COMPONENT_SUMMARY=    ITS Tool allows you to translate your XML documents with PO files using rules from the W3C Internationalization Tag Set
COMPONENT_PROJECT_URL=    http://itstool.org/
COMPONENT_SRC=        $(COMPONENT_NAME)-$(COMPONENT_VERSION)
@@ -53,5 +54,5 @@
CONFIGURE_OPTIONS +=    --sysconfdir=$(ETCDIR)
# Auto-generated dependencies
REQUIRED_PACKAGES += library/python/libxml2-39
REQUIRED_PACKAGES += runtime/python-39
PYTHON_REQUIRED_PACKAGES += library/python/libxml2
PYTHON_REQUIRED_PACKAGES += runtime/python
components/text/itstool/itstool.p5m
@@ -14,6 +14,7 @@
#
set name=pkg.fmri value=pkg:/$(COMPONENT_FMRI)@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
set name=pkg.human-version value=$(HUMAN_VERSION)
set name=pkg.summary value="$(COMPONENT_SUMMARY)"
set name=info.classification value="$(COMPONENT_CLASSIFICATION)"
set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
@@ -22,15 +23,11 @@
license $(COMPONENT_LICENSE_FILE) license='$(COMPONENT_LICENSE)'
<transform file path=usr.*/man/.+ -> default mangler.man.stability uncommitted>
file path=usr/bin/itstool
file path=usr/share/itstool/its/docbook.its
file path=usr/share/itstool/its/docbook5.its
file path=usr/share/itstool/its/its.its
file path=usr/share/itstool/its/mallard.its
file path=usr/share/itstool/its/ttml.its
file path=usr/share/itstool/its/xhtml.its
file path=usr/share/man/man1/itstool.1
components/text/itstool/manifests/sample-manifest.p5m
@@ -10,10 +10,11 @@
#
#
# Copyright 2016 <contributor>
# Copyright 2023 <contributor>
#
set name=pkg.fmri value=pkg:/$(COMPONENT_FMRI)@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
set name=pkg.human-version value=$(HUMAN_VERSION)
set name=pkg.summary value="$(COMPONENT_SUMMARY)"
set name=info.classification value="$(COMPONENT_CLASSIFICATION)"
set name=info.upstream-url value=$(COMPONENT_PROJECT_URL)
components/text/itstool/patches/02-fix-escape-sequences.patch
New file
@@ -0,0 +1,61 @@
https://github.com/itstool/itstool/pull/50
--- itstool-2.0.7/itstool.in.orig
+++ itstool-2.0.7/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('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;')
-        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)
components/text/itstool/pkg5
@@ -1,9 +1,7 @@
{
    "dependencies": [
        "SUNWcs",
        "library/python/libxml2-39",
        "runtime/python-39",
        "shell/ksh93"
        "runtime/python-39"
    ],
    "fmris": [
        "text/itstool"