mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #2009 from ProgVal/determinism
Make files generation at install deterministic
This commit is contained in:
commit
a7723ff6f4
2
setup.py
2
setup.py
@ -162,7 +162,7 @@ else:
|
|||||||
messages=jscatalog,
|
messages=jscatalog,
|
||||||
plural_expr=catalog.plural_expr,
|
plural_expr=catalog.plural_expr,
|
||||||
locale=str(catalog.locale)
|
locale=str(catalog.locale)
|
||||||
), outfile)
|
), outfile, sort_keys=True)
|
||||||
outfile.write(');')
|
outfile.write(');')
|
||||||
finally:
|
finally:
|
||||||
outfile.close()
|
outfile.close()
|
||||||
|
@ -837,7 +837,7 @@ class StandaloneHTMLBuilder(Builder):
|
|||||||
u'# The remainder of this file is compressed using zlib.\n'
|
u'# The remainder of this file is compressed using zlib.\n'
|
||||||
% (self.config.project, self.config.version)).encode('utf-8'))
|
% (self.config.project, self.config.version)).encode('utf-8'))
|
||||||
compressor = zlib.compressobj(9)
|
compressor = zlib.compressobj(9)
|
||||||
for domainname, domain in iteritems(self.env.domains):
|
for domainname, domain in sorted(self.env.domains.items()):
|
||||||
for name, dispname, type, docname, anchor, prio in \
|
for name, dispname, type, docname, anchor, prio in \
|
||||||
sorted(domain.get_objects()):
|
sorted(domain.get_objects()):
|
||||||
if anchor.endswith(name):
|
if anchor.endswith(name):
|
||||||
|
@ -4,6 +4,10 @@
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
from six import iteritems
|
from six import iteritems
|
||||||
|
try:
|
||||||
|
from collections import OrderedDict
|
||||||
|
except ImportError: # Fallback for Python 2.6
|
||||||
|
OrderedDict = dict
|
||||||
|
|
||||||
# Pgen imports
|
# Pgen imports
|
||||||
|
|
||||||
@ -57,7 +61,7 @@ class ParserGenerator(object):
|
|||||||
def make_first(self, c, name):
|
def make_first(self, c, name):
|
||||||
rawfirst = self.first[name]
|
rawfirst = self.first[name]
|
||||||
first = {}
|
first = {}
|
||||||
for label in rawfirst:
|
for label in sorted(rawfirst):
|
||||||
ilabel = self.make_label(c, label)
|
ilabel = self.make_label(c, label)
|
||||||
##assert ilabel not in first # X X X failed on <> ... !=
|
##assert ilabel not in first # X X X failed on <> ... !=
|
||||||
first[ilabel] = 1
|
first[ilabel] = 1
|
||||||
@ -138,8 +142,8 @@ class ParserGenerator(object):
|
|||||||
totalset[label] = 1
|
totalset[label] = 1
|
||||||
overlapcheck[label] = {label: 1}
|
overlapcheck[label] = {label: 1}
|
||||||
inverse = {}
|
inverse = {}
|
||||||
for label, itsfirst in iteritems(overlapcheck):
|
for label, itsfirst in sorted(overlapcheck.items()):
|
||||||
for symbol in itsfirst:
|
for symbol in sorted(itsfirst):
|
||||||
if symbol in inverse:
|
if symbol in inverse:
|
||||||
raise ValueError("rule %s is ambiguous; %s is in the"
|
raise ValueError("rule %s is ambiguous; %s is in the"
|
||||||
" first sets of %s as well as %s" %
|
" first sets of %s as well as %s" %
|
||||||
@ -349,6 +353,9 @@ class NFAState(object):
|
|||||||
assert isinstance(next, NFAState)
|
assert isinstance(next, NFAState)
|
||||||
self.arcs.append((label, next))
|
self.arcs.append((label, next))
|
||||||
|
|
||||||
|
def __hash__(self):
|
||||||
|
return hash(tuple(x[0] for x in self.arcs))
|
||||||
|
|
||||||
class DFAState(object):
|
class DFAState(object):
|
||||||
|
|
||||||
def __init__(self, nfaset, final):
|
def __init__(self, nfaset, final):
|
||||||
@ -357,7 +364,10 @@ class DFAState(object):
|
|||||||
assert isinstance(final, NFAState)
|
assert isinstance(final, NFAState)
|
||||||
self.nfaset = nfaset
|
self.nfaset = nfaset
|
||||||
self.isfinal = final in nfaset
|
self.isfinal = final in nfaset
|
||||||
self.arcs = {} # map from label to DFAState
|
self.arcs = OrderedDict() # map from label to DFAState
|
||||||
|
|
||||||
|
def __hash__(self):
|
||||||
|
return hash(tuple(self.arcs))
|
||||||
|
|
||||||
def addarc(self, next, label):
|
def addarc(self, next, label):
|
||||||
assert isinstance(label, str)
|
assert isinstance(label, str)
|
||||||
|
@ -275,9 +275,9 @@ class IndexBuilder(object):
|
|||||||
rv = {}
|
rv = {}
|
||||||
otypes = self._objtypes
|
otypes = self._objtypes
|
||||||
onames = self._objnames
|
onames = self._objnames
|
||||||
for domainname, domain in iteritems(self.env.domains):
|
for domainname, domain in sorted(iteritems(self.env.domains)):
|
||||||
for fullname, dispname, type, docname, anchor, prio in \
|
for fullname, dispname, type, docname, anchor, prio in \
|
||||||
domain.get_objects():
|
sorted(domain.get_objects()):
|
||||||
# XXX use dispname?
|
# XXX use dispname?
|
||||||
if docname not in fn2index:
|
if docname not in fn2index:
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user