24
from setuptools import setup, find_packages
25
25
from horizon import version
27
from horizon.openstack.common import setup
29
requires = setup.parse_requirements()
30
depend_links = setup.parse_dependency_links()
31
tests_require = setup.parse_requirements(['tools/test-requires'])
28
33
ROOT = os.path.dirname(__file__)
29
PIP_REQUIRES = os.path.join(ROOT, "tools", "pip-requires")
30
TEST_REQUIRES = os.path.join(ROOT, "tools", "test-requires")
33
def parse_requirements(*filenames):
35
We generate our install_requires from the pip-requires and test-requires
36
files so that we don't have to maintain the dependency definitions in
41
for line in open(f, 'r').read().split('\n'):
42
# Comment lines. Skip.
43
if re.match(r'(\s*#)|(\s*$)', line):
45
# Editable matches. Put the egg name into our reqs list.
46
if re.match(r'\s*-e\s+', line):
47
pkg = re.sub(r'\s*-e\s+.*#egg=(.*)$', r'\1', line)
48
requirements.append("%s" % pkg)
49
# File-based installs not supported/needed. Skip.
50
elif re.match(r'\s*-f\s+', line):
53
requirements.append(line)
57
def parse_dependency_links(*filenames):
59
We generate our dependency_links from the pip-requires and test-requires
60
files for the dependencies pulled from github (prepended with -e).
64
for line in open(f, 'r').read().split('\n'):
65
if re.match(r'\s*-[ef]\s+', line):
66
line = re.sub(r'\s*-[ef]\s+', '', line)
67
line = re.sub(r'\s*git\+https', 'http', line)
68
line = re.sub(r'\.git#', '/tarball/master#', line)
69
dependency_links.append(line)
70
return dependency_links
74
36
return open(os.path.join(ROOT, fname)).read()
39
setuptools.setup(name="horizon",
78
40
version=version.canonical_version_string(),
79
41
url='https://github.com/openstack/horizon/',
80
42
license='Apache 2.0',
82
44
long_description=read('README.rst'),
83
45
author='OpenStack',
84
46
author_email='horizon@lists.launchpad.net',
85
packages=find_packages(),
47
packages=setuptools.find_packages(),
48
cmdclass=setup.get_cmdclass(),
86
49
include_package_data=True,
50
install_requires=requires,
51
tests_require=tests_require,
52
dependency_links=depend_links,
88
install_requires=parse_requirements(PIP_REQUIRES),
89
tests_require=parse_requirements(TEST_REQUIRES),
90
dependency_links=parse_dependency_links(PIP_REQUIRES, TEST_REQUIRES),
91
54
classifiers=['Development Status :: 4 - Beta',
92
55
'Framework :: Django',
93
56
'Intended Audience :: Developers',