diff options
| author | 2024-03-29 18:34:53 +0800 | |
|---|---|---|
| committer | 2024-03-29 18:34:53 +0800 | |
| commit | d0493fa55ee3ca63fce4b918e432e34c90eddae9 (patch) | |
| tree | fc7ea2056f0367a3dd2c0042b3d0b6f9074b6b25 | |
| parent | fa93c59702c16940506d4a713fe9f92888945d36 (diff) | |
| download | ipm-d0493fa55ee3ca63fce4b918e432e34c90eddae9.tar.gz ipm-d0493fa55ee3ca63fce4b918e432e34c90eddae9.zip | |
fix(index): fix recursion load
| -rw-r--r-- | src/ipm/models/index.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ipm/models/index.py b/src/ipm/models/index.py index 774da1f..cd8b78b 100644 --- a/src/ipm/models/index.py +++ b/src/ipm/models/index.py @@ -2,7 +2,6 @@ from pathlib import Path from typing import Any, Literal, Optional from ipm.const import INDEX_PATH from ipm.exceptions import LockLoadFailed -from ipm.models.lock import PackageLock from ipm.typing import Dict import requests @@ -45,6 +44,8 @@ class Yggdrasil: @staticmethod def init(index: str) -> "Yggdrasil": + from ipm.models.lock import PackageLock + lock_bytes = requests.get( index.rstrip("/") + "/" + "json/packages.json" ).content @@ -99,6 +100,11 @@ class Yggdrasil: if distribution["version"] == match_version: return distribution["hash"] + def get_lastest_version(self, name: str) -> Optional[str]: + if name not in self.packages: + return None + return self.packages[name]["latestVersion"] + @property def uuid(self) -> str: """世界树唯一标识""" |
