From 12a89225e30d2b31854be387b78cd60a15446163 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Fri, 13 Jul 2012 12:07:33 -0400 Subject: Add SKIP_WRITE_GIT_CHANGELOG to setup.py. Sync with latest setup.py from openstack-common which adds options to SKIP_WRITE_GIT_CHANGELOG and SKIP_GENERATE_AUTHORS. If you set SKIP_WRITE_GIT_CHANGELOG in your environment it will speed up sdist creation by 10-20 seconds which also helps make tox run faster (because it runs sdist). Change-Id: I5da708d2e9547d5e554cf49ecfcf39591de6a4e5 --- nova/openstack/common/setup.py | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) (limited to 'nova/openstack') diff --git a/nova/openstack/common/setup.py b/nova/openstack/common/setup.py index 2be72e61a..59f255d0c 100644 --- a/nova/openstack/common/setup.py +++ b/nova/openstack/common/setup.py @@ -178,12 +178,16 @@ def _get_git_post_version(): def write_git_changelog(): """Write a changelog based on the git changelog.""" - if os.path.isdir('.git'): - git_log_cmd = 'git log --stat' - changelog = _run_shell_command(git_log_cmd) - mailmap = parse_mailmap() - with open("ChangeLog", "w") as changelog_file: - changelog_file.write(canonicalize_emails(changelog, mailmap)) + new_changelog = 'ChangeLog' + if not os.getenv('SKIP_WRITE_GIT_CHANGELOG'): + if os.path.isdir('.git'): + git_log_cmd = 'git log --stat' + changelog = _run_shell_command(git_log_cmd) + mailmap = parse_mailmap() + with open(new_changelog, "w") as changelog_file: + changelog_file.write(canonicalize_emails(changelog, mailmap)) + else: + open(new_changelog, 'w').close() def generate_authors(): @@ -191,17 +195,21 @@ def generate_authors(): jenkins_email = 'jenkins@review.openstack.org' old_authors = 'AUTHORS.in' new_authors = 'AUTHORS' - if os.path.isdir('.git'): - # don't include jenkins email address in AUTHORS file - git_log_cmd = ("git log --format='%aN <%aE>' | sort -u | " - "grep -v " + jenkins_email) - changelog = _run_shell_command(git_log_cmd) - mailmap = parse_mailmap() - with open(new_authors, 'w') as new_authors_fh: - new_authors_fh.write(canonicalize_emails(changelog, mailmap)) - if os.path.exists(old_authors): - with open(old_authors, "r") as old_authors_fh: - new_authors_fh.write('\n' + old_authors_fh.read()) + if not os.getenv('SKIP_GENERATE_AUTHORS'): + if os.path.isdir('.git'): + # don't include jenkins email address in AUTHORS file + git_log_cmd = ("git log --format='%aN <%aE>' | sort -u | " + "grep -v " + jenkins_email) + changelog = _run_shell_command(git_log_cmd) + mailmap = parse_mailmap() + with open(new_authors, 'w') as new_authors_fh: + new_authors_fh.write(canonicalize_emails(changelog, mailmap)) + if os.path.exists(old_authors): + with open(old_authors, "r") as old_authors_fh: + new_authors_fh.write('\n' + old_authors_fh.read()) + else: + open(new_authors, 'w').close() + _rst_template = """%(heading)s %(underline)s -- cgit