From 6e0bf44dba96fbc643d127702f7d4de0c9d32b23 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Mon, 27 May 2019 13:27:51 +0200 Subject: [PATCH 1/2] Don't check for existance of destination files/folders Aso warn for * path expansion (currently unsupported by singularity) --- CHANGELOG.md | 1 + spython/main/parse/docker.py | 26 ++++++++++++-------------- spython/version.py | 2 +- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76e8fef1..ca4a13d5 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) + - fixing warning for files, only relevant for sources (0.0.59) - deprecating pulling by commit or hash, not supported for Singularity (0.0.58) - export command added back, points to build given Singularity 3.x+ - print but with logger, should be println (0.0.57) diff --git a/spython/main/parse/docker.py b/spython/main/parse/docker.py index 860a5110..c99be13a 100644 --- a/spython/main/parse/docker.py +++ b/spython/main/parse/docker.py @@ -199,21 +199,19 @@ def _add_files(self, source, dest): dest: the destiation ''' - # Create data structure to iterate over - - paths = {'source': source, - 'dest': dest} - - for pathtype, path in paths.items(): - if path == ".": - paths[pathtype] = os.getcwd() - - # Warning if doesn't exist - if not os.path.exists(path): - bot.warning("%s doesn't exist, ensure exists for build" %path) - + def expandPath(path): + return os.getcwd() if path == "." else path + + # Warn the user Singularity doesn't support expansion + if source.contains('*'): + bot.warning("Singularity doesn't support expansion, * found in %s" % source) + + # Warning if file/folder (src) doesn't exist + if not os.path.exists(source): + bot.warning("%s doesn't exist, ensure exists for build" % source) + # The pair is added to the files as a list - self.files.append([paths['source'], paths['dest']]) + self.files.append([expandPath(source), expandPath(dest)]) def _parse_http(self, url, dest): diff --git a/spython/version.py b/spython/version.py index 9a6c83de..fa2b936a 100644 --- a/spython/version.py +++ b/spython/version.py @@ -6,7 +6,7 @@ # with this file, You can obtain one at http://mozilla.org/MPL/2.0/. -__version__ = "0.0.58" +__version__ = "0.0.59" AUTHOR = 'Vanessa Sochat' AUTHOR_EMAIL = 'vsochat@stanford.edu' NAME = 'spython' From 0e8c886cd123432aa1fbf4b8b908aa91c735d11f Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Mon, 27 May 2019 13:31:10 +0200 Subject: [PATCH 2/2] Add missing import --- spython/main/parse/converters.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spython/main/parse/converters.py b/spython/main/parse/converters.py index ef3f2fa1..af77d276 100644 --- a/spython/main/parse/converters.py +++ b/spython/main/parse/converters.py @@ -11,6 +11,8 @@ import re import sys +from spython.logger import bot + # Singularity to Dockerfile # Easier, parsed line by line