summaryrefslogtreecommitdiffstats
path: root/chrome/tools
diff options
context:
space:
mode:
authorderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-06 22:49:43 +0000
committerderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-06 22:49:43 +0000
commit174cf0c7c20edf63af4328023a56bf3c2c421c99 (patch)
treef440b4149c3c7ca0b548a9a34b69e524e779f12a /chrome/tools
parentbde750194a878fafe3bd5c0cb14264f3bb171735 (diff)
downloadchromium_src-174cf0c7c20edf63af4328023a56bf3c2c421c99.zip
chromium_src-174cf0c7c20edf63af4328023a56bf3c2c421c99.tar.gz
chromium_src-174cf0c7c20edf63af4328023a56bf3c2c421c99.tar.bz2
Make extract_actions.py not require setting PYTHONPATH.
BUG=none TEST=ran it with a relative path from a few directories and with an absolute path Review URL: http://codereview.chromium.org/6133002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70675 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/tools')
-rwxr-xr-xchrome/tools/extract_actions.py20
1 files changed, 9 insertions, 11 deletions
diff --git a/chrome/tools/extract_actions.py b/chrome/tools/extract_actions.py
index 03cd3f0..3517183 100755
--- a/chrome/tools/extract_actions.py
+++ b/chrome/tools/extract_actions.py
@@ -1,5 +1,5 @@
#!/usr/bin/python
-# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -15,12 +15,7 @@ See also:
chrome/browser/user_metrics.h
http://wiki.corp.google.com/twiki/bin/view/Main/ChromeUserExperienceMetrics
-Run it from the chrome/tools directory like:
- export PYTHONPATH=../../tools/python # for google.path_utils
- extract_actions.py
-or
- extract_actions.py --hash
- which will update the chromeactions.txt
+If run with a "--hash" argument, chromeactions.txt will be updated.
"""
__author__ = 'evanm (Evan Martin)'
@@ -30,6 +25,7 @@ import re
import sys
import hashlib
+sys.path.insert(1, os.path.join(sys.path[0], '..', '..', 'tools', 'python'))
from google import path_utils
# Files that are known to use UserMetrics::RecordComputedAction(), which means
@@ -225,14 +221,16 @@ def main(argv):
hash_output = True
else:
hash_output = False
- print >>sys.stderr, "WARNING: if you added new UMA tags, you need to" + \
- " override the chromeactions.txt file and use the --hash option"
+ print >>sys.stderr, "WARNING: If you added new UMA tags, you must" + \
+ " use the --hash option to update chromeactions.txt."
# if we do a hash output, we want to only append NEW actions, and we know
# the file we want to work on
actions = set()
+ chromeactions_path = os.path.join(path_utils.ScriptDir(), "chromeactions.txt")
+
if hash_output:
- f = open("chromeactions.txt")
+ f = open(chromeactions_path)
for line in f:
part = line.rpartition("\t")
part = part[2].strip()
@@ -258,7 +256,7 @@ def main(argv):
AddClosedSourceActions(actions)
if hash_output:
- f = open("chromeactions.txt", "w")
+ f = open(chromeactions_path, "w")
# Print out the actions as a sorted list.