Index: tools/findit/utils.py |
diff --git a/tools/findit/utils.py b/tools/findit/utils.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4e8a0ab947c28e74887dca6732af763f4f0eb59b |
--- /dev/null |
+++ b/tools/findit/utils.py |
@@ -0,0 +1,24 @@ |
+# Copyright (c) 2011 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 re |
+import sys |
+ |
+ |
+GIT_HASH_PATTERN = re.compile(r'^[0-9a-fA-F]{40}$') |
+ |
+ |
+def GetOSName(platform_name=sys.platform): |
+ if platform_name == 'cygwin' or platform_name.startswith('win'): |
+ return 'win' |
+ elif platform_name.startswith('linux'): |
+ return 'unix' |
+ elif platform_name.startswith('darwin'): |
+ return 'mac' |
+ else: |
+ return platform_name |
+ |
+ |
+def IsGitHash(revision): |
+ return GIT_HASH_PATTERN.match(str(revision)) |