~ubuntu-branches/ubuntu/raring/horizon/raring

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-06-01 10:57:56 UTC
  • mfrom: (1.1.15)
  • Revision ID: package-import@ubuntu.com-20120601105756-dif0km7n98vhdi2x
Tags: 2012.2~f2~20120530.1777-0ubuntu1
* New upstream release. 
* debian/patches/add_juju_settings_panel.patch: Refreshed
* debian/patches/turn-off-debug.patch: Refreshed

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
import os
23
23
import re
24
 
from setuptools import setup, find_packages
 
24
import setuptools
25
25
from horizon import version
26
26
 
 
27
from horizon.openstack.common import setup
 
28
 
 
29
requires = setup.parse_requirements()
 
30
depend_links = setup.parse_dependency_links()
 
31
tests_require = setup.parse_requirements(['tools/test-requires'])
27
32
 
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")
31
 
 
32
 
 
33
 
def parse_requirements(*filenames):
34
 
    """
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
37
 
    two places.
38
 
    """
39
 
    requirements = []
40
 
    for f in filenames:
41
 
        for line in open(f, 'r').read().split('\n'):
42
 
            # Comment lines. Skip.
43
 
            if re.match(r'(\s*#)|(\s*$)', line):
44
 
                continue
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):
51
 
                pass
52
 
            else:
53
 
                requirements.append(line)
54
 
    return requirements
55
 
 
56
 
 
57
 
def parse_dependency_links(*filenames):
58
 
    """
59
 
    We generate our dependency_links from the pip-requires and test-requires
60
 
    files for the dependencies pulled from github (prepended with -e).
61
 
    """
62
 
    dependency_links = []
63
 
    for f in filenames:
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
71
 
 
72
34
 
73
35
def read(fname):
74
36
    return open(os.path.join(ROOT, fname)).read()
75
37
 
76
38
 
77
 
setup(name="horizon",
 
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,
87
53
      zip_safe=False,
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',