Skip to content

Commit

Permalink
singularity build: automatically try fakeroot mode if proot is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-c committed Dec 5, 2023
1 parent 9d7eacb commit 7e1b082
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cwltool/singularity.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,13 @@ def get_image(
file.write(singularityfile)

Check warning on line 186 in cwltool/singularity.py

View check run for this annotation

Codecov / codecov/patch

cwltool/singularity.py#L186

Added line #L186 was not covered by tests

os.environ["APPTAINER_TMPDIR"] = absolute_path
Client.build(recipe=singularityfile_path, build_folder=absolute_path, sudo=False)
singularity_options = ["--fakeroot"] if not shutil.which("proot") else []
Client.build(

Check warning on line 190 in cwltool/singularity.py

View check run for this annotation

Codecov / codecov/patch

cwltool/singularity.py#L188-L190

Added lines #L188 - L190 were not covered by tests
recipe=singularityfile_path,
build_folder=absolute_path,
sudo=False,
options=singularity_options,
)
found = True

Check warning on line 196 in cwltool/singularity.py

View check run for this annotation

Codecov / codecov/patch

cwltool/singularity.py#L196

Added line #L196 was not covered by tests
elif "dockerImageId" not in dockerRequirement and "dockerPull" in dockerRequirement:
match = re.search(pattern=r"([a-z]*://)", string=dockerRequirement["dockerPull"])
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ passenv =
GITHUB_*
PROOT_NO_SECCOMP
APPTAINER_TMPDIR
SINGULARITY_FAKEROOT

extras =
py3{8,9,10,11,12}-unit: deps
Expand Down

0 comments on commit 7e1b082

Please sign in to comment.