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

Side by Side Diff: tools/telemetry/telemetry/core/platform/linux_platform_backend.py

Issue 381293003: [Telemetry] Consider linux distribution number is 0 when it cannot be parsed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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 | « no previous file | 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 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 4
5 import logging 5 import logging
6 import os 6 import os
7 import subprocess 7 import subprocess
8 import sys 8 import sys
9 9
10 from telemetry import decorators 10 from telemetry import decorators
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 raise NotImplementedError('Unknown Linux OS version') 43 raise NotImplementedError('Unknown Linux OS version')
44 44
45 codename = None 45 codename = None
46 version = None 46 version = None
47 with open('/etc/lsb-release') as f: 47 with open('/etc/lsb-release') as f:
48 for line in f.readlines(): 48 for line in f.readlines():
49 key, _, value = line.partition('=') 49 key, _, value = line.partition('=')
50 if key == 'DISTRIB_CODENAME': 50 if key == 'DISTRIB_CODENAME':
51 codename = value.strip() 51 codename = value.strip()
52 elif key == 'DISTRIB_RELEASE': 52 elif key == 'DISTRIB_RELEASE':
53 version = float(value) 53 version = float(value)
tonyg 2014/07/11 02:33:45 I think you meant to remove this line. That kind
54 try:
55 version = float(value)
56 except ValueError:
57 version = 0
54 if codename and version: 58 if codename and version:
55 break 59 break
56 return platform_backend.OSVersion(codename, version) 60 return platform_backend.OSVersion(codename, version)
57 61
58 def CanFlushIndividualFilesFromSystemCache(self): 62 def CanFlushIndividualFilesFromSystemCache(self):
59 return True 63 return True
60 64
61 def FlushEntireSystemCache(self): 65 def FlushEntireSystemCache(self):
62 p = subprocess.Popen(['/sbin/sysctl', '-w', 'vm.drop_caches=3']) 66 p = subprocess.Popen(['/sbin/sysctl', '-w', 'vm.drop_caches=3'])
63 p.wait() 67 p.wait()
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 cloud_storage.GetIfChanged(bin_path, cloud_storage.INTERNAL_BUCKET) 118 cloud_storage.GetIfChanged(bin_path, cloud_storage.INTERNAL_BUCKET)
115 os.chmod(bin_path, 0755) 119 os.chmod(bin_path, 0755)
116 except cloud_storage.CloudStorageError, e: 120 except cloud_storage.CloudStorageError, e:
117 logging.error(e) 121 logging.error(e)
118 if fallback_package: 122 if fallback_package:
119 logging.error('You may proceed by manually installing %s via:\n' 123 logging.error('You may proceed by manually installing %s via:\n'
120 'sudo apt-get install %s' % (bin_name, fallback_package)) 124 'sudo apt-get install %s' % (bin_name, fallback_package))
121 sys.exit(1) 125 sys.exit(1)
122 126
123 assert self.CanLaunchApplication(bin_name), 'Failed to install ' + bin_name 127 assert self.CanLaunchApplication(bin_name), 'Failed to install ' + bin_name
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698