##// END OF EJS Templates
avoid utils.version dependency in split repos
Min RK -
Show More
@@ -0,0 +1,25 b''
1 # encoding: utf-8
2 """
3 Utilities for version comparison
4
5 It is a bit ridiculous that we need these.
6 """
7
8 # Copyright (c) Jupyter Development Team.
9 # Distributed under the terms of the Modified BSD License.
10
11 from distutils.version import LooseVersion
12
13
14 def check_version(v, check):
15 """check version string v >= check
16
17 If dev/prerelease tags result in TypeError for string-number comparison,
18 it is assumed that the dependency is satisfied.
19 Users on dev branches are responsible for keeping their own packages up to date.
20 """
21 try:
22 return LooseVersion(v) >= LooseVersion(check)
23 except TypeError:
24 return True
25
@@ -1,7 +1,7 b''
1 import os
1 import os
2
2
3 import terminado
3 import terminado
4 from IPython.utils.version import check_version
4 from ..utils import check_version
5
5
6 if not check_version(terminado.__version__, '0.3.3'):
6 if not check_version(terminado.__version__, '0.3.3'):
7 raise ImportError("terminado >= 0.3.3 required, found %s" % terminado.__version__)
7 raise ImportError("terminado >= 0.3.3 required, found %s" % terminado.__version__)
@@ -9,6 +9,7 b' import errno'
9 import os
9 import os
10 import stat
10 import stat
11 import sys
11 import sys
12 from distutils.version import LooseVersion
12
13
13 try:
14 try:
14 from urllib.parse import quote, unquote
15 from urllib.parse import quote, unquote
@@ -142,6 +143,19 b" def to_api_path(os_path, root=''):"
142 return path
143 return path
143
144
144
145
146 def check_version(v, check):
147 """check version string v >= check
148
149 If dev/prerelease tags result in TypeError for string-number comparison,
150 it is assumed that the dependency is satisfied.
151 Users on dev branches are responsible for keeping their own packages up to date.
152 """
153 try:
154 return LooseVersion(v) >= LooseVersion(check)
155 except TypeError:
156 return True
157
158
145 # Copy of IPython.utils.process.check_pid:
159 # Copy of IPython.utils.process.check_pid:
146
160
147 def _check_pid_win32(pid):
161 def _check_pid_win32(pid):
@@ -23,8 +23,8 b' except ImportError as e:'
23
23
24 from jupyter_nbconvert.utils.pandoc import pandoc
24 from jupyter_nbconvert.utils.pandoc import pandoc
25 from jupyter_nbconvert.utils.exceptions import ConversionException
25 from jupyter_nbconvert.utils.exceptions import ConversionException
26 from jupyter_nbconvert.utils.version import check_version
26 from IPython.utils.py3compat import cast_bytes
27 from IPython.utils.py3compat import cast_bytes
27 from IPython.utils.version import check_version
28
28
29
29
30 marked = os.path.join(os.path.dirname(__file__), "marked.js")
30 marked = os.path.join(os.path.dirname(__file__), "marked.js")
@@ -9,9 +9,8 b' import warnings'
9 import re
9 import re
10 from io import TextIOWrapper, BytesIO
10 from io import TextIOWrapper, BytesIO
11
11
12 from IPython.utils.py3compat import cast_bytes
12 from jupyter_nbconvert.utils.version import check_version
13 from IPython.utils.version import check_version
13 from IPython.utils.py3compat import cast_bytes, which
14 from IPython.utils.py3compat import which
15
14
16 from .exceptions import ConversionException
15 from .exceptions import ConversionException
17
16
General Comments 0
You need to be logged in to leave comments. Login now