diff options
author | Bhuvan Arumugam <bhuvan@apache.org> | 2012-06-01 23:38:12 -0700 |
---|---|---|
committer | Bhuvan Arumugam <bhuvan@apache.org> | 2012-06-02 00:04:12 -0700 |
commit | a1f8ea1c7f9849e0fb64c547d6456d2c3c38c5e8 (patch) | |
tree | 279b1b71294a1a42d52509953e94f002ad404b0d | |
parent | b9b897252868732763de60d829b5c8de188adf38 (diff) | |
download | python-glanceclient-a1f8ea1c7f9849e0fb64c547d6456d2c3c38c5e8.tar.gz |
Auto generate AUTHORS file for glanceclient component.
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.
* .gitignore
Add AUTHORS file.
* glanceclient/openstack/common/setup.py
Sync changes from openstack-common.
* setup.py
Generate AUTHORS file before creating the package.
* glanceclient/shell.py
Pep8 fix.
* tests/test_authors.py
Remove this test case.
Change-Id: I9e9d4da5ca3b147b483250dcf25a3b2a840123c2
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | AUTHORS | 9 | ||||
-rw-r--r-- | glanceclient/openstack/common/setup.py | 16 | ||||
-rw-r--r-- | glanceclient/shell.py | 2 | ||||
-rw-r--r-- | setup.py | 2 | ||||
-rw-r--r-- | tests/test_authors.py | 63 |
6 files changed, 18 insertions, 75 deletions
@@ -6,6 +6,7 @@ cover .idea *.swp *~ +AUTHORS build dist python_glanceclient.egg-info diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index b13279b..0000000 --- a/AUTHORS +++ /dev/null @@ -1,9 +0,0 @@ -Brian Waldon <bcwaldon@gmail.com> -Jay Pipes <jaypipes@gmail.com> -Monty Taylor <mordred@inaugust.com> -Dean Troyer <dtroyer@gmail.com> -Gabriel Hurley <gabriel@strikeawe.com> -James E. Blair <jeblair@hp.com> -Chuck Short <chuck.short@canonical.com> -Michael Basnight <mbasnight@gmail.com> -Thierry Carrez <thierry@openstack.org> diff --git a/glanceclient/openstack/common/setup.py b/glanceclient/openstack/common/setup.py index 7c2835e..79b5a62 100644 --- a/glanceclient/openstack/common/setup.py +++ b/glanceclient/openstack/common/setup.py @@ -61,14 +61,21 @@ def parse_requirements(requirements_files=['requirements.txt', 'tools/pip-requires']): requirements = [] for line in get_reqs_from_files(requirements_files): + # For the requirements list, we need to inject only the portion + # after egg= so that distutils knows the package it's looking for + # such as: + # -e git://github.com/openstack/nova/master#egg=nova if re.match(r'\s*-e\s+', line): requirements.append(re.sub(r'\s*-e\s+.*#egg=(.*)$', r'\1', line)) - elif re.match(r'\s*-f\s+', line): - pass + # such as: + # http://github.com/openstack/nova/zipball/master#egg=nova elif re.match(r'\s*https?:', line): requirements.append(re.sub(r'\s*https?:.*#egg=(.*)$', r'\1', line)) + # -f lines are for index locations, and don't get used here + elif re.match(r'\s*-f\s+', line): + pass else: requirements.append(line) @@ -78,11 +85,16 @@ def parse_requirements(requirements_files=['requirements.txt', def parse_dependency_links(requirements_files=['requirements.txt', 'tools/pip-requires']): dependency_links = [] + # dependency_links inject alternate locations to find packages listed + # in requirements for line in get_reqs_from_files(requirements_files): + # skip comments and blank lines if re.match(r'(\s*#)|(\s*$)', line): continue + # lines with -e or -f need the whole line, minus the flag if re.match(r'\s*-[ef]\s+', line): dependency_links.append(re.sub(r'\s*-[ef]\s+', '', line)) + # lines that are only urls can go in unmolested elif re.match(r'\s*https?:', line): dependency_links.append(line) return dependency_links diff --git a/glanceclient/shell.py b/glanceclient/shell.py index ee002f5..e971fca 100644 --- a/glanceclient/shell.py +++ b/glanceclient/shell.py @@ -36,7 +36,7 @@ class OpenStackImagesShell(object): parser = argparse.ArgumentParser( prog='glance', description=__doc__.strip(), - epilog='See "glance help COMMAND" '\ + epilog='See "glance help COMMAND" ' 'for help on a specific command.', add_help=False, formatter_class=HelpFormatter, @@ -3,6 +3,7 @@ import sys import setuptools +from glanceclient.openstack.common.setup import generate_authors from glanceclient.openstack.common.setup import parse_requirements from glanceclient.openstack.common.setup import parse_dependency_links from glanceclient.openstack.common.setup import write_git_changelog @@ -12,6 +13,7 @@ requires = parse_requirements() dependency_links = parse_dependency_links() tests_require = parse_requirements(['tools/test-requires']) write_git_changelog() +generate_authors() if sys.version_info < (2, 6): requires.append('simplejson') diff --git a/tests/test_authors.py b/tests/test_authors.py deleted file mode 100644 index b9c3d10..0000000 --- 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) |