Skip to content

Commit

Permalink
fix: update fMRIPrep version in bibliography at run time
Browse files Browse the repository at this point in the history
  • Loading branch information
oesteban committed Mar 7, 2022
1 parent e476163 commit 13d16af
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
1 change: 0 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ jobs:
echo "them to your fork with ``git push origin --tags``"
fi
sed -i -E "s/(__version__ = )'[A-Za-z0-9.-]+'/\1'${CIRCLE_TAG:-$THISVERSION}'/" wrapper/fmriprep_docker.py
sed -i "s/title = {FMRIPrep}/title = {FMRIPrep ${CIRCLE_TAG:-$THISVERSION}}/" fmriprep/data/boilerplate.bib
# Build docker image
e=1 && for i in {1..5}; do
docker build --rm \
Expand Down
13 changes: 8 additions & 5 deletions fmriprep/cli/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,21 @@ def build_boilerplate(config_file, workflow):
citation_files["md"].write_text(boilerplate)

if not config.execution.md_only_boilerplate and citation_files["md"].exists():
from pathlib import Path
from subprocess import check_call, CalledProcessError, TimeoutExpired
from pkg_resources import resource_filename as pkgrf
from shutil import copyfile

bib_text = Path(pkgrf("fmriprep", "data/boilerplate.bib")).read_text()
citation_files["bib"].write_text(
bib_text.replace("fMRIPrep <version>", f"fMRIPrep {config.environment.version}")
)

# Generate HTML file resolving citations
cmd = [
"pandoc",
"-s",
"--bibliography",
pkgrf("fmriprep", "data/boilerplate.bib"),
str(citation_files["bib"]),
"--citeproc",
"--metadata",
'pagetitle="fMRIPrep citation boilerplate"',
Expand All @@ -212,7 +217,7 @@ def build_boilerplate(config_file, workflow):
"pandoc",
"-s",
"--bibliography",
pkgrf("fmriprep", "data/boilerplate.bib"),
str(citation_files["bib"]),
"--natbib",
str(citation_files["md"]),
"-o",
Expand All @@ -227,5 +232,3 @@ def build_boilerplate(config_file, workflow):
config.loggers.cli.warning(
"Could not generate CITATION.tex file:\n%s", " ".join(cmd)
)
else:
copyfile(pkgrf("fmriprep", "data/boilerplate.bib"), citation_files["bib"])
2 changes: 1 addition & 1 deletion fmriprep/data/boilerplate.bib
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ @article{fmriprep1

@article{fmriprep2,
author = {Esteban, Oscar and Blair, Ross and Markiewicz, Christopher J. and Berleant, Shoshana L. and Moodie, Craig and Ma, Feilong and Isik, Ayse Ilkay and Erramuzpe, Asier and Kent, James D. andGoncalves, Mathias and DuPre, Elizabeth and Sitek, Kevin R. and Gomez, Daniel E. P. and Lurie, Daniel J. and Ye, Zhifang and Poldrack, Russell A. and Gorgolewski, Krzysztof J.},
title = {fMRIPrep},
title = {fMRIPrep <version>},
year = 2018,
doi = {10.5281/zenodo.852659},
publisher = {Zenodo},
Expand Down

0 comments on commit 13d16af

Please sign in to comment.