Skip to content
Myr

release 0.12.3

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by David Lord · parent 22992a0 · Browse files · 2 files+51 added−33 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+51 added−33 removed

  • other:+51 added−33 removed

2 files+51 added−33 removed

modified:scripts/make-release.py+50 added-32 removed
1#!/usr/bin/env python2# -*- coding: utf-8 -*-3"""4 make-release5 ~~~~~~~~~~~~67 Helper script that performs a release. Does pretty much everything8 automatically for us.910 :copyright: (c) 2015 by Armin Ronacher.11 :license: BSD, see LICENSE for more details.12"""2from __future__ import print_function14import sys34import os5import re6import sys17from datetime import datetime, date18from subprocess import Popen, PIPE7from datetime import date, datetime8from subprocess import PIPE, Popen920_date_clean_re = re.compile(r'(\d+)(st|nd|rd|th)')10_date_strip_re = re.compile(r'(?<=\d)(st|nd|rd|th)')111213def parse_changelog():14 with open('CHANGES') as f:15 lineiter = iter(f)16 for line in lineiter:17 match = re.search('^Version\s+(.*)', line.strip())1819 if match is None:20 continue2122 version = match.group(1).strip()2331 if lineiter.next().count('-') != len(match.group(0)):24 if next(lineiter).count('-') != len(match.group(0)):25 continue2627 while 1:34 change_info = lineiter.next().strip()28 change_info = next(lineiter).strip()2930 if change_info:31 break3238 match = re.search(r'released on (\w+\s+\d+\w+\s+\d+)'39 r'(?:, codename (.*))?(?i)', change_info)33 match = re.search(34 r'released on (\w+\s+\d+\w+\s+\d+)(?:, codename (.*))?',35 change_info,36 flags=re.IGNORECASE37 )3839 if match is None:40 continue4142 datestr, codename = match.groups()
1 unmodified line
444546def bump_version(version):47 try:49 parts = map(int, version.split('.'))48 parts = [int(i) for i in version.split('.')]49 except ValueError:50 fail('Current version is not numeric')5152 parts[-1] += 153 return '.'.join(map(str, parts))545556def parse_date(string):57 string = _date_clean_re.sub(r'\1', string)57 string = _date_strip_re.sub('', string)58 return datetime.strptime(string, '%B %d %Y')596061def set_filename_version(filename, version_number, pattern):
2 unmodified lines
64 def inject_version(match):65 before, old, after = match.groups()66 changed.append(True)67 return before + version_number + after6869 with open(filename) as f:69 contents = re.sub(r"^(\s*%s\s*=\s*')(.+?)(')(?sm)" % pattern,70 inject_version, f.read())70 contents = re.sub(71 r"^(\s*%s\s*=\s*')(.+?)(')" % pattern,72 inject_version, f.read(),73 flags=re.DOTALL | re.MULTILINE74 )7576 if not changed:77 fail('Could not find %s in %s', pattern, filename)78
5 unmodified lines
84 info('Setting __init__.py version to %s', version)85 set_filename_version('flask/__init__.py', version, '__version__')868784def build_and_upload():85 Popen([sys.executable, 'setup.py', 'release', 'sdist', 'bdist_wheel', 'upload']).wait()88def build():89 cmd = [sys.executable, 'setup.py', 'sdist', 'bdist_wheel']90 Popen(cmd).wait()919293def fail(message, *args):94 print('Error:', message % args, file=sys.stderr)
4 unmodified lines
99 print(message % args, file=sys.stderr)100101102def get_git_tags():98 return set(Popen(['git', 'tag'], stdout=PIPE).communicate()[0].splitlines())103 return set(104 Popen(['git', 'tag'], stdout=PIPE).communicate()[0].splitlines()105 )106107108def git_is_clean():109 return Popen(['git', 'diff', '--quiet']).wait() == 0
12 unmodified lines
122def main():123 os.chdir(os.path.join(os.path.dirname(__file__), '..'))124125 rv = parse_changelog()126127 if rv is None:128 fail('Could not parse changelog')129130 version, release_date, codename = rv123 dev_version = bump_version(version) + '-dev'131 dev_version = bump_version(version) + '.dev'132133 info(125 info('Releasing %s (codename %s, release date %s)',126 version, codename, release_date.strftime('%d/%m/%Y'))134 'Releasing %s (codename %s, release date %s)',135 version, codename, release_date.strftime('%d/%m/%Y')136 )137 tags = get_git_tags()138139 if version in tags:140 fail('Version "%s" is already tagged', version)141142 if release_date.date() != date.today():143 fail(132 fail('Release date is not today (%s != %s)',133 release_date.date(), date.today())144 'Release date is not today (%s != %s)',145 release_date.date(), date.today()146 )147148 if not git_is_clean():149 fail('You have uncommitted changes in git')150151 try:152 import wheel # noqa: F401153 except ImportError:154 fail('You need to install the wheel package.')155156 set_init_version(version)157 make_git_commit('Bump version number to %s', version)158 make_git_tag(version)141 build_and_upload()159 build()160 set_init_version(dev_version)161162163if __name__ == '__main__':
1 unmodified line
modified:CHANGES+1 added-1 removed
3 unmodified lines
45Version 0.12.36--------------78Bugfix release, unreleased8Released on April 26th 2018910- :func:`Request.get_json` no longer accepts arbitrary encodings.11 Incoming JSON should be encoded using UTF-8 per :rfc:`8259`, but12 Flask will autodetect UTF-8, -16, or -32. (`#2692`_)
625 unmodified lines