Make sure that svnlook outputs UTF8.

Since we have an empty environment, svnlook defaults to ASCII, outputting
{U+xxxx} instead of UTF8 characters. We can either re-interpret those, or
just make sure we get UTF8 in the first place.
This commit is contained in:
2016-11-11 10:43:41 +01:00
parent 34a0bb3e2f
commit ac8c302b28

View File

@@ -10,6 +10,7 @@ Example call:
""" """
import json import json
import os
import os.path import os.path
import subprocess import subprocess
import sys import sys
@@ -42,6 +43,9 @@ except KeyError:
url = parse.urljoin(PILLAR_URL, '/attract/api/%s/subversion/log' % project_url) url = parse.urljoin(PILLAR_URL, '/attract/api/%s/subversion/log' % project_url)
# Make sure that svnlook outputs UTF8. Without this, since we have an empty environment,
# it defaults to ASCII, outputting {U+xxxx} instead of UTF8 characters.
os.environ['LANG'] = 'en_US.utf8'
def svnlook(subcmd): def svnlook(subcmd):
info = subprocess.check_output(['/usr/bin/svnlook', subcmd, svn_repo, '-r', str(svn_revision)]) info = subprocess.check_output(['/usr/bin/svnlook', subcmd, svn_repo, '-r', str(svn_revision)])