Chromium Code Reviews| Index: tools/telemetry/telemetry/core/platform/linux_platform_backend.py |
| diff --git a/tools/telemetry/telemetry/core/platform/linux_platform_backend.py b/tools/telemetry/telemetry/core/platform/linux_platform_backend.py |
| index 54fde65707b7e81da791bab67dc4d8b1a485da6b..b44a42ee5a9f3a60295e78d72c868cc181ccf17e 100644 |
| --- a/tools/telemetry/telemetry/core/platform/linux_platform_backend.py |
| +++ b/tools/telemetry/telemetry/core/platform/linux_platform_backend.py |
| @@ -5,6 +5,7 @@ |
| import logging |
| import os |
| import platform |
| +import site |
| import subprocess |
| import sys |
| @@ -96,6 +97,10 @@ class LinuxPlatformBackend( |
| raise NotImplementedError( |
| 'Please teach Telemetry how to install ' + application) |
| + def InstallPythonModule(self, module): |
| + if module == 'cv2': |
| + self._InstallOpenCV() |
|
flackr
2014/10/21 16:08:16
As with InstallApplication, raise NotImplementedEr
mthiesse
2014/10/21 20:01:10
Done.
|
| + |
| def CanMonitorPower(self): |
| return self._power_monitor.CanMonitorPower() |
| @@ -154,6 +159,34 @@ class LinuxPlatformBackend( |
| 'You may proceed by manually building and installing dummynet for ' \ |
| 'your kernel. See: http://info.iet.unipi.it/~luigi/dummynet/' |
| + def _InstallOpenCV(self): |
| + cv2so = support_binaries.FindPath( |
| + 'cv2.so', self.GetArchName(), self.GetOSName()) |
| + cloud_storage.GetIfChanged(cv2so, cloud_storage.INTERNAL_BUCKET) |
| + if not os.path.exists(cv2so): |
| + raise Exception( |
| + 'Failed to install openCV. You may try installing openCV manually. ' |
| + 'See: github.com/jayrambhia/Install-OpenCV') |
| + # These are the openCV dependencies, according to |
| + # https://github.com/jayrambhia/Install-OpenCV at the time of writing. |
| + # This dependency list may not be exhaustive. |
| + print('Installing openCV dependencies:') |
| + subprocess.check_call(['sudo', 'apt-get', '-q', 'install', |
|
tonyg
2014/10/17 01:15:11
I wonder whether we should instead add these packa
flackr
2014/10/21 16:08:16
We could statically link the external lib dependen
mthiesse
2014/10/21 20:01:10
Yes, it's just difficult to figure out exactly wha
|
| + 'libopencv-dev', 'yasm', 'libjpeg-dev', |
| + 'libavcodec-dev', 'libavformat-dev', |
| + 'libswscale-dev', 'libdc1394-22-dev', |
| + 'libxine-dev', 'libgstreamer0.10-dev', |
| + 'libgstreamer-plugins-base0.10-dev', 'libv4l-dev', |
| + 'python-dev', 'python-numpy', 'libtbb-dev', |
| + 'libqt4-dev', 'libgtk2.0-dev', 'libxvidcore-dev', |
| + 'libtheora-dev', 'libx264-dev', 'v4l-utils']) |
| + target_dir = site.getsitepackages()[0] |
| + target_name = os.path.join(target_dir, 'cv2.so') |
| + # First remove any old/incorrect versions. |
| + subprocess.check_call(['sudo', 'rm', '-f', target_name]) |
| + subprocess.check_call(['sudo', 'cp', cv2so, target_dir]) |
| + subprocess.check_call(['sudo', 'chmod', 'a+r-x', target_name]) |
| + |
| def _InstallBinary(self, bin_name, fallback_package=None): |
| bin_path = support_binaries.FindPath( |
| bin_name, self.GetArchName(), self.GetOSName()) |