Index: tools/telemetry/catapult_base/util.py |
diff --git a/tools/telemetry/catapult_base/util.py b/tools/telemetry/catapult_base/util.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..25fed017f7a10f56e1805272088091c49d25b332 |
--- /dev/null |
+++ b/tools/telemetry/catapult_base/util.py |
@@ -0,0 +1,25 @@ |
+# Copyright 2015 The Chromium Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+import os |
+import sys |
+ |
+ |
+def GetCatapultDir(): |
+ return os.path.normpath(os.path.join( |
+ os.path.dirname(__file__), '..', '..', '..', 'third_party', 'catapult')) |
+ |
+ |
+def IsRunningOnCrosDevice(): |
+ """Returns True if we're on a ChromeOS device.""" |
+ lsb_release = '/etc/lsb-release' |
+ if sys.platform.startswith('linux') and os.path.exists(lsb_release): |
+ with open(lsb_release, 'r') as f: |
+ res = f.read() |
+ if res.count('CHROMEOS_RELEASE_NAME'): |
+ return True |
+ return False |
+ |
+ |
+def IsExecutable(path): |
+ return os.path.isfile(path) and os.access(path, os.X_OK) |