Skip to content

Commit

Permalink
Add script that copies the maintainers from the maintainers team to a…
Browse files Browse the repository at this point in the history
…ll the others teams of the OCA
  • Loading branch information
guewen committed Jun 23, 2014
1 parent 6a4c753 commit 7933f24
Show file tree
Hide file tree
Showing 6 changed files with 736 additions and 0 deletions.
661 changes: 661 additions & 0 deletions LICENSE.txt

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions requirements.txt
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
21 changes: 21 additions & 0 deletions setup.cfg
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
3 changes: 3 additions & 0 deletions setup.py
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 added tools/__init__.py
Empty file.
46 changes: 46 additions & 0 deletions tools/copy_maintainers.py
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()

0 comments on commit 7933f24

Please sign in to comment.