1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-09 21:20:45 -08:00

Make portable to python 3.3.

Copied from Perforce
 Change: 184032
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Gareth Rees 2014-01-16 17:07:56 +00:00
parent adee119fa2
commit 283d668be3
2 changed files with 5 additions and 5 deletions

View file

@ -6,7 +6,7 @@ See <http://sphinx-doc.org/extensions.html>
from collections import defaultdict
from inspect import isabstract, isclass
import re
import designs
from . import designs
from docutils import nodes, transforms
from sphinx import addnodes
@ -295,7 +295,7 @@ class GlossaryTransform(transforms.Transform):
('e', 'ed'),
('', 'ed'),
])
for (name, fullname), value in objects.items():
for (name, fullname), value in list(objects.items()):
if name != 'term':
continue
m = self.sense_re.match(fullname)
@ -338,6 +338,6 @@ def setup(app):
app.add_role_to_domain('mps', 'ref', mps_ref_role)
app.add_transform(GlossaryTransform)
app.connect('build-finished', GlossaryTransform.warn_indirect_terms)
for g in globals().itervalues():
for g in globals().values():
if isclass(g) and issubclass(g, MpsDirective):
g.add_to_app(app)

View file

@ -91,7 +91,7 @@ def index_sub(m):
return s
def convert_file(name, source, dest):
s = open(source).read()
s = open(source, encoding='utf-8').read()
# We want the index directive to go right at the start, so that it leads
# to the whole document.
m = index.search(s)
@ -115,7 +115,7 @@ def convert_file(name, source, dest):
os.makedirs(os.path.dirname(dest))
except:
pass
with open(dest, 'w') as out:
with open(dest, mode='w', encoding='utf-8') as out:
out.write(s)
# Mini-make