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

Unified Diff: third_party/gsutil/20110627/boto/bin/lss3

Issue 10199002: Upgrade gsutil to 3.4 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments Created 8 years, 8 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
Index: third_party/gsutil/20110627/boto/bin/lss3
diff --git a/third_party/gsutil/20110627/boto/bin/lss3 b/third_party/gsutil/20110627/boto/bin/lss3
deleted file mode 100755
index 7135d87286350fbded55f52e75d1910c539065f0..0000000000000000000000000000000000000000
--- a/third_party/gsutil/20110627/boto/bin/lss3
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/env python
-import boto
-
-def sizeof_fmt(num):
- for x in ['b ','KB','MB','GB','TB', 'XB']:
- if num < 1024.0:
- return "%3.1f %s" % (num, x)
- num /= 1024.0
- return "%3.1f %s" % (num, x)
-
-def list_bucket(b, prefix=None):
- """List everything in a bucket"""
- from boto.s3.prefix import Prefix
- total = 0
- query = b
- if prefix:
- if not prefix.endswith("/"):
- prefix = prefix + "/"
- query = b.list(prefix=prefix, delimiter="/")
- print "%s" % prefix
- num = 0
- for k in query:
- num += 1
- mode = "-rwx---"
- if isinstance(k, Prefix):
- mode = "drwxr--"
- size = 0
- else:
- size = k.size
- for g in k.get_acl().acl.grants:
- if g.id == None:
- if g.permission == "READ":
- mode = "-rwxr--"
- elif g.permission == "FULL_CONTROL":
- mode = "-rwxrwx"
- print "%s\t%010s\t%s" % (mode, sizeof_fmt(size), k.name)
- total += size
- print "="*60
- print "TOTAL: \t%010s \t%i Files" % (sizeof_fmt(total), num)
-
-def list_buckets(s3):
- """List all the buckets"""
- for b in s3.get_all_buckets():
- print b.name
-
-if __name__ == "__main__":
- import sys
- s3 = boto.connect_s3()
- if len(sys.argv) < 2:
- list_buckets(s3)
- else:
- for name in sys.argv[1:]:
- prefix = None
- if "/" in name:
- (name, prefix) = name.split("/",1)
- list_bucket(s3.get_bucket(name), prefix)
« no previous file with comments | « third_party/gsutil/20110627/boto/bin/list_instances ('k') | third_party/gsutil/20110627/boto/bin/pyami_sendmail » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698