File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 73
73
except ImportError :
74
74
import subprocess
75
75
76
+ # Python 3.4 and earlier require contextlib2 for temporarily redirecting stderr and stdout
77
+ if sys .version_info < (3 , 5 ):
78
+ from contextlib2 import redirect_stdout , redirect_stderr
79
+ else :
80
+ from contextlib import redirect_stdout , redirect_stderr
81
+
76
82
# Detect whether IPython is installed to determine if the built-in "ipy" command should be included
77
83
ipython_available = True
78
84
try :
92
98
# BrokenPipeError is only in Python 3. Use IOError for Python 2.
93
99
if six .PY3 :
94
100
BROKEN_PIPE_ERROR = BrokenPipeError
95
-
96
- # redirect_stdout and redirect_stderr weren't added to contextlib until Python 3.4
97
- from contextlib import redirect_stdout , redirect_stderr
98
101
else :
99
102
BROKEN_PIPE_ERROR = IOError
100
- from contextlib2 import redirect_stdout , redirect_stderr
101
103
102
104
# On some systems, pyperclip will import gtk for its clipboard functionality.
103
105
# The following code is a workaround for gtk interfering with printing from a background
Original file line number Diff line number Diff line change 67
67
if sys .platform .startswith ('win' ):
68
68
INSTALL_REQUIRES += ['pyreadline' ]
69
69
70
- # Python 2.7 also requires contextlib2 for temporarily redirecting stdout and stderr and subprocess32
70
+ # Python 3.4 and earlier require contextlib2 for temporarily redirecting stderr and stdout
71
+ if sys .version_info < (3 , 5 ):
72
+ INSTALL_REQUIRES += ['contextlib2' ]
73
+
74
+ # Python 2.7 also requires subprocess32
71
75
if sys .version_info < (3 , 0 ):
72
- INSTALL_REQUIRES += ['contextlib2' , ' subprocess32' ]
76
+ INSTALL_REQUIRES += ['subprocess32' ]
73
77
74
78
# unittest.mock was added in Python 3.3. mock is a backport of unittest.mock to all versions of Python
75
79
TESTS_REQUIRE = ['mock' , 'pytest' ]
You can’t perform that action at this time.
0 commit comments