From 0c24ead1cb0126a1847c2ed971649e9ee25e920e Mon Sep 17 00:00:00 2001 From: Julian T Date: Sat, 24 Apr 2021 20:28:44 +0200 Subject: Add status subcommand --- apply/resolv.py | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'apply/resolv.py') diff --git a/apply/resolv.py b/apply/resolv.py index eba5ed1..93d0566 100644 --- a/apply/resolv.py +++ b/apply/resolv.py @@ -1,7 +1,6 @@ from pathlib import Path from .writer import Writer from .state import StateFile, FileState -import os class Resolver: @@ -16,17 +15,6 @@ class Resolver: self.override = override self.state = state - def check_location(self, path: Path) -> FileState: - if not path.exists(): - return FileState.Unused - - if path.is_symlink(): - dest = Path(os.path.realpath(str(path))) - if Path.cwd() in dest.parents: - return FileState.create_owned(dest) - - return FileState.Used - def check_parent(self, path: Path, packagename): """ Check if parents exists, and if we created them mark them @@ -46,7 +34,7 @@ class Resolver: def do_link(self, package, ppath: Path): dest = Path(self.applydir, ppath) - dest_state = self.check_location(dest) + dest_state = FileState.check_location(dest) if not self.override and not dest_state.can_write(): # Check if it's a pointer to the correct location @@ -58,7 +46,7 @@ class Resolver: self.check_parent(dest, package) target_abs = Path.cwd().joinpath(Path(package, ppath)) - if dest_state == FileState.Owned \ + if dest_state == FileState.Owned and dest_state.link_intact()\ and dest_state.links_to() == target_abs: return -- cgit v1.2.3