aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--LICENSE.txt29
-rw-r--r--README.md67
-rw-r--r--delivery_merge/conda.py9
-rw-r--r--delivery_merge/git.py11
-rw-r--r--delivery_merge/merge.py3
-rw-r--r--delivery_merge/utils.py4
6 files changed, 102 insertions, 21 deletions
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..fab45f8
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,29 @@
+BSD 3-Clause License
+
+Copyright (c) 2019, Association of Universities for Research in Astronomy (AURA)
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holder nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..943dd6a
--- /dev/null
+++ b/README.md
@@ -0,0 +1,67 @@
+# delivery_merge
+
+## What does it do?
+
+1. Install miniconda3 in the current working directory
+2. Create a new environment based on an explicit dump file
+3. Transpose packages listed in a `dmfile` into the new environment
+4. Generate a YAML and explicit dump of the new environment
+5. [optionally] Scan packages installed via `dmfile` and execute tests (if possible) inside the new environment
+
+## Where should I run this?
+
+Inside of a CI/CD pipeline.
+
+
+## Usage
+
+```
+usage: delivery_merge [-h] [--env-name ENV_NAME] --installer-version
+ INSTALLER_VERSION [--run-tests] --dmfile DMFILE
+ base_spec
+
+positional arguments:
+ base_spec
+
+optional arguments:
+ -h, --help show this help message and exit
+ --env-name ENV_NAME name of environment
+ --installer-version INSTALLER_VERSION
+ miniconda3 installer version
+ --run-tests
+ --dmfile DMFILE
+```
+
+## The dmfile
+
+Comment characters: `;` or `#`
+
+Line format: `{conda_package}[=<>]{version}`
+
+**Example:**
+
+```
+; This is a comment
+package_a=1.0.0
+package_b<=1.0.0
+package_c>=1.0.0 # This is also a comment
+package_d>1.0.0
+package_e<1.0.0
+```
+
+
+## Execution example
+
+```sh
+$ cat < EOF > hstdp-2019.3-py36.dm
+python=3.6
+numpy=1.16.3
+EOF
+$ git clone https://github.com/astroconda/astroconda-releases
+$ delivery_merge --env-name delivery \
+ --installer-version=4.5.12 \
+ --dmfile hstdp-2019.3-py36.dm \
+ astroconda-releases/hstdp/2019.2/latest-linux
+
+# >>> Actual output here <<<
+```
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
"""