diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-06-29 19:24:15 -0400 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-06-29 19:24:15 -0400 |
commit | 324c44871e43599fd05a1e95f3c36b1986ca2f64 (patch) | |
tree | a876d0771c33d12943be69e81bddefbbbab3d8b3 | |
parent | 4cef001564a262ff4d2a590bb0f8a9675e952194 (diff) | |
download | cmd2-git-324c44871e43599fd05a1e95f3c36b1986ca2f64.tar.gz |
Require pyperclip >= 1.6 which simplifies clipboard.py
-rw-r--r-- | cmd2/clipboard.py | 24 | ||||
-rwxr-xr-x | setup.py | 2 |
2 files changed, 5 insertions, 21 deletions
diff --git a/cmd2/clipboard.py b/cmd2/clipboard.py index b2331649..8e3cddc3 100644 --- a/cmd2/clipboard.py +++ b/cmd2/clipboard.py @@ -2,30 +2,14 @@ """ This module provides basic ability to copy from and paste to the clipboard/pastebuffer. """ -import sys - import pyperclip - -# Newer versions of pyperclip are released as a single file, but older versions had a more complicated structure -try: - from pyperclip.exceptions import PyperclipException -except ImportError: # pragma: no cover - # noinspection PyUnresolvedReferences,PyProtectedMember - from pyperclip import PyperclipException +# noinspection PyProtectedMember +from pyperclip import PyperclipException # Can we access the clipboard? Should always be true on Windows and Mac, but only sometimes on Linux -# noinspection PyUnresolvedReferences try: - # Get the version of the pyperclip module as a float - pyperclip_ver = float('.'.join(pyperclip.__version__.split('.')[:2])) - - # The extraneous output bug in pyperclip on Linux using xclip was fixed in more recent versions of pyperclip - if sys.platform.startswith('linux') and pyperclip_ver < 1.6: - # Avoid extraneous output to stderr from xclip when clipboard is empty at cost of overwriting clipboard contents - pyperclip.copy('') - else: - # Try getting the contents of the clipboard - _ = pyperclip.paste() + # Try getting the contents of the clipboard + _ = pyperclip.paste() except PyperclipException: can_clip = False else: @@ -31,7 +31,7 @@ Topic :: Software Development :: Libraries :: Python Modules SETUP_REQUIRES = ['setuptools_scm'] -INSTALL_REQUIRES = ['pyperclip >= 1.5.27', 'colorama', 'attrs >= 16.3.0', 'wcwidth >= 0.1.7'] +INSTALL_REQUIRES = ['pyperclip >= 1.6', 'colorama >= 0.3.7', 'attrs >= 16.3.0', 'wcwidth >= 0.1.7'] EXTRAS_REQUIRE = { # Windows also requires pyreadline to ensure tab completion works |