Skip to content

Commit 710c24b

Browse files
committed
Use pyterminalsize for terminal sizing
1 parent 00c853b commit 710c24b

File tree

2 files changed

+3
-18
lines changed

2 files changed

+3
-18
lines changed

pre_commit/output.py

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,14 @@
11
from __future__ import unicode_literals
22

3-
import os
4-
import subprocess
53
import sys
64

7-
from backports.shutil_get_terminal_size import get_terminal_size
5+
from pyterminalsize import get_terminal_size
86

97
from pre_commit import color
108
from pre_commit import five
119

1210

13-
def _get_cols_from_tput(): # pragma: no cover (fallback)
14-
if not os.environ.get('TERM'):
15-
return 80
16-
else:
17-
return int(
18-
subprocess.Popen(
19-
('tput', 'cols'), stdout=subprocess.PIPE,
20-
).communicate()[0] or
21-
# Default in the case of no terminal
22-
80
23-
)
24-
25-
26-
COLS = get_terminal_size((0, 0)).columns or _get_cols_from_tput()
11+
COLS = get_terminal_size((80, 0)).columns
2712

2813

2914
def get_hook_message(

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@
4141
install_requires=[
4242
'argparse',
4343
'aspy.yaml',
44-
'backports.shutil_get_terminal_size',
4544
'cached-property',
4645
'jsonschema',
4746
'nodeenv>=0.11.1',
4847
'ordereddict',
48+
'pyterminalsize',
4949
'pyyaml',
5050
'virtualenv',
5151
],

0 commit comments

Comments
 (0)