Skip to content

Commit

Permalink
Do not execute contribs.py for Python 2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelle committed Dec 26, 2015
1 parent 0acee83 commit b89022c
Showing 1 changed file with 32 additions and 28 deletions.
60 changes: 32 additions & 28 deletions doc/release/contribs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,46 @@

tag = sys.argv[1]

def call(cmd):
return subprocess.check_output(shlex.split(cmd), universal_newlines=True).split('\n')
_python_version_str = '{0.major}.{0.minor}'.format(sys.version_info)

tag_date = call("git show --format='%%ci' %s" % tag)[0]
print("Release %s was on %s\n" % (tag, tag_date))
if _python_version_str >= '2.7':

merges = call("git log --since='%s' --merges --format='>>>%%B' --reverse" % tag_date)
merges = [m for m in merges if m.strip()]
merges = '\n'.join(merges).split('>>>')
merges = [m.split('\n')[:2] for m in merges]
merges = [m for m in merges if len(m) == 2 and m[1].strip()]
def call(cmd):
return subprocess.check_output(shlex.split(cmd), universal_newlines=True).split('\n')

num_commits = call("git rev-list %s..HEAD --count" % tag)[0]
print("A total of %s changes have been committed.\n" % num_commits)
tag_date = call("git show --format='%%ci' %s" % tag)[0]
print("Release %s was on %s\n" % (tag, tag_date))

print("It contained the following %d merges:\n" % len(merges))
for (merge, message) in merges:
if merge.startswith('Merge pull request #'):
PR = ' (%s)' % merge.split()[3]
else:
PR = ''
merges = call("git log --since='%s' --merges --format='>>>%%B' --reverse" % tag_date)
merges = [m for m in merges if m.strip()]
merges = '\n'.join(merges).split('>>>')
merges = [m.split('\n')[:2] for m in merges]
merges = [m for m in merges if len(m) == 2 and m[1].strip()]

print('- ' + message + PR)
num_commits = call("git rev-list %s..HEAD --count" % tag)[0]
print("A total of %s changes have been committed.\n" % num_commits)

print("It contained the following %d merges:\n" % len(merges))
for (merge, message) in merges:
if merge.startswith('Merge pull request #'):
PR = ' (%s)' % merge.split()[3]
else:
PR = ''

print("\nMade by the following committers [alphabetical by last name]:\n")
print('- ' + message + PR)

authors = call("git log --since='%s' --format=%%aN" % tag_date)
authors = [a.strip() for a in authors if a.strip()]

def key(author):
author = [v for v in author.split() if v[0] in string.ascii_letters]
if len(author) > 0:
return author[-1]
print("\nMade by the following committers [alphabetical by last name]:\n")

authors = sorted(set(authors), key=key)
authors = call("git log --since='%s' --format=%%aN" % tag_date)
authors = [a.strip() for a in authors if a.strip()]

for a in authors:
print('- ' + a)
def key(author):
author = [v for v in author.split() if v[0] in string.ascii_letters]
if len(author) > 0:
return author[-1]

authors = sorted(set(authors), key=key)

for a in authors:
print('- ' + a)

0 comments on commit b89022c

Please sign in to comment.