Browse Source

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
Ian Wienand 9 months ago
parent
commit
44012c032b
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      zuul_sphinx/zuul.py

+ 2
- 1
zuul_sphinx/zuul.py View File

@@ -13,6 +13,7 @@
13 13
 # under the License.
14 14
 
15 15
 from collections import OrderedDict
16
+import codecs
16 17
 import os
17 18
 
18 19
 from sphinx import addnodes
@@ -187,7 +188,7 @@ class ZuulDirective(Directive):
187 188
         lines.append('.. zuul:role:: %s' % name)
188 189
         lines.append('')
189 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 192
             role_lines = f.read().split('\n')
192 193
             for l in role_lines:
193 194
                 lines.append('   ' + l)

Loading…
Cancel
Save