mirror of
https://github.com/httpie/cli.git
synced 2024-11-22 07:43:20 +01:00
Handle curses-free Pythons
This commit is contained in:
parent
0d08732397
commit
87e44ae639
@ -3,7 +3,7 @@ HTTPie - a CLI, cURL-like tool for humans.
|
||||
|
||||
"""
|
||||
__author__ = 'Jakub Roztocil'
|
||||
__version__ = '0.9.6'
|
||||
__version__ = '1.0.0-dev'
|
||||
__licence__ = 'BSD'
|
||||
|
||||
|
||||
|
@ -1,4 +1,8 @@
|
||||
import sys
|
||||
try:
|
||||
import curses
|
||||
except ImportError:
|
||||
curses = None # Compiled w/o curses
|
||||
|
||||
from httpie.compat import is_windows
|
||||
from httpie.config import DEFAULT_CONFIG_DIR, Config
|
||||
@ -28,17 +32,12 @@ class Environment(object):
|
||||
stderr_isatty = stderr.isatty()
|
||||
colors = 256
|
||||
if not is_windows:
|
||||
import curses
|
||||
try:
|
||||
curses.setupterm()
|
||||
if curses:
|
||||
try:
|
||||
curses.setupterm()
|
||||
colors = curses.tigetnum('colors')
|
||||
except TypeError:
|
||||
# pypy3 (2.4.0)
|
||||
colors = curses.tigetnum(b'colors')
|
||||
except curses.error:
|
||||
pass
|
||||
del curses
|
||||
except curses.error:
|
||||
pass
|
||||
else:
|
||||
# noinspection PyUnresolvedReferences
|
||||
import colorama.initialise
|
||||
|
Loading…
Reference in New Issue
Block a user