blob: d26a2c7c28d07dc0b8314453b23585a93d465375 [file] [log] [blame]
# Copyright (c) 2015 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""This script is a faster, specialized alternative to for
getting the toolchain revision. Speed matters when running gn gen, for example.
import json
import os.path
import sys
BUILD_DIR = os.path.dirname(os.path.abspath(__file__))
NACL_DIR = os.path.dirname(BUILD_DIR)
DEFAULT_REVISIONS_DIR = os.path.join(NACL_DIR, 'toolchain_revisions')
def main():
if len(sys.argv) < 2:
print 'usage: %s toolchain_package_names...' % sys.argv[0]
for package in sys.argv[1:]:
revisions_file = os.path.join(DEFAULT_REVISIONS_DIR, package + '.json')
if not os.path.exists(revisions_file):
print 'unknown toolchain %s' % package
f = open(revisions_file)
data = json.load(f)
print data['revision']
if __name__ == '__main__':