mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Fix python3 only dependency
Use backports version of shutil_get_terminal_size for python versions earlier than 3.3
This commit is contained in:
+6
-2
@@ -3,6 +3,10 @@ import json
|
||||
import os
|
||||
import sys
|
||||
import distutils.spawn
|
||||
if sys.version_info < (3, 3):
|
||||
from backports.shutil_get_terminal_size import shutil_get_terminal_size
|
||||
else:
|
||||
from shutil import get_terminal_size as shutil_get_terminal_size
|
||||
import shutil
|
||||
import signal
|
||||
|
||||
@@ -424,7 +428,7 @@ def shell():
|
||||
|
||||
# Grab current terminal dimensions to replace the hardcoded default
|
||||
# dimensions of pexpect
|
||||
terminal_dimensions = shutil.get_terminal_size()
|
||||
terminal_dimensions = shutil_get_terminal_size()
|
||||
|
||||
c = pexpect.spawn(
|
||||
"{0} -c '. {1}; exec {0} -i'".format(
|
||||
@@ -444,7 +448,7 @@ def shell():
|
||||
# Must be defined here to have the shell process in its context, since we
|
||||
# can't pass it as an argument
|
||||
def sigwinch_passthrough(sig, data):
|
||||
terminal_dimensions = shutil.get_terminal_size()
|
||||
terminal_dimensions = shutil_get_terminal_size()
|
||||
c.setwinsize(terminal_dimensions.lines, terminal_dimensions.columns)
|
||||
signal.signal(signal.SIGWINCH, sigwinch_passthrough)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user