Mercurial > dotfiles
changeset 438:3d999fcf62c6
Check for subrepo directories with no repos in them.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sat, 17 Feb 2018 15:04:36 -0800 |
parents | 21dd55ac743c |
children | f1f95a19fffe |
files | install.py |
diffstat | 1 files changed, 19 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/install.py Sun Apr 29 20:16:35 2018 -0700 +++ b/install.py Sat Feb 17 15:04:36 2018 -0800 @@ -247,10 +247,21 @@ func(path) else: raise + + +def _is_non_empty_dir_with(path, contains=None): + if not os.path.isdir(path): + return False + if isinstance(contains, str): + contains = [contains] + for cnt in contains: + if not os.path.exists(os.path.join(path, cnt)): + return False + return True def clone_git(url, path, force=False): - if os.path.isdir(path): + if _is_non_empty_dir_with(path, '.git'): if not force: print("git pull origin master %s" % path) subprocess.check_call(['git', 'pull', 'origin', 'master'], @@ -266,7 +277,7 @@ def clone_hg(url, path, force=False): - if os.path.isdir(path): + if _is_non_empty_dir_with(path, '.hg'): if not force: print("hg pull -u %s" % path) subprocess.check_call(['hg', 'pull', '-u'], cwd=path) @@ -390,6 +401,7 @@ lmn = '%s (local)' % mn funcs.append((lmn, local_func)) + failed_installs = [] funcs = sorted(funcs, key=_get_install_func_priority, reverse=True) for name, func in funcs: print("Installing %s" % name) @@ -405,7 +417,11 @@ func(*f_args, **f_kwargs) except Exception as ex: print("ERROR: %s" % ex) - print("Aborting install.") + print("Skipping install of '%s'." % name) + failed_installs.append(name) + if failed_installs: + for name in failed_installs: + print("ERROR: failed to install '%s'." % name) def _get_install_func_priority(func_info):