summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorDan Prince <dprince@redhat.com>2012-07-13 09:38:59 -0400
committerDan Prince <dprince@redhat.com>2012-07-13 09:38:59 -0400
commit621ee29407c64dc2cfc40ceda97b58a9fd859a5b (patch)
treea28b5012235908775cbf1d13984169b5f889a043 /setup.py
parent2ce3f88692d985e9ab91ebad3ad84e5d821d9b0a (diff)
downloadpbr-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.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/setup.py b/setup.py
index 2be72e6..48601ea 100644
--- a/setup.py
+++ b/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():