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

Unified Diff: gclient_utils.py

Issue 3300008: Remove kwargs copy, it is not necessary. Remove ordered argument support from popen to simplify it. (Closed)
Patch Set: Created 10 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient_utils.py
diff --git a/gclient_utils.py b/gclient_utils.py
index 66514f12aeb5991e2131aa1c987875e1e242dacb..7558b4266b3aa7bfb622b50500ba2a18eadef68c 100644
--- a/gclient_utils.py
+++ b/gclient_utils.py
@@ -38,26 +38,22 @@ class CheckCallError(OSError):
self.stderr = stderr
-def Popen(*args, **kwargs):
+def Popen(args, **kwargs):
"""Calls subprocess.Popen() with hacks to work around certain behaviors.
Ensure English outpout for svn and make it work reliably on Windows.
"""
- copied = False
+ logging.debug(u'%s, cwd=%s' % (u' '.join(args), kwargs.get('cwd', '')))
if not 'env' in kwargs:
- copied = True
- kwargs = kwargs.copy()
# It's easier to parse the stdout if it is always in English.
kwargs['env'] = os.environ.copy()
kwargs['env']['LANGUAGE'] = 'en'
if not 'shell' in kwargs:
- if not copied:
- kwargs = kwargs.copy()
# *Sigh*: Windows needs shell=True, or else it won't search %PATH% for the
# executable, but shell=True makes subprocess on Linux fail when it's called
# with a list because it only tries to execute the first item in the list.
kwargs['shell'] = (sys.platform=='win32')
- return subprocess.Popen(*args, **kwargs)
+ return subprocess.Popen(args, **kwargs)
def CheckCall(command, cwd=None, print_error=True):
@@ -66,7 +62,6 @@ def CheckCall(command, cwd=None, print_error=True):
Works on python 2.4
"""
- logging.debug('%s, cwd=%s' % (str(command), str(cwd)))
try:
stderr = None
if not print_error:
@@ -296,7 +291,6 @@ def CheckCallAndFilter(args, stdout=None, filter_fn=None,
stdout = stdout or sys.stdout
filter_fn = filter_fn or (lambda x: None)
assert not 'stderr' in kwargs
- logging.debug(args)
kid = Popen(args, bufsize=0,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
**kwargs)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698