| # Copyright 2019 Google Inc. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| INFRA_GO = 'go.skia.org/infra' |
| WHICH = 'where' if sys.platform == 'win32' else 'which' |
| '''Verify that golang is properly installed. If not, exit with an error.''' |
| go_exe = subprocess.check_output([WHICH, 'go']) |
| except (subprocess.CalledProcessError, OSError): |
| _fail('Unable to find Golang installation; see ' |
| 'https://golang.org/doc/install') |
| if not os.environ.get('GOPATH'): |
| _fail('GOPATH environment variable is not set; is Golang properly ' |
| go_bin = os.path.join(os.environ['GOPATH'], 'bin') |
| for entry in os.environ.get('PATH', '').split(os.pathsep): |
| _fail('%s not in PATH; is Golang properly installed?' % go_bin) |
| '''Clone or update the given repo URL via "go get".''' |
| subprocess.check_call(['go', 'get', '-u', url]) |
| '''Update the local checkout of the Skia infra codebase.''' |