Skip to content

Commit a369914

Browse files
authored
šŸ“¦ļø Restore bids-validator installation in containerized C-PAC images (#2170)
2 parents 39507bd + d865870 commit a369914

File tree

4 files changed

+25
-7
lines changed

4 files changed

+25
-7
lines changed

ā€Ž.github/Dockerfiles/Ubuntu.jammy-non-free.Dockerfileā€Ž

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ FROM neurodebian:jammy-non-free
2929
LABEL org.opencontainers.image.description "NOT INTENDED FOR USE OTHER THAN AS A STAGE IMAGE IN A MULTI-STAGE BUILD \
3030
Ubuntu Jammy base image"
3131
LABEL org.opencontainers.image.source https://github.com/FCP-INDI/C-PAC
32-
ARG DEBIAN_FRONTEND=noninteractive
32+
ARG BIDS_VALIDATOR_VERSION=1.14.6 \
33+
DEBIAN_FRONTEND=noninteractive
3334
ENV TZ=America/New_York \
3435
PATH=$PATH:/.local/bin \
3536
PYTHONPATH=$PYTHONPATH:/.local/lib/python3.10/site-packages
@@ -61,7 +62,10 @@ RUN groupadd -r c-pac \
6162
&& echo $TZ > /etc/timezone \
6263
&& sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
6364
&& dpkg-reconfigure --frontend=noninteractive locales \
64-
&& update-locale LANG="en_US.UTF-8"
65+
&& update-locale LANG="en_US.UTF-8" \
66+
# # install bids-validator
67+
&& curl -fsSL https://raw.githubusercontent.com/tj/n/master/bin/n | bash -s lts \
68+
&& npm install -g "bids-validator@${BIDS_VALIDATOR_VERSION}"
6569

6670
COPY --from=c-pac_templates /cpac_templates /cpac_templates
6771
COPY --from=dcan-hcp /opt/dcan-tools/pipeline/global /opt/dcan-tools/pipeline/global

ā€ŽCHANGELOG.mdā€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2929
- Disabled variant image builds.
3030
- Made orientation configurable (was hard-coded as "RPI").
3131

32+
### Fixed
33+
34+
- Restored `bids-validator` functionality.
35+
3236
### Removed
3337

3438
- Variant image recipes.

ā€ŽCPAC/utils/tests/test_bids_utils.pyā€Ž

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Tests for bids_utils"""
22
import os
3+
from subprocess import run
4+
35
import pytest
46
import yaml
57
from CPAC.utils.bids_utils import bids_gen_cpac_sublist, \
@@ -45,7 +47,12 @@ def _prefix_entities(paths, path):
4547
])), 'w')
4648

4749

48-
@pytest.mark.parametrize('only_one_anat', [True, False])
50+
def test_bids_validator() -> None:
51+
"""Test subprocess call to `bids-validator`."""
52+
run(["bids-validator", "--version"], check=True)
53+
54+
55+
@pytest.mark.parametrize("only_one_anat", [True, False])
4956
def test_create_cpac_data_config_only_one_anat(tmp_path, only_one_anat):
5057
"""Function to test 'only_one_anat' parameter of
5158
'create_cpac_data_config' function"""

ā€ŽCPAC/utils/versioning/dependencies.pyā€Ž

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,12 @@ def requirements() -> dict:
119119

120120

121121
REPORTED = dict(sorted({
122-
**cli_version('ldd --version', formatting=first_line),
123-
'Python': sys.version.replace('\n', ' ').replace(' ', ' '),
124-
**cli_version('3dECM -help', delimiter='_',
125-
formatting=lambda _: last_line(_).split('{')[-1].rstrip('}'))
122+
**cli_version("bids-validator --version", dependency="bids-validator",
123+
in_result=False, formatting=first_line),
124+
**cli_version("ldd --version", formatting=first_line),
125+
"Python": sys.version.replace("\n", " ").replace(" ", " "),
126+
**cli_version("3dECM -help", delimiter="_",
127+
formatting=lambda _: last_line(_).split("{")[-1].rstrip("}"))
126128
}.items(), key=_version_sort))
129+
127130
REQUIREMENTS = requirements()

0 commit comments

Comments
Ā (0)