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

Side by Side Diff: tools/telemetry/telemetry/core/util.py

Issue 321773002: [PowerProfiler] Make sure correct version of pySerial is imported with monsoon profiler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch for landing! Created 6 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 | « tools/telemetry/telemetry/core/platform/profiler/monsoon.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2012 The Chromium Authors. All rights reserved. 1 # Copyright 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 import glob 4 import glob
5 import imp 5 import imp
6 import inspect 6 import inspect
7 import logging 7 import logging
8 import os 8 import os
9 import socket 9 import socket
10 import sys 10 import sys
(...skipping 21 matching lines...) Expand all
32 return os.path.join(GetTelemetryDir(), 'unittest_data') 32 return os.path.join(GetTelemetryDir(), 'unittest_data')
33 33
34 34
35 def GetChromiumSrcDir(): 35 def GetChromiumSrcDir():
36 return os.path.normpath(os.path.join(GetTelemetryDir(), os.pardir, os.pardir)) 36 return os.path.normpath(os.path.join(GetTelemetryDir(), os.pardir, os.pardir))
37 37
38 38
39 def AddDirToPythonPath(*path_parts): 39 def AddDirToPythonPath(*path_parts):
40 path = os.path.abspath(os.path.join(*path_parts)) 40 path = os.path.abspath(os.path.join(*path_parts))
41 if os.path.isdir(path) and path not in sys.path: 41 if os.path.isdir(path) and path not in sys.path:
42 sys.path.append(path) 42 sys.path.insert(0, path)
43 43
44 _counter = [0] 44 _counter = [0]
45 def _GetUniqueModuleName(): 45 def _GetUniqueModuleName():
46 _counter[0] += 1 46 _counter[0] += 1
47 return "page_set_module_" + str(_counter[0]) 47 return "page_set_module_" + str(_counter[0])
48 48
49 def GetPythonPageSetModule(file_path): 49 def GetPythonPageSetModule(file_path):
50 return imp.load_source(_GetUniqueModuleName(), file_path) 50 return imp.load_source(_GetUniqueModuleName(), file_path)
51 51
52 52
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 """ 158 """
159 name, ext = os.path.splitext(base_name) 159 name, ext = os.path.splitext(base_name)
160 assert ext == '', 'base_name cannot contain file extension.' 160 assert ext == '', 'base_name cannot contain file extension.'
161 index = 0 161 index = 0
162 while True: 162 while True:
163 output_name = '%s_%03d' % (name, index) 163 output_name = '%s_%03d' % (name, index)
164 if not glob.glob(output_name + '.*'): 164 if not glob.glob(output_name + '.*'):
165 break 165 break
166 index = index + 1 166 index = index + 1
167 return output_name 167 return output_name
OLDNEW
« no previous file with comments | « tools/telemetry/telemetry/core/platform/profiler/monsoon.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698