Commit ea80f8ff authored by vivek.vg@samsung.com's avatar vivek.vg@samsung.com

[PowerProfiler] Make sure correct version of pySerial is imported with monsoon profiler.

Python 2.7.x includes pySerial version 2.5 as a distribution package. This conflicts with
our repository version of pySerial i.e. 2.7. The submodule serial.tools.* was included in
pySerial after 2.6 as per [1].

The utility function util.AddDirToPythonPath(...) appends the path at the end of the path
list. Due to this, the python interpreter picks up the pySerial library from system include
path at /usr/lib/python2.7/dist-packages/serial. This CL modifies AddDirToPythonPath(...) API to always prepend the path.

[1] http://pyserial.sourceforge.net/pyserial_api.html#module-serial.tools.list_ports

NOTRY=true

Review URL: https://codereview.chromium.org/321773002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276531 0039d316-1c4b-4281-b951-d872f2087c98
parent 4a6b53a3
...@@ -44,6 +44,8 @@ class Monsoon: ...@@ -44,6 +44,8 @@ class Monsoon:
can be specified with 'serialno' (using the number printed on its back). can be specified with 'serialno' (using the number printed on its back).
With wait=False, IOError is thrown if a device is not immediately available. With wait=False, IOError is thrown if a device is not immediately available.
""" """
assert float(serial.VERSION) >= 2.7, \
'Monsoon requires pyserial v2.7 or later. You have %s' % serial.VERSION
self._coarse_ref = self._fine_ref = self._coarse_zero = self._fine_zero = 0 self._coarse_ref = self._fine_ref = self._coarse_zero = self._fine_zero = 0
self._coarse_scale = self._fine_scale = 0 self._coarse_scale = self._fine_scale = 0
......
...@@ -39,7 +39,7 @@ def GetChromiumSrcDir(): ...@@ -39,7 +39,7 @@ def GetChromiumSrcDir():
def AddDirToPythonPath(*path_parts): def AddDirToPythonPath(*path_parts):
path = os.path.abspath(os.path.join(*path_parts)) path = os.path.abspath(os.path.join(*path_parts))
if os.path.isdir(path) and path not in sys.path: if os.path.isdir(path) and path not in sys.path:
sys.path.append(path) sys.path.insert(0, path)
_counter = [0] _counter = [0]
def _GetUniqueModuleName(): def _GetUniqueModuleName():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment