Skip to content

Commit 0433d28

Browse files
authored
redo to close #187 and to close #188 (#195)
* redo to close #187 and to close #188 Signed-off-by: vsoch <[email protected]>
1 parent 6fb49da commit 0433d28

File tree

7 files changed

+75
-12
lines changed

7 files changed

+75
-12
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ The client here will eventually be released as "spython" (and eventually to
1717
singularity on pypi), and the versions here will coincide with these releases.
1818

1919
## [master](https://github.com/singularityhub/singularity-cli/tree/master)
20+
- parser bugfixes, arg from Docker not properly parsed (0.2.1)
2021
- version checks removed to support Singularity 3.x and above (0.2.0)
2122
- adding support for SIF (oras pull) (0.1.18)
2223
- updating CI/tests and fixing deprecations (warnings) (0.1.17)

setup.py

-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ def get_requirements(lookup=None):
104104
"Topic :: Software Development",
105105
"Topic :: Scientific/Engineering",
106106
"Operating System :: Unix",
107-
"Programming Language :: Python :: 2.7",
108107
"Programming Language :: Python :: 3",
109108
],
110109
entry_points={"console_scripts": ["spython=spython.client:main"]},

spython/main/parse/parsers/base.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,6 @@ def _replace_from_dict(self, string, args):
155155
string: the string with replacements made
156156
"""
157157
for key, value in args.items():
158-
if re.search(r"\$(" + key + r"|\{[^}]*\})", string):
159-
string = re.sub(r"\$(" + key + r"|\{[^}]*\})", value, string)
158+
if re.search("([$]" + key + "|[$][{]" + key + "[}])", string):
159+
string = re.sub("([$]" + key + "|[$]{" + key + "[}])", value, string)
160160
return string

spython/main/parse/writers/docker.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,16 @@ def validate_stage(self, parser):
7171
if parser.fromHeader is None:
7272
bot.exit("Dockerfile requires a fromHeader.")
7373

74-
# Parse the provided name
75-
uri_regexes = [_reduced_uri, _default_uri, _docker_uri]
74+
# Parse the provided name
75+
uri_regexes = [_reduced_uri, _default_uri, _docker_uri]
7676

77-
for r in uri_regexes:
78-
match = r.match(parser.fromHeader)
79-
if match:
80-
break
77+
for r in uri_regexes:
78+
match = r.match(parser.fromHeader)
79+
if match:
80+
break
8181

82-
if not match:
83-
bot.exit("FROM header %s not valid." % parser.fromHeader)
82+
if not match:
83+
bot.exit("FROM header %s not valid." % parser.fromHeader)
8484

8585
def convert(self, runscript="/bin/bash", force=False):
8686
"""convert is called by the parent class to convert the recipe object
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Bootstrap: docker
2+
From: nvidia/cuda:11.1.1-cudnn8-devel-ubuntu20.04
3+
Stage: spython-base
4+
5+
%files
6+
./requirements.txt /workspace
7+
%labels
8+
maintainer="Dong Wang"
9+
%post
10+
CUDA_VERSION=11.1.1
11+
OS_VERSION=20.04
12+
13+
14+
15+
16+
PATH="/root/miniconda3/bin:${PATH}"
17+
PATH="/root/miniconda3/bin:${PATH}"
18+
DEBIAN_FRONTEND=noninteractive
19+
20+
SHELL ["/bin/bash", "-c"]
21+
22+
apt-get update && apt-get upgrade -y &&\
23+
apt-get install -y wget python3-pip
24+
25+
python3 -m pip install --upgrade pip
26+
27+
cd /workspace
28+
python3 -m pip install -r /workspace/requirements.txt and &&\
29+
rm /workspace/requirements.txt
30+
31+
%environment
32+
export PATH="/root/miniconda3/bin:${PATH}"
33+
%runscript
34+
cd /workspace
35+
exec /bin/bash /bin/bash "$@"
36+
%startscript
37+
cd /workspace
38+
exec /bin/bash /bin/bash "$@"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
ARG CUDA_VERSION=11.1.1
2+
ARG OS_VERSION=20.04
3+
4+
FROM nvidia/cuda:${CUDA_VERSION}-cudnn8-devel-ubuntu${OS_VERSION}
5+
6+
LABEL maintainer="Dong Wang"
7+
8+
9+
ENV PATH="/root/miniconda3/bin:${PATH}"
10+
ARG PATH="/root/miniconda3/bin:${PATH}"
11+
ARG DEBIAN_FRONTEND=noninteractive
12+
13+
SHELL ["/bin/bash", "-c"]
14+
15+
RUN apt-get update && apt-get upgrade -y &&\
16+
apt-get install -y wget python3-pip
17+
18+
RUN python3 -m pip install --upgrade pip
19+
20+
WORKDIR /workspace
21+
ADD ./requirements.txt /workspace
22+
RUN python3 -m pip install -r /workspace/requirements.txt and &&\
23+
rm /workspace/requirements.txt
24+
25+
CMD ["/bin/bash"]

spython/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
66

77

8-
__version__ = "0.2.0"
8+
__version__ = "0.2.1"
99
AUTHOR = "Vanessa Sochat"
1010
AUTHOR_EMAIL = "[email protected]"
1111
NAME = "spython"

0 commit comments

Comments
 (0)