forked from OCA/maintainer-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script that copies the maintainers from the maintainers team to a…
…ll the others teams of the OCA
- Loading branch information
Showing
6 changed files
with
736 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,5 @@ | ||
argparse==1.2.1 | ||
github3.py==0.9.0 | ||
requests==2.3.0 | ||
uritemplate.py==0.3.0 | ||
wsgiref==0.1.2 |
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,21 @@ | ||
[metadata] | ||
name = oca-maintainers-tools | ||
author = OCA - Odoo Community Associatin | ||
summary = Set of tools for the management of the Odoo Community projects | ||
license = APGL3 | ||
description-file = README.md | ||
requires-python = >=2.7 | ||
classifier = | ||
Development Status :: 4 - Beta | ||
Environment :: Console | ||
Intended Audience :: Developers | ||
Intended Audience :: Information Technology | ||
License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+) | ||
Operating System :: OS Independent | ||
Programming Language :: Python | ||
[files] | ||
packages = | ||
tools | ||
[entry_points] | ||
console_scripts = | ||
copy-maintainers = tools.copy_maintainers:main |
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,3 @@ | ||
import setuptools | ||
|
||
setuptools.setup(setup_requires=['pbr'], pbr=True) |
Empty file.
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,46 @@ | ||
#!/usr/bin/env python | ||
|
||
from github3 import login | ||
from getpass import getuser, getpass | ||
|
||
MAINTAINERS_TEAM_ID = 844365 | ||
BLACKLIST = [MAINTAINERS_TEAM_ID, | ||
829420 # 'Owners' team | ||
] | ||
|
||
|
||
def main(): | ||
# user = getuser() | ||
user = 'guewen' | ||
|
||
password = '' | ||
while not password: | ||
password = getpass('Password for {0}: '.format(user)) | ||
|
||
gh = login(user, password=password) | ||
|
||
org = gh.organization('oca') | ||
|
||
teams = org.iter_teams() | ||
maintainers_team = next((team for team in teams if | ||
team.id == MAINTAINERS_TEAM_ID), | ||
None) | ||
assert maintainers_team, "Maintainers Team not found" | ||
|
||
maintainers = set(maintainers_team.iter_members()) | ||
|
||
for team in teams: | ||
if team.id in BLACKLIST: | ||
continue | ||
team_members = set(team.iter_members()) | ||
print "Team %s" % team.name | ||
missing = maintainers - team_members | ||
if not missing: | ||
print "All maintainers are registered" | ||
for member in missing: | ||
print "Adding %s" % member.login | ||
team.add_member(member.login) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |