summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorGabriel Hurley <gabriel@strikeawe.com>2012-02-29 17:31:12 -0800
committerGabriel Hurley <gabriel@strikeawe.com>2012-02-29 17:31:12 -0800
commit2042b89649673b767fd4eb5a1b4ce88b03291e30 (patch)
tree183fd0c80efd7e658639cf23e181548914e5db70 /setup.py
parenta67402595b05909f18af9b827fd4e326bf95d3da (diff)
downloadhorizon-2042b89649673b767fd4eb5a1b4ce88b03291e30.tar.gz
Makes setup.py actually list it's dependencies for pip/easy_install.
Change-Id: I9b774f5d64662f67d2a4dd2d1dd4dc59be0f45df
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py53
1 files changed, 45 insertions, 8 deletions
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',