diff options
author | Bhuvan Arumugam <bhuvan@apache.org> | 2012-06-01 22:12:26 -0700 |
---|---|---|
committer | Bhuvan Arumugam <bhuvan@apache.org> | 2012-06-21 21:14:26 -0700 |
commit | 94f45dac5129e3394583703a3b496d8e160a0c43 (patch) | |
tree | 792d49673bfba69e2e381e62fd81836bc9a492f2 /keystone/openstack | |
parent | 991a6182e06327ed144f224efb04a81ddab2fae0 (diff) | |
download | keystone-94f45dac5129e3394583703a3b496d8e160a0c43.tar.gz keystone-94f45dac5129e3394583703a3b496d8e160a0c43.tar.xz keystone-94f45dac5129e3394583703a3b496d8e160a0c43.zip |
Utilize newer changes in openstack-common.
Use common.setup.get_cmdclass() to clean-up redundant code.
* keystone/openstack/common/setup.py
Sync from openstack-common project.
* setup.py
Code clean-up. No functional change.
Change-Id: I12f538ba8e727270b3b615dc06b0fd0328f36e1e
Diffstat (limited to 'keystone/openstack')
-rw-r--r-- | keystone/openstack/common/setup.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/keystone/openstack/common/setup.py b/keystone/openstack/common/setup.py index 09f71a37..ff4b9b55 100644 --- a/keystone/openstack/common/setup.py +++ b/keystone/openstack/common/setup.py @@ -23,6 +23,8 @@ import os import re import subprocess +from setuptools.command import sdist + def parse_mailmap(mailmap='.mailmap'): mapping = {} @@ -48,6 +50,7 @@ def canonicalize_emails(changelog, mapping): # Get requirements from the first file that exists def get_reqs_from_files(requirements_files): + reqs_in = [] for requirements_file in requirements_files: if os.path.exists(requirements_file): return open(requirements_file, 'r').read().split('\n') @@ -143,3 +146,38 @@ def generate_authors(): if os.path.exists(old_authors): with open(old_authors, "r") as old_authors_fh: new_authors_fh.write('\n' + old_authors_fh.read()) + + +def get_cmdclass(): + """Return dict of commands to run from setup.py.""" + + cmdclass = dict() + + class LocalSDist(sdist.sdist): + """Builds the ChangeLog and Authors files from VC first.""" + + def run(self): + write_git_changelog() + generate_authors() + # sdist.sdist is an old style class, can't use super() + sdist.sdist.run(self) + + cmdclass['sdist'] = LocalSDist + + # If Sphinx is installed on the box running setup.py, + # enable setup.py to build the documentation, otherwise, + # just ignore it + try: + from sphinx.setup_command import BuildDoc + + class LocalBuildDoc(BuildDoc): + def run(self): + for builder in ['html', 'man']: + self.builder = builder + self.finalize_options() + BuildDoc.run(self) + cmdclass['build_sphinx'] = LocalBuildDoc + except ImportError: + pass + + return cmdclass |