-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simple script to generate AUTHORS.rst from .zenodo.json file #3995
Changes from 3 commits
23fd127
728a203
6fcb9e7
114d0b2
e0b41a0
7eb0f3b
92201e1
8acfe15
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 = [] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like it's no longer needed |
||
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)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should add similar exception logic for writing the output file as you did for reading the input file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops. Good catch. |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not like setting the defaults and then having to do this; especially, because this could error. My rule of thumb is that a script with default arguments should be able to just run; if I have to set environment variables to run it with default arguments I may as well just pass the arguments. I would just make the arguments required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can do. My initial thought was that the default use of this script would be automated (in the future!) rather than normally being something an individual user would run, so I was thinking "$ISISROOT" is set would be the default case. I see your point, though, and am happy to just remove the defaults and make the arguments required.