8000 Merge pull request #45: Skip pyreadline on Windows with Python 3.9+ · xolox/python-humanfriendly@ae2a7e2 · GitHub
[go: up one dir, main page]

8000 Skip to content

Commit ae2a7e2

Browse files
committed
Merge pull request #45: Skip pyreadline on Windows with Python 3.9+
2 parents 278215d + e0ef4bc commit ae2a7e2

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

humanfriendly/prompts.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,11 @@ def prepare_friendly_prompts():
341341
This function is called by the other functions in this module to enable
342342
user friendly prompts.
343343
"""
344-
import readline # NOQA
344+
try:
345+
import readline # NOQA
346+
except ImportError:
347+
# might not be available on Windows if pyreadline isn't installed
348+
pass
345349

346350

347351
def retry_limit(limit=MAX_ATTEMPTS):

setup.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ def get_install_requires():
4949
if sys.version_info.major == 2:
5050
install_requires.append('monotonic')
5151
if sys.platform == 'win32':
52-
install_requires.append('pyreadline')
52+
# pyreadline isn't compatible with Python 3.9+
53+
# https://github.com/pyreadline/pyreadline/issues/65
54+
install_requires.append('pyreadline ; python_version<"3.9"')
5355
return sorted(install_requires)
5456

5557

@@ -63,7 +65,9 @@ def get_extras_require():
6365
])
6466
extras_require[expression] = ['monotonic']
6567
# Conditional `pyreadline' dependency.
66-
expression = ':sys_platform == "win32"'
68+
# pyreadline isn't compatible with Python 3.9+
69+
# https://github.com/pyreadline/pyreadline/issues/65
70+
expression = ':sys_platform == "win32" and python_version<"3.9"'
6771
extras_require[expression] = 'pyreadline'
6872
return extras_require
6973

0 commit comments

Comments
 (0)
0