handle installed

This commit is contained in:
huchenlei
2024-12-20 14:56:39 -08:00
parent 9d1ef85af8
commit 4e44c26beb
4 changed files with 43 additions and 59 deletions

View File

@@ -5,7 +5,7 @@ import os
import toml
from git_helper import is_git_repo
from git_helper import is_git_repo, get_commit_hash
@dataclass
@@ -37,6 +37,15 @@ class InstalledNodePackage:
def is_disabled(self) -> bool:
return self.disabled
def get_commit_hash(self) -> str:
return get_commit_hash(self.fullpath)
def isValid(self) -> bool:
if self.is_from_cnr:
return os.path.exists(os.path.join(self.fullpath, '.tracking'))
return True
@staticmethod
def from_fullpath(fullpath: str) -> InstalledNodePackage:
parent_folder_name = os.path.split(fullpath)[-2]