From 59de5919ac93766a8ffaeee5f4f54fc5d5a5c536 Mon Sep 17 00:00:00 2001 From: Vanessa Sochat Date: Fri, 21 Jun 2019 14:21:36 -0400 Subject: [PATCH] adding build options argument Signed-off-by: Vanessa Sochat --- CHANGELOG.md | 1 + spython/main/build.py | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 96359ff9..6a7d4620 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ The client here will eventually be released as "spython" (and eventually to singularity on pypi), and the versions here will coincide with these releases. ## [master](https://github.com/singularityhub/singularity-cli/tree/master) + - adding additional options to build to support singularity-compose (0.0.68) - client should support shell (0.0.67) - adding test for entrypoint + cmd and fixing testing requirements (0.0.66) - fixing bug that inspect does not honor quiet (0.0.65) diff --git a/spython/main/build.py b/spython/main/build.py index b47587f6..2ba0640a 100644 --- a/spython/main/build.py +++ b/spython/main/build.py @@ -21,7 +21,8 @@ def build(self, recipe=None, ext='sif', sudo=True, stream=False, - force=False): + force=False, + options=None): '''build a singularity image, optionally for an isolated build (requires sudo). If you specify to stream, expect the image name @@ -44,13 +45,17 @@ def build(self, recipe=None, name (with "image") then a fun robot name will be generated instead. Highly recommended :) sudo: give sudo to the command (or not) default is True for build - + options: for all other options, specify them in this list. ''' from spython.utils import check_install check_install() cmd = self._init_command('build') + # If no extra options + if not options: + options = [] + if 'version 3' in self.version(): ext = 'sif' @@ -87,10 +92,10 @@ def build(self, recipe=None, if sandbox: cmd.append('--sandbox') - elif sandbox: + elif writable: cmd.append('--writable') - cmd = cmd + [image, recipe] + cmd = cmd + options + [image, recipe] if not stream: self._run_command(cmd, sudo=sudo, capture=False)