From 5893b6a967496e2f609e07c621b26e74c1ceca22 Mon Sep 17 00:00:00 2001 From: Jan Fabry Date: Mon, 23 Jul 2018 21:57:54 +0200 Subject: [PATCH] Use pyreadline on Windows readline is not supported on Windows, pyreadline is a Python-only alternative. --- compoundpi/__init__.py | 3 +++ compoundpi/cmdline.py | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/compoundpi/__init__.py b/compoundpi/__init__.py index f31d306..83b0ff2 100644 --- a/compoundpi/__init__.py +++ b/compoundpi/__init__.py @@ -58,6 +58,9 @@ 'MarkupSafe<0.16', ]) +if sys.platform.startswith('Win'): + __requires__.append('pyreadline') + __classifiers__ = [ 'Development Status :: 4 - Beta', 'Environment :: Console', diff --git a/compoundpi/cmdline.py b/compoundpi/cmdline.py index 080e8a9..a255e5c 100644 --- a/compoundpi/cmdline.py +++ b/compoundpi/cmdline.py @@ -50,12 +50,16 @@ import os import re import cmd -import readline import locale import logging import warnings from textwrap import TextWrapper +try: + import readline +except ImportError: + import pyreadline as readline + from .terminal import _CONSOLE # Hex 1 and 2 are used to ensure readline ignores color sequences in the prompt