Skip to content

Commit

Permalink
Make image lists deterministic
Browse files Browse the repository at this point in the history
  • Loading branch information
comawill authored and mwarning committed Dec 29, 2024
1 parent 52c0bd7 commit 918b028
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions update.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def hash_file(path):

dups_found = False
hashes = {}
for entry in glob.glob("images/", recursive=True):
for entry in sorted(glob.glob("images/", recursive=True)):
if os.path.isfile(entry):
hash = hash_file(entry)
if hash in hashes:
Expand Down Expand Up @@ -185,7 +185,7 @@ def add_previews(db):
def find_images_paths(name):
image_exts = (".png", ".svg", ".pdf")
images = []
for entry in glob.glob("images/{}/*".format(name), recursive=True):
for entry in sorted(glob.glob("images/{}/*".format(name), recursive=True)):
if not os.path.isfile(entry):
continue
if entry.endswith(image_exts):
Expand Down Expand Up @@ -221,7 +221,7 @@ def indexOf(ext):

def update_file_listings(path, create_index=False):
entries = []
for entry in glob.glob("{}/*".format(path)):
for entry in sorted(glob.glob("{}/*".format(path))):
if not entry.endswith("/index.html"):
entries.append(entry)

Expand Down

0 comments on commit 918b028

Please sign in to comment.