1*8975f5c5SAndroid Build Coastguard Worker#!/usr/bin/env vpython3 2*8975f5c5SAndroid Build Coastguard Worker# Copyright 2023 The Chromium Authors 3*8975f5c5SAndroid Build Coastguard Worker# Use of this source code is governed by a BSD-style license that can be 4*8975f5c5SAndroid Build Coastguard Worker# found in the LICENSE file. 5*8975f5c5SAndroid Build Coastguard Worker"""Print the default service account's auth token to stdout.""" 6*8975f5c5SAndroid Build Coastguard Worker 7*8975f5c5SAndroid Build Coastguard Workerfrom __future__ import absolute_import 8*8975f5c5SAndroid Build Coastguard Workerimport os 9*8975f5c5SAndroid Build Coastguard Workerimport subprocess 10*8975f5c5SAndroid Build Coastguard Workerimport sys 11*8975f5c5SAndroid Build Coastguard Worker 12*8975f5c5SAndroid Build Coastguard Workersys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), 13*8975f5c5SAndroid Build Coastguard Worker 'test'))) 14*8975f5c5SAndroid Build Coastguard Workerfrom common import DIR_SRC_ROOT 15*8975f5c5SAndroid Build Coastguard Worker 16*8975f5c5SAndroid Build Coastguard Workersys.path.append(os.path.join(DIR_SRC_ROOT, 'build')) 17*8975f5c5SAndroid Build Coastguard Workerimport find_depot_tools 18*8975f5c5SAndroid Build Coastguard Worker 19*8975f5c5SAndroid Build Coastguard Worker 20*8975f5c5SAndroid Build Coastguard Workerdef main(): 21*8975f5c5SAndroid Build Coastguard Worker luci_auth = os.path.join(find_depot_tools.DEPOT_TOOLS_PATH, 'luci-auth') 22*8975f5c5SAndroid Build Coastguard Worker proc = subprocess.run([ 23*8975f5c5SAndroid Build Coastguard Worker luci_auth, 'token', '-scopes', 24*8975f5c5SAndroid Build Coastguard Worker 'https://www.googleapis.com/auth/devstorage.read_only' 25*8975f5c5SAndroid Build Coastguard Worker ], 26*8975f5c5SAndroid Build Coastguard Worker encoding='utf-8') 27*8975f5c5SAndroid Build Coastguard Worker return proc.returncode 28*8975f5c5SAndroid Build Coastguard Worker 29*8975f5c5SAndroid Build Coastguard Worker 30*8975f5c5SAndroid Build Coastguard Workerif __name__ == '__main__': 31*8975f5c5SAndroid Build Coastguard Worker sys.exit(main()) 32