|
37 | 37 | all_members = dict()
|
38 | 38 | repos = dict()
|
39 | 39 | for repo in ompi_org.get_repos():
|
40 |
| - print("Found Org Repo: {repo}".format(repo=repo.name)) |
| 40 | + print(f"Found Org Repo: {repo.name}") |
| 41 | + |
| 42 | + if repo.archived: |
| 43 | + print("--> NOTE: This repo is archived") |
41 | 44 |
|
42 | 45 | # For each repo, get the teams on that repo
|
43 |
| - repo_teams = dict() |
| 46 | + repo_teams = dict() |
44 | 47 | for team in repo.get_teams():
|
45 |
| - out = (" Found team on repo {org}/{repo}: {team} ({perm}) " |
46 |
| - .format(org=ompi_org.name, repo=repo.name, |
47 |
| - team=team.name, perm=team.permission)) |
| 48 | + out = f" Found team on repo {ompi_org.name}/{repo.name}: {team.name} ({team.permission}) " |
48 | 49 | # We only care about teams with push permissions
|
49 | 50 | if team.permission == "pull":
|
50 |
| - print("{out} -- SKIPPED".format(out=out)) |
| 51 | + print(f"{out} -- SKIPPED") |
51 | 52 | continue
|
52 | 53 |
|
53 | 54 | print(out)
|
|
56 | 57 | team_members = dict()
|
57 | 58 | member_teams = dict()
|
58 | 59 | for member in team.get_members():
|
59 |
| - print(" Found member: {name}" |
60 |
| - .format(name=member.login)) |
| 60 | + print(f" Found member: {member.login}") |
61 | 61 | team_members[member.id] = member
|
62 | 62 |
|
63 | 63 | if member.id not in all_members:
|
|
81 | 81 | 'repo_teams' : repo_teams,
|
82 | 82 | }
|
83 | 83 |
|
84 |
| - |
85 | 84 | print("All the repos:")
|
86 | 85 | pprint(repos)
|
87 | 86 | pprint(all_members)
|
|
92 | 91 | fieldnames = ['login', 'name', 'email', 'company']
|
93 | 92 |
|
94 | 93 | # Add all the repo names
|
95 |
| -for _, rentry in repos.items(): |
| 94 | +# |
| 95 | +# Skip archived repos -- they're read-only, and thereare are |
| 96 | +# effectively just noise in the annual review process. |
| 97 | +repo_names = list() |
| 98 | +for rentry in repos.values(): |
96 | 99 | repo = rentry['repo']
|
97 |
| - fieldnames.append("{org}/{repo}" |
98 |
| - .format(org=ompi_org.login, |
99 |
| - repo=repo.name)) |
| 100 | + if not repo.archived: |
| 101 | + # Used to include the org name in here, but it was always |
| 102 | + # "open-mpi", and it just made the colun need to be wider. |
| 103 | + repo_names.append(repo.name) |
| 104 | + |
| 105 | +fieldnames.extend(sorted(repo_names)) |
100 | 106 |
|
101 | 107 | #--------------------------------------------------------------------
|
102 | 108 |
|
103 | 109 | # Now write out the CSV
|
104 | 110 | outfile = 'permissions.csv'
|
105 |
| -print("Writing: ".format(outfile=outfile)) |
| 111 | +print(f"Writing: {outfile}") |
106 | 112 | with open(outfile, 'w', newline='') as csvfile:
|
107 | 113 | writer = csv.DictWriter(csvfile, fieldnames=fieldnames,
|
108 | 114 | quoting=csv.QUOTE_ALL)
|
109 | 115 | writer.writeheader()
|
110 | 116 | for mid, mentry in all_members.items():
|
111 | 117 | member = mentry['member']
|
112 |
| - print(" Writing member: {member}".format(member=member.login)) |
| 118 | + print(f" Writing member: {member.login}") |
113 | 119 |
|
114 | 120 | # Initial entries about the user
|
115 | 121 | row = {
|
|
123 | 129 | for _, rentry in repos.items():
|
124 | 130 | repo = rentry['repo']
|
125 | 131 |
|
| 132 | + # Per above, skip archived repos |
| 133 | + if repo.archived: |
| 134 | + continue |
| 135 | + |
126 | 136 | found = list()
|
127 | 137 | for tid, tentry in rentry['repo_teams'].items():
|
128 | 138 | if tid in mentry['member_teams']:
|
129 | 139 | team = tentry['team']
|
130 | 140 | found.append(team.name)
|
131 | 141 |
|
132 |
| - row[repo.full_name] = ', '.join(found) |
| 142 | + row[repo.name] = ', '.join(found) |
133 | 143 |
|
134 | 144 | writer.writerow(row)
|
0 commit comments