Browse Source

Sort file lists in doc and tr stats (#247)

This makes the output reproducible
in spite of nondeterministic filesystem readdir result order.

This is useful for a reproducible builds.
Bernhard M. Wiedemann 4 years ago
parent
commit
bfbf41052f
3 changed files with 4 additions and 4 deletions
  1. 1 1
      locale/grass_po_stats.py
  2. 1 1
      man/build_class_graphical.py
  3. 2 2
      man/build_manual_gallery.py

+ 1 - 1
locale/grass_po_stats.py

@@ -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:

+ 1 - 1
man/build_class_graphical.py

@@ -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)
 

+ 2 - 2
man/build_manual_gallery.py

@@ -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)
@@ -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(