OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/env python | |
2 # Copyright (c) 2016 The Chromium Authors. All rights reserved. | |
Lei Zhang
2016/08/24 18:37:02
no (c)
Tom (Use chromium acct)
2016/08/24 22:45:21
Done.
| |
3 # Use of this source code is governed by a BSD-style license that can be | |
4 # found in the LICENSE file. | |
5 | |
Lei Zhang
2016/08/24 18:37:02
Can you add some comments to explain what this doe
Tom (Use chromium acct)
2016/08/24 22:45:21
Done.
| |
6 import sys | |
7 | |
8 if len(sys.argv) != 2: | |
9 exit(1) | |
10 | |
11 packages = {} | |
12 | |
13 def AddPackagesFromFile(file): | |
14 global packages | |
15 lines = file.readlines() | |
16 if len(lines) % 3 != 0: | |
17 exit(1) | |
18 for i in range(0, len(lines), 3): | |
Lei Zhang
2016/08/24 18:37:02
xrange?
Tom (Use chromium acct)
2016/08/24 22:45:21
Done.
| |
19 packages[lines[i]] = (lines[i + 1], lines[i + 2]) | |
20 | |
21 AddPackagesFromFile(open(sys.argv[1], 'r')) | |
22 AddPackagesFromFile(sys.stdin) | |
23 | |
24 output_file = open(sys.argv[1], 'w') | |
25 | |
26 for (package, (filename, sha256)) in packages.iteritems(): | |
27 output_file.write(package + filename + sha256) | |
OLD | NEW |