diff options
| author | Bhuvan Arumugam <bhuvan@apache.org> | 2012-05-01 16:27:58 -0700 |
|---|---|---|
| committer | Bhuvan Arumugam <bhuvan@apache.org> | 2012-05-01 16:31:23 -0700 |
| commit | 3c7350b3c97fcbc4d2dbad9cd49b50282a4a4047 (patch) | |
| tree | 6e744f7b9725f42ea7e4fed561a8b9ac85a7627d /tests | |
| parent | 67ea436a990154e54ebb25444d580d0eca886ad2 (diff) | |
| download | python-openstackclient-3c7350b3c97fcbc4d2dbad9cd49b50282a4a4047.tar.gz | |
Auto generate AUTHORS for python-openstackclient.
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.
* tests/test_authors.py
Remove this test case.
* .gitignore
Add AUTHORS file.
* openstackclient/openstack/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.
Generate AUTHORS file before creating the package.
Change-Id: Ia5488a43f88e13a0fb1f7a5d8d10a576b9034dc8
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_authors.py | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/tests/test_authors.py b/tests/test_authors.py deleted file mode 100644 index b9c3d101..00000000 --- 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) |
