One last redux for setup.py requirement parsing.

Working around some limitations of setuptools/distribute/distutils
in order to get the right versions of everything installed.

Splits requirements out between core requirements and testing
requirements.

Change-Id: I2157527a91041a6297efe689b2a709f47fc605d8
This commit is contained in:
Gabriel Hurley 2012-03-02 13:59:07 -08:00
parent c16ba74d9f
commit f5a8fd4404
3 changed files with 21 additions and 12 deletions

View File

@ -29,20 +29,24 @@ PIP_REQUIRES = os.path.join(ROOT, "tools", "pip-requires")
TEST_REQUIRES = os.path.join(ROOT, "tools", "test-requires")
"""
We generate our install_requires and dependency_links from the
files listed in pip-requires and test-requires so that we don't have
to maintain the dependency definitions in two places.
"""
def parse_requirements(*filenames):
"""
We generate our install_requires from the pip-requires and test-requires
files so that we don't have to maintain the dependency definitions in
two places.
"""
requirements = []
for f in filenames:
for line in open(f, 'r').read().split('\n'):
# Comment lines. Skip.
if re.match(r'(\s*#)|(\s*$)', line):
continue
elif re.match(r'\s*-[ef]\s+', line):
# Editable matches. Put the egg name into our reqs list.
if re.match(r'\s*-e\s+', line):
pkg = re.sub(r'\s*-e\s+.*#egg=(.*)$', r'\1', line)
requirements.append("%s" % pkg)
# File-based installs not supported/needed. Skip.
elif re.match(r'\s*-f\s+', line):
pass
else:
requirements.append(line)
@ -50,6 +54,10 @@ def parse_requirements(*filenames):
def parse_dependency_links(*filenames):
"""
We generate our dependency_links from the pip-requires and test-requires
files for the dependencies pulled from github (prepended with -e).
"""
dependency_links = []
for f in filenames:
for line in open(f, 'r').read().split('\n'):
@ -71,12 +79,13 @@ setup(name="horizon",
license='Apache 2.0',
description="The OpenStack Dashboard.",
long_description=read('README.rst'),
author='Devin Carlen',
author_email='devin.carlen@gmail.com',
author='OpenStack',
author_email='horizon@lists.launchpad.net',
packages=find_packages(),
include_package_data=True,
zip_safe=False,
install_requires=parse_requirements(PIP_REQUIRES, TEST_REQUIRES),
install_requires=parse_requirements(PIP_REQUIRES),
tests_require=parse_requirements(TEST_REQUIRES),
dependency_links=parse_dependency_links(PIP_REQUIRES, TEST_REQUIRES),
classifiers=['Development Status :: 4 - Beta',
'Framework :: Django',

View File

@ -2,6 +2,7 @@
Django>=1.3
python-cloudfiles
python-dateutil
django-nose
# Glance Requirements
PasteDeploy

View File

@ -1,7 +1,6 @@
# Testing Requirements
CherryPy
coverage
django-nose
django-nose-selenium
mox
nose