From 36740d90353c92e814917a0688764875fda49558 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 7 May 2019 00:22:20 -0400 Subject: Refactor: * Remove git.py * Replace duplicate code with simple wrapper * Add README.md * Add LICENSE.txt --- delivery_merge/conda.py | 9 +-------- delivery_merge/git.py | 11 ----------- delivery_merge/merge.py | 3 +-- delivery_merge/utils.py | 4 ++++ 4 files changed, 6 insertions(+), 21 deletions(-) delete mode 100644 delivery_merge/git.py (limited to 'delivery_merge') diff --git a/delivery_merge/conda.py b/delivery_merge/conda.py index 57d715e..709dbaf 100644 --- a/delivery_merge/conda.py +++ b/delivery_merge/conda.py @@ -71,11 +71,4 @@ def conda_env_load(env_name): def conda(*args): - command = ['conda'] - tmp = [] - for arg in args: - tmp += arg.split() - - command += tmp - print(f'Running: {" ".join(command)}') - return run(command, capture_output=True) + return sh('conda', *args) diff --git a/delivery_merge/git.py b/delivery_merge/git.py deleted file mode 100644 index 9e8aa6a..0000000 --- a/delivery_merge/git.py +++ /dev/null @@ -1,11 +0,0 @@ -from subprocess import run - -def git(*args): - command = ['git'] - tmp = [] - for arg in args: - tmp += arg.split() - - command += tmp - print(f'Running: {" ".join(command)}') - return run(command, capture_output=True) diff --git a/delivery_merge/merge.py b/delivery_merge/merge.py index e8a9ba1..457c433 100644 --- a/delivery_merge/merge.py +++ b/delivery_merge/merge.py @@ -2,8 +2,7 @@ import os import re import yaml from .conda import conda, conda_env_load -from .git import git -from .utils import pushd +from .utils import git, pushd from glob import glob from subprocess import run diff --git a/delivery_merge/utils.py b/delivery_merge/utils.py index 1dca224..2344a13 100644 --- a/delivery_merge/utils.py +++ b/delivery_merge/utils.py @@ -14,6 +14,10 @@ def sh(prog, *args): return run(command, capture_output=True) +def git(*args): + return sh('git', *args) + + def getenv(s): """ Convert string of key pairs to dictionary format """ -- cgit