~ubuntu-branches/ubuntu/trusty/horizon/trusty

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-03-09 11:50:22 UTC
  • mfrom: (1.1.9)
  • Revision ID: package-import@ubuntu.com-20120309115022-ymiww5i58rbg97my
Tags: 2012.1~rc1~20120308.1479-0ubuntu1
* New upstream version.
* debian/rules: Fix symlink when installing horizon.
  (LP: #947118)
* debian/control: Add python-django-nose as a dep. (LP: #944235)
* debian/control: Fix broken depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#    under the License.
20
20
 
21
21
import os
22
 
from setuptools import setup, find_packages, findall
 
22
import re
 
23
from setuptools import setup, find_packages
23
24
from horizon import version
24
25
 
25
26
 
 
27
ROOT = os.path.dirname(__file__)
 
28
PIP_REQUIRES = os.path.join(ROOT, "tools", "pip-requires")
 
29
TEST_REQUIRES = os.path.join(ROOT, "tools", "test-requires")
 
30
 
 
31
 
 
32
def parse_requirements(*filenames):
 
33
    """
 
34
    We generate our install_requires from the pip-requires and test-requires
 
35
    files so that we don't have to maintain the dependency definitions in
 
36
    two places.
 
37
    """
 
38
    requirements = []
 
39
    for f in filenames:
 
40
        for line in open(f, 'r').read().split('\n'):
 
41
            # Comment lines. Skip.
 
42
            if re.match(r'(\s*#)|(\s*$)', line):
 
43
                continue
 
44
            # Editable matches. Put the egg name into our reqs list.
 
45
            if re.match(r'\s*-e\s+', line):
 
46
                pkg = re.sub(r'\s*-e\s+.*#egg=(.*)$', r'\1', line)
 
47
                requirements.append("%s" % pkg)
 
48
            # File-based installs not supported/needed. Skip.
 
49
            elif re.match(r'\s*-f\s+', line):
 
50
                pass
 
51
            else:
 
52
                requirements.append(line)
 
53
    return requirements
 
54
 
 
55
 
 
56
def parse_dependency_links(*filenames):
 
57
    """
 
58
    We generate our dependency_links from the pip-requires and test-requires
 
59
    files for the dependencies pulled from github (prepended with -e).
 
60
    """
 
61
    dependency_links = []
 
62
    for f in filenames:
 
63
        for line in open(f, 'r').read().split('\n'):
 
64
            if re.match(r'\s*-[ef]\s+', line):
 
65
                line = re.sub(r'\s*-[ef]\s+', '', line)
 
66
                line = re.sub(r'\s*git\+https', 'http', line)
 
67
                line = re.sub(r'\.git#', '/tarball/master#', line)
 
68
                dependency_links.append(line)
 
69
    return dependency_links
 
70
 
 
71
 
26
72
def read(fname):
27
 
    return open(os.path.join(os.path.dirname(__file__), fname)).read()
 
73
    return open(os.path.join(ROOT, fname)).read()
28
74
 
29
75
 
30
76
setup(name="horizon",
33
79
      license='Apache 2.0',
34
80
      description="The OpenStack Dashboard.",
35
81
      long_description=read('README.rst'),
36
 
      author='Devin Carlen',
37
 
      author_email='devin.carlen@gmail.com',
 
82
      author='OpenStack',
 
83
      author_email='horizon@lists.launchpad.net',
38
84
      packages=find_packages(),
39
85
      include_package_data=True,
40
 
      package_data={'horizon': [s[len('horizon/'):] for s in
41
 
                                findall('horizon/templates') \
42
 
                                + findall('horizon/dashboards/nova/templates') \
43
 
                                + findall('horizon/dashboards/syspanel/templates') \
44
 
                                + findall('horizon/dashboards/settings/templates')]},
45
 
      install_requires=[],
 
86
      zip_safe=False,
 
87
      install_requires=parse_requirements(PIP_REQUIRES),
 
88
      tests_require=parse_requirements(TEST_REQUIRES),
 
89
      dependency_links=parse_dependency_links(PIP_REQUIRES, TEST_REQUIRES),
46
90
      classifiers=['Development Status :: 4 - Beta',
47
91
                   'Framework :: Django',
48
92
                   'Intended Audience :: Developers',