diff options
author | Dan Prince <dprince@redhat.com> | 2012-07-13 09:38:59 -0400 |
---|---|---|
committer | Dan Prince <dprince@redhat.com> | 2012-07-13 09:38:59 -0400 |
commit | 5a21c63033be67a1f46e788c43a36b9dfa0094f2 (patch) | |
tree | 88c277363eceba498662055b5a2625d6540de49e /openstack | |
parent | c80bfb563626200f7587c7ca52433c59a303b469 (diff) | |
download | oslo-5a21c63033be67a1f46e788c43a36b9dfa0094f2.tar.gz oslo-5a21c63033be67a1f46e788c43a36b9dfa0094f2.tar.xz oslo-5a21c63033be67a1f46e788c43a36b9dfa0094f2.zip |
Add SKIP_WRITE_GIT_CHANGELOG option to setup.py
Updates the write_git_changelog function in setup.py so that
it will skip changelog generation if the SKIP_WRITE_GIT_CHANGELOG
env variable is set.
The motivation for this change is to speed up running sdist which
gets executed at the begining of a tox run. Some projects (like Nova)
can take between 10-20 seconds to generate a changelog in this fashion.
Change-Id: I2e75060d303bc8fae784129e8e42f09922a8b09e
Diffstat (limited to 'openstack')
-rw-r--r-- | openstack/common/setup.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/openstack/common/setup.py b/openstack/common/setup.py index 2be72e6..48601ea 100644 --- a/openstack/common/setup.py +++ b/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(): |