Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skip pyreadline dependency on Windows with Python 3.9+ #45

Merged
merged 1 commit into from
Sep 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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