[clang] 4c1e487 - scan-build-py: Change scripts to explicitly require python3

Anders Waldenborg via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 2 11:10:09 PDT 2022


Author: Anders Waldenborg
Date: 2022-06-02T20:08:21+02:00
New Revision: 4c1e487c413810655757ea19d0cf3d4f5c40898e

URL: https://github.com/llvm/llvm-project/commit/4c1e487c413810655757ea19d0cf3d4f5c40898e
DIFF: https://github.com/llvm/llvm-project/commit/4c1e487c413810655757ea19d0cf3d4f5c40898e.diff

LOG: scan-build-py: Change scripts to explicitly require python3

The "#!" line in all scan-build-py scripts were using just bare
"/usr/bin/python" which according to PEP-0394 can be either python3,
python2 or not exist at all.

E.g in latest debian and ubuntu releases "/usr/bin/python" does not
exist at all by default and user must install python-is-python2 or
python-is-python3 packages to get the bare version less "python"
command.

Until recently (70b06fe8a186 "scan-build-py: Force the opening in utf-8"
changed "libscanbuild") these scripts worked in both python2 and
python3, but now they (rightfully) are python3 only, and broke on
systems where the "python" command means python2.

By changing the "#!" to be "python3" it is not only explicit that the
scripts require python3 it also works on systems where "python" command
is python2 or nonexistent.

Differential Revision: https://reviews.llvm.org/D126804

Added: 
    

Modified: 
    clang/tools/scan-build-py/bin/analyze-build
    clang/tools/scan-build-py/bin/intercept-build
    clang/tools/scan-build-py/bin/scan-build
    clang/tools/scan-build-py/libexec/analyze-c++
    clang/tools/scan-build-py/libexec/analyze-cc
    clang/tools/scan-build-py/libexec/intercept-c++
    clang/tools/scan-build-py/libexec/intercept-cc

Removed: 
    


################################################################################
diff  --git a/clang/tools/scan-build-py/bin/analyze-build b/clang/tools/scan-build-py/bin/analyze-build
index b3f61429906c4..636b5aa4dd36d 100755
--- a/clang/tools/scan-build-py/bin/analyze-build
+++ b/clang/tools/scan-build-py/bin/analyze-build
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 # See https://llvm.org/LICENSE.txt for license information.

diff  --git a/clang/tools/scan-build-py/bin/intercept-build b/clang/tools/scan-build-py/bin/intercept-build
index 9ecde39984434..dcd0473ef5489 100755
--- a/clang/tools/scan-build-py/bin/intercept-build
+++ b/clang/tools/scan-build-py/bin/intercept-build
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 # See https://llvm.org/LICENSE.txt for license information.

diff  --git a/clang/tools/scan-build-py/bin/scan-build b/clang/tools/scan-build-py/bin/scan-build
index a341751d993a2..3e5a5ade304c2 100755
--- a/clang/tools/scan-build-py/bin/scan-build
+++ b/clang/tools/scan-build-py/bin/scan-build
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 # See https://llvm.org/LICENSE.txt for license information.

diff  --git a/clang/tools/scan-build-py/libexec/analyze-c++ b/clang/tools/scan-build-py/libexec/analyze-c++
index a280b2fb4ddaf..5c72dfff4a896 100755
--- a/clang/tools/scan-build-py/libexec/analyze-c++
+++ b/clang/tools/scan-build-py/libexec/analyze-c++
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 # See https://llvm.org/LICENSE.txt for license information.

diff  --git a/clang/tools/scan-build-py/libexec/analyze-cc b/clang/tools/scan-build-py/libexec/analyze-cc
index 36bbcd93f9871..fbdbde8f5b2e6 100755
--- a/clang/tools/scan-build-py/libexec/analyze-cc
+++ b/clang/tools/scan-build-py/libexec/analyze-cc
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 # See https://llvm.org/LICENSE.txt for license information.

diff  --git a/clang/tools/scan-build-py/libexec/intercept-c++ b/clang/tools/scan-build-py/libexec/intercept-c++
index 9e541a180d6b4..b8c8e923ec76e 100755
--- a/clang/tools/scan-build-py/libexec/intercept-c++
+++ b/clang/tools/scan-build-py/libexec/intercept-c++
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 # See https://llvm.org/LICENSE.txt for license information.

diff  --git a/clang/tools/scan-build-py/libexec/intercept-cc b/clang/tools/scan-build-py/libexec/intercept-cc
index 9e541a180d6b4..b8c8e923ec76e 100755
--- a/clang/tools/scan-build-py/libexec/intercept-cc
+++ b/clang/tools/scan-build-py/libexec/intercept-cc
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 # See https://llvm.org/LICENSE.txt for license information.


        


More information about the cfe-commits mailing list