Skip to content

Commit

Permalink
Introduce variable since which mpl version the minimal python version
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
timhoffm committed Nov 4, 2020
1 parent 07145c2 commit f9907b4
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit f9907b4

Please sign in to comment.