diff --git a/.gitignore b/.gitignore index f0e1ef517..a933f74fa 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,5 @@ openstack_dashboard/local/local_settings.py docs/build/ docs/source/sourcecode .venv +build +dist diff --git a/setup.py b/setup.py index 4f5430f38..c6086977b 100755 --- a/setup.py +++ b/setup.py @@ -19,12 +19,52 @@ # under the License. import os -from setuptools import setup, find_packages, findall +import re +from setuptools import setup, find_packages from horizon import version +ROOT = os.path.dirname(__file__) +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): + requirements = [] + for f in filenames: + for line in open(f, 'r').read().split('\n'): + if re.match(r'(\s*#)|(\s*$)', line): + continue + 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 + else: + requirements.append(line) + return requirements + + +def parse_dependency_links(*filenames): + dependency_links = [] + for f in filenames: + for line in open(f, 'r').read().split('\n'): + if re.match(r'\s*-[ef]\s+', line): + line = re.sub(r'\s*-[ef]\s+', '', line) + line = re.sub(r'\s*git\+https', 'http', line) + line = re.sub(r'\.git#', '/tarball/master#', line) + dependency_links.append(line) + return dependency_links + + def read(fname): - return open(os.path.join(os.path.dirname(__file__), fname)).read() + return open(os.path.join(ROOT, fname)).read() setup(name="horizon", @@ -36,12 +76,9 @@ setup(name="horizon", author='Devin Carlen', author_email='devin.carlen@gmail.com', packages=find_packages(), - package_data={'horizon': [s[len('horizon/'):] for s in - findall('horizon/templates') \ - + findall('horizon/dashboards/nova/templates') \ - + findall('horizon/dashboards/syspanel/templates') \ - + findall('horizon/dashboards/settings/templates')]}, - install_requires=[], + zip_safe=False, + install_requires=parse_requirements(PIP_REQUIRES, TEST_REQUIRES), + dependency_links=parse_dependency_links(PIP_REQUIRES, TEST_REQUIRES), classifiers=['Development Status :: 4 - Beta', 'Framework :: Django', 'Intended Audience :: Developers', diff --git a/tools/pip-requires b/tools/pip-requires index ff3d9f148..9654e15ec 100644 --- a/tools/pip-requires +++ b/tools/pip-requires @@ -19,5 +19,5 @@ iso8601 # Horizon Non-pip Requirements -e git+https://github.com/openstack/python-novaclient.git#egg=python-novaclient -e git+https://github.com/openstack/python-keystoneclient.git#egg=python-keystoneclient --e git+https://github.com/openstack/python-quantumclient.git#egg=python-quantumclient-dev +-e git+https://github.com/openstack/python-quantumclient.git#egg=python-quantumclient -e git+https://github.com/openstack/glance.git#egg=glance diff --git a/tools/test-requires b/tools/test-requires index a586718b2..1ce28d514 100644 --- a/tools/test-requires +++ b/tools/test-requires @@ -1,10 +1,10 @@ # Testing Requirements CherryPy coverage -django-nose==0.1.2 +django-nose django-nose-selenium mox -nose==1.0.0 +nose pep8 pylint