Skip to content

Commit

Permalink
📦️ Restore bids-validator installation in containerized C-PAC images (
Browse files Browse the repository at this point in the history
  • Loading branch information
shnizzedy authored Dec 13, 2024
2 parents 39507bd + d865870 commit a369914
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
8 changes: 6 additions & 2 deletions .github/Dockerfiles/Ubuntu.jammy-non-free.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ FROM neurodebian:jammy-non-free
LABEL org.opencontainers.image.description "NOT INTENDED FOR USE OTHER THAN AS A STAGE IMAGE IN A MULTI-STAGE BUILD \
Ubuntu Jammy base image"
LABEL org.opencontainers.image.source https://github.com/FCP-INDI/C-PAC
ARG DEBIAN_FRONTEND=noninteractive
ARG BIDS_VALIDATOR_VERSION=1.14.6 \
DEBIAN_FRONTEND=noninteractive
ENV TZ=America/New_York \
PATH=$PATH:/.local/bin \
PYTHONPATH=$PYTHONPATH:/.local/lib/python3.10/site-packages
Expand Down Expand Up @@ -61,7 +62,10 @@ RUN groupadd -r c-pac \
&& echo $TZ > /etc/timezone \
&& sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
&& dpkg-reconfigure --frontend=noninteractive locales \
&& update-locale LANG="en_US.UTF-8"
&& update-locale LANG="en_US.UTF-8" \
# # install bids-validator
&& curl -fsSL https://raw.githubusercontent.com/tj/n/master/bin/n | bash -s lts \
&& npm install -g "bids-validator@${BIDS_VALIDATOR_VERSION}"

COPY --from=c-pac_templates /cpac_templates /cpac_templates
COPY --from=dcan-hcp /opt/dcan-tools/pipeline/global /opt/dcan-tools/pipeline/global
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Disabled variant image builds.
- Made orientation configurable (was hard-coded as "RPI").

### Fixed

- Restored `bids-validator` functionality.

### Removed

- Variant image recipes.
Expand Down
9 changes: 8 additions & 1 deletion CPAC/utils/tests/test_bids_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Tests for bids_utils"""
import os
from subprocess import run

import pytest
import yaml
from CPAC.utils.bids_utils import bids_gen_cpac_sublist, \
Expand Down Expand Up @@ -45,7 +47,12 @@ def _prefix_entities(paths, path):
])), 'w')


@pytest.mark.parametrize('only_one_anat', [True, False])
def test_bids_validator() -> None:
"""Test subprocess call to `bids-validator`."""
run(["bids-validator", "--version"], check=True)


@pytest.mark.parametrize("only_one_anat", [True, False])
def test_create_cpac_data_config_only_one_anat(tmp_path, only_one_anat):
"""Function to test 'only_one_anat' parameter of
'create_cpac_data_config' function"""
Expand Down
11 changes: 7 additions & 4 deletions CPAC/utils/versioning/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,12 @@ def requirements() -> dict:


REPORTED = dict(sorted({
**cli_version('ldd --version', formatting=first_line),
'Python': sys.version.replace('\n', ' ').replace(' ', ' '),
**cli_version('3dECM -help', delimiter='_',
formatting=lambda _: last_line(_).split('{')[-1].rstrip('}'))
**cli_version("bids-validator --version", dependency="bids-validator",
in_result=False, formatting=first_line),
**cli_version("ldd --version", formatting=first_line),
"Python": sys.version.replace("\n", " ").replace(" ", " "),
**cli_version("3dECM -help", delimiter="_",
formatting=lambda _: last_line(_).split("{")[-1].rstrip("}"))
}.items(), key=_version_sort))

REQUIREMENTS = requirements()

0 comments on commit a369914

Please sign in to comment.