~ubuntu-branches/ubuntu/quantal/keystone/quantal-security

« back to all changes in this revision

Viewing changes to keystone/openstack/common/setup.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-06-22 12:27:50 UTC
  • mto: (35.1.1 quantal-proposed)
  • mto: This revision was merged to the branch mainline in revision 28.
  • Revision ID: package-import@ubuntu.com-20120622122750-4urdq17en1990apn
Tags: upstream-2012.2~f2~20120622.2353
ImportĀ upstreamĀ versionĀ 2012.2~f2~20120622.2353

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
import re
24
24
import subprocess
25
25
 
 
26
from setuptools.command import sdist
 
27
 
26
28
 
27
29
def parse_mailmap(mailmap='.mailmap'):
28
30
    mapping = {}
31
33
        for l in fp:
32
34
            l = l.strip()
33
35
            if not l.startswith('#') and ' ' in l:
34
 
                canonical_email, alias = [x for x in l.split(' ') \
35
 
                                         if x.startswith('<')]
 
36
                canonical_email, alias = [x for x in l.split(' ')
 
37
                                          if x.startswith('<')]
36
38
                mapping[alias] = canonical_email
37
39
    return mapping
38
40
 
48
50
 
49
51
# Get requirements from the first file that exists
50
52
def get_reqs_from_files(requirements_files):
 
53
    reqs_in = []
51
54
    for requirements_file in requirements_files:
52
55
        if os.path.exists(requirements_file):
53
56
            return open(requirements_file, 'r').read().split('\n')
143
146
            if os.path.exists(old_authors):
144
147
                with open(old_authors, "r") as old_authors_fh:
145
148
                    new_authors_fh.write('\n' + old_authors_fh.read())
 
149
 
 
150
 
 
151
def get_cmdclass():
 
152
    """Return dict of commands to run from setup.py."""
 
153
 
 
154
    cmdclass = dict()
 
155
 
 
156
    class LocalSDist(sdist.sdist):
 
157
        """Builds the ChangeLog and Authors files from VC first."""
 
158
 
 
159
        def run(self):
 
160
            write_git_changelog()
 
161
            generate_authors()
 
162
            # sdist.sdist is an old style class, can't use super()
 
163
            sdist.sdist.run(self)
 
164
 
 
165
    cmdclass['sdist'] = LocalSDist
 
166
 
 
167
    # If Sphinx is installed on the box running setup.py,
 
168
    # enable setup.py to build the documentation, otherwise,
 
169
    # just ignore it
 
170
    try:
 
171
        from sphinx.setup_command import BuildDoc
 
172
 
 
173
        class LocalBuildDoc(BuildDoc):
 
174
            def run(self):
 
175
                for builder in ['html', 'man']:
 
176
                    self.builder = builder
 
177
                    self.finalize_options()
 
178
                    BuildDoc.run(self)
 
179
        cmdclass['build_sphinx'] = LocalBuildDoc
 
180
    except ImportError:
 
181
        pass
 
182
 
 
183
    return cmdclass