From 559af6b190bc6f5729e33b422e394c0aa07189ba Mon Sep 17 00:00:00 2001 From: Lephenixnoir Date: Thu, 14 Jan 2021 11:15:59 +0100 Subject: [PATCH] install: re-resolve cloned repositories as local ones --- giteapc/repo.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/giteapc/repo.py b/giteapc/repo.py index c6a0727..ba680c6 100644 --- a/giteapc/repo.py +++ b/giteapc/repo.py @@ -219,7 +219,7 @@ def fetch(*args, use_ssh=False, use_https=False, force=False, update=False): if not has_tag and force: warn(f"{r.fullname} doesn't have the [giteapc] tag") if not has_tag and not force: - return fatal(f"{r.fullname} doesn't have the [giteapc] tag, "+\ + raise Error(f"{r.fullname} doesn't have the [giteapc] tag, "+\ "use -f to force") # Checkout requested version, if any @@ -315,6 +315,9 @@ def search_dependencies(names, fetched, plan, **kwargs): if r.fullname not in fetched: fetch(r.fullname, **kwargs) fetched.add(r.fullname) + # Re-resolve, as a local repository this time + if r.remote: + r = s.resolve(local_only=True) # Schedule dependencies before r search_dependencies(r.dependencies(), fetched, plan, **kwargs) plan.append(s) @@ -386,10 +389,10 @@ def uninstall(*args, keep=False): if not keep: msg("{}: {R}Removing files{_}".format(pretty_repo(r), **colors())) - if os.path.isdir(r.folder): - shutil.rmtree(r.folder) - elif os.path.islink(r.folder): + if os.path.islink(r.folder): os.remove(r.folder) + elif os.path.isdir(r.folder): + shutil.rmtree(r.folder) else: raise Error(f"cannot handle {r.folder} (not a folder/symlink)")