Skip to content

Commit be411d7

Browse files
authored
Merge pull request #1567 from yarikoptic/enh-consistent-citation
ENH: remove all prior existing citation files first
2 parents 07ee316 + 38cfd77 commit be411d7

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

.zenodo.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@
106106
"affiliation": "University College London",
107107
"orcid": "0000-0002-9699-9052"
108108
},
109+
{
110+
"name": "Halchenko, Yaroslav O.",
111+
"affiliation": "Dartmouth College: Hanover, NH, United States",
112+
"orcid": "0000-0003-3456-2493"
113+
},
109114
{
110115
"name": "Poldrack, Russell A.",
111116
"affiliation": "Department of Psychology, Stanford University",

fmriprep/cli/run.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,18 @@ def build_workflow(opts, retval):
786786
boilerplate = retval['workflow'].visit_desc()
787787

788788
if boilerplate:
789-
(logs_path / 'CITATION.md').write_text(boilerplate)
789+
# To please git-annex users and also to guarantee consistency
790+
# among different renderings of the same file, first remove any
791+
# existing one
792+
citation_files = {
793+
ext: logs_path / ('CITATION.%s' % ext)
794+
for ext in ('bib', 'tex', 'md', 'html')
795+
}
796+
for citation_file in citation_files.values():
797+
if citation_file.exists() or citation_file.is_symlink():
798+
citation_file.unlink()
799+
800+
citation_files['md'].write_text(boilerplate)
790801
logger.log(25, 'Works derived from this fMRIPrep execution should '
791802
'include the following boilerplate:\n\n%s', boilerplate)
792803

@@ -795,8 +806,8 @@ def build_workflow(opts, retval):
795806
pkgrf('fmriprep', 'data/boilerplate.bib'),
796807
'--filter', 'pandoc-citeproc',
797808
'--metadata', 'pagetitle="fMRIPrep citation boilerplate"',
798-
str(logs_path / 'CITATION.md'),
799-
'-o', str(logs_path / 'CITATION.html')]
809+
str(citation_files['md']),
810+
'-o', str(citation_files['html'])]
800811
try:
801812
check_call(cmd, timeout=10)
802813
except (FileNotFoundError, CalledProcessError, TimeoutExpired):
@@ -806,16 +817,16 @@ def build_workflow(opts, retval):
806817
# Generate LaTex file resolving citations
807818
cmd = ['pandoc', '-s', '--bibliography',
808819
pkgrf('fmriprep', 'data/boilerplate.bib'),
809-
'--natbib', str(logs_path / 'CITATION.md'),
810-
'-o', str(logs_path / 'CITATION.tex')]
820+
'--natbib', str(citation_files['md']),
821+
'-o', str(citation_files['tex'])]
811822
try:
812823
check_call(cmd, timeout=10)
813824
except (FileNotFoundError, CalledProcessError, TimeoutExpired):
814825
logger.warning('Could not generate CITATION.tex file:\n%s',
815826
' '.join(cmd))
816827
else:
817828
copyfile(pkgrf('fmriprep', 'data/boilerplate.bib'),
818-
(logs_path / 'CITATION.bib'))
829+
citation_files['bib'])
819830

820831
return retval
821832

0 commit comments

Comments
 (0)