Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 |
| OLD | NEW |