mirror of
https://github.com/httpie/cli.git
synced 2025-06-06 23:36:27 +02: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'
|
__author__ = 'Jakub Roztocil'
|
||||||
__version__ = '0.9.6'
|
__version__ = '1.0.0-dev'
|
||||||
__licence__ = 'BSD'
|
__licence__ = 'BSD'
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
import sys
|
import sys
|
||||||
|
try:
|
||||||
|
import curses
|
||||||
|
except ImportError:
|
||||||
|
curses = None # Compiled w/o curses
|
||||||
|
|
||||||
from httpie.compat import is_windows
|
from httpie.compat import is_windows
|
||||||
from httpie.config import DEFAULT_CONFIG_DIR, Config
|
from httpie.config import DEFAULT_CONFIG_DIR, Config
|
||||||
@ -28,17 +32,12 @@ class Environment(object):
|
|||||||
stderr_isatty = stderr.isatty()
|
stderr_isatty = stderr.isatty()
|
||||||
colors = 256
|
colors = 256
|
||||||
if not is_windows:
|
if not is_windows:
|
||||||
import curses
|
if curses:
|
||||||
try:
|
|
||||||
curses.setupterm()
|
|
||||||
try:
|
try:
|
||||||
|
curses.setupterm()
|
||||||
colors = curses.tigetnum('colors')
|
colors = curses.tigetnum('colors')
|
||||||
except TypeError:
|
except curses.error:
|
||||||
# pypy3 (2.4.0)
|
pass
|
||||||
colors = curses.tigetnum(b'colors')
|
|
||||||
except curses.error:
|
|
||||||
pass
|
|
||||||
del curses
|
|
||||||
else:
|
else:
|
||||||
# noinspection PyUnresolvedReferences
|
# noinspection PyUnresolvedReferences
|
||||||
import colorama.initialise
|
import colorama.initialise
|
||||||
|
Loading…
x
Reference in New Issue
Block a user