OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 |
| 3 # Copyright 2015 Google Inc. |
| 4 # |
| 5 # Use of this source code is governed by a BSD-style license that can be |
| 6 # found in the LICENSE file. |
| 7 |
| 8 |
| 9 import os |
| 10 import subprocess |
| 11 import sys |
| 12 |
| 13 sys.path.insert(0, os.path.join('common', 'py', 'utils')) |
| 14 import gs_utils |
| 15 |
| 16 |
| 17 def get_uploaded_hashes(gs_bucket, gs_dir): |
| 18 _, files = gs_utils.GSUtils().list_bucket_contents(gs_bucket, subdir=gs_dir) |
| 19 hashes = [] |
| 20 for line in files: |
| 21 hashes.append(os.path.basename(line).split('.')[0]) |
| 22 return hashes |
| 23 |
| 24 |
| 25 def main(gs_bucket, gs_dir, output_file): |
| 26 hashes = get_uploaded_hashes(gs_bucket, gs_dir) |
| 27 with open(output_file, 'w') as f: |
| 28 for h in hashes: |
| 29 f.write(h + '\n') |
| 30 |
| 31 |
| 32 if __name__ == '__main__': |
| 33 if len(sys.argv) != 4: |
| 34 print >> sys.stderr , ('Usage: %s <gs_bucket> <gs_subdir> <output_file>' % |
| 35 sys.argv[0]) |
| 36 sys.exit(1) |
| 37 main(*sys.argv[1:]) |
OLD | NEW |