diff --git a/.gitignore b/.gitignore index cd970b93..58c9e7e5 100644 --- a/.gitignore +++ b/.gitignore @@ -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 b13279be..00000000 --- a/AUTHORS +++ /dev/null @@ -1,9 +0,0 @@ -Brian Waldon -Jay Pipes -Monty Taylor -Dean Troyer -Gabriel Hurley -James E. Blair -Chuck Short -Michael Basnight -Thierry Carrez diff --git a/glanceclient/openstack/common/setup.py b/glanceclient/openstack/common/setup.py index 7c2835e6..79b5a62b 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/setup.py b/setup.py index 4634ccd9..750f9acf 100644 --- a/setup.py +++ b/setup.py @@ -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 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)