forked from pantsbuild/pants
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[internal] Change contributors script to not cite # of contributions (p…
…antsbuild#14005) We decided as maintainers that we don't want to emphasize the # of commits in our weekly release emails thanking code contributors. # of commits is not a great way to measure contributions, and it also creates a hierarchy we don't want to emphasize. Instead, the maintainers informally voted to drop # of contributions and sort the contributors alphabetically. We also considered randomly. In the process, this rewrites the contributor script to use Python. [ci skip-rust] [ci skip-build-wheels]
- Loading branch information
1 parent
19801e8
commit 10dec99
Showing
4 changed files
with
62 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
from __future__ import annotations | ||
|
||
import argparse | ||
import subprocess | ||
from pathlib import Path | ||
|
||
|
||
def create_parser() -> argparse.ArgumentParser: | ||
parser = argparse.ArgumentParser(description="Generate contributor list") | ||
parser.add_argument( | ||
"-s", "--since", help="Contributors since this revision, e.g. the Git tag `release_2.8.0`" | ||
) | ||
return parser | ||
|
||
|
||
def main() -> None: | ||
args = create_parser().parse_args() | ||
if args.since: | ||
print(" " + "\n ".join(sorted_contributors(range=f"{args.since}..HEAD"))) | ||
else: | ||
update_contributors_md() | ||
|
||
|
||
def sorted_contributors(range: str) -> list[str]: | ||
contributors = set( | ||
subprocess.run( | ||
["git", "log", "--use-mailmap", "--format=format:%aN", range], | ||
stdout=subprocess.PIPE, | ||
check=True, | ||
) | ||
.stdout.decode() | ||
.splitlines() | ||
) | ||
return sorted(contributors) | ||
|
||
|
||
def update_contributors_md() -> None: | ||
Path("CONTRIBUTORS.md").write_text( | ||
"Created by running `./pants run build-support/bin/contributors.py`.\n\n+ " | ||
+ "\n+ ".join(sorted_contributors(range="HEAD")) | ||
+ "\n" | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file was deleted.
Oops, something went wrong.