diff --git a/.gitignore b/.gitignore index c8125b8f7a..3eb4f30817 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ doc/source/modules.rst doc/source/keystone.* ChangeLog requirements.txt +AUTHORS build/ dist/ etc/keystone.conf diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index 7a8bca1975..0000000000 --- a/AUTHORS +++ /dev/null @@ -1,113 +0,0 @@ -Adam Gandelman -Adam Young -Adipudi Praveena -Akira YOSHIYAMA -Alan Pevec -Alex Silva -Alvaro Lopez Garcia -Andrew Bogott -Andy Smith -Anne Gentle -annegentle -Anthony Young -Brian Lamar -Brian Lamar -Brian Waldon -Brian Waldon -bsirish -Carlos Marin -Chmouel Boudjnah -Chuck Short -Cole Robinson -Dan Prince -Dan Prince -Darren Birkett -dcramer -Dean Troyer -Deepak Garg -Devin Carlen -Dolph Mathews -Dolph Mathews -Ed Leafe -Édouard Thuleau -Eoghan Glynn -Ewan Mellor -Gabriel Hurley -Ghe Rivero -gholt -Guang Yee -Hengqing Hu -Ionuț Arțăriși -jabdul -James E. Blair -James E. Blair -James E. Blair -Jason Cannavale -Jay Pipes -Jay Pipes -Jesse Andrews -Joe Heck -Joe Savak -John Dickinson -John Eo -John Eo -Jorge L. Williams -Joseph W. Breu -Josh Kearney -Julien Danjou -Justin Santa Barbara -Justin Shepherd -Kevin L. Mitchell -Khaled Hussein -Khaled Hussein -Kiall Mac Innes -KnightHacker -Liem Nguyen -Liem Nguyen -lzyeval -Mark Gius -Mark McLoughlin -Maru Newby -Michael Basnight -Michael Still -Monty Taylor -Pádraig Brady -Paul McMillan -Paul Voccio -Peng Yong -Pete Zaitcev -Ralf Haferkamp -Ramana Juvvadi -Ramana Juvvadi -Ramana Juvvadi -Robin Norwood -Ron Pedde -root -root -Russell Bryant -saikrishna1511@gmail.com -Sai Krishna -Salvatore Orlando -Sandy Walsh -Shevek -sirish bitra -sirish.bitra -sirishbitra -Sony K. Philip -termie -Thierry Carrez -Todd Willey -Todd Willey -Vishvananda Ishaya -vishvananda -Will Kelly -Yaguang Tang -Yogeshwar Srikrishnan -Yong Sheng Gong -Yun Mao -Yuriy Taraday -Zhongyue Luo -Ziad Sawalha -ziadsawalha -Ziad Sawalha -Ziad Sawalha diff --git a/keystone/openstack/common/setup.py b/keystone/openstack/common/setup.py index 9eabfcca3f..231b3384c1 100644 --- a/keystone/openstack/common/setup.py +++ b/keystone/openstack/common/setup.py @@ -37,8 +37,8 @@ def parse_mailmap(mailmap='.mailmap'): def canonicalize_emails(changelog, mapping): - """ Takes in a string and an email alias mapping and replaces all - instances of the aliases in the string with their real email + """Takes in a string and an email alias mapping and replaces all + instances of the aliases in the string with their real email. """ for alias, email in mapping.iteritems(): changelog = changelog.replace(alias, email) @@ -97,7 +97,7 @@ def _run_shell_command(cmd): def write_vcsversion(location): - """ Produce a vcsversion dict that mimics the old one produced by bzr + """Produce a vcsversion dict that mimics the old one produced by bzr. """ if os.path.isdir('.git'): branch_nick_cmd = 'git branch | grep -Ei "\* (.*)" | cut -f2 -d" "' @@ -118,10 +118,30 @@ version_info = { def write_git_changelog(): - """ Write a changelog based on the git changelog """ + """Write a changelog based on the git changelog.""" if os.path.isdir('.git'): git_log_cmd = 'git log --stat' changelog = _run_shell_command(git_log_cmd) mailmap = parse_mailmap() with open("ChangeLog", "w") as changelog_file: changelog_file.write(canonicalize_emails(changelog, mailmap)) + + +def generate_authors(): + """Create AUTHORS file using git commits.""" + jenkins_email = 'jenkins@review.openstack.org' + old_authors = 'AUTHORS.in' + new_authors = 'AUTHORS' + if os.path.isdir('.git'): + # don't include jenkins email address in AUTHORS file + git_log_cmd = "git log --format='%aN <%aE>' | sort -u | " \ + "grep -v " + jenkins_email + changelog = _run_shell_command(git_log_cmd) + mailmap = parse_mailmap() + new_authors_fh = open(new_authors, "w") + new_authors_fh.write(canonicalize_emails(changelog, mailmap)) + if os.path.exists(old_authors): + new_authors_fh.write("\n") + with open(old_authors, "r") as old_authors_fh: + new_authors_fh.write(''.join(old_authors_fh.readlines())) + new_authors_fh.close() diff --git a/setup.py b/setup.py index d4aa39c6e1..06bb2769b3 100644 --- a/setup.py +++ b/setup.py @@ -19,6 +19,7 @@ from setuptools.command.sdist import sdist from setuptools import setup import subprocess +from keystone.openstack.common.setup import generate_authors from keystone.openstack.common.setup import parse_requirements from keystone.openstack.common.setup import parse_dependency_links from keystone.openstack.common.setup import write_requirements @@ -29,6 +30,7 @@ class local_sdist(sdist): """Customized sdist hook - builds the ChangeLog file from VC first""" def run(self): write_git_changelog() + generate_authors() sdist.run(self) cmdclass = {'sdist': local_sdist} diff --git a/tests/test_authors.py b/tests/test_authors.py deleted file mode 100644 index b9c3d101da..0000000000 --- a/tests/test_authors.py +++ /dev/null @@ -1,63 +0,0 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2012 OpenStack LLC -# Copyright 2012 Nebula Inc -# -# 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. - -import commands -import os -import unittest - - -def parse_mailmap(mailmap='.mailmap'): - mapping = {} - if os.path.exists(mailmap): - fp = open(mailmap, 'r') - for l in fp: - l = l.strip() - if not l.startswith('#') and ' ' in l: - canonical_email, alias = l.split(' ') - mapping[alias] = canonical_email - return mapping - - -def str_dict_replace(s, mapping): - for s1, s2 in mapping.iteritems(): - s = s.replace(s1, s2) - return s - - -class AuthorsTestCase(unittest.TestCase): - def test_authors_up_to_date(self): - root = os.path.normpath(os.path.join(os.path.dirname(__file__), '..')) - contributors = set() - missing = set() - authors_file = open(os.path.join(root, 'AUTHORS'), 'r').read() - - if os.path.exists(os.path.join(root, '.git')): - mailmap = parse_mailmap(os.path.join(root, '.mailmap')) - for email in commands.getoutput('git log --format=%ae').split(): - if not email: - continue - if "jenkins" in email and "openstack.org" in email: - continue - email = '<' + email + '>' - contributors.add(str_dict_replace(email, mailmap)) - - for contributor in contributors: - if not contributor in authors_file: - missing.add(contributor) - - self.assertTrue(len(missing) == 0, - '%r not listed in AUTHORS file.' % missing)