Skip to content

Commit ec85590

Browse files
authored
add should return the container yaml (#584)
* add should return the container yaml Signed-off-by: vsoch <[email protected]>
1 parent f211d96 commit ec85590

File tree

6 files changed

+14
-7
lines changed

6 files changed

+14
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and **Merged pull requests**. Critical items to know are:
1414
The versions coincide with releases on pip. Only major versions will be released as tags on Github.
1515

1616
## [0.0.x](https://github.com/singularityhub/singularity-hpc/tree/main) (0.0.x)
17+
- Update add to return container yaml (0.1.11)
1718
- Fixing bug with writing package file in update (0.1.1)
1819
- Add support for remote registry and sync commands --all (0.1.0)
1920
- support for GitLab and GitHub remotes

setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def get_reqs(lookup=None, key="INSTALL_REQUIRES"):
4343
VERSION = lookup["__version__"]
4444
NAME = lookup["NAME"]
4545
AUTHOR = lookup["AUTHOR"]
46+
EMAIL = lookup["EMAIL"]
4647
PACKAGE_URL = lookup["PACKAGE_URL"]
4748
KEYWORDS = lookup["KEYWORDS"]
4849
DESCRIPTION = lookup["DESCRIPTION"]
@@ -69,6 +70,7 @@ def get_reqs(lookup=None, key="INSTALL_REQUIRES"):
6970
name=NAME,
7071
version=VERSION,
7172
author=AUTHOR,
73+
author_email=EMAIL,
7274
maintainer=AUTHOR,
7375
packages=find_packages(),
7476
include_package_data=True,

shpc/main/container/singularity.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def __init__(self):
4646

4747
def exists(self, module_name):
4848
"""
49-
A derivate of get to return boolean about container existence.
49+
A derivative of get to return boolean about container existence.
5050
"""
5151
# This can be the module or container directory
5252
container_dir = self.container_dir(module_name)
@@ -79,7 +79,7 @@ def add(self, module_name, image, config, container_yaml, **kwargs):
7979
"""
8080
Manually add a registry container, e.g., generating a container.yaml
8181
for an existing container file. container_yaml is the destination file.
82-
If it's already exisitng, it's loaded into config. Otherwise we are
82+
If it's already existing, it's loaded into config. Otherwise we are
8383
using a template config.
8484
"""
8585
if ":" not in module_name:
@@ -89,7 +89,7 @@ def add(self, module_name, image, config, container_yaml, **kwargs):
8989

9090
# Cut out early if the tag isn't latest, and we already have it
9191
# DO NOT call config.tags here, it will add an empty latest
92-
if tag != "latest" and tag in config._config["tags"]:
92+
if tag != "latest" and config._config and tag in config._config["tags"]:
9393
if not utils.confirm_action(
9494
"Tag %s already is defined, are you sure you want to overwrite it? "
9595
% tag
@@ -116,6 +116,7 @@ def add(self, module_name, image, config, container_yaml, **kwargs):
116116
"Registry entry %s was added! Before shpc install, edit:" % module_name
117117
)
118118
print(container_yaml)
119+
return container_yaml
119120

120121
def _add_local_image(self, name, tag, image, config, container_yaml, **kwargs):
121122
"""
@@ -380,7 +381,7 @@ def _pull_github(self, uri, dest=None):
380381
repo = "/".join(uri.split("/")[0:2])
381382
prefix = repo.replace("/", "-")
382383

383-
# The tag includes release and contianer tag (e.g., 0.0.1:latest)
384+
# The tag includes release and container tag (e.g., 0.0.1:latest)
384385
tag = uri.replace(repo, "", 1).strip("/")
385386
github_tag, container_tag = tag.split(":", 1)
386387

shpc/main/modules/base.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,9 @@ def add(self, image, module_name=None, **kwargs):
200200
config = container.ContainerConfig(
201201
registry.FilesystemResult(module_name, template), validate=False
202202
)
203-
self.container.add(module_name, image, config, container_yaml=dest, **kwargs)
203+
return self.container.add(
204+
module_name, image, config, container_yaml=dest, **kwargs
205+
)
204206

205207
def get(self, module_name, env_file=False):
206208
"""

shpc/main/registry/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def iter_registry(self, filter_string=None):
6262

6363
def find(self, name, path=None):
6464
"""
65-
Find the first occurance of a module.
65+
Find the first occurrence of a module.
6666
"""
6767
# Custom one-off path provided to load from
6868
if path:

shpc/version.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
__copyright__ = "Copyright 2021-2022, Vanessa Sochat"
33
__license__ = "MPL 2.0"
44

5-
__version__ = "0.1.1"
5+
__version__ = "0.1.11"
66
AUTHOR = "Vanessa Sochat"
7+
78
NAME = "singularity-hpc"
89
PACKAGE_URL = "https://github.com/singularityhub/singularity-hpc"
910
KEYWORDS = "singularity, containers, hpc, lmd"

0 commit comments

Comments
 (0)