From 23fd12701a0e61c2a4ce624317395848665d4aba Mon Sep 17 00:00:00 2001 From: Kristin Date: Mon, 31 Aug 2020 15:49:43 -0700 Subject: [PATCH 1/5] Add script to create AUTHORS.rst from .zenodo.json and update AUTHORS.rst --- AUTHORS.rst | 119 +++++++++++++++--------------- isis/scripts/zenodo_to_authors.py | 34 +++++++++ 2 files changed, 92 insertions(+), 61 deletions(-) create mode 100644 isis/scripts/zenodo_to_authors.py diff --git a/AUTHORS.rst b/AUTHORS.rst index 23124c7c1e..9040c3485e 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -1,67 +1,64 @@ ISIS3 Contributors ================== -- Aaron Curtis -- Adam Goins -- Adam Paquette -- Andrew Annex -- Andrew Stebenne -- Austin Sanders -- B. Seignovert -- Christopher Austin -- Christopher Ryan Combs Jr -- Cole Neubauer -- Curtis Rose -- David Miller -- Debbie Cook -- Ella Mae Lee -- Elpitha Howington-Kraus +- Jason Laura +- Jesse Mapel +- Kristin Berry +- Kaitlyn Lee +- Kelvin Rodriguez +- Stuart Sides +- Adam Paquette +- Kaj Williams +- Austin Sanders +- Lauren Adoram-Kershner +- John Shinaman +- Lynn Weller +- Evin Dunn +- Tim Giroux +- Tracie Sucharski +- Jeanie Backer +- Adam Goins +- Makayla Shepard +- Christopher Combs +- Debbie Cook +- Kris Becker +- Summer Stapleton +- Cole Neubauer +- Tyler Wilson +- Aaron Giroux +- Moses Milazzo +- Ross Beyer +- Elpitha Howington-Kraus +- Kenneth Edmundson +- Raad Saleh +- Oleg Alexandrov +- Aaron Curtis - Eric Gault -- Eric Hyer -- Evin Dunn -- Ian Humphrey -- Jac Shinaman -- Jai Rideout -- James Alexander Crough -- Janet Barrett -- Jason Laura -- Jeannie Backer -- Jeff Anderson -- Jeffrey Covington -- Jesse Mapel -- John Bonn -- Kaitlyn Lee -- Kaj E Williams -- Kelvin Rodriguez -- Ken Edmundson -- Kim Oyama -- Kris Becker -- Kristin Berry -- Lauren Adoram-Kershner -- Lynn Weller -- Mackenzie Boyd -- Makayla Shepherd -- Marjorie Hahn -- Mathew Eis -- Michael Aye -- Moses Milazzo -- Oleg Alexandrov -- Orrin Thomas -- Peter Giroux -- Raad A. Saleh -- Ross Beyer -- Sasha Brownsberger -- Sharmilla Prasad -- Steven Lambright -- Stuart Sides -- Summer Stapleton -- Tracie Sucharski -- Travis Addair -- Tyler Wilson -- Victor Silva +- Andrew Annex +- Victor Silva +- Benoit Seignovert +- Andrew Stebenne +- Christopher Austin +- Curtis Rose +- David Miller +- Ella Mae Lee +- Eric Heyer +- Ian Humphrey +- Jai Rideout +- James Alexander Crough +- Janet Barrett +- Jeff Anderson +- Jeffrey Covington +- John Bonn +- Kim Oyama +- Mackenzie Boyd +- Marjorie Hahn +- Mathew Eis +- Orrin Thomas +- Sasha Brownsberger +- Sharmilla Prasad +- Steven Lambright +- Travis Addair ----- -This list was initially generated using this bash command (additional manual edits are needed): - -git log --pretty="- %an %n" | sort | uniq -i >> AUTHORS.rst - +This list was generated from the .zenodo.json file by running python zenodo_to_authors.py. \ No newline at end of file diff --git a/isis/scripts/zenodo_to_authors.py b/isis/scripts/zenodo_to_authors.py new file mode 100644 index 0000000000..6d84ff175f --- /dev/null +++ b/isis/scripts/zenodo_to_authors.py @@ -0,0 +1,34 @@ +# Uses the .zenodo.json file to generate an AUTHORS.rst file. +# No arguments are necessary. Just set $ISISROOT and run: python zenodo_to_authors.py + +import os + +# Files to open +if "ISISROOT" in os.environ: + zenodo_path = os.path.expandvars("$ISISROOT/../.zenodo.json") + authors_path = os.path.expandvars("$ISISROOT/../AUTHORS.rst") +else: + print("Please set $ISISROOT and re-run this script.") + exit() + +# Read .zenodo.json file: +lines = [] +with open(zenodo_path, 'r') as zenodo_file: + lines = zenodo_file.readlines() + +output_lines = ["ISIS3 Contributors", "==================\n"] + +for line in lines: + # Pull the names out of the zenodo file and reformat + if "\"name\"" in line: + name = line.strip().split(":")[1].strip("\", ") + last, first = name.split(",") + output_lines.append("- {} {}".format(first.strip(),last.strip())) + +output_lines.append("\n-----") +output_lines.append("This list was generated from the .zenodo.json file by running python zenodo_to_authors.py.") + +# Write to AUTHORS.rst file +with open(authors_path, 'w') as authors_file: + authors_file.write('\n'.join(output_lines)) + From 728a2033da3be2efc4c038398a1ce13edfcae487 Mon Sep 17 00:00:00 2001 From: Kristin Date: Mon, 31 Aug 2020 18:07:49 -0700 Subject: [PATCH 2/5] Update PR template and contributing docs --- .github/pull_request_template.md | 2 +- CONTRIBUTING.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 0a3bc69d37..dd35461bcf 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -36,7 +36,7 @@ - [ ] I have updated the documentation accordingly. - [ ] I have added tests to cover my changes. - [ ] All new and existing tests passed. -- [ ] I have added myself to the [AUTHORS.rst](https://github.com/USGS-Astrogeology/ISIS3/blob/dev/AUTHORS.rst) document. +- [ ] I have added myself to the [.zenodo.json](https://github.com/USGS-Astrogeology/ISIS3/blob/dev/.zenodo.json) document. ## Licensing This project is mostly composed of free and unencumbered software released into the public domain, and we are unlikely to accept contributions that are not also released into the public domain. Somewhere near the top of each file should have these words: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f68591f556..b7fd2b715c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,7 +43,7 @@ In the case of an objection being raised in a pull request by another committer, committers should seek to arrive at a consensus by way of addressing concerns being expressed by discussion, compromise on the proposed change, or withdrawal of the proposed change. -When making a contribution for the first time, please add your name to the Authors.rst file **and** the `.zenodo.json file.` We strongly recommend adding your affiliation and ORCiD to the `zenodo.json` file. These additions only have to happen once. +When making a contribution for the first time, please add your name to the `.zenodo.json file.` We strongly recommend adding your affiliation and ORCiD to the `zenodo.json` file. These additions only have to happen once. # Becoming a Committer From 114d0b22b6bae88f403a48d2267890b0b0cd5d18 Mon Sep 17 00:00:00 2001 From: Kristin Date: Mon, 14 Sep 2020 09:35:09 -0700 Subject: [PATCH 3/5] Removed json error in .zenodo.json and update script based on feedback --- .zenodo.json | 2 +- isis/scripts/zenodo_to_authors.py | 46 +++++++++++++++++++++---------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/.zenodo.json b/.zenodo.json index 0c6f935d18..45a7fba1ec 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -188,7 +188,7 @@ }, { "name": "Addair, Travis" - }, + } ], "title": "Integrated Software for Imageers and Spectrometers", "description": "A software library and set of tools to support ingestions, processing, and analysis of planetary science data.", diff --git a/isis/scripts/zenodo_to_authors.py b/isis/scripts/zenodo_to_authors.py index 6d84ff175f..5b90bb0c5e 100644 --- a/isis/scripts/zenodo_to_authors.py +++ b/isis/scripts/zenodo_to_authors.py @@ -1,29 +1,45 @@ # Uses the .zenodo.json file to generate an AUTHORS.rst file. -# No arguments are necessary. Just set $ISISROOT and run: python zenodo_to_authors.py +# No arguments are necessary if $ISISROOT is set. import os +import argparse +import json + +parser = argparse.ArgumentParser(description="Generate an AUTHORS.rst file from a .zenodo.json file") +parser.add_argument("zenodo_input_file", nargs='?', type=str, + help="The file path to the .zenodo.json file.", default="$ISISROOT/../.zenodo.json") +parser.add_argument("authors_output_file", nargs='?', type=str, + help="The path for the output AUTHORS.rst file.", default="$ISISROOT/../AUTHORS.rst") + +args = parser.parse_args() + +zenodo_path = args.zenodo_input_file +authors_path = args.authors_output_file # Files to open -if "ISISROOT" in os.environ: - zenodo_path = os.path.expandvars("$ISISROOT/../.zenodo.json") - authors_path = os.path.expandvars("$ISISROOT/../AUTHORS.rst") -else: - print("Please set $ISISROOT and re-run this script.") +if (("$ISISROOT" in args.zenodo_input_file) or ("$ISISROOT" in args.authors_output_file)): + if ("ISISROOT" in os.environ): + zenodo_path = os.path.expandvars(args.zenodo_input_file) + authors_path = os.path.expandvars(args.authors_output_file) + else: + print("Please set $ISISROOT and re-run this script or specify the input and output files.") exit() # Read .zenodo.json file: lines = [] -with open(zenodo_path, 'r') as zenodo_file: - lines = zenodo_file.readlines() - +try: + with open(zenodo_path, 'r') as zenodo_file: + parsed_json = json.load(zenodo_file) +except: + print("{} could not be opened as the input file.".format(zenodo_path)) + exit() + output_lines = ["ISIS3 Contributors", "==================\n"] -for line in lines: - # Pull the names out of the zenodo file and reformat - if "\"name\"" in line: - name = line.strip().split(":")[1].strip("\", ") - last, first = name.split(",") - output_lines.append("- {} {}".format(first.strip(),last.strip())) +for elt in parsed_json['creators']: + name = elt['name'] + last, first = name.split(",") + output_lines.append("- {} {}".format(first.strip(),last.strip())) output_lines.append("\n-----") output_lines.append("This list was generated from the .zenodo.json file by running python zenodo_to_authors.py.") From 92201e1cec43663c981403c3c42f37f33016bf85 Mon Sep 17 00:00:00 2001 From: Kristin Date: Mon, 14 Sep 2020 10:43:27 -0700 Subject: [PATCH 4/5] update based on more feedback --- AUTHORS.rst | 68 ++++++++++++------------------- isis/scripts/zenodo_to_authors.py | 28 +++++-------- 2 files changed, 35 insertions(+), 61 deletions(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index 4f81fe62bd..9040c3485e 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -34,49 +34,31 @@ ISIS3 Contributors - Oleg Alexandrov - Aaron Curtis - Eric Gault -- Eric Hyer -- Evin Dunn -- Ian Humphrey -- Jac Shinaman -- Jai Rideout -- James Alexander Crough -- Janet Barrett -- Jason Laura -- Jeannie Backer -- Jeff Anderson -- Jeffrey Covington -- Jesse Mapel -- John Bonn -- Kaitlyn Lee -- Kaj E Williams -- Kelvin Rodriguez -- Ken Edmundson -- Kim Oyama -- Kris Becker -- Kristin Berry -- Lauren Adoram-Kershner -- Lynn Weller -- Mackenzie Boyd -- Makayla Shepherd -- Marjorie Hahn -- Mathew Eis -- Michael Aye -- Moses Milazzo -- Oleg Alexandrov -- Orrin Thomas -- Peter Giroux -- Raad A. Saleh -- Ross Beyer -- Sasha Brownsberger -- Sharmilla Prasad -- Steven Lambright -- Stuart Sides -- Summer Stapleton -- Timothy Giroux -- Tracie Sucharski -- Travis Addair -- Tyler Wilson -- Victor Silva +- Andrew Annex +- Victor Silva +- Benoit Seignovert +- Andrew Stebenne +- Christopher Austin +- Curtis Rose +- David Miller +- Ella Mae Lee +- Eric Heyer +- Ian Humphrey +- Jai Rideout +- James Alexander Crough +- Janet Barrett +- Jeff Anderson +- Jeffrey Covington +- John Bonn +- Kim Oyama +- Mackenzie Boyd +- Marjorie Hahn +- Mathew Eis +- Orrin Thomas +- Sasha Brownsberger +- Sharmilla Prasad +- Steven Lambright +- Travis Addair ----- This list was generated from the .zenodo.json file by running python zenodo_to_authors.py. \ No newline at end of file diff --git a/isis/scripts/zenodo_to_authors.py b/isis/scripts/zenodo_to_authors.py index 5b90bb0c5e..f857de0c4d 100644 --- a/isis/scripts/zenodo_to_authors.py +++ b/isis/scripts/zenodo_to_authors.py @@ -6,33 +6,21 @@ import json parser = argparse.ArgumentParser(description="Generate an AUTHORS.rst file from a .zenodo.json file") -parser.add_argument("zenodo_input_file", nargs='?', type=str, - help="The file path to the .zenodo.json file.", default="$ISISROOT/../.zenodo.json") -parser.add_argument("authors_output_file", nargs='?', type=str, - help="The path for the output AUTHORS.rst file.", default="$ISISROOT/../AUTHORS.rst") +parser.add_argument("zenodo_input_file", type=str, help="The file path to the .zenodo.json file.") +parser.add_argument("authors_output_file", type=str, help="The path for the output AUTHORS.rst file.") args = parser.parse_args() zenodo_path = args.zenodo_input_file authors_path = args.authors_output_file -# Files to open -if (("$ISISROOT" in args.zenodo_input_file) or ("$ISISROOT" in args.authors_output_file)): - if ("ISISROOT" in os.environ): - zenodo_path = os.path.expandvars(args.zenodo_input_file) - authors_path = os.path.expandvars(args.authors_output_file) - else: - print("Please set $ISISROOT and re-run this script or specify the input and output files.") - exit() - # Read .zenodo.json file: -lines = [] try: with open(zenodo_path, 'r') as zenodo_file: parsed_json = json.load(zenodo_file) except: - print("{} could not be opened as the input file.".format(zenodo_path)) - exit() + print("{} could not be read as the input file.".format(zenodo_path)) + raise output_lines = ["ISIS3 Contributors", "==================\n"] @@ -45,6 +33,10 @@ output_lines.append("This list was generated from the .zenodo.json file by running python zenodo_to_authors.py.") # Write to AUTHORS.rst file -with open(authors_path, 'w') as authors_file: - authors_file.write('\n'.join(output_lines)) +try: + with open(authors_path, 'w') as authors_file: + authors_file.write('\n'.join(output_lines)) +except: + print("{} could not be opened as the output file.".format(authors_path)) + raise From 8acfe1561f8e20417a04919933f0bea1ad6f15b8 Mon Sep 17 00:00:00 2001 From: Kristin Date: Mon, 14 Sep 2020 10:44:11 -0700 Subject: [PATCH 5/5] removed comment --- isis/scripts/zenodo_to_authors.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/isis/scripts/zenodo_to_authors.py b/isis/scripts/zenodo_to_authors.py index f857de0c4d..b4410eacf9 100644 --- a/isis/scripts/zenodo_to_authors.py +++ b/isis/scripts/zenodo_to_authors.py @@ -1,5 +1,4 @@ -# Uses the .zenodo.json file to generate an AUTHORS.rst file. -# No arguments are necessary if $ISISROOT is set. +# Uses a .zenodo.json file to generate an AUTHORS.rst file. import os import argparse