From de874b02661f59ef4e99f18272883a13a4d55f16 Mon Sep 17 00:00:00 2001 From: jdhughes-usgs Date: Thu, 11 Jun 2020 11:26:15 -0400 Subject: [PATCH] refactor(make-release): Software citation developed from version.py Closes #727 --- README.md | 4 ++-- flopy/version.py | 4 ++-- release/make-release.py | 39 ++++++++++++++++++++++++++------------- 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index f1069fcc8a..a303bf9921 100644 --- a/README.md +++ b/README.md @@ -216,11 +216,11 @@ How to Cite ##### ***Citation for FloPy:*** -[Bakker, M., Post, V., Langevin, C. D., Hughes, J. D., White, J. T., Starn, J. J. and Fienen, M. N., 2016, Scripting MODFLOW Model Development Using Python and FloPy: Groundwater, v. 54, p. 733–739, doi:10.1111/gwat.12413.](http://dx.doi.org/10.1111/gwat.12413) +[Bakker, Mark, Post, Vincent, Langevin, C. D., Hughes, J. D., White, J. T., Starn, J. J. and Fienen, M. N., 2016, Scripting MODFLOW Model Development Using Python and FloPy: Groundwater, v. 54, p. 733–739, doi:10.1111/gwat.12413.](http://dx.doi.org/10.1111/gwat.12413) ##### ***Software/Code citation for FloPy:*** -[Bakker, M., Post, V., Langevin, C. D., Hughes, J. D., White, J. T., Leaf, A. T., Paulinski, S. R., Larsen, J. D., Toews, M. W., Morway, E. D., Bellino, J. C., Starn, J. J., and Fienen, M. N., 2019, FloPy v3.3.1 — release candidate: U.S. Geological Survey Software Release, 15 December 2019, http://dx.doi.org/10.5066/F7BK19FH](http://dx.doi.org/10.5066/F7BK19FH) +[Bakker, Mark, Post, Vincent, Langevin, C. D., Hughes, J. D., White, J. T., Leaf, A. T., Paulinski, S. R., Larsen, J. D., Toews, M. W., Morway, E. D., Bellino, J. C., Starn, J. J., and Fienen, M. N., 2020, FloPy v3.3.1 — release candidate: U.S. Geological Survey Software Release, 11 June 2020, http://dx.doi.org/10.5066/F7BK19FH](http://dx.doi.org/10.5066/F7BK19FH) MODFLOW Resources diff --git a/flopy/version.py b/flopy/version.py index 151c5c2efa..6ab4b5b62f 100644 --- a/flopy/version.py +++ b/flopy/version.py @@ -1,5 +1,5 @@ # flopy version file automatically created using...make-release.py -# created on...May 26, 2020 17:16:58 +# created on...June 11, 2020 11:16:17 major = 3 minor = 3 @@ -21,7 +21,7 @@ 'Michael W. Toews': 'M.Toews@gns.cri.nz', 'Eric D. Morway': 'emorway@usgs.gov', 'Jason C. Bellino': 'jbellino@usgs.gov', - 'Jeffrey Starn': 'jjstarn@usgs.gov', + 'Jon Jeffrey Starn': 'jjstarn@usgs.gov', 'Michael N. Fienen': 'mnfienen@usgs.gov', } __author__ = ', '.join(author_dict.keys()) diff --git a/release/make-release.py b/release/make-release.py index 3fe3a99e52..c357a676ba 100644 --- a/release/make-release.py +++ b/release/make-release.py @@ -1,6 +1,5 @@ #!/usr/bin/python -from __future__ import print_function import subprocess import os import sys @@ -27,15 +26,18 @@ pak = 'flopy' -# authors list for Software/Code citation for FloPy -# author should be defined LastName FirstName MiddleInitial -# MiddleInitial can be absent. Use spaces instead of commas to separate -# LastName, FirstName, and MiddleInitial. -authors = ['Bakker Mark', 'Post Vincent', 'Langevin Christian D', - 'Hughes Joseph D', 'White Jeremy T', 'Leaf Andrew T', - 'Paulinski Scott R', 'Larsen Joshua D', 'Toews Michael W', - 'Morway Eric D', 'Bellino Jason C', 'Starn Jeffrey J', - 'Fienen Michael N'] +# local import of package variables in flopy/version.py +# imports author_dict +exec(open(os.path.join("..", "flopy", "version.py")).read()) + +# build authors list for Software/Code citation for FloPy +authors = [] +for key in author_dict.keys(): + t = key.split() + author = '{}'.format(t[-1]) + for str in t[0:-1]: + author += ' {}'.format(str) + authors.append(author) approved = '''Disclaimer ---------- @@ -130,6 +132,7 @@ def get_software_citation(version, is_approved): sb = '' if not is_approved: sb = ' — release candidate' + # format author names line = '[' for ipos, author in enumerate(authors): if ipos > 0: @@ -137,10 +140,19 @@ def get_software_citation(version, is_approved): if ipos == len(authors) - 1: line += 'and ' sv = author.split() - tauthor = '{}, {}.'.format(sv[0], sv[1][0]) - if len(sv) > 2: - tauthor += ' {}.'.format(sv[2][0]) + tauthor = '{}'.format(sv[0]) + if len(sv) < 3: + gname = sv[1] + if len(gname) > 1: + tauthor += ', {}'.format(gname) + else: + tauthor += ', {}.'.format(gname[0]) + else: + tauthor += ', {}. {}.'.format(sv[1][0], sv[2][0]) + # add formatted author name to line line += tauthor + + # add the rest of the citation line += ', {}, '.format(now.year) + \ 'FloPy v{}{}: '.format(version, sb) + \ 'U.S. Geological Survey Software Release, ' + \ @@ -443,3 +455,4 @@ def update_USGSmarkdown(vmajor, vminor, vmicro): if __name__ == "__main__": update_version() + get_software_citation('3.1.1', True) \ No newline at end of file