diff --git a/.travis.yml b/.travis.yml index a4215e686..2dc898c21 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,8 @@ language: python -sudo: true +sudo: false python: - "2.7" - pypy -before_install: - - "sudo apt-get install -y xclip" # command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors install: - "pip install --upgrade --src . -r requirements.txt" diff --git a/libmproxy/console/flowlist.py b/libmproxy/console/flowlist.py index 236bd5084..d611dc6e1 100644 --- a/libmproxy/console/flowlist.py +++ b/libmproxy/console/flowlist.py @@ -1,7 +1,10 @@ from __future__ import absolute_import import urwid -import pyperclip from . import common +try: + import pyperclip +except: + pyperclip = False def _mkhelp(): text = [] @@ -139,16 +142,19 @@ class ConnectionItem(common.WWrap): self.master.server_playback_path ) def server_copy_response(self, k): - if k == "c": - try: - pyperclip.copy(self.flow.response.get_decoded_content()) - except TypeError: - self.master.statusbar.message("Content is binary or can be converted to text") - elif k == "h": - try: - pyperclip.copy(str(self.flow.response.headers)) - except TypeError: - self.master.statusbar.message("Error converting headers to text") + if pyperclip: + if k == "c": + try: + pyperclip.copy(self.flow.response.get_decoded_content()) + except TypeError: + self.master.statusbar.message("Content is binary or can be converted to text") + elif k == "h": + try: + pyperclip.copy(str(self.flow.response.headers)) + except TypeError: + self.master.statusbar.message("Error converting headers to text") + else: + self.master.statusbar.message("No clipboard support on your system, sorry.") def keypress(self, (maxcol,), key): key = common.shortcuts(key) diff --git a/libmproxy/console/flowview.py b/libmproxy/console/flowview.py index 08a0148f5..667a74074 100644 --- a/libmproxy/console/flowview.py +++ b/libmproxy/console/flowview.py @@ -4,7 +4,10 @@ import urwid from . import common, grideditor, contentview from .. import utils, flow, controller from ..protocol.http import HTTPResponse, CONTENT_MISSING, decoded -import pyperclip +try: + import pyperclip +except: + pyperclip = False class SearchError(Exception): pass @@ -650,16 +653,19 @@ class FlowView(common.WWrap): self.master.refresh_flow(self.flow) def server_copy_response(self, k): - if k == "c": - try: - pyperclip.copy(self.flow.response.get_decoded_content()) - except TypeError: - self.master.statusbar.message("Content is binary or can be converted to text") - elif k == "h": - try: - pyperclip.copy(str(self.flow.response.headers)) - except TypeError: - self.master.statusbar.message("Error converting headers to text") + if pyperclip: + if k == "c": + try: + pyperclip.copy(self.flow.response.get_decoded_content()) + except TypeError: + self.master.statusbar.message("Content is binary or can be converted to text") + elif k == "h": + try: + pyperclip.copy(str(self.flow.response.headers)) + except TypeError: + self.master.statusbar.message("Error converting headers to text") + else: + self.master.statusbar.message("No clipboard support on your system, sorry.") def delete_body(self, t): if t == "m":