aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard M. Wiedemann <bwiedemann@suse.de>2018-04-16 02:11:11 +0200
committerDavid Robillard <d@drobilla.net>2018-04-21 14:02:38 +0200
commit239d19c14be76b781377aa53d1f6c411c1e0c3bb (patch)
tree421170f643ae54d2d3cbdbe507390c980fca6d7a
parent06700865e1324fc33ae864a5114900cfc7dce6f5 (diff)
downloadlv2-239d19c14be76b781377aa53d1f6c411c1e0c3bb.tar.xz
lv2specgen: Sort lists for reproducible documentation
-rwxr-xr-xlv2specgen/lv2specgen.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/lv2specgen/lv2specgen.py b/lv2specgen/lv2specgen.py
index 38594fb..004e5bd 100755
--- a/lv2specgen/lv2specgen.py
+++ b/lv2specgen/lv2specgen.py
@@ -116,7 +116,7 @@ def findStatements(model, s, p, o):
def findOne(m, s, p, o):
l = findStatements(m, s, p, o)
try:
- return l.next()
+ return sorted(l)[0]
except:
return None
@@ -403,7 +403,7 @@ def rdfsPropertyInfo(term, m):
domains = findStatements(m, term, rdfs.domain, None)
domainsdoc = ""
first = True
- for d in domains:
+ for d in sorted(domains):
union = findOne(m, getObject(d), owl.unionOf, None)
if union:
uris = parseCollection(m, getObject(union))
@@ -421,7 +421,7 @@ def rdfsPropertyInfo(term, m):
ranges = findStatements(m, term, rdfs.range, None)
rangesdoc = ""
first = True
- for r in ranges:
+ for r in sorted(ranges):
union = findOne(m, getObject(r), owl.unionOf, None)
if union:
uris = parseCollection(m, getObject(union))
@@ -484,13 +484,14 @@ def rdfsClassInfo(term, m):
restrictions.append(getSubject(meta_type))
if len(superclasses) > 0:
+ superclasses.sort()
doc += "\n<tr><th>Sub-class of</th>"
first = True
for superclass in superclasses:
doc += getProperty(getTermLink(superclass), first)
first = False
- for r in restrictions:
+ for r in sorted(restrictions):
props = findStatements(m, r, None, None)
onProp = None
comment = None
@@ -536,6 +537,7 @@ def rdfsClassInfo(term, m):
# Find out about properties which have rdfs:domain of t
d = classdomains.get(str(term), "")
if d:
+ d.sort()
dlist = ''
first = True
for k in d:
@@ -546,6 +548,7 @@ def rdfsClassInfo(term, m):
# Find out about properties which have rdfs:range of t
r = classranges.get(str(term), "")
if r:
+ r.sort()
rlist = ''
first = True
for k in r:
@@ -613,7 +616,7 @@ def rdfsInstanceInfo(term, m):
doc = ""
first = True
- for match in findStatements(m, term, rdf.type, None):
+ for match in sorted(findStatements(m, term, rdf.type, None)):
doc += getProperty(getTermLink(getObject(match),
term,
rdf.type),
@@ -949,7 +952,7 @@ def releaseChangeset(m, release, prefix=''):
entry = ''
#entry = '<dd><ul>\n'
- for i in findStatements(m, getObject(changeset), dcs.item, None):
+ for i in sorted(findStatements(m, getObject(changeset), dcs.item, None)):
item = getObject(i)
label = findOne(m, item, rdfs.label, None)
if not label: