Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: tools/metrics/histograms/histograms_path.py

Issue 1143323006: Histograms.xml python script housekeeping (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bad_message
Patch Set: Split off the extensions permission weirdness. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2013 The Chromium Authors. All rights reserved.
Ilya Sherman 2015/05/27 00:12:24 nit: 2015
ncarter (slow) 2015/05/29 23:01:10 Done.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 """Utility functions for resolving file paths in histograms scripts."""
6
7 import os.path
8
9
10 def GetHistogramsFile():
11 """Returns the path to histograms.xml.
12
13 Prefer using this function instead of just open("histograms.xml"), so that
14 scripts work properly even if run from outside the histograms directory.
15 """
16 return os.path.join(os.path.dirname(__file__), 'histograms.xml')
17
18
19 def GetInputFile(src_relative_file_path):
Ilya Sherman 2015/05/27 00:12:24 Is it worth providing this at a higher level, so t
ncarter (slow) 2015/05/29 23:01:10 I moved it to common (as path_util.py). I also add
20 """Converts a src/-relative file path into a path that can be opened."""
21 depth = [os.path.dirname(__file__), '..', '..', '..']
22 return os.path.join(*(depth + src_relative_file_path.split('/')))
Ilya Sherman 2015/05/27 00:12:24 Out of curiousity, what does the "*" operator do?
ncarter (slow) 2015/05/29 23:01:10 https://docs.python.org/2/tutorial/controlflow.htm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698