Skip to content

Commit

Permalink
replace 'singularity' occurences with 'apptainer' in container suppor…
Browse files Browse the repository at this point in the history
…t for Apptainer + bump copyright to 2023

Co-authored-by: Simon Branford <[email protected]>
  • Loading branch information
boegel and branfosj authored Apr 9, 2023
1 parent b541440 commit f7654c4
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions easybuild/tools/containers/apptainer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022-2022 Ghent University
# Copyright 2022-2023 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
Expand Down Expand Up @@ -59,7 +59,7 @@ def apptainer_version():
return res.group(0)

def build_image(self, recipe_path):
"""Build container image by calling out to 'sudo singularity build'."""
"""Build container image by calling out to 'sudo apptainer build'."""

cont_path = container_path()
def_file = os.path.basename(recipe_path)
Expand Down Expand Up @@ -98,15 +98,15 @@ def build_image(self, recipe_path):
raise EasyBuildError("Container image already exists at %s, not overwriting it without --force",
img_path)

# resolve full path to 'singularity' binary, since it may not be available via $PATH under sudo...
singularity = which('apptainer')
# resolve full path to 'apptainer' binary, since it may not be available via $PATH under sudo...
apptainer = which('apptainer')
cmd_env = ''

singularity_tmpdir = self.tmpdir
if singularity_tmpdir:
cmd_env += 'APPTAINER_TMPDIR=%s' % singularity_tmpdir
apptainer_tmpdir = self.tmpdir
if apptainer_tmpdir:
cmd_env += 'APPTAINER_TMPDIR=%s' % apptainer_tmpdir

cmd = ' '.join(['sudo', cmd_env, singularity, 'build', cmd_opts, img_path, recipe_path])
cmd = ' '.join(['sudo', cmd_env, apptainer, 'build', cmd_opts, img_path, recipe_path])
print_msg("Running '%s', you may need to enter your 'sudo' password..." % cmd)
run_cmd(cmd, stream_output=True)
print_msg("Apptainer image created at %s" % img_path, log=self.log)

0 comments on commit f7654c4

Please sign in to comment.