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
Provenance
- Commit
63deee0- Tree
06f4971- Author
David Lord <davidism@gmail.com>- Committer
David Lord <davidism@gmail.com>- Parent
22992a0
2 files changed+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- ~~~~~~~~~~~~6-7- Helper script that performs a release. Does pretty much everything8- automatically for us.9-10- :copyright: (c) 2015 by Armin Ronacher.11- :license: BSD, see LICENSE for more details.12-"""2 from __future__ import print_function14-import sys3+4 import os5 import re6+import sys17-from datetime import datetime, date18-from subprocess import Popen, PIPE7+from datetime import date, datetime8+from subprocess import PIPE, Popen9 20-_date_clean_re = re.compile(r'(\d+)(st|nd|rd|th)')10+_date_strip_re = re.compile(r'(?<=\d)(st|nd|rd|th)')11 12 13 def 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())18+19 if match is None:20 continue21+22 version = match.group(1).strip()23+31- if lineiter.next().count('-') != len(match.group(0)):24+ if next(lineiter).count('-') != len(match.group(0)):25 continue26+27 while 1:34- change_info = lineiter.next().strip()28+ change_info = next(lineiter).strip()29+30 if change_info:31 break32 38- 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+ )38+39 if match is None:40 continue41 42 datestr, codename = match.groups()1 unmodified line44 45 46 def 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')51+52 parts[-1] += 153 return '.'.join(map(str, parts))54 55 56 def 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')59 60 61 def set_filename_version(filename, version_number, pattern):2 unmodified lines64 def inject_version(match):65 before, old, after = match.groups()66 changed.append(True)67 return before + version_number + after68+69 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+ )75 76 if not changed:77 fail('Could not find %s in %s', pattern, filename)78 5 unmodified lines84 info('Setting __init__.py version to %s', version)85 set_filename_version('flask/__init__.py', version, '__version__')86 87 84-def build_and_upload():85- Popen([sys.executable, 'setup.py', 'release', 'sdist', 'bdist_wheel', 'upload']).wait()88+def build():89+ cmd = [sys.executable, 'setup.py', 'sdist', 'bdist_wheel']90+ Popen(cmd).wait()91 92 93 def fail(message, *args):94 print('Error:', message % args, file=sys.stderr)4 unmodified lines99 print(message % args, file=sys.stderr)100 101 102 def 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+ )106 107 108 def git_is_clean():109 return Popen(['git', 'diff', '--quiet']).wait() == 012 unmodified lines122 def main():123 os.chdir(os.path.join(os.path.dirname(__file__), '..'))124 125 rv = parse_changelog()126+127 if rv is None:128 fail('Could not parse changelog')129 130 version, release_date, codename = rv123- dev_version = bump_version(version) + '-dev'131+ dev_version = bump_version(version) + '.dev'132 133+ 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()138 139 if version in tags:140 fail('Version "%s" is already tagged', version)141+142 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+ )147 148 if not git_is_clean():149 fail('You have uncommitted changes in git')150 151+ try:152+ import wheel # noqa: F401153+ except ImportError:154+ fail('You need to install the wheel package.')155+156 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)161 162 163 if __name__ == '__main__':1 unmodified linemodified:CHANGES+1 added-1 removed
3 unmodified lines4 5 Version 0.12.36 --------------7 8-Bugfix release, unreleased8+Released on April 26th 20189 10 - :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