[PATCH] D126804: [scan-build-py] Change scripts to explicitly require python3

Anders Waldenborg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 1 11:59:08 PDT 2022


wanders created this revision.
wanders added reviewers: phosek, sylvestre.ledru.
Herald added a subscriber: whisperity.
Herald added a project: All.
wanders requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

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 <https://reviews.llvm.org/rG70b06fe8a1862f5b9a0ef4e5e9098c1e457cf275> "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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D126804

Files:
  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


Index: clang/tools/scan-build-py/libexec/intercept-cc
===================================================================
--- clang/tools/scan-build-py/libexec/intercept-cc
+++ 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.
Index: clang/tools/scan-build-py/libexec/intercept-c++
===================================================================
--- clang/tools/scan-build-py/libexec/intercept-c++
+++ 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.
Index: clang/tools/scan-build-py/libexec/analyze-cc
===================================================================
--- clang/tools/scan-build-py/libexec/analyze-cc
+++ 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.
Index: clang/tools/scan-build-py/libexec/analyze-c++
===================================================================
--- clang/tools/scan-build-py/libexec/analyze-c++
+++ 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.
Index: clang/tools/scan-build-py/bin/scan-build
===================================================================
--- clang/tools/scan-build-py/bin/scan-build
+++ 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.
Index: clang/tools/scan-build-py/bin/intercept-build
===================================================================
--- clang/tools/scan-build-py/bin/intercept-build
+++ 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.
Index: clang/tools/scan-build-py/bin/analyze-build
===================================================================
--- clang/tools/scan-build-py/bin/analyze-build
+++ 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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126804.433478.patch
Type: text/x-patch
Size: 3142 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220601/5b0b4027/attachment-0001.bin>


More information about the cfe-commits mailing list