~midokura/nova/midostack-oneiric

114 by Devin Carlen
Updated licenses
1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
3
# Copyright 2010 United States Government as represented by the
3.1.9 by Vishvananda Ishaya
Removed trailing whitespace from header
4
# Administrator of the National Aeronautics and Space Administration.
114 by Devin Carlen
Updated licenses
5
# All Rights Reserved.
6
#
7
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
8
#    not use this file except in compliance with the License. You may obtain
9
#    a copy of the License at
10
#
11
#         http://www.apache.org/licenses/LICENSE-2.0
12
#
1 by Jesse Andrews
initial commit
13
#    Unless required by applicable law or agreed to in writing, software
114 by Devin Carlen
Updated licenses
14
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16
#    License for the specific language governing permissions and limitations
17
#    under the License.
1 by Jesse Andrews
initial commit
18
988.2.9 by Brian Waldon
adding gettext to setup.py
19
import gettext
942.1.3 by Soren Hansen
Add a find_data_files method to setup.py. Use it to get tools/ installed under /usr/(local/)/share/nova
20
import glob
396.2.1 by Soren Hansen
Added a .mailmap that maps addresses in bzr to people's real, preferred
21
import os
22
import subprocess
673.1.2 by jaypipes at gmail
Adds Distutils.Extra support, removes Babel support, which is half-baked at best.
23
import sys
396.2.1 by Soren Hansen
Added a .mailmap that maps addresses in bzr to people's real, preferred
24
645.3.1 by jaypipes at gmail
Merge Distutils.Extra changes for automating translation message catalog compilation
25
from setuptools import find_packages
186.1.1 by Monty Taylor
Added ChangeLog generation.
26
from setuptools.command.sdist import sdist
27
1031.1.1 by jaypipes at gmail
Make the import of distutils.extra non-mandatory in setup.py. Just print a warning that i18n commands are not available...
28
# In order to run the i18n commands for compiling and
29
# installing message catalogs, we use DistUtilsExtra.
30
# Don't make this a hard requirement, but warn that
31
# i18n commands won't be available if DistUtilsExtra is
32
# not installed...
645.3.1 by jaypipes at gmail
Merge Distutils.Extra changes for automating translation message catalog compilation
33
try:
1031.1.1 by jaypipes at gmail
Make the import of distutils.extra non-mandatory in setup.py. Just print a warning that i18n commands are not available...
34
    from DistUtilsExtra.auto import setup
645.3.1 by jaypipes at gmail
Merge Distutils.Extra changes for automating translation message catalog compilation
35
except ImportError:
1031.1.1 by jaypipes at gmail
Make the import of distutils.extra non-mandatory in setup.py. Just print a warning that i18n commands are not available...
36
    from setuptools import setup
37
    print "Warning: DistUtilsExtra required to use i18n builders. "
38
    print "To build nova with support for message catalogs, you need "
39
    print "  https://launchpad.net/python-distutils-extra >= 2.18"
645.3.1 by jaypipes at gmail
Merge Distutils.Extra changes for automating translation message catalog compilation
40
988.2.9 by Brian Waldon
adding gettext to setup.py
41
gettext.install('nova', unicode=1)
645.3.1 by jaypipes at gmail
Merge Distutils.Extra changes for automating translation message catalog compilation
42
396.2.7 by Soren Hansen
Fix typo "nova.util" -> "nova.utils"
43
from nova.utils import parse_mailmap, str_dict_replace
515.6.2 by Soren Hansen
Less code generation.
44
from nova import version
45
46
if os.path.isdir('.bzr'):
47
    with open("nova/vcsversion.py", 'w') as version_file:
515.5.1 by Todd Willey
Track version info, and make available for logging.
48
        vcs_cmd = subprocess.Popen(["bzr", "version-info", "--python"],
49
                                   stdout=subprocess.PIPE)
50
        vcsversion = vcs_cmd.communicate()[0]
51
        version_file.write(vcsversion)
52
53
186.1.1 by Monty Taylor
Added ChangeLog generation.
54
class local_sdist(sdist):
55
    """Customized sdist hook - builds the ChangeLog file from VC first"""
56
57
    def run(self):
58
        if os.path.isdir('.bzr'):
59
            # We're in a bzr branch
254.1.1 by Soren Hansen
Better log formatter for Nova. It's just like gnuchangelog, but logs the author rather than the committer.
60
            env = os.environ.copy()
61
            env['BZR_PLUGIN_PATH'] = os.path.abspath('./bzrplugins')
62
            log_cmd = subprocess.Popen(["bzr", "log", "--novalog"],
63
                                       stdout=subprocess.PIPE, env=env)
186.1.1 by Monty Taylor
Added ChangeLog generation.
64
            changelog = log_cmd.communicate()[0]
396.2.1 by Soren Hansen
Added a .mailmap that maps addresses in bzr to people's real, preferred
65
            mailmap = parse_mailmap()
186.1.1 by Monty Taylor
Added ChangeLog generation.
66
            with open("ChangeLog", "w") as changelog_file:
396.2.1 by Soren Hansen
Added a .mailmap that maps addresses in bzr to people's real, preferred
67
                changelog_file.write(str_dict_replace(changelog, mailmap))
186.1.1 by Monty Taylor
Added ChangeLog generation.
68
        sdist.run(self)
