def build_dep(dep=None, deps_dir=None, channel='prod', specific_tags=False): repo = REPO_ROOT + dep target = os.path.join(deps_dir, dep) if os.path.exists(target): os.chdir(target) if is_git(): run('git fetch') else: run('hg pull') else: # let's try to detect the repo kind with a few heuristics if _is_git_repo(repo): run('git clone %s %s' % (repo, target)) else: run('hg clone %s %s' % (repo, target)) os.chdir(target) if has_changes(): if channel != 'dev': print('the code was changed, aborting!') sys.exit(0) else: print('Warning: the code was changed/') cmd = update_cmd(dep, channel, specific_tags) run(cmd) run('%s setup.py develop' % PYTHON)
def updating_repo(name, channel, specific_tags, force=False, timeout=60, verbose=False): if not force and has_changes(timeout, verbose) and channel != 'dev': print('The code was changed locally, aborting!') print('You can use --force but all uncommited ' 'changes will be discarded.') sys.exit(0) if is_git(): run('git submodule update') run(update_cmd(name, channel, specific_tags, force), timeout, verbose)
def build_dep(dep=None, deps_dir=None, channel='prod', specific_tags=False, timeout=300, verbose=False): # using REPO_ROOT if the provided dep is not an URL is_url = False for scheme in _REPO_SCHEMES: if dep.startswith(scheme): is_url = True break if not is_url: repo = REPO_ROOT + dep else: repo = dep target = os.path.join(deps_dir, os.path.basename(dep)) if os.path.exists(target): os.chdir(target) if is_git(): run('git fetch') else: run('hg pull') else: # let's try to detect the repo kind with a few heuristics if _is_git_repo(repo): run('git clone %s %s' % (repo, target)) else: run('hg clone %s %s' % (repo, target)) os.chdir(target) if has_changes(timeout, verbose): if channel != 'dev': print('The code was changed, aborting !') print('Use the dev channel if you change locally the code') sys.exit(0) else: print('Warning: the code was changed.') cmd = update_cmd(dep, channel, specific_tags) run(cmd, timeout, verbose) run('%s setup.py develop' % PYTHON, timeout, verbose)