aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/environment.py
diff options
context:
space:
mode:
authorTing-Wei Lan <lantw@src.gnome.org>2019-09-19 20:49:33 +0800
committerTing-Wei Lan <lantw@src.gnome.org>2019-09-29 00:11:13 +0800
commit08ce1fb541374fb1ddce1d7318ceb92459942e9e (patch)
tree9f974d70cbfae8cca8ef17ee2acfc2aa6f34dd85 /mesonbuild/environment.py
parentd6c4e79c8443005639c60693510a5f62d6e0dc96 (diff)
downloadmeson-08ce1fb541374fb1ddce1d7318ceb92459942e9e.zip
meson-08ce1fb541374fb1ddce1d7318ceb92459942e9e.tar.gz
meson-08ce1fb541374fb1ddce1d7318ceb92459942e9e.tar.bz2
Move the list of LLVM version suffixes to a common place
Both scan-build and llvm-config need the same list of LLVM version suffixes. It is better to keep the list at a common place instead of having several copies in different files, which is likely to become out-of-sync when the list is updated.
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r--mesonbuild/environment.py41
1 files changed, 27 insertions, 14 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index ee5b568..7c10825 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -163,6 +163,32 @@ def detect_ninja(version: str = '1.5', log: bool = False) -> str:
mlog.log('Found {}-{} at {}'.format(name, found, quote_arg(n)))
return n
+def get_llvm_tool_names(tool: str) -> typing.List[str]:
+ # Ordered list of possible suffixes of LLVM executables to try. Start with
+ # base, then try newest back to oldest (3.5 is arbitrary), and finally the
+ # devel version. Please note that the development snapshot in Debian does
+ # not have a distinct name. Do not move it to the beginning of the list
+ # unless it becomes a stable release.
+ suffixes = [
+ '', # base (no suffix)
+ '-8', '80',
+ '-7', '70',
+ '-6.0', '60',
+ '-5.0', '50',
+ '-4.0', '40',
+ '-3.9', '39',
+ '-3.8', '38',
+ '-3.7', '37',
+ '-3.6', '36',
+ '-3.5', '35',
+ '-9', # Debian development snapshot
+ '-devel', # FreeBSD development snapshot
+ ]
+ names = []
+ for suffix in suffixes:
+ names.append(tool + suffix)
+ return names
+
def detect_scanbuild():
""" Look for scan-build binary on build platform
@@ -182,20 +208,7 @@ def detect_scanbuild():
exelist = split_args(os.environ['SCANBUILD'])
else:
- tools = [
- 'scan-build', # base
- 'scan-build-8', 'scan-build80',
- 'scan-build-7', 'scan-build70',
- 'scan-build-6.0', 'scan-build60',
- 'scan-build-5.0', 'scan-build50',
- 'scan-build-4.0', 'scan-build40',
- 'scan-build-3.9', 'scan-build39',
- 'scan-build-3.8', 'scan-build38',
- 'scan-build-3.7', 'scan-build37',
- 'scan-build-3.6', 'scan-build36',
- 'scan-build-3.5', 'scan-build35',
- 'scan-build-9', 'scan-build-devel', # development snapshot
- ]
+ tools = get_llvm_tool_names('scan-build')
for tool in tools:
if shutil.which(tool) is not None:
exelist = [shutil.which(tool)]