611.2.1 by Monty Taylor
Adds conditional around sphinx inclusion.
69
nova_cmdclass = {'sdist': local_sdist}
70
71
72
try:
73
    from sphinx.setup_command import BuildDoc
611.2.2 by Monty Taylor
Fixed a pep8 spacing issue.
74
611.2.1 by Monty Taylor
Adds conditional around sphinx inclusion.
75
    class local_BuildDoc(BuildDoc):
76
        def run(self):
77
            for builder in ['html', 'man']:
78
                self.builder = builder
79
                self.finalize_options()
80
                BuildDoc.run(self)
81
    nova_cmdclass['build_sphinx'] = local_BuildDoc
82
83
except:
84
    pass
85
536.1.1 by Monty Taylor
Added babel/gettext build support.
86
87
try:
579.2.1 by Soren Hansen
Refactor run_tests.sh to allow us to run an extra command after the tests.
88
    from babel.messages import frontend as babel
89
    nova_cmdclass['compile_catalog'] = babel.compile_catalog
90
    nova_cmdclass['extract_messages'] = babel.extract_messages
91
    nova_cmdclass['init_catalog'] = babel.init_catalog
92
    nova_cmdclass['update_catalog'] = babel.update_catalog
536.1.1 by Monty Taylor
Added babel/gettext build support.
93
except:
579.2.1 by Soren Hansen
Refactor run_tests.sh to allow us to run an extra command after the tests.
94
    pass
536.1.1 by Monty Taylor
Added babel/gettext build support.
95
942.1.3 by Soren Hansen
Add a find_data_files method to setup.py. Use it to get tools/ installed under /usr/(local/)/share/nova
96
97
def find_data_files(destdir, srcdir):
98
    package_data = []
99
    files = []
100
    for d in glob.glob('%s/*' % (srcdir, )):
101
        if os.path.isdir(d):
102
            package_data += find_data_files(
103
                                 os.path.join(destdir, os.path.basename(d)), d)
104
        else:
105
            files += [d]
106
    package_data += [(destdir, files)]
107
    return package_data
108
1031.1.1 by jaypipes at gmail
Make the import of distutils.extra non-mandatory in setup.py. Just print a warning that i18n commands are not available...
109
setup(name='nova',
515.6.5 by Soren Hansen
s/canonical_version/canonical_version_string/g
110
      version=version.canonical_version_string(),
175.2.1 by Soren Hansen
Bump version to 0.9.0.
111
      description='cloud computing fabric controller',
112
      author='OpenStack',
113
      author_email='nova@lists.launchpad.net',
114
      url='http://www.openstack.org/',
536.1.1 by Monty Taylor
Added babel/gettext build support.
115
      cmdclass=nova_cmdclass,
186.1.2 by Monty Taylor
Fixed pep8 issues in setup.py - thanks redbo.
116
      packages=find_packages(exclude=['bin', 'smoketests']),
423.1.1 by Soren Hansen
Add include_package_data=True to setup.py.
117
      include_package_data=True,
465.3.1 by Monty Taylor
Added reference in setup.py so that python setup.py test works now.
118
      test_suite='nose.collector',
942.1.3 by Soren Hansen
Add a find_data_files method to setup.py. Use it to get tools/ installed under /usr/(local/)/share/nova
119
      data_files=find_data_files('share/nova', 'tools'),
672.1.1 by Thierry Carrez
Adding missing scripts and files to setup.py / MANIFEST.in
120
      scripts=['bin/nova-ajax-console-proxy',
121
               'bin/nova-api',
181.1.5 by Monty Taylor
Updated setup.py file to install stuff on a python setup.py install command.
122
               'bin/nova-compute',
672.1.1 by Thierry Carrez
Adding missing scripts and files to setup.py / MANIFEST.in
123
               'bin/nova-console',
181.1.5 by Monty Taylor
Updated setup.py file to install stuff on a python setup.py install command.
124
               'bin/nova-dhcpbridge',
672.1.1 by Thierry Carrez
Adding missing scripts and files to setup.py / MANIFEST.in
125
               'bin/nova-direct-api',
181.1.5 by Monty Taylor
Updated setup.py file to install stuff on a python setup.py install command.
126
               'bin/nova-import-canonical-imagestore',
127
               'bin/nova-instancemonitor',
515.4.1 by Todd Willey
Apply logging changes as a giant patch to work around the cloudpipe delete + add issue in the original patch.
128
               'bin/nova-logspool',
181.1.5 by Monty Taylor
Updated setup.py file to install stuff on a python setup.py install command.
129
               'bin/nova-manage',
130
               'bin/nova-network',
131
               'bin/nova-objectstore',
292.1.2 by Soren Hansen
Install nova-scheduler.
132
               'bin/nova-scheduler',
515.4.1 by Todd Willey
Apply logging changes as a giant patch to work around the cloudpipe delete + add issue in the original patch.
133
               'bin/nova-spoolsentry',
672.1.1 by Thierry Carrez
Adding missing scripts and files to setup.py / MANIFEST.in
134
               'bin/stack',
382.3.2 by Vishvananda Ishaya
add nova-debug to setup.py
135
               'bin/nova-volume',
752.5.31 by Anthony Young
add nova-vncproxy to setup.py
136
               'bin/nova-vncproxy',
382.3.2 by Vishvananda Ishaya
add nova-debug to setup.py
137
               'tools/nova-debug'])