Skip to content

Commit

Permalink
Sort file lists in doc and tr stats (OSGeo#247)
Browse files Browse the repository at this point in the history
This makes the output reproducible
in spite of nondeterministic filesystem readdir result order.

This is useful for a reproducible builds.
  • Loading branch information
bmwiedemann authored and wenzeslaus committed Dec 20, 2019
1 parent 86f0eca commit bfbf410
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion locale/grass_po_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def read_po_files(inputdirpath):
originalpath = os.getcwd()
os.chdir(inputdirpath)
languages = {}
for pofile in glob.glob("*.po"):
for pofile in sorted(glob.glob("*.po")):
lang = pofile.split('_')[1:]
# check if are two definitions like pt_br
if len(lang) == 2:
Expand Down
2 changes: 1 addition & 1 deletion man/build_class_graphical.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def main():
img_extensions = ['png', 'jpg', 'gif']
img_patterns = ['*.' + extension for extension in img_extensions]
imgs = []
for filename in os.listdir(html_dir):
for filename in sorted(os.listdir(html_dir)):
if file_matches(filename, img_patterns):
imgs.append(filename)

Expand Down
4 changes: 2 additions & 2 deletions man/build_manual_gallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def file_matches(filename, patterns):

def get_files(directory, patterns, exclude_patterns):
files = []
for filename in os.listdir(directory):
for filename in sorted(os.listdir(directory)):
if file_matches(filename, patterns):
if not file_matches(filename, exclude_patterns):
files.append(filename)
Expand Down Expand Up @@ -168,7 +168,7 @@ def main():
"Manual: Manual gallery" % grass_version))
output.write(header_graphical_index_tmpl)
output.write('<ul class="img-list">\n')
for image, html_file in img_html_files.items():
for image, html_file in sorted(img_html_files.items()):
name = get_module_name(html_file)
title = title_from_names(name, image)
output.write(
Expand Down

0 comments on commit bfbf410

Please sign in to comment.