diff options
| author | Bhuvan Arumugam <bhuvan@apache.org> | 2012-05-01 16:27:58 -0700 |
|---|---|---|
| committer | Bhuvan Arumugam <bhuvan@apache.org> | 2012-05-01 16:31:23 -0700 |
| commit | 3c7350b3c97fcbc4d2dbad9cd49b50282a4a4047 (patch) | |
| tree | 6e744f7b9725f42ea7e4fed561a8b9ac85a7627d /openstackclient | |
| parent | 67ea436a990154e54ebb25444d580d0eca886ad2 (diff) | |
| download | python-openstackclient-3c7350b3c97fcbc4d2dbad9cd49b50282a4a4047.tar.gz | |
Auto generate AUTHORS for python-openstackclient.
Bug: 976267
Now that git commits are gated by CLA, we shouldn't enforce
committers to add an entry in AUTHORS file. The AUTHORS file
should be generated automatically, based on git commits.
This commit fixes the problem.
* AUTHORS
Remove this file.
* tests/test_authors.py
Remove this test case.
* .gitignore
Add AUTHORS file.
* openstackclient/openstack/common/setup.py
generate_authors(): New method to create AUTHORS file. If
AUTHORS.in file exists, append it's content to AUTHORS file.
* setup.py
Import the new method.
Generate AUTHORS file before creating the package.
Change-Id: Ia5488a43f88e13a0fb1f7a5d8d10a576b9034dc8
Diffstat (limited to 'openstackclient')
| -rw-r--r-- | openstackclient/openstack/common/setup.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/openstackclient/openstack/common/setup.py b/openstackclient/openstack/common/setup.py index 43761027..60c731a9 100644 --- a/openstackclient/openstack/common/setup.py +++ b/openstackclient/openstack/common/setup.py @@ -37,8 +37,8 @@ def parse_mailmap(mailmap='.mailmap'): def canonicalize_emails(changelog, mapping): - """ Takes in a string and an email alias mapping and replaces all - instances of the aliases in the string with their real email + """Takes in a string and an email alias mapping and replaces all + instances of the aliases in the string with their real email. """ for alias, email in mapping.iteritems(): changelog = changelog.replace(alias, email) @@ -97,7 +97,7 @@ def _run_shell_command(cmd): def write_vcsversion(location): - """ Produce a vcsversion dict that mimics the old one produced by bzr + """Produce a vcsversion dict that mimics the old one produced by bzr. """ if os.path.isdir('.git'): branch_nick_cmd = 'git branch | grep -Ei "\* (.*)" | cut -f2 -d" "' @@ -118,7 +118,7 @@ version_info = { def write_git_changelog(): - """Write a changelog based on the 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) @@ -128,13 +128,18 @@ def write_git_changelog(): def generate_authors(): - """Create AUTHORS file using git commits""" + """Create AUTHORS file using git commits.""" 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("AUTHORS", "w") as authors_file: - authors_file.write(canonicalize_emails(changelog, 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()) |
