1 # Copyright 2020 The Chromium Authors
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 # This script gets default goma_dir for depot_tools goma.
14 if sys.platform in ['win32', 'cygwin']:
17 for path in os.environ.get('PATH', '').split(os.pathsep):
18 # normpath() required to strip trailing slash when present.
19 if os.path.basename(os.path.normpath(path)) == 'depot_tools':
20 candidates.append(os.path.join(path, '.cipd_bin'))
23 if os.path.isfile(os.path.join(d, gomacc)):
26 # mb analyze step set use_goma=true, but goma_dir="",
27 # and bot doesn't have goma in default locataion above.
28 # to mitigate this, just use initial depot_tools path
29 # or default path as before (if depot_tools doesn't exist
31 # TODO(ukai): crbug.com/1073276: fix mb analyze step and make it hard error?
32 if sys.platform in ['win32', 'cygwin']:
33 sys.stdout.write('C:\\src\\goma\\goma-win64')
34 elif 'GOMA_DIR' in os.environ:
35 sys.stdout.write(os.environ.get('GOMA_DIR'))
37 sys.stdout.write(os.path.join(os.environ.get('HOME', ''), 'goma'))
41 if __name__ == '__main__':