diff --git a/CHANGELOG.txt b/CHANGELOG.txt index f0eb76001e..e1c332d59e 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -34,6 +34,7 @@ Changelog 2.0.1 (xx.xx.xxxx) - IN DEVELOPMENT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * Added error notification when running the `wagtail` command on Python <3.4 (Matt Westcott) * Fix: Draftail now supports features specified via the `WAGTAILADMIN_RICH_TEXT_EDITORS` setting (Todd Dembrey) * Fix: Password reset form no longer indicates whether the email is recognised, as per standard Django behaviour (Bertrand Bordage) * Fix: `UserAttributeSimilarityValidator` is now correctly enforced on user creation / editing forms (Tim Heap) diff --git a/docs/releases/2.0.1.rst b/docs/releases/2.0.1.rst index 610a98c272..d2deabacf4 100644 --- a/docs/releases/2.0.1.rst +++ b/docs/releases/2.0.1.rst @@ -10,6 +10,8 @@ Wagtail 2.0.1 release notes - IN DEVELOPMENT What's new ========== + * Added error notification when running the ``wagtail`` command on Python <3.4 (Matt Westcott) + Bug fixes ~~~~~~~~~ diff --git a/wagtail/bin/wagtail.py b/wagtail/bin/wagtail.py index 5a541675ff..0816ad2672 100644 --- a/wagtail/bin/wagtail.py +++ b/wagtail/bin/wagtail.py @@ -8,6 +8,16 @@ from argparse import ArgumentParser from difflib import unified_diff from django.core.management import ManagementUtility +# Need to use the django.utils.six version of print, to avoid a syntax error on Py2 when using print(..., end='') +from django.utils.six import print_ + + +CURRENT_PYTHON = sys.version_info[:2] +REQUIRED_PYTHON = (3, 4) + +if CURRENT_PYTHON < REQUIRED_PYTHON: + sys.stderr.write("This version of Wagtail requires Python {}.{} or above - you are running {}.{}\n".format(*(REQUIRED_PYTHON + CURRENT_PYTHON))) + sys.exit(1) def pluralize(value, arg='s'): @@ -227,7 +237,7 @@ class UpdateModulePaths(Command): with fileinput.FileInput(filename, inplace=True) as f: for original_line in f: line = self._rewrite_line(original_line) - print(line, end='') # NOQA + print_(line, end='') # NOQA if line != original_line: change_count += 1