diff options
Diffstat (limited to 'bumper')
-rwxr-xr-x | bumper | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -30,9 +30,15 @@ class Bumper(cliapp.Application): def process_args(self, args): project_name = self.get_project_name() version = self.get_version(args) - version_py = self.find_version_py() print 'Releasing {} version {}'.format(project_name, version) + current_version = self.get_current_version() + if not self.version_is_newer(version, current_version): + raise cliapp.AppException( + 'New version {} is older than current version {}'.format( + version, current_version)) + + version_py = self.find_version_py() print '... {}'.format(version_py) self.write_version_py(version_py, version, '') @@ -81,6 +87,15 @@ class Bumper(cliapp.Application): raise cliapp.AppException('Too many version.py in project') return version_pys[0] + def get_current_version(self): + return cliapp.runcmd(['python', 'setup.py', '--version']).strip() + + def version_is_newer(self, v1, v2): + '''Is v1 newer than v2?''' + vi1 = self.parse_version_info(v1, None) + vi2 = self.parse_version_info(v2, None) + return vi1 > vi2 + def update_debian_changelog(self, version, msg): debian_version = '{}-1'.format(version) cliapp.runcmd(['dch', '-v', debian_version, msg]) |