Picking up dependencies from pip-requires file.

Also, removing pip-requires_essex and test-requires_essex

https://bugs.launchpad.net/ceilometer/+bug/1055319

Change-Id: Ifec6b8fe5b53b45d8c94fbc87110f20541e9f3d0
This commit is contained in:
Surya Prabhakar 2012-09-21 14:24:04 +05:30
parent 913c33c341
commit 49209f45f6
7 changed files with 96 additions and 31 deletions

View File

@ -0,0 +1,83 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
# 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.
"""
Utilities with minimum-depends for use in setup.py
"""
import datetime
import os
import re
import subprocess
import sys
from setuptools.command import sdist
# Get requirements from the first file that exists
def get_reqs_from_files(requirements_files):
for requirements_file in requirements_files:
if os.path.exists(requirements_file):
return open(requirements_file, 'r').read().split('\n')
return []
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))
# 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
# argparse is part of the standard library starting with 2.7
# adding it to the requirements list screws distro installs
elif line == 'argparse' and sys.version_info >= (2, 7):
pass
else:
requirements.append(line)
return requirements
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

View File

@ -21,6 +21,11 @@ import textwrap
import setuptools
from ceilometer.openstack.common import setup
requires = setup.parse_requirements()
depend_links = setup.parse_dependency_links()
setuptools.setup(
name='ceilometer',
version='0',
@ -37,6 +42,8 @@ setuptools.setup(
'bin/ceilometer-api',
'bin/ceilometer-collector'],
py_modules=[],
install_requires=requires,
dependency_links=depend_links,
entry_points=textwrap.dedent("""
[ceilometer.collector]
instance = ceilometer.compute.notifications:Instance

View File

@ -1,5 +1,3 @@
http://tarballs.openstack.org/nova/nova-master.tar.gz
http://tarballs.openstack.org/glance/glance-master.tar.gz
webob
kombu
iso8601
@ -8,6 +6,6 @@ netaddr
argparse
sqlalchemy
eventlet
anyjson==0.3.1
anyjson>=0.3.1
Flask==0.9
stevedore>=0.4

View File

@ -1,13 +0,0 @@
https://github.com/openstack/openstack-common/zipball/master#egg=openstack.common
https://github.com/openstack/nova/zipball/2012.1.1#egg=nova
https://github.com/openstack/python-novaclient/zipball/2012.1#egg=novaclient
webob
kombu
iso8601
lockfile
netaddr
argparse
sqlalchemy
anyjson==0.3.1
Flask==0.9
stevedore>=0.4

View File

@ -3,7 +3,6 @@ coverage
pep8>=1.0
mock
mox
glance>=2011.3.1
python-glanceclient
# NOTE(dhellmann): Ming is necessary to provide the Mongo-in-memory
# implementation of MongoDB. The original source for Ming is at
@ -13,4 +12,6 @@ python-glanceclient
# github to make it easier to install, then ended up making some
# changes to it so it would be compatible with PyMongo's API.
https://github.com/dreamhost/Ming/zipball/master#egg=Ming
http://tarballs.openstack.org/nova/nova-master.tar.gz
http://tarballs.openstack.org/glance/glance-master.tar.gz
setuptools-git>=0.4

View File

@ -1 +0,0 @@
carrot

16
tox.ini
View File

@ -1,9 +1,9 @@
[tox]
envlist = py26,py27,pep8,py26-essex,py27-essex
envlist = py26,py27,pep8
[testenv]
deps = -r{toxinidir}/tools/pip-requires
-r{toxinidir}/tools/test-requires
deps = -r{toxinidir}/tools/test-requires
-r{toxinidir}/tools/pip-requires
setenv = VIRTUAL_ENV={envdir}
NOSE_WITH_OPENSTACK=1
NOSE_OPENSTACK_COLOR=1
@ -19,13 +19,3 @@ commands = {toxinidir}/run_tests.sh --no-path-adjustment --with-coverage --cover
[testenv:pep8]
deps = pep8==1.1
commands = pep8 --repeat --show-source ceilometer setup.py bin/ceilometer-agent-central bin/ceilometer-agent-compute bin/ceilometer-collector bin/ceilometer-api tests
[testenv:py26-essex]
deps = -r{toxinidir}/tools/pip-requires_essex
-r{toxinidir}/tools/test-requires
-r{toxinidir}/tools/test-requires_essex
[testenv:py27-essex]
deps = -r{toxinidir}/tools/pip-requires_essex
-r{toxinidir}/tools/test-requires
-r{toxinidir}/tools/test-requires_essex