From f4ce37b9c23cb09b5e4e07c0af5bae7a65f6cc04 Mon Sep 17 00:00:00 2001 From: Bhuvan Arumugam Date: Fri, 20 Apr 2012 23:37:28 -0700 Subject: [PATCH] Auto generate AUTHORS file for glance. Bug: 976267 Now that git commits are gated by CLA, we shouldn't enforce committers to add an entry in AUTHORS file. The AUTHORS file should be generated automatically, based on git commits. This commit fixes the problem. * Authors Remove this file. To be consistent with other projects, the new file AUTHORS is generated automatically. * .gitignore Add AUTHORS file. * glance/common/setup.py generate_authors(): New method to create AUTHORS file. If AUTHORS.in file exists, append it's content to AUTHORS file. * setup.py Import the new method. local_sdist.run(): Generate AUTHORS file before creating the package. * MANIFEST.in s/Authors/AUTHORS * glance/tests/unit/test_misc.py AuthorsTestCase: Remove this class that test an entry in Authors file. parse_mailmap(), str_dict_replace(): Remove these methods. Change-Id: If83c3fe9b2142342ac11cc019bc24926f52ee753 --- .gitignore | 1 + Authors | 71 ---------------------------------- MANIFEST.in | 2 +- glance/tests/unit/test_misc.py | 46 ---------------------- setup.py | 2 + 5 files changed, 4 insertions(+), 118 deletions(-) delete mode 100644 Authors diff --git a/.gitignore b/.gitignore index cbb155a2d1..739f9ca783 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ .glance-venv .venv .tox +AUTHORS build dist glance.egg-info diff --git a/Authors b/Authors deleted file mode 100644 index 39ed54ce2a..0000000000 --- a/Authors +++ /dev/null @@ -1,71 +0,0 @@ -Adam Gandelman -Alex Meade -Andrew Hutchings -Andrey Brindeyev -Bernhard M. Wiedemann -Bhuvan Arumugam -Brian Lamar -Brian Waldon -Chris Behrens -Christopher MacGown -Chuck Short -Cory Wright -Dan Prince -Dean Troyer -Derek Higgins -Donal Lafferty -Eldar Nugaev -Eoghan Glynn -Ewan Mellor -Gabriel Hurley -Hengqing Hu -Ionuț Arțăriși -Isaku Yamahata -J. Daniel Schmidt -Jason Koelker -Jay Pipes -James E. Blair -Jesse Andrews -Jinwoo 'Joseph' Suh -Joe Gordon -Johannes Erdfelt -Josh Durgin -Josh Kearney -Juerg Haefliger -Justin Santa Barbara -Justin Shepherd -Ken Pepple -Ken Thomas -Kevin L. Mitchell -Lorin Hochstein -Major Hayden -Mark McLoughlin -Mark Washenberger -Maru Newby -Matt Dietz -Matthias Schmitz -Mike Lundy -Monty Taylor -Pádraig Brady -Paul Bourke -Paul McMillan -Pavan Kumar Sunkara -Peng Yong -Pete Zaitcev -Rick Clark -Rick Harris -Reynolds Chin -Russell Bryant -Sam Morrison -Soren Hansen -Stuart McLaren -Taku Fukushima -Thierry Carrez -Tom Hancock -Unmesh Gurjar -Wayne A. Walls -William Wolf -Vishvananda Ishaya -Yaguang Tang -Yuriy Taraday -Zhongyue Luo diff --git a/MANIFEST.in b/MANIFEST.in index c4388196b0..ff146a6ee5 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,7 +1,7 @@ include run_tests.sh ChangeLog include README.rst builddeb.sh include MANIFEST.in pylintrc -include Authors +include AUTHORS include run_tests.py include HACKING.rst include LICENSE diff --git a/glance/tests/unit/test_misc.py b/glance/tests/unit/test_misc.py index 3cf0ce746f..7080d900d2 100644 --- a/glance/tests/unit/test_misc.py +++ b/glance/tests/unit/test_misc.py @@ -26,52 +26,6 @@ from glance.common import exception from glance.common import utils -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): - - topdir = os.path.normpath(os.path.dirname(__file__) + '/../../..') - contributors = set() - missing = set() - authors_file = open(os.path.join(topdir, 'Authors'), 'r').read() - - if os.path.exists(os.path.join(topdir, '.git')): - mailmap = parse_mailmap(os.path.join(topdir, '.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 contributor == 'glance-core': - continue - if not contributor in authors_file: - missing.add(contributor) - - self.assertTrue(len(missing) == 0, - '%r not listed in Authors' % missing) - - class UtilsTestCase(unittest.TestCase): def test_bool_from_string(self): diff --git a/setup.py b/setup.py index bf5d61332e..c633b883fc 100644 --- a/setup.py +++ b/setup.py @@ -21,6 +21,7 @@ import subprocess from setuptools import setup, find_packages from setuptools.command.sdist import sdist +from glance.openstack.common.setup import generate_authors from glance.openstack.common.setup import parse_requirements from glance.openstack.common.setup import parse_dependency_links @@ -65,6 +66,7 @@ class local_sdist(sdist): changelog = log_cmd.communicate()[0] with open("ChangeLog", "w") as changelog_file: changelog_file.write(changelog) + generate_authors() sdist.run(self) cmdclass = {'sdist': local_sdist}