示例#1
0
def get_conda_packages(packages=DEFAULT_PACKAGES, run_lambda=run):
    grep_cmd = get_grep_cmd(packages)
    conda = os.environ.get('CONDA_EXE', 'conda')
    out = run_and_read_all(run_lambda, conda + ' list | ' + grep_cmd)
    if out is None:
        return out
    # Comment starting at beginning of line
    comment_regex = re.compile(r'^#.*\n')
    return re.sub(comment_regex, '', out)
示例#2
0
def get_git_untracked(root_dir=_ROOT_DIR, git_dir=_ROOT_DIR):
    # Note that paths returned by git ls-files are relative to the script.
    return run_and_read_all(
        run, 'cd {:s} && git ls-files {:s} --exclude-standard --others'.format(
            root_dir, git_dir))
示例#3
0
def get_git_modifed(root_dir=_ROOT_DIR, git_dir=_ROOT_DIR):
    # Note that paths returned by git ls-files are relative to the script.
    return run_and_read_all(
        run, 'cd {:s} && git ls-files {:s} -m'.format(root_dir, git_dir))
示例#4
0
def get_git_rev(root_dir=_ROOT_DIR, first=8):
    git_rev = run_and_read_all(
        run, 'cd {:s} && git rev-parse HEAD'.format(root_dir))
    return git_rev[:first] if git_rev else git_rev
示例#5
0
def get_git_untracked(git_dir=None):
    git_dir = git_dir or get_root_dir()
    return run_and_read_all(
        run, 'git ls-files {:s} --exclude-standard --others'.format(git_dir))
示例#6
0
def get_git_modifed(git_dir=None):
    git_dir = git_dir or get_root_dir()
    return run_and_read_all(run, 'git ls-files {:s} -m'.format(git_dir))
示例#7
0
def get_git_rev(first=8):
    return run_and_read_all(run, 'git rev-parse HEAD')[:first]
示例#8
0
 def run_with_pip(pip):
     grep_cmd = get_grep_cmd(packages)
     return run_and_read_all(run_lambda, pip + ' list --format=freeze | ' + grep_cmd)