in devtools/setup.py [0:0]
def get_recent_changelog(filename):
"""Grab the entry for the latest release."""
contents = read(filename).split("\n")
# Skip the title (first two lines)
contents = contents[2:]
# Find the latest release
start_line, end_line = None, None
for i, line in enumerate(contents):
# if we've found the start & end, we're done
if all([start_line, end_line]):
break
# 4 dashes are a horizontal line in rST, so look for headers with 5+
if line.startswith("-----"):
if start_line is None:
start_line = i - 1
continue
if end_line is None:
end_line = i - 1
continue
recent_log_lines = contents[start_line:end_line]
recent_log = "\n".join(recent_log_lines)
return recent_log