Skip to content

Commit

Permalink
Remove redundant sort, unify criteria
Browse files Browse the repository at this point in the history
`get_installable_versions()` is already sorted using `Version`
  • Loading branch information
elopez committed Dec 31, 2024
1 parent 6ce0bf5 commit bc587e8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion solc_select/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def solc_select() -> None:
versions = args.get(INSTALL_VERSIONS)
if not versions:
print("Available versions to install:")
for version in sort_versions(get_installable_versions()):
for version in get_installable_versions():
print(version)
else:
install_artifacts(args.get(INSTALL_VERSIONS))
Expand Down
4 changes: 3 additions & 1 deletion solc_select/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import sys
from typing import List

from packaging.version import Version


def mac_can_run_intel_binaries() -> bool:
"""Check if the Mac is Intel or M1 with available Rosetta. Will throw an exception if run on non-macOS."""
Expand All @@ -18,4 +20,4 @@ def mac_can_run_intel_binaries() -> bool:

def sort_versions(versions: List[str]) -> List[str]:
"""Sorts a list of versions following the component order (major/minor/patch)"""
return sorted(versions, key=lambda v: [int(s) for s in v.split(".")])
return sorted(versions, key=Version)

0 comments on commit bc587e8

Please sign in to comment.