Make generated texinfo files reproducible by sorting the anchors

This commit is contained in:
Dmitry Shachnev 2018-08-27 10:37:17 +03:00
parent 2429cc5bbf
commit 561199e5e8
2 changed files with 5 additions and 1 deletions

View File

@ -612,7 +612,7 @@ class TexinfoTranslator(nodes.NodeVisitor):
node_name = node['node_name'] node_name = node['node_name']
pointers = tuple([node_name] + self.rellinks[node_name]) pointers = tuple([node_name] + self.rellinks[node_name])
self.body.append('\n@node %s,%s,%s,%s\n' % pointers) # type: ignore self.body.append('\n@node %s,%s,%s,%s\n' % pointers) # type: ignore
for id in self.next_section_ids: for id in sorted(self.next_section_ids):
self.add_anchor(id, node) self.add_anchor(id, node)
self.next_section_ids.clear() self.next_section_ids.clear()

View File

@ -50,6 +50,10 @@ def test_texinfo_warnings(app, status, warning):
def test_texinfo(app, status, warning): def test_texinfo(app, status, warning):
TexinfoTranslator.ignore_missing_images = True TexinfoTranslator.ignore_missing_images = True
app.builder.build_all() app.builder.build_all()
result = (app.outdir / 'SphinxTests.texi').text(encoding='utf8')
assert ('@anchor{markup doc}@anchor{12}'
'@anchor{markup id1}@anchor{13}'
'@anchor{markup testing-various-markup}@anchor{14}' in result)
# now, try to run makeinfo over it # now, try to run makeinfo over it
cwd = os.getcwd() cwd = os.getcwd()
os.chdir(app.outdir) os.chdir(app.outdir)