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

Side by Side Diff: tools/metrics/common/path_util.py

Issue 1143323006: Histograms.xml python script housekeeping (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bad_message
Patch Set: Fix imports (sadface) 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
« no previous file with comments | « extensions/browser/bad_message.h ('k') | tools/metrics/common/presubmit_util.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2015 The Chromium Authors. All rights reserved.
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 GetInputFile('tools/metrics/histograms/histograms.xml')
17
18
19 def GetInputFile(src_relative_file_path):
20 """Converts a src/-relative file path into a path that can be opened."""
21 depth = [os.path.dirname(__file__), '..', '..', '..']
22 path = os.path.join(*(depth + src_relative_file_path.split('/')))
23 return os.path.abspath(path)
OLDNEW
« no previous file with comments | « extensions/browser/bad_message.h ('k') | tools/metrics/common/presubmit_util.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698