Browse code

Add fallback code to make it compatible with Python2 implementation (we could simplify by adding whichcraft, but a new dependency just for one which command seems an overkill)

Gianfranco Costamagna authored on 2018/05/02 18:41:17
Showing 1 changed files
... ...
@@ -57,7 +57,12 @@ import tempfile
57 57
 from copy import copy
58 58
 from optparse import OptionParser, Option, OptionValueError, IndentedHelpFormatter
59 59
 from logging import debug, info, warning, error
60
-from shutil import which
60
+
61
+try:
62
+    from shutil import which
63
+except ImportError:
64
+    # python2 fallback code
65
+    from distutils.spawn import find_executable as which
61 66
 
62 67
 from ssl import SSLError
63 68
 import io