Skip to content

Commit

Permalink
Merge pull request scikit-image#3160 from hmaarrfk/maintenance_remove…
Browse files Browse the repository at this point in the history
…_python_version_checking

Refractor python version checking in __init__.py
  • Loading branch information
soupault authored Jun 9, 2018
2 parents 637db10 + bda09ca commit 1be50d1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 20 deletions.
22 changes: 2 additions & 20 deletions skimage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,26 +64,8 @@

__version__ = '0.15.dev0'


if sys.version_info < (3,):
raise ImportError("""
You are running scikit-image on Python 2.
Unfortunately, scikit-image 0.15 and above no longer work on this
version of Python. You therefore have two options: either upgrade to
Python 3, or install an older version of scikit-image using
$ pip install 'scikit-image<0.15'
Please also consider updating `pip` and `setuptools`:
$ pip install pip setuptools --upgrade
Newer versions of these tools avoid installing packages incompatible
with your version of Python.
""")

from ._shared.version_requirements import ensure_python_version
ensure_python_version((3, 5))

# Logic for checking for improper install and importing while in the source
# tree when package has not been installed inplace.
Expand Down
26 changes: 26 additions & 0 deletions skimage/_shared/version_requirements.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,35 @@
from distutils.version import LooseVersion
from platform import python_version
import functools
import re
import sys


def ensure_python_version(min_version):
if not isinstance(min_version, tuple):
min_version = (min_version, )
if sys.version_info < min_version:
raise ImportError("""
You are running scikit-image on an unsupported version of Python.
Unfortunately, scikit-image 0.15 and above no longer work with your installed
version of Python (%s). You therefore have two options: either upgrade to
Python %s, or install an older version of scikit-image.
For Python 2.7 or Python 3.4, use
$ pip install 'scikit-image<0.15'
Please also consider updating `pip` and `setuptools`:
$ pip install pip setuptools --upgrade
Newer versions of these tools avoid installing packages incompatible
with your version of Python.
""" % (python_version(), '.'.join([str(v) for v in min_version])))


def _check_version(actver, version, cmp_op):
"""
Check version string of an active module against a required version.
Expand Down

0 comments on commit 1be50d1

Please sign in to comment.