Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1645)

Unified Diff: mojo/devtools/common/devtoolslib/http_server.py

Issue 1316443002: Call `gzip` in subprocess instead of gzipping in Python in http_server. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | mojo/devtools/common/devtoolslib/shell_arguments.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/devtools/common/devtoolslib/http_server.py
diff --git a/mojo/devtools/common/devtoolslib/http_server.py b/mojo/devtools/common/devtoolslib/http_server.py
index d8a275770135205263026d3cba56a3aa733ddf77..7c04174fe34828381b67dfe988a6228f2f1649bb 100644
--- a/mojo/devtools/common/devtoolslib/http_server.py
+++ b/mojo/devtools/common/devtoolslib/http_server.py
@@ -6,15 +6,14 @@ import atexit
import datetime
import email.utils
import errno
-import gzip
import hashlib
import logging
import math
import os.path
-import shutil
import socket
-import threading
+import subprocess
import tempfile
+import threading
import SimpleHTTPServer
import SocketServer
@@ -155,9 +154,8 @@ def _get_handler_class_for_path(mappings):
if not self.gzipped_file:
self.gzipped_file = tempfile.NamedTemporaryFile(delete=False)
self.original_file_name = candidate
- with open(candidate, 'rb') as source:
- with gzip.GzipFile(fileobj=self.gzipped_file) as target:
- shutil.copyfileobj(source, target)
+ subprocess.check_call(['gzip', '-c', candidate],
piotrt 2015/08/25 09:23:36 Maybe it would be good to handle errors here? the
ppi 2015/08/25 11:34:36 Done.
+ stdout=self.gzipped_file)
self.gzipped_file.close()
return self.gzipped_file.name
return candidate
« no previous file with comments | « no previous file | mojo/devtools/common/devtoolslib/shell_arguments.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698