Bazel: add spack external find support (#18008)

This commit is contained in:
Adam J. Stewart 2020-08-14 01:48:49 -05:00 committed by GitHub
parent 84a16e62d6
commit be046d7341
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,8 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import re
class Bazel(Package):
"""Bazel is an open-source build and test tool similar to Make, Maven, and
@ -135,6 +137,14 @@ class Bazel(Package):
phases = ['bootstrap', 'install']
executables = ['^bazel$']
@classmethod
def determine_version(cls, exe):
output = Executable(exe)('version', output=str, error=str)
match = re.search(r'Build label: ([\d.]+)', output)
return match.group(1) if match else None
def url_for_version(self, version):
if version >= Version('0.4.1'):
url = 'https://github.com/bazelbuild/bazel/releases/download/{0}/bazel-{0}-dist.zip'