Mojo C++ bindings: better log message for serialization warnings.
[chromium-blink-merge.git] / native_client_sdk / src / build_tools / build_version.py
blob6e0aaa7421b3ec06a89fbe14925fcb59ec95c667
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 """Small utility library of python functions used during SDK building.
6 """
8 import os
9 import sys
11 # pylint: disable=E0602
13 # Reuse last change utility code.
14 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
15 SRC_DIR = os.path.dirname(os.path.dirname(os.path.dirname(SCRIPT_DIR)))
16 sys.path.append(os.path.join(SRC_DIR, 'build/util'))
17 import lastchange
20 # Location of chrome's version file.
21 VERSION_PATH = os.path.join(SRC_DIR, 'chrome', 'VERSION')
24 def ChromeVersion():
25 '''Extract chrome version from src/chrome/VERSION + svn.
27 Returns:
28 Chrome version string or trunk + svn rev.
29 '''
30 info = lastchange.FetchVersionInfo(None)
31 if info.url.startswith('/trunk/'):
32 return 'trunk.%s' % info.revision
33 else:
34 return ChromeVersionNoTrunk()
37 def ChromeVersionNoTrunk():
38 '''Extract the chrome version from src/chrome/VERSION.
39 Ignore whether this is a trunk build.
41 Returns:
42 Chrome version string.
43 '''
44 exec(open(VERSION_PATH).read())
45 return '%s.%s.%s.%s' % (MAJOR, MINOR, BUILD, PATCH)
48 def ChromeMajorVersion():
49 '''Extract chrome major version from src/chrome/VERSION.
51 Returns:
52 Chrome major version.
53 '''
54 exec(open(VERSION_PATH, 'r').read())
55 return str(MAJOR)
58 def ChromeRevision():
59 '''Extract chrome revision from svn.
61 Returns:
62 The Chrome revision as a string. e.g. "12345"
63 '''
64 return lastchange.FetchVersionInfo(None).revision
66 def NaClRevision():
67 '''Extract NaCl revision from svn.
69 Returns:
70 The NaCl revision as a string. e.g. "12345"
71 '''
72 nacl_dir = os.path.join(SRC_DIR, 'native_client')
73 return lastchange.FetchVersionInfo(None, nacl_dir).revision