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

Unified Diff: build/android/pylib/android_commands.py

Issue 201443017: Replace GetHostSize with a cross-platform implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Handle dirs Created 6 years, 9 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: build/android/pylib/android_commands.py
diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py
index 4cf996f134a724e9ad7a17825cf69b57eb6804bd..ad395d8aa0894f392d13183ead144a41acd8a663 100644
--- a/build/android/pylib/android_commands.py
+++ b/build/android/pylib/android_commands.py
@@ -1002,7 +1002,14 @@ class AndroidCommands(object):
return
def GetHostSize(path):
craigdh 2014/03/24 23:36:46 This is getting really big for an inline function
- return int(cmd_helper.GetCmdOutput(['du', '-sb', path]).split()[0])
+ running_size = os.path.getsize(path)
+ if os.path.isdir(path):
+ for root, dirs, files in os.walk(path):
+ running_size += sum([GetHostSize(os.path.join(root, f))
craigdh 2014/03/24 23:36:46 You should just be able to call os.path.getsize on
+ for f in files])
+ running_size += sum([os.path.getsize(os.path.join(root, d))
+ for d in dirs])
+ return running_size
size = GetHostSize(host_path)
self._pushed_files.append(device_path)
« 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