13
0

Work around itstools bug #9648

Forwarded from debian.
Having stderr output inside the returned command tricks the system
to fail in detecting the version.
Ignoring stderr output looks fine to make it build properly:

```
itstool --version
/usr/bin/itstool:239: SyntaxWarning: invalid escape sequence '\s'
  if re.sub('\s+', ' ', text).strip() != '':
/usr/bin/itstool:337: SyntaxWarning: invalid escape sequence '\s'
  message = re.sub('\s+', ' ', message).strip()
/usr/bin/itstool:475: SyntaxWarning: invalid escape sequence '\s'
  return re.sub('\s+', ' ', self.locnote).strip()
/usr/bin/itstool:477: SyntaxWarning: invalid escape sequence '\s'
  return '(itstool) link: ' + re.sub('\s+', ' ', self.locnoteref).strip()
/usr/bin/itstool:891: SyntaxWarning: invalid escape sequence '\<'
  regex = re.compile('(.*) \<(.*)\>, (.*)')
/usr/bin/itstool:926: SyntaxWarning: invalid escape sequence '\s'
  if re.sub('\s+', '', prevtext) == '':
/usr/bin/itstool:1452: SyntaxWarning: invalid escape sequence '\.'
  _locale_pattern = re.compile('([a-zA-Z0-9-]+)(_[A-Za-z0-9]+)?(@[A-Za-z0-9]+)?(\.[A-Za-z0-9]+)?')
itstool 2.0.6
```
This commit is contained in:
GianfrancoCostamagna 2024-03-04 14:27:14 +01:00 committed by Robin Gareus
parent 37d130f6e1
commit 338cd09a4a
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -1008,7 +1008,7 @@ def configure(conf):
# freedesktop translations needs itstool > 1.0.3 (-j option) # freedesktop translations needs itstool > 1.0.3 (-j option)
if Options.options.freedesktop: if Options.options.freedesktop:
output = subprocess.Popen("itstool --version", shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines() output = subprocess.Popen("itstool --version", shell=True, stderr=subprocess.DEVNULL, stdout=subprocess.PIPE).communicate()[0].splitlines()
o = output[0].decode('utf-8') o = output[0].decode('utf-8')
itstool = o.split(' ')[0] itstool = o.split(' ')[0]
version = o.split(' ')[1].split('.') version = o.split(' ')[1].split('.')