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 e2535208bcc9ee88078cae30a9c30d250a2ba76c..89d9dd392c575bb0ea850e5a125fb327d9bec1b9 100644 |
--- a/tools/telemetry/telemetry/core/platform/linux_platform_backend.py |
+++ b/tools/telemetry/telemetry/core/platform/linux_platform_backend.py |
@@ -44,15 +44,17 @@ class LinuxPlatformBackend( |
codename = None |
version = None |
- with open('/etc/lsb-release') as f: |
- for line in f.readlines(): |
- key, _, value = line.partition('=') |
- if key == 'DISTRIB_CODENAME': |
- codename = value.strip() |
- elif key == 'DISTRIB_RELEASE': |
+ for line in self._GetFileContents('/etc/lsb-release').splitlines(): |
+ key, _, value = line.partition('=') |
+ if key == 'DISTRIB_CODENAME': |
+ codename = value.strip() |
+ elif key == 'DISTRIB_RELEASE': |
+ try: |
version = float(value) |
- if codename and version: |
- break |
+ except ValueError: |
+ version = 0 |
+ if codename and version: |
+ break |
return platform_backend.OSVersion(codename, version) |
def CanFlushIndividualFilesFromSystemCache(self): |