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 | 621ee29407c64dc2cfc40ceda97b58a9fd859a5b (patch) | |
tree | a28b5012235908775cbf1d13984169b5f889a043 /setup.py | |
parent | 2ce3f88692d985e9ab91ebad3ad84e5d821d9b0a (diff) | |
download | pbr-621ee29407c64dc2cfc40ceda97b58a9fd859a5b.tar.gz |
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 'setup.py')
-rw-r--r-- | setup.py | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -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(): |