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

Update conditional pyreadline3 dependency for Win #1046

Merged
merged 1 commit into from
Jan 29, 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
3 changes: 2 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ ipython = "*"
isort = "*"
mock = {version = "*",markers = "python_version < '3.6'"}
plumbum = "*"
pyreadline = {version = "*",sys_platform = "== 'win32'"}
pyreadline = {version = "*",sys_platform = "== 'win32'",markers = "python_version < '3.8'"}
pyreadline3 = {version = "*",sys_platform = "== 'win32'",markers = "python_version >= '3.8'"}
pytest = "*"
pytest-cov = "*"
pytest-mock = "*"
Expand Down
4 changes: 2 additions & 2 deletions cmd2/rl_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class RlType(Enum):
# Explanation for why readline wasn't loaded
_rl_warn_reason = ''

# The order of this check matters since importing pyreadline will also show readline in the modules list
if 'pyreadline' in sys.modules:
# The order of this check matters since importing pyreadline/pyreadline3 will also show readline in the modules list
if 'pyreadline' in sys.modules or 'pyreadline3' in sys.modules:
rl_type = RlType.PYREADLINE

from ctypes import byref
Expand Down
9 changes: 6 additions & 3 deletions docs/overview/integrating.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ Windows Considerations

If you would like to use :ref:`features/completion:Completion`, and you want
your application to run on Windows, you will need to ensure you install the
``pyreadline`` package. Make sure to include the following in your
``setup.py``::
``pyreadline3`` or ``pyreadline`` package. Make sure to include the following
in your ``setup.py``::

install_requires=[
'cmd2>=1,<2',
":sys_platform=='win32'": ['pyreadline'],
":sys_platform=='win32'": [
"pyreadline ; python_version<'3.8'",
"pyreadline3 ; python_version>='3.8'", # pyreadline3 is a drop-in replacement for Python 3.8 and above
],
]
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@
]

EXTRAS_REQUIRE = {
# Windows also requires pyreadline to ensure tab completion works
":sys_platform=='win32'": ['pyreadline'],
# Windows also requires pyreadline or the replacement, pyreadline3, to ensure tab completion works
":sys_platform=='win32' and python_version<'3.8'": ["pyreadline"],
":sys_platform=='win32' and python_version>='3.8'": ["pyreadline3"],
# Extra dependencies for running unit tests
'test': [
"gnureadline; sys_platform=='darwin'", # include gnureadline on macOS to ensure it is available in nox env
Expand Down