Skip to content

Commit

Permalink
Merge pull request #45: Skip pyreadline on Windows with Python 3.9+
Browse files Browse the repository at this point in the history
  • Loading branch information
xolox committed Sep 17, 2021
2 parents 278215d + e0ef4bc commit ae2a7e2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion humanfriendly/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,11 @@ def prepare_friendly_prompts():
This function is called by the other functions in this module to enable
user friendly prompts.
"""
import readline # NOQA
try:
import readline # NOQA
except ImportError:
# might not be available on Windows if pyreadline isn't installed
pass


def retry_limit(limit=MAX_ATTEMPTS):
Expand Down
8 changes: 6 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ def get_install_requires():
if sys.version_info.major == 2:
install_requires.append('monotonic')
if sys.platform == 'win32':
install_requires.append('pyreadline')
# pyreadline isn't compatible with Python 3.9+
# https://github.com/pyreadline/pyreadline/issues/65
install_requires.append('pyreadline ; python_version<"3.9"')
return sorted(install_requires)


Expand All @@ -63,7 +65,9 @@ def get_extras_require():
])
extras_require[expression] = ['monotonic']
# Conditional `pyreadline' dependency.
expression = ':sys_platform == "win32"'
# pyreadline isn't compatible with Python 3.9+
# https://github.com/pyreadline/pyreadline/issues/65
expression = ':sys_platform == "win32" and python_version<"3.9"'
extras_require[expression] = 'pyreadline'
return extras_require

Expand Down

0 comments on commit ae2a7e2

Please sign in to comment.