Handle curses-free Pythons

This commit is contained in:
Jakub Roztocil 2016-09-06 11:07:52 +01:00
parent 0d08732397
commit 87e44ae639
2 changed files with 9 additions and 10 deletions

View File

@ -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'

View File

@ -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