Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clr_loader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def get_coreclr(
candidates = [
rt for rt in find_runtimes() if rt.name == "Microsoft.NETCore.App"
]
candidates.sort(key=lambda spec: spec.version, reverse=True)
candidates.sort(key=lambda spec: spec.version_info, reverse=True)
if not candidates:
raise RuntimeError("Failed to find a suitable runtime")

Expand Down
13 changes: 9 additions & 4 deletions clr_loader/util/runtime_spec.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Dict, TextIO
from typing import Any, Dict, TextIO, Tuple


@dataclass
Expand All @@ -12,14 +12,19 @@ class DotnetCoreRuntimeSpec:
version: str
path: Path

@property
def version_info(self) -> Tuple[int, int, int, str]:
base, _, suffix = self.version.partition("-")
major, minor, patch = base.split(".")
return (int(major), int(minor), int(patch), suffix)

@property
def tfm(self) -> str:
return f"net{self.version[:3]}"
return f"net{self.version_info[0]}.{self.version_info[1]}"

@property
def floor_version(self) -> str:
major, minor, _ = self.version.split(".")
return f"{major}.{minor}.0"
return f"{self.version_info[0]}.{self.version_info[1]}.0"

@property
def runtime_config(self) -> Dict[str, Any]:
Expand Down
Loading