diff options
author | Lars Wirzenius <liw@liw.fi> | 2016-02-14 12:49:29 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2016-02-14 12:49:29 +0200 |
commit | 73eb0c175d40bb7273f45a025e1278fcda552772 (patch) | |
tree | 6a0c7bb40b10951103068a70c7d04add1c45ad37 | |
parent | 4e6d3f18173e53be7c95b8f18c6f9f406badc077 (diff) | |
download | bumper-73eb0c175d40bb7273f45a025e1278fcda552772.tar.gz |
Update NEWS for new release
-rwxr-xr-x | bumper | 14 | ||||
-rw-r--r-- | bumper.yarn | 20 |
2 files changed, 34 insertions, 0 deletions
@@ -17,6 +17,9 @@ # =*= License: GPL-3+ =*= +import re +import time + import cliapp @@ -27,6 +30,7 @@ class Bumper(cliapp.Application): filename = args[1] self.write_version_py(filename, version) self.update_debian_changelog(version) + self.update_NEWS(version) self.commit(version) self.make_release_tag(version) @@ -35,6 +39,16 @@ class Bumper(cliapp.Application): cliapp.runcmd(['dch', '-v', debian_version, 'New upstream release.']) cliapp.runcmd(['dch', '-r', '']) + def update_NEWS(self, version): + with open('NEWS') as f: + text = f.read() + date = time.strftime('%Y-%m-%d') + pattern = r'^Version \d+(\.\d+)*, not yet released$' + replacement = 'Version {}, released {}'.format(version, date) + updated = re.sub(pattern, replacement, text, flags=re.M) + with open('NEWS', 'w') as f: + f.write(updated) + def commit(self, version): msg = 'Prepare to release version {}'.format(version) cliapp.runcmd(['git', 'commit', '-am', msg]) diff --git a/bumper.yarn b/bumper.yarn index 8f2e3b0..99c7e19 100644 --- a/bumper.yarn +++ b/bumper.yarn @@ -63,6 +63,8 @@ We run Bumper, and it does several things. THEN git repository foo has tag foo-3.2, signed with AA8CD13C AND in foo, tag foo-3.2, foolib/version.py contains ... "__version__ = "3.2"\n__version_info__ = (3, 2)\n" + AND in foo, tag foo-3.2, NEWS matches + ... "^Version 3.2, released \\d\\d\\d\\d-\\d\\d-\\d\\d$" AND file foolib/version.py in foo contains ... "__version__ = "3.2"\n__version_info__ = (3, 2)\n" AND in foo, tag foo-3.2, has Debian version 3.2-1 @@ -96,6 +98,12 @@ for Bumper. from distutils.core import setup setup(name='{project}') '''.format(project=project)) + yarnstep.write_file(os.path.join(dirname, 'NEWS'), ''' + NEWS for {project} + ================== + Version 0.0, not yet released + ----------------------------- + '''.format(project=project)) cliapp.runcmd(['git', 'init', dirname]) cliapp.runcmd(['git', 'add', '.'], cwd=dirname) cliapp.runcmd(['git', 'commit', '-mInitial'], cwd=dirname) @@ -151,6 +159,18 @@ for Bumper. cwd=dirname) assert wanted_data == actual_data + IMPLEMENTS THEN in (\S+), tag (\S+), (\S+) matches "(.*)" + import re, cliapp, yarnstep + dirname = yarnstep.get_next_match_as_datadir_path() + tag = yarnstep.get_next_match() + filename = yarnstep.get_next_match() + wanted_data_escaped = yarnstep.get_next_match() + wanted_data = yarnstep.unescape_backslashes(wanted_data_escaped) + actual_data = cliapp.runcmd( + ['git', 'cat-file', 'blob', '{}:{}'.format(tag, filename)], + cwd=dirname) + assert re.search(wanted_data, actual_data, flags=re.M) + IMPLEMENTS THEN in (\S+), tag (\S+), has Debian version (\S+) import os, yarnstep dirname = yarnstep.get_next_match_as_datadir_path() |