From 30ba2ec5da0c898d2b77256e57851dafc77973da Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Wed, 8 Feb 2017 15:54:44 -0500 Subject: [PATCH] remove ptl command This command is no longer needed because the list-changes report for patches to openstack/releases includes the information. Change-Id: I7b1805279d615cba129c70614cd260adeda8ce25 Signed-off-by: Doug Hellmann --- README.rst | 14 ---- releasetools/cmds/ptl.py | 137 --------------------------------------- setup.cfg | 1 - 3 files changed, 152 deletions(-) delete mode 100644 releasetools/cmds/ptl.py diff --git a/README.rst b/README.rst index dd9ce7a..30216c7 100644 --- a/README.rst +++ b/README.rst @@ -258,20 +258,6 @@ requirements repositories and then run the script as:: $ check_library_constraints.sh /path/to/requirements-repository stable/mitaka -ptl ---- - -Report information about the PTL of a project by querying the -governance repository. - -:: - - $ ptl "release management" - - Name : Doug Hellmann - IRC Nick : dhellmann - IRC Channel : openstack-release - Email : doug@doughellmann.com milestone-checkup ----------------- diff --git a/releasetools/cmds/ptl.py b/releasetools/cmds/ptl.py deleted file mode 100644 index 0b66144..0000000 --- a/releasetools/cmds/ptl.py +++ /dev/null @@ -1,137 +0,0 @@ -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from __future__ import print_function -from __future__ import unicode_literals -import argparse -import itertools - -from releasetools import governance - -import mwclient - -ALIASES = { - 'chef': 'Chef OpenStack', - 'app-catalog': 'Community App Catalog', - 'infra': 'Infrastructure', - 'charms': 'OpenStack Charms', - 'docs': 'Documentation', - 'ux': 'OpenStack UX', - 'deb': 'Packaging-deb', - 'rpm': 'Packaging-rpm', - 'puppet': 'Puppet OpenStack', - 'qa': 'Quality Assurance', - 'relmgt': 'Release Management', - 'stable': 'Stable branch maintenance', -} - -_TEMPLATE = ''' -Name : {name} -IRC Nick : {irc} -IRC Channel : {irc_channel} -Email : {email} -Liaison : {liaison_name} - {liaison_irc} -''' - - -def get_page_section(page_content, section): - "Return iterable of lines making up a section of a wiki page." - section_start = u'== {} =='.format(section).lower() - lines = page_content.splitlines() - lines = itertools.dropwhile( - lambda x: x.lower() != section_start, - lines, - ) - lines.next() # skip the section heading - lines = itertools.takewhile( - lambda x: not x.startswith('== '), - lines, - ) - return lines - - -def get_wiki_table(page_content, section): - """Return iterable of dicts making up rows of a wiki table. - - Assumes there is only one table per section. - - """ - lines = get_page_section(page_content, section) - lines = itertools.dropwhile( - lambda x: x != '{| class="wikitable"', - lines, - ) - headings = [] - for line in lines: - if line == '|-': - continue - elif line.startswith('!'): - headings = [h.strip() for h in line.lstrip('!').split('!!')] - elif line.startswith('|'): - items = [i.strip() for i in line.lstrip('|').split('||')] - row = { - h: i - for (h, i) in itertools.izip(headings, items) - } - yield row - elif line == '}': - # end of table - break - - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument( - 'team', nargs='+', - help='the team name', - ) - args = parser.parse_args() - - args.team = ' '.join(args.team) - args.team = ALIASES.get(args.team.lower(), args.team) - - team_data = governance.get_team_data() - # Allow for case-insensitive search - teams = { - n.lower(): i - for n, i in team_data.items() - } - - # Check for liaison information. - site = mwclient.Site('wiki.openstack.org') - page = site.Pages['CrossProjectLiaisons'] - table = get_wiki_table(page.text(), 'Release management') - liaisons = { - row['Project'].lower(): row - for row in table - } - team_liaison = liaisons.get(args.team.lower(), {}) - - try: - team = teams[args.team.lower()] - except KeyError: - print('No official team {!r}'.format(args.team)) - team = {} - - if 'ptl' in team: - ptl = team['ptl'] - print(_TEMPLATE.format( - name=ptl.get('name'), - irc=ptl.get('irc'), - email=ptl.get('email'), - irc_channel=team.get('irc-channel'), - liaison_name=team_liaison.get('Liaison'), - liaison_irc=team_liaison.get('IRC Handle'), - )) diff --git a/setup.cfg b/setup.cfg index 31367f0..374b578 100644 --- a/setup.cfg +++ b/setup.cfg @@ -36,4 +36,3 @@ console_scripts = send-mail = releasetools.cmds.mail:main update-reviews = releasetools.cmds.update_reviews:main latest-deliverable-versions = releasetools.cmds.latest_deliverable_versions:main - ptl = releasetools.cmds.ptl:main