nuke Pillow

This commit is contained in:
Thomas Kriechbaumer 2017-02-15 00:34:23 +01:00
parent bb2fa6dc7d
commit 8a6f8bd461
6 changed files with 4 additions and 30 deletions

View File

@ -85,7 +85,7 @@ libraries. This was tested on a fully patched installation of Ubuntu 16.04.
.. code:: bash
sudo apt-get install python3-pip python3-dev libffi-dev libssl-dev libtiff5-dev libjpeg8-dev zlib1g-dev libwebp-dev
sudo apt-get install python3-pip python3-dev libffi-dev libssl-dev zlib1g-dev
sudo pip3 install mitmproxy # or pip3 install --user mitmproxy
On older Ubuntu versions, e.g., **12.04** and **14.04**, you may need to install
@ -104,7 +104,7 @@ libraries. This was tested on a fully patched installation of Fedora 24.
.. code:: bash
sudo dnf install make gcc redhat-rpm-config python3-pip python3-devel libffi-devel openssl-devel libtiff-devel libjpeg-devel zlib-devel libwebp-devel openjpeg2-devel
sudo dnf install make gcc redhat-rpm-config python3-pip python3-devel libffi-devel openssl-devel zlib-devel
sudo pip3 install mitmproxy # or pip3 install --user mitmproxy
Make sure to have an up-to-date version of pip by running ``pip3 install -U pip``.

View File

@ -1,13 +1,9 @@
import io
import imghdr
from PIL import Image
from mitmproxy.contentviews import base
from mitmproxy.types import multidict
from . import image_parser
from mitmproxy.contentviews import base
class ViewImage(base.View):
name = "Image"
@ -16,8 +12,6 @@ class ViewImage(base.View):
"image/png",
"image/jpeg",
"image/gif",
"image/vnd.microsoft.icon",
"image/x-icon",
]
def __call__(self, data, **metadata):
@ -37,19 +31,3 @@ class ViewImage(base.View):
parts = image_parser.parse_jpeg(data)
fmt = base.format_dict(multidict.MultiDict(parts))
return "%s image" % f, fmt
try:
img = Image.open(io.BytesIO(data))
except IOError:
return None
parts = [
("Format", str(img.format_description)),
("Size", "%s x %s px" % img.size),
("Mode", str(img.mode)),
]
for i in sorted(img.info.keys()):
if i != "exif":
parts.append(
(str(i), str(img.info[i]))
)
fmt = base.format_dict(multidict.MultiDict(parts))
return "%s image" % img.format, fmt

View File

@ -71,7 +71,6 @@ setup(
"hyperframe>=4.0.1, <5",
"jsbeautifier>=1.6.3, <1.7",
"kaitaistruct>=0.6, <0.7",
"Pillow>=3.2, <4.1",
"passlib>=1.6.5, <1.8",
"pyasn1>=0.1.9, <0.3",
"pyOpenSSL>=16.0, <17.0",
@ -118,6 +117,7 @@ setup(
'examples': [
"beautifulsoup4>=4.4.1, <4.6",
"pytz>=2015.07.0, <=2016.10",
"Pillow>=3.2, <4.1",
]
}
)

View File

@ -3,5 +3,4 @@ import logging
logging.getLogger("hyper").setLevel(logging.WARNING)
logging.getLogger("requests").setLevel(logging.WARNING)
logging.getLogger("passlib").setLevel(logging.WARNING)
logging.getLogger("PIL").setLevel(logging.WARNING)
logging.getLogger("tornado").setLevel(logging.WARNING)

View File

@ -9,7 +9,6 @@ def test_view_image():
"mitmproxy/data/image.png",
"mitmproxy/data/image.gif",
"mitmproxy/data/all.jpeg",
"mitmproxy/data/image.ico"
]:
with open(tutils.test_data.path(img), "rb") as f:
assert v(f.read())

View File

@ -23,8 +23,6 @@ logging.getLogger("hyper.packages.hpack.hpack").setLevel(logging.WARNING)
logging.getLogger("requests.packages.urllib3.connectionpool").setLevel(logging.WARNING)
logging.getLogger("passlib.utils.compat").setLevel(logging.WARNING)
logging.getLogger("passlib.registry").setLevel(logging.WARNING)
logging.getLogger("PIL.Image").setLevel(logging.WARNING)
logging.getLogger("PIL.PngImagePlugin").setLevel(logging.WARNING)
# inspect the log: