summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorBhuvan Arumugam <bhuvan@apache.org>2012-04-27 12:29:36 -0700
committerBhuvan Arumugam <bhuvan@apache.org>2012-04-30 10:01:19 -0700
commita50701f91afb6c50ed36a9886cb8f7f15353294a (patch)
tree5a49a6c86cdc3c5d84cc62aff4eb461cdc5d6176 /setup.py
parent8b22726c33fe8c2f83bdd5f810b16cfc7b8aee08 (diff)
downloadpbr-a50701f91afb6c50ed36a9886cb8f7f15353294a.tar.gz
Handle authors existed before VCS was around.
Bug: 976267 The list of such authors are stored in AUTHORS.in file. When auto generating AUTHORS file, include them as well. * openstack/common/setup.py __doc__: For all methods, remove space and include period. generate_authors(): If AUTHORS.in file exist, append the content to AUTHORS file. Change-Id: I05da1e561383cc151e7ef34e75a4600e3afdda6e
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/setup.py b/setup.py
index 4376102..60c731a 100644
--- a/setup.py
+++ b/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())