summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorengedy@chromium.org <engedy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-15 00:15:39 +0000
committerengedy@chromium.org <engedy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-15 00:15:39 +0000
commit6ce3d3b40fcd767d06c5fe5cc984aa2517fa33ef (patch)
tree9d7bfe5267b7eae5179984734134a7fe73f7dd67 /tools
parentce22687f7abaa66e88ba2c618e04dc568adba62b (diff)
downloadchromium_src-6ce3d3b40fcd767d06c5fe5cc984aa2517fa33ef.zip
chromium_src-6ce3d3b40fcd767d06c5fe5cc984aa2517fa33ef.tar.gz
chromium_src-6ce3d3b40fcd767d06c5fe5cc984aa2517fa33ef.tar.bz2
Make pretty_print.py look for a histograms.xml in the current working directory first.
This will allow the script to be used with files in directories other than tools/metrics/histograms. Furthermore, print the relative path of the histograms.xml file actually used to avoid confusion. BUG=None Review URL: https://codereview.chromium.org/163473008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251449 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rwxr-xr-xtools/metrics/histograms/pretty_print.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/tools/metrics/histograms/pretty_print.py b/tools/metrics/histograms/pretty_print.py
index 60e8c78..bde97fd 100755
--- a/tools/metrics/histograms/pretty_print.py
+++ b/tools/metrics/histograms/pretty_print.py
@@ -322,13 +322,17 @@ def main():
histograms_filename = 'histograms.xml'
histograms_backup_filename = 'histograms.before.pretty-print.xml'
- script_dir = path_utils.ScriptDir()
-
- histograms_pathname = os.path.join(script_dir, histograms_filename)
- histograms_backup_pathname = os.path.join(script_dir,
+ # If there is a histograms.xml in the current working directory, use that.
+ # Otherwise, use the one residing in the same directory as this script.
+ histograms_dir = os.getcwd()
+ if not os.path.isfile(os.path.join(histograms_dir, histograms_filename)):
+ histograms_dir = path_utils.ScriptDir()
+
+ histograms_pathname = os.path.join(histograms_dir, histograms_filename)
+ histograms_backup_pathname = os.path.join(histograms_dir,
histograms_backup_filename)
- logging.info('Loading %s...' % histograms_filename)
+ logging.info('Loading %s...' % os.path.relpath(histograms_pathname))
with open(histograms_pathname, 'rb') as f:
xml = f.read()