From 7fc080d57065e4765a0648352fd4cde24272fd3c Mon Sep 17 00:00:00 2001 From: Joseph Weston <joseph.weston08@gmail.com> Date: Tue, 20 Jun 2017 14:17:32 +0200 Subject: [PATCH] bump required Python version to 3.5 Add check for this in setup.py to avoid potentially confusing tracebacks later. --- INSTALL.rst | 2 +- setup.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/INSTALL.rst b/INSTALL.rst index dfb81ad1..b00fbdf9 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -29,7 +29,7 @@ Prerequisites ============= Building Kwant requires - * `Python <https://www.python.org/>`_ 3.4 or above (Kwant 1.1 is the last + * `Python <https://www.python.org/>`_ 3.5 or above (Kwant 1.1 is the last version to support Python 2), * `NumPy <http://numpy.org/>`_ 1.11.0 or newer, * `SciPy <https://scipy.org/>`_ 0.17.0 or newer, diff --git a/setup.py b/setup.py index 74f45b0b..160a6030 100755 --- a/setup.py +++ b/setup.py @@ -124,6 +124,16 @@ def configure_extensions(exts, aliases=(), build_summary=None): return exts +def check_python_version(min_version): + installed_version = sys.version_info[:3] + if installed_version < min_version: + print('Error: Python {} required, but {} is installed'.format( + '.'.join(map(str, min_version)), + '.'.join(map(str, installed_version))) + ) + sys.exit(1) + + def check_versions(): global version, version_is_from_git @@ -557,6 +567,7 @@ def maybe_cythonize(exts): def main(): + check_python_version((3, 5)) check_versions() exts = collections.OrderedDict([ -- GitLab