Skip to content

Commit

Permalink
link issues in changes
Browse files Browse the repository at this point in the history
display changes as rst
update make-release script from jinja
  • Loading branch information
davidism committed Dec 1, 2017
1 parent 8eb665a commit 79b33a7
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 46 deletions.
31 changes: 21 additions & 10 deletions CHANGES → CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,38 @@ unreleased
- **Deprecate support for Python 2.6 and 3.3.** CI tests will not run for these
versions, and support will be dropped completely in the next version.
(`pallets/meta#24`_)
- Raise ``TypeError`` when port is not an integer.
- Raise ``TypeError`` when port is not an integer. (`#1088`_)
- Fully deprecate ``werkzeug.script``. Use `Click <http://click.pocoo.org>`_
instead.
instead. (`#1090`_)
- ``response.age`` is parsed as a ``timedelta``. Previously, it was incorrectly
treated as a ``datetime``. The header value is an integer number of seconds,
not a date string. (``#414``)
not a date string. (`#414`_)
- Fix a bug in ``TypeConversionDict`` where errors are not propagated when
using the converter. (``#1102``)
using the converter. (`#1102`_)
- ``Authorization.qop`` is a string instead of a set, to comply with
RFC 2617. (``#984``)
RFC 2617. (`#984`_)
- An exception is raised when an encoded cookie is larger than, by default,
4093 bytes. Browsers may silently ignore cookies larger than this.
``BaseResponse`` has a new attribute ``max_cookie_size`` and ``dump_cookie``
has a new argument ``max_size`` to configure this. (`#780`_, `#1109`_)
- Fix a TypeError in ``werkzeug.contrib.lint.GuardedIterator.close``.
(`#1116`_)
- ``BaseResponse.calculate_content_length`` now correctly works for unicode
responses on Python 3. It first encodes using `iter_encoded`.

.. _`pallets/meta#24`: https://github.com/pallets/meta/issues/24
.. _`#780`: https://github.com/pallets/werkzeug/pull/780
.. _`#1109`: https://github.com/pallets/werkzeug/pull/1109
responses on Python 3. It first encodes using ``iter_encoded``. (`#705`_)
- The built-in dev server supports receiving requests with chunked transfer
encoding. (`#1198`_)

.. _pallets/meta#24: https://github.com/pallets/meta/issues/24
.. _#414: https://github.com/pallets/werkzeug/pull/414
.. _#705: https://github.com/pallets/werkzeug/pull/705
.. _#780: https://github.com/pallets/werkzeug/pull/780
.. _#984: https://github.com/pallets/werkzeug/pull/984
.. _#1088: https://github.com/pallets/werkzeug/pull/1088
.. _#1090: https://github.com/pallets/werkzeug/pull/1090
.. _#1102: https://github.com/pallets/werkzeug/pull/1102
.. _#1109: https://github.com/pallets/werkzeug/pull/1109
.. _#1116: https://github.com/pallets/werkzeug/pull/1116
.. _#1198: https://github.com/pallets/werkzeug/pull/1198


Version 0.12.2
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Submitting patches
- Try to follow `PEP8 <http://legacy.python.org/dev/peps/pep-0008/>`_, but you
may ignore the line-length-limit if following it would make the code uglier.

- Add an entry to ``CHANGES`` and your name to ``AUTHORS``.
- Add an entry to ``CHANGES.rst`` and your name to ``AUTHORS``.


Running the testsuite
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include Makefile CHANGES LICENSE AUTHORS
include Makefile CHANGES.rst LICENSE AUTHORS
recursive-include werkzeug/debug/shared *
recursive-include tests *
recursive-include docs *
Expand Down
2 changes: 1 addition & 1 deletion docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This file lists all major changes in Werkzeug over the versions.
For API breaking changes have a look at :ref:`api-changes`, they
are listed there in detail.

.. include:: ../CHANGES
.. include:: ../CHANGES.rst

.. _api-changes:

Expand Down
93 changes: 60 additions & 33 deletions scripts/make-release.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,46 @@
Helper script that performs a release. Does pretty much everything
automatically for us.
:copyright: (c) 2014 by Armin Ronacher.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import sys
import shutil
from __future__ import print_function

import os
import re
from datetime import datetime, date
from subprocess import Popen, PIPE
import sys
from datetime import date, datetime
from subprocess import PIPE, Popen

_date_clean_re = re.compile(r'(\d+)(st|nd|rd|th)')
_date_strip_re = re.compile(r'(?<=\d)(st|nd|rd|th)')


def parse_changelog():
with open('CHANGES') as f:
with open('CHANGES.rst') as f:
lineiter = iter(f)
for line in lineiter:
match = re.search('^Version\s+(.*)', line.strip())

if match is None:
continue

version = match.group(1).strip()
if lineiter.next().count('-') != len(match.group(0)):

if next(lineiter).count('-') != len(match.group(0)):
continue

while 1:
change_info = lineiter.next().strip()
change_info = next(lineiter).strip()

if change_info:
break

match = re.search(r'released on (\w+\s+\d+\w+\s+\d+)'
r'(?:, codename (.*))?', change_info,
flags=re.IGNORECASE)
match = re.search(
r'released on (\w+\s+\d+\w+\s+\d+)(?:, codename (.*))?',
change_info,
flags=re.IGNORECASE
)

if match is None:
continue

Expand All @@ -47,15 +56,16 @@ def parse_changelog():

def bump_version(version):
try:
parts = map(int, version.split('.'))
parts = [int(i) for i in version.split('.')]
except ValueError:
fail('Current version is not numeric')

parts[-1] += 1
return '.'.join(map(str, parts))


def parse_date(string):
string = _date_clean_re.sub(r'\1', string)
string = _date_strip_re.sub('', string)
return datetime.strptime(string, '%B %d %Y')


Expand All @@ -66,10 +76,13 @@ def inject_version(match):
before, old, after = match.groups()
changed.append(True)
return before + version_number + after

with open(filename) as f:
contents = re.sub(r"^(\s*%s\s*=\s*')(.+?)(')" % pattern,
inject_version, f.read(),
flags=re.DOTALL | re.MULTILINE)
contents = re.sub(
r"^(\s*%s\s*=\s*')(.+?)(')" % pattern,
inject_version, f.read(),
flags=re.DOTALL | re.MULTILINE
)

if not changed:
fail('Could not find %s in %s', pattern, filename)
Expand All @@ -83,28 +96,29 @@ def set_init_version(version):
set_filename_version('werkzeug/__init__.py', version, '__version__')


def build_and_upload():
# Work around setuptools packaging stray .pyc files
if os.path.exists('werkzeug/testsuite'):
shutil.rmtree('werkzeug/testsuite')
def set_setup_version(version):
info('Setting setup.py version to %s', version)
set_filename_version('setup.py', version, 'version')

Popen([sys.executable, 'setup.py', 'release', 'sdist', 'bdist_wheel',
'upload']).wait()

def build_and_upload():
cmd = [sys.executable, 'setup.py', 'release', 'sdist', 'bdist_wheel']
Popen(cmd).wait()


def fail(message, *args):
print >> sys.stderr, 'Error:', message % args
print('Error:', message % args, file=sys.stderr)
sys.exit(1)


def info(message, *args):
print >> sys.stderr, message % args
print(message % args, file=sys.stderr)


def get_git_tags():
return set(Popen(['git', 'tag'], stdout=PIPE)
.communicate()[0]
.splitlines())
return set(
Popen(['git', 'tag'], stdout=PIPE).communicate()[0].splitlines()
)


def git_is_clean():
Expand All @@ -125,30 +139,43 @@ def main():
os.chdir(os.path.join(os.path.dirname(__file__), '..'))

rv = parse_changelog()

if rv is None:
fail('Could not parse changelog')

version, release_date, codename = rv
dev_version = bump_version(version) + '-dev'
dev_version = bump_version(version) + '.dev'

info('Releasing %s (codename %s, release date %s)',
version, codename, release_date.strftime('%d/%m/%Y'))
info(
'Releasing %s (codename %s, release date %s)',
version, codename, release_date.strftime('%d/%m/%Y')
)
tags = get_git_tags()

if version in tags:
fail('Version "%s" is already tagged', version)

if release_date.date() != date.today():
fail('Release date is not today (%s != %s)',
release_date.date(), date.today())
fail(
'Release date is not today (%s != %s)',
release_date.date(), date.today()
)

if not git_is_clean():
fail('You have uncommitted changes in git')

try:
import wheel
except ImportError:
fail('You need to install the wheel package.')

set_init_version(version)
set_setup_version(version)
make_git_commit('Bump version number to %s', version)
make_git_tag(version)
build_and_upload()
set_init_version(dev_version)
set_setup_version(dev_version)


if __name__ == '__main__':
Expand Down

0 comments on commit 79b33a7

Please sign in to comment.