Ensure keys are sorted by versions

So far it seems consistent, but if more are added, this might not be
guaranteed.
This commit is contained in:
Joshua M. Boniface 2024-11-21 14:45:10 -05:00
parent efa1e92c22
commit a1b09d2d36
2 changed files with 5 additions and 1 deletions

View File

@ -11,6 +11,7 @@ from email.utils import format_datetime, localtime
from git import Repo from git import Repo
from os import getenv from os import getenv
import os.path import os.path
from packaging.version import Version
from subprocess import run, PIPE from subprocess import run, PIPE
import sys import sys
from yaml import load, SafeLoader from yaml import load, SafeLoader
@ -62,7 +63,9 @@ def _determine_framework_versions():
if submodule.name in configurations["frameworks"].keys(): if submodule.name in configurations["frameworks"].keys():
for framework_arg in configurations["frameworks"][submodule.name].keys(): for framework_arg in configurations["frameworks"][submodule.name].keys():
framework_args[framework_arg] = None 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: try:
commit = submodule.module().commit(commit_hash) commit = submodule.module().commit(commit_hash)
if commit in submodule.module().iter_commits('HEAD'): if commit in submodule.module().iter_commits('HEAD'):

View File

@ -1,2 +1,3 @@
GitPython GitPython
pyyaml pyyaml
packaging