From a1b09d2d36e4b2c3cc732d8da8f3190288d7308a Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Thu, 21 Nov 2024 14:45:10 -0500 Subject: [PATCH] Ensure keys are sorted by versions So far it seems consistent, but if more are added, this might not be guaranteed. --- build.py | 5 ++++- requirements.txt | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/build.py b/build.py index fe4d4f2..0e5e6fe 100755 --- a/build.py +++ b/build.py @@ -11,6 +11,7 @@ from git import Repo from os import getenv import os.path +from packaging.version import Version from subprocess import run, PIPE import sys from yaml import load, SafeLoader @@ -62,7 +63,9 @@ def _determine_framework_versions(): if submodule.name in configurations["frameworks"].keys(): for framework_arg in configurations["frameworks"][submodule.name].keys(): framework_args[framework_arg] = None - for commit_hash in configurations["frameworks"][submodule.name][framework_arg].keys(): + def sort_versions(input_dict): + return dict(sorted(input_dict.items(), key=lambda item: Version(str(item[1])))) + for commit_hash in sort_versions(configurations["frameworks"][submodule.name][framework_arg]): try: commit = submodule.module().commit(commit_hash) if commit in submodule.module().iter_commits('HEAD'): diff --git a/requirements.txt b/requirements.txt index 618d488..f0265bb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ GitPython pyyaml +packaging