From f9907b49f9d00c03cf014a25d057d0d09d43d8cf Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Wed, 4 Nov 2020 23:01:20 +0100 Subject: [PATCH] Introduce variable since which mpl version the minimal python version requirement holds. By introducing a variable instead of a hard-coded value in the error message, I hope that we remember to update `since_mpl_version` when we update `py_min_version`. --- setup.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 76d584822d5c..445a448ebc52 100644 --- a/setup.py +++ b/setup.py @@ -8,17 +8,19 @@ # and/or pip. import sys -min_version = (3, 7) +py_min_version = (3, 7) # minimal supported python version +since_mpl_version = (3, 4) # py_min_version is required since this mpl version -if sys.version_info < min_version: +if sys.version_info < py_min_version: error = """ -Beginning with Matplotlib 3.4, Python {0} or above is required. -You are using Python {1}. +Beginning with Matplotlib {0}, Python {1} or above is required. +You are using Python {2}. This may be due to an out of date pip. Make sure you have pip >= 9.0.1. -""".format('.'.join(str(n) for n in min_version), +""".format('.'.join(str(n) for n in since_mpl_version), + '.'.join(str(n) for n in py_min_version), '.'.join(str(n) for n in sys.version_info[:3])) sys.exit(error) @@ -281,7 +283,7 @@ def build_extensions(self): ext_modules=[Extension("", [])], package_data=package_data, - python_requires='>={}'.format('.'.join(str(n) for n in min_version)), + python_requires='>={}'.format('.'.join(str(n) for n in py_min_version)), setup_requires=[ "certifi>=2020.06.20", "numpy>=1.16",