def setup_develop_repos(repo_dirs): """ Run python installs """ for repodir in repo_dirs: print('Installing: ' + repodir) mu.cd(repodir) assert exists('setup.py'), 'cannot setup a nonpython repo' mu.cmd('python setup.py develop')
def checkout_repos(repo_urls, repo_dirs=None, checkout_dir=None): """ Checkout every repo in repo_urls into checkout_dir """ # Check out any repo you dont have if checkout_dir is not None: repo_dirs = mu.get_repo_dirs(checkout_dir) assert repo_dirs is not None, 'specify checkout dir or repo_dirs' for repodir, repourl in zip(repo_dirs, repo_urls): print('[git] checkexist: ' + repodir) if not exists(repodir): mu.cd(dirname(repodir)) mu.cmd('git clone ' + repourl)
def pull_repos(repo_dirs, repos_with_submodules=[]): for repodir in repo_dirs: print('Pulling: ' + repodir) mu.cd(repodir) assert exists('.git'), 'cannot pull a nongit repo' mu.cmd('git pull') reponame = split(repodir)[1] if reponame in repos_with_submodules or\ repodir in repos_with_submodules: repos_with_submodules mu.cmd('git submodule init') mu.cmd('git submodule update')
def main(): # sudo apt-get install -y exuberant-ctags if sys.platform.startswith("win32"): try: ensure_ctags_win32() except Exception: print("failed to get ctags.exe for win32") pass PULL = "--pull" in sys.argv BUNDLE_DPATH = util_git1.BUNDLE_DPATH ensuredir(BUNDLE_DPATH) VIM_REPOS_WITH_SUBMODULES = util_git1.VIM_REPOS_WITH_SUBMODULES VIM_REPO_URLS = util_git1.VIM_REPO_URLS VIM_REPO_DIRS = util_git1.get_repo_dirs(VIM_REPO_URLS, BUNDLE_DPATH) # All modules in the bundle dir (even if not listed) BUNDLE_DIRS = [join(BUNDLE_DPATH, name) for name in os.listdir(BUNDLE_DPATH)] cd(BUNDLE_DPATH) util_git1.checkout_repos(VIM_REPO_URLS, VIM_REPO_DIRS) __NOT_GIT_REPOS__ = [] __BUNDLE_REPOS__ = [] for repodir in BUNDLE_DIRS: # Mark which repos do not have .git dirs if not util_git1.is_gitrepo(repodir): __NOT_GIT_REPOS__.append(repodir) else: __BUNDLE_REPOS__.append(repodir) if PULL: util_git1.pull_repos(__BUNDLE_REPOS__, VIM_REPOS_WITH_SUBMODULES) ensure_nongit_plugins() # Print suggestions for removing nonbundle repos if len(__NOT_GIT_REPOS__) > 0: print("Please fix these nongit repos: ") print("\n".join(__NOT_GIT_REPOS__)) print("maybe like this: ") clutterdir = util_git1.unixpath("~/local/vim/vimfiles/clutter") suggested_cmds = ["mkdir " + clutterdir] + [ "mv " + util_git1.unixpath(dir_) + " " + clutterdir for dir_ in __NOT_GIT_REPOS__ ] print("\n".join(suggested_cmds))
def main(): # sudo apt-get install -y exuberant-ctags if sys.platform.startswith('win32'): try: ensure_ctags_win32() except Exception: print('failed to get ctags.exe for win32') pass PULL = '--pull' in sys.argv BUNDLE_DPATH = util_git1.BUNDLE_DPATH ensuredir(BUNDLE_DPATH) VIM_REPOS_WITH_SUBMODULES = util_git1.VIM_REPOS_WITH_SUBMODULES VIM_REPO_URLS = util_git1.VIM_REPO_URLS VIM_REPO_DIRS = util_git1.get_repo_dirs(VIM_REPO_URLS, BUNDLE_DPATH) # All modules in the bundle dir (even if not listed) BUNDLE_DIRS = [join(BUNDLE_DPATH, name) for name in os.listdir(BUNDLE_DPATH)] cd(BUNDLE_DPATH) util_git1.checkout_repos(VIM_REPO_URLS, VIM_REPO_DIRS) __NOT_GIT_REPOS__ = [] __BUNDLE_REPOS__ = [] for repodir in BUNDLE_DIRS: # Mark which repos do not have .git dirs if not util_git1.is_gitrepo(repodir): __NOT_GIT_REPOS__.append(repodir) else: __BUNDLE_REPOS__.append(repodir) if PULL: util_git1.pull_repos(__BUNDLE_REPOS__, VIM_REPOS_WITH_SUBMODULES) ensure_nongit_plugins() # Print suggestions for removing nonbundle repos if len(__NOT_GIT_REPOS__) > 0: print('Please fix these nongit repos: ') print('\n'.join(__NOT_GIT_REPOS__)) print('maybe like this: ') clutterdir = util_git1.unixpath('~/local/vim/vimfiles/clutter') suggested_cmds = ( ['mkdir ' + clutterdir] + ['mv ' + util_git1.unixpath(dir_) + ' ' + clutterdir for dir_ in __NOT_GIT_REPOS__]) print('\n'.join(suggested_cmds))
def main(): # sudo apt-get install -y exuberant-ctags if sys.platform.startswith('win32'): try: ensure_ctags_win32() except Exception: print('failed to get ctags.exe for win32') pass import REPOS1 import util_git1 from meta_util_git1 import get_repo_dirs from meta_util_git1 import cd BUNDLE_DPATH = REPOS1.BUNDLE_DPATH ensuredir(BUNDLE_DPATH) VIM_REPOS_WITH_SUBMODULES = REPOS1.VIM_REPOS_WITH_SUBMODULES VIM_REPO_URLS = REPOS1.VIM_REPO_URLS VIM_REPO_DIRS = get_repo_dirs(VIM_REPO_URLS, BUNDLE_DPATH) # All modules in the bundle dir (even if not listed) import os BUNDLE_DIRS = [join(BUNDLE_DPATH, name) for name in os.listdir(BUNDLE_DPATH)] cd(BUNDLE_DPATH) print('VIM_REPO_DIRS = {!r}'.format(VIM_REPO_DIRS)) print('VIM_REPO_URLS = {!r}'.format(VIM_REPO_URLS)) # util_git1.checkout_repos(VIM_REPO_URLS, VIM_REPO_DIRS) import ubelt as ub for repodir, repourl in zip(VIM_REPO_DIRS, VIM_REPO_URLS): print('[git] checkexist: ' + repodir) if not exists(repodir): cd(dirname(repodir)) ub.cmd('git clone ' + repourl, verbose=3) __NOT_GIT_REPOS__ = [] __BUNDLE_REPOS__ = [] for repodir in BUNDLE_DIRS: # Mark which repos do not have .git dirs if not util_git1.is_gitrepo(repodir): __NOT_GIT_REPOS__.append(repodir) else: __BUNDLE_REPOS__.append(repodir) if ub.argflag('--pull'): util_git1.pull_repos(__BUNDLE_REPOS__, VIM_REPOS_WITH_SUBMODULES) ensure_nongit_plugins() # Print suggestions for removing nonbundle repos if len(__NOT_GIT_REPOS__) > 0: print('Please fix these nongit repos: ') print('\n'.join(__NOT_GIT_REPOS__)) print('maybe like this: ') clutterdir = util_git1.unixpath('~/local/vim/vimfiles/clutter') suggested_cmds = ( ['mkdir ' + clutterdir] + ['mv ' + util_git1.unixpath(dir_) + ' ' + clutterdir for dir_ in __NOT_GIT_REPOS__]) print('\n'.join(suggested_cmds)) # Hack for nerd fonts # """ # cd ~/local/vim/vimfiles/bundle # # git clone https://github.com/ryanoasis/nerd-fonts.git --depth 1 # https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Inconsolata/complete/Inconsolata%20Nerd%20Font%20Complete.otf # https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/Inconsolata/complete/Inconsolata%20Nerd%20Font%20Complete.otf # """ # HACK FOR JEDI import os for repo in VIM_REPOS_WITH_SUBMODULES: cd(join(BUNDLE_DPATH, repo)) command = 'git submodule update --init --recursive' try: import ubelt as ub ub.cmd(command, verbose=2) except Exception: os.system(command)
def main(): # sudo apt-get install -y exuberant-ctags if sys.platform.startswith('win32'): try: ensure_ctags_win32() except Exception: print('failed to get ctags.exe for win32') pass PULL = '--pull' in sys.argv BUNDLE_DPATH = util_git1.BUNDLE_DPATH ensuredir(BUNDLE_DPATH) VIM_REPOS_WITH_SUBMODULES = util_git1.VIM_REPOS_WITH_SUBMODULES VIM_REPO_URLS = util_git1.VIM_REPO_URLS VIM_REPO_DIRS = util_git1.get_repo_dirs(VIM_REPO_URLS, BUNDLE_DPATH) # All modules in the bundle dir (even if not listed) import os BUNDLE_DIRS = [join(BUNDLE_DPATH, name) for name in os.listdir(BUNDLE_DPATH)] cd(BUNDLE_DPATH) util_git1.checkout_repos(VIM_REPO_URLS, VIM_REPO_DIRS) __NOT_GIT_REPOS__ = [] __BUNDLE_REPOS__ = [] for repodir in BUNDLE_DIRS: # Mark which repos do not have .git dirs if not util_git1.is_gitrepo(repodir): __NOT_GIT_REPOS__.append(repodir) else: __BUNDLE_REPOS__.append(repodir) if PULL: util_git1.pull_repos(__BUNDLE_REPOS__, VIM_REPOS_WITH_SUBMODULES) ensure_nongit_plugins() # Print suggestions for removing nonbundle repos if len(__NOT_GIT_REPOS__) > 0: print('Please fix these nongit repos: ') print('\n'.join(__NOT_GIT_REPOS__)) print('maybe like this: ') clutterdir = util_git1.unixpath('~/local/vim/vimfiles/clutter') suggested_cmds = ( ['mkdir ' + clutterdir] + ['mv ' + util_git1.unixpath(dir_) + ' ' + clutterdir for dir_ in __NOT_GIT_REPOS__]) print('\n'.join(suggested_cmds)) # Hack for nerd fonts # """ # cd ~/local/vim/vimfiles/bundle # # git clone https://github.com/ryanoasis/nerd-fonts.git --depth 1 # https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Inconsolata/complete/Inconsolata%20Nerd%20Font%20Complete.otf # https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/Inconsolata/complete/Inconsolata%20Nerd%20Font%20Complete.otf # """ # HACK FOR JEDI import os for repo in VIM_REPOS_WITH_SUBMODULES: cd(join(BUNDLE_DPATH, repo)) command = 'git submodule update --init --recursive' try: import ubelt as ub ub.cmd(command, verbout=1, verbose=2) except Exception: os.system(command)