install: re-resolve cloned repositories as local ones

This commit is contained in:
Lephenixnoir 2021-01-14 11:15:59 +01:00
parent cd43a431a9
commit 559af6b190
No known key found for this signature in database
GPG key ID: 1BBA026E13FC0495

View file

@ -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)")