From f5a8fd44045f45c26e32d31d696e7de1f6c29ec2 Mon Sep 17 00:00:00 2001 From: Gabriel Hurley Date: Fri, 2 Mar 2012 13:59:07 -0800 Subject: [PATCH] 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 --- setup.py | 31 ++++++++++++++++++++----------- tools/pip-requires | 1 + tools/test-requires | 1 - 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/setup.py b/setup.py index dad157aff1..6127d9d4db 100755 --- a/setup.py +++ b/setup.py @@ -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', diff --git a/tools/pip-requires b/tools/pip-requires index eb36aee280..929fd3b59e 100644 --- a/tools/pip-requires +++ b/tools/pip-requires @@ -2,6 +2,7 @@ Django>=1.3 python-cloudfiles python-dateutil +django-nose # Glance Requirements PasteDeploy diff --git a/tools/test-requires b/tools/test-requires index 1ce28d514d..6aaa187c52 100644 --- a/tools/test-requires +++ b/tools/test-requires @@ -1,7 +1,6 @@ # Testing Requirements CherryPy coverage -django-nose django-nose-selenium mox nose