|
1 | 1 | """Utility functions for version checking."""
|
| 2 | +import sys |
2 | 3 | import warnings
|
3 | 4 |
|
4 |
| -__all__ = ['check_version', '_require_mxnet_version'] |
| 5 | +__all__ = ['check_version', '_require_mxnet_version', '_deprecate_python2'] |
5 | 6 |
|
6 | 7 | def check_version(min_version, warning_only=False):
|
7 | 8 | """Check the version of gluoncv satisfies the provided minimum version.
|
@@ -35,10 +36,18 @@ def _require_mxnet_version(mx_version):
|
35 | 36 | "Legacy mxnet-mkl=={} detected, some new modules may not work properly. "
|
36 | 37 | "mxnet-mkl>={} is required. You can use pip to upgrade mxnet "
|
37 | 38 | "`pip install mxnet-mkl --pre --upgrade` "
|
38 |
| - "or `pip install mxnet-cu90mkl --pre --upgrade`").format(mx.__version__, mx_version) |
| 39 | + "or `pip install mxnet-cu100mkl --pre --upgrade`\ |
| 40 | + ").format(mx.__version__, mx_version) |
39 | 41 | raise ImportError(msg)
|
40 | 42 | except ImportError:
|
41 | 43 | raise ImportError(
|
42 | 44 | "Unable to import dependency mxnet. "
|
43 |
| - "A quick tip is to install via `pip install mxnet-mkl/mxnet-cu90mkl --pre`. " |
| 45 | + "A quick tip is to install via `pip install mxnet-mkl/mxnet-cu100mkl --pre`. " |
44 | 46 | "please refer to https://gluon-cv.mxnet.io/#installation for details.")
|
| 47 | + |
| 48 | +def _deprecate_python2(): |
| 49 | + if sys.version_info[0] < 3: |
| 50 | + msg = 'Python2 has reached the end of its life on January 1st, 2020. ' + \ |
| 51 | + 'A future version of gluoncv will drop support for Python 2.' |
| 52 | + warnings.simplefilter('always', DeprecationWarning) |
| 53 | + warnings.warn(msg, DeprecationWarning) |
0 commit comments