Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Extract UserMetrics "actions" strings from the Chrome source. | 7 """Extract UserMetrics "actions" strings from the Chrome source. |
| 8 | 8 |
| 9 This program generates the list of known actions we expect to see in the | 9 This program generates the list of known actions we expect to see in the |
| 10 user behavior logs. It walks the Chrome source, looking for calls to | 10 user behavior logs. It walks the Chrome source, looking for calls to |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 499 parser.close() | 499 parser.close() |
| 500 | 500 |
| 501 def WalkDirectory(root_path, actions, extensions, callback): | 501 def WalkDirectory(root_path, actions, extensions, callback): |
| 502 for path, dirs, files in os.walk(root_path): | 502 for path, dirs, files in os.walk(root_path): |
| 503 if '.svn' in dirs: | 503 if '.svn' in dirs: |
| 504 dirs.remove('.svn') | 504 dirs.remove('.svn') |
| 505 if '.git' in dirs: | 505 if '.git' in dirs: |
| 506 dirs.remove('.git') | 506 dirs.remove('.git') |
| 507 for file in files: | 507 for file in files: |
| 508 ext = os.path.splitext(file)[1] | 508 ext = os.path.splitext(file)[1] |
| 509 if ext in extensions: | 509 if ext and ext in extensions: |
|
Alexei Svitkine (slow)
2014/11/12 22:27:00
This seems unrelated to the change you're making t
gayane -on leave until 09-2017
2014/11/15 00:09:09
Done.
| |
| 510 callback(os.path.join(path, file), actions) | 510 callback(os.path.join(path, file), actions) |
| 511 | 511 |
| 512 def AddLiteralActions(actions): | 512 def AddLiteralActions(actions): |
| 513 """Add literal actions specified via calls to UserMetrics functions. | 513 """Add literal actions specified via calls to UserMetrics functions. |
| 514 | 514 |
| 515 Arguments: | 515 Arguments: |
| 516 actions: set of actions to add to. | 516 actions: set of actions to add to. |
| 517 """ | 517 """ |
| 518 EXTENSIONS = ('.cc', '.mm', '.c', '.m') | 518 EXTENSIONS = ('.cc', '.mm', '.c', '.m') |
| 519 | 519 |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 813 | 813 |
| 814 with open(actions_xml_path, 'wb') as f: | 814 with open(actions_xml_path, 'wb') as f: |
| 815 f.write(pretty) | 815 f.write(pretty) |
| 816 print ('Updated %s. Don\'t forget to add it to your changelist' % | 816 print ('Updated %s. Don\'t forget to add it to your changelist' % |
| 817 actions_xml_path) | 817 actions_xml_path) |
| 818 return 0 | 818 return 0 |
| 819 | 819 |
| 820 | 820 |
| 821 if '__main__' == __name__: | 821 if '__main__' == __name__: |
| 822 sys.exit(main(sys.argv)) | 822 sys.exit(main(sys.argv)) |
| OLD | NEW |