summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Wienand <iwienand@redhat.com>2018-07-02 17:27:21 +1000
committerIan Wienand <iwienand@redhat.com>2018-08-20 14:33:12 +1000
commit44012c032bd53fd92543aa374cb974dc33eafc88 (patch)
tree784566e6f5087bda7db64714ba253783dbd09fb0
parentfb48c1fe3daaf60ad1a3e94927f2b09be3094b42 (diff)
Open role readme files in utf-8 mode
I managed to get some hidden utf-8 characters into a zuul role README.rst file which broke building in the gate on python 2.7 in a rather mysterious way, deep inside the rst parser. Make sure we open the README.rst files in unicode mode; this way the lines are passed into the rst core as unicode and things go as planned. Change-Id: Id27062989c0527de545b18471eec29926955a4e4
Notes
Notes (review): Code-Review+2: Tobias Henkel <tobias.henkel@bmw.de> Code-Review+2: James E. Blair <corvus@inaugust.com> Workflow+1: James E. Blair <corvus@inaugust.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Tue, 21 Aug 2018 21:01:28 +0000 Reviewed-on: https://review.openstack.org/579474 Project: openstack-infra/zuul-sphinx Branch: refs/heads/master
-rw-r--r--zuul_sphinx/zuul.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/zuul_sphinx/zuul.py b/zuul_sphinx/zuul.py
index a140988..7e8463a 100644
--- a/zuul_sphinx/zuul.py
+++ b/zuul_sphinx/zuul.py
@@ -13,6 +13,7 @@
13# under the License. 13# under the License.
14 14
15from collections import OrderedDict 15from collections import OrderedDict
16import codecs
16import os 17import os
17 18
18from sphinx import addnodes 19from sphinx import addnodes
@@ -187,7 +188,7 @@ class ZuulDirective(Directive):
187 lines.append('.. zuul:role:: %s' % name) 188 lines.append('.. zuul:role:: %s' % name)
188 lines.append('') 189 lines.append('')
189 role_readme = self.zuul_role_paths[name] 190 role_readme = self.zuul_role_paths[name]
190 with open(role_readme) as f: 191 with codecs.open(role_readme, encoding='utf-8') as f:
191 role_lines = f.read().split('\n') 192 role_lines = f.read().split('\n')
192 for l in role_lines: 193 for l in role_lines:
193 lines.append(' ' + l) 194 lines.append(' ' + l)