[clang] [clang] Unify python shebangs (PR #187256)
Ross Burton via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 18 05:33:04 PDT 2026
https://github.com/rossburton created https://github.com/llvm/llvm-project/pull/187256
As per PEP-0394[1], there is no real concensus over what binary names Python has, specifically 'python' could be Python 3, Python 2, or not exist.
However, everyone has a python3 interpreter and the scripts are all written for Python 3. Unify the shebangs so that the ~50% of shebangs that use python now use python3.
[1] https://peps.python.org/pep-0394/
>From 54624f702d26cf682fbb29a1df80451fff0647e7 Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton at arm.com>
Date: Wed, 15 Oct 2025 15:04:40 +0100
Subject: [PATCH] [clang] Unify python shebangs
As per PEP-0394[1], there is no real concensus over what binary names
Python has, specifically 'python' could be Python 3, Python 2, or not
exist.
However, everyone has a python3 interpreter and the scripts are all
written for Python 3. Unify the shebangs so that the ~50% of shebangs
that use python now use python3.
[1] https://peps.python.org/pep-0394/
---
clang/bindings/python/examples/cindex/cindex-dump.py | 2 +-
clang/bindings/python/examples/cindex/cindex-includes.py | 2 +-
clang/docs/tools/generate_formatted_state.py | 2 +-
clang/test/Analysis/check-analyzer-fixit.py | 2 +-
clang/test/Analysis/csv2json.py | 2 +-
clang/test/Driver/ftime-trace-sections.py | 2 +-
clang/tools/include-mapping/test.py | 2 +-
clang/tools/scan-build/bin/set-xcode-analyzer | 2 +-
clang/tools/scan-view/bin/scan-view | 2 +-
clang/tools/scan-view/share/Reporter.py | 2 +-
clang/tools/scan-view/share/startfile.py | 2 +-
clang/utils/ABITest/ABITestGen.py | 2 +-
clang/utils/CIndex/completion_logger_server.py | 2 +-
clang/utils/CaptureCmd | 2 +-
clang/utils/CmpDriver | 2 +-
clang/utils/FindSpecRefs | 2 +-
clang/utils/FuzzTest | 2 +-
clang/utils/TestUtils/deep-stack.py | 2 +-
clang/utils/analyzer/CmpRuns.py | 2 +-
clang/utils/analyzer/SATest.py | 2 +-
clang/utils/analyzer/SATestAdd.py | 2 +-
clang/utils/analyzer/SATestBuild.py | 2 +-
clang/utils/analyzer/SATestUpdateDiffs.py | 2 +-
clang/utils/analyzer/SumTimerInfo.py | 2 +-
clang/utils/analyzer/exploded-graph-rewriter.py | 2 +-
clang/utils/check_cfc/check_cfc.py | 2 +-
clang/utils/check_cfc/obj_diff.py | 2 +-
clang/utils/check_cfc/test_check_cfc.py | 2 +-
clang/utils/clangdiag.py | 2 +-
clang/utils/modfuzz.py | 2 +-
clang/utils/token-delta.py | 2 +-
clang/www/builtins.py | 2 +-
32 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/clang/bindings/python/examples/cindex/cindex-dump.py b/clang/bindings/python/examples/cindex/cindex-dump.py
index 97b0e6682855a..9d7c33d6ed59b 100644
--- a/clang/bindings/python/examples/cindex/cindex-dump.py
+++ b/clang/bindings/python/examples/cindex/cindex-dump.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# ===- cindex-dump.py - cindex/Python Source Dump -------------*- python -*--===#
#
diff --git a/clang/bindings/python/examples/cindex/cindex-includes.py b/clang/bindings/python/examples/cindex/cindex-includes.py
index ea066a7e91082..dcb9f7e58e3eb 100644
--- a/clang/bindings/python/examples/cindex/cindex-includes.py
+++ b/clang/bindings/python/examples/cindex/cindex-includes.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# ===- cindex-includes.py - cindex/Python Inclusion Graph -----*- python -*--===#
#
diff --git a/clang/docs/tools/generate_formatted_state.py b/clang/docs/tools/generate_formatted_state.py
index 2de43dc383f55..f857320ada1b7 100755
--- a/clang/docs/tools/generate_formatted_state.py
+++ b/clang/docs/tools/generate_formatted_state.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# A tool to parse creates a document outlining how clang formatted the
# LLVM project is.
diff --git a/clang/test/Analysis/check-analyzer-fixit.py b/clang/test/Analysis/check-analyzer-fixit.py
index b616255de89b0..5c19461fd5d82 100644
--- a/clang/test/Analysis/check-analyzer-fixit.py
+++ b/clang/test/Analysis/check-analyzer-fixit.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
#
# ===- check-analyzer-fixit.py - Static Analyzer test helper ---*- python -*-===#
#
diff --git a/clang/test/Analysis/csv2json.py b/clang/test/Analysis/csv2json.py
index e303ca0aad167..c1231ccf40065 100644
--- a/clang/test/Analysis/csv2json.py
+++ b/clang/test/Analysis/csv2json.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
#
# ===- csv2json.py - Static Analyzer test helper ---*- python -*-===#
#
diff --git a/clang/test/Driver/ftime-trace-sections.py b/clang/test/Driver/ftime-trace-sections.py
index 02afa4ac54eb7..46248e546d94a 100644
--- a/clang/test/Driver/ftime-trace-sections.py
+++ b/clang/test/Driver/ftime-trace-sections.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import json, sys, time
diff --git a/clang/tools/include-mapping/test.py b/clang/tools/include-mapping/test.py
index 81803855dac8f..7293b5a19d883 100755
--- a/clang/tools/include-mapping/test.py
+++ b/clang/tools/include-mapping/test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# ===- test.py - ---------------------------------------------*- python -*--===#
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
diff --git a/clang/tools/scan-build/bin/set-xcode-analyzer b/clang/tools/scan-build/bin/set-xcode-analyzer
index 5d98c0cf2c1e2..929a093536f3f 100755
--- a/clang/tools/scan-build/bin/set-xcode-analyzer
+++ b/clang/tools/scan-build/bin/set-xcode-analyzer
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# [PR 11661] Note that we hardwire to /usr/bin/python because we
# want to the use the system version of Python on Mac OS X.
diff --git a/clang/tools/scan-view/bin/scan-view b/clang/tools/scan-view/bin/scan-view
index d01aebb4029a7..f3375804654d2 100755
--- a/clang/tools/scan-view/bin/scan-view
+++ b/clang/tools/scan-view/bin/scan-view
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
from __future__ import print_function
diff --git a/clang/tools/scan-view/share/Reporter.py b/clang/tools/scan-view/share/Reporter.py
index 21874b378687e..aa16a47524c8b 100644
--- a/clang/tools/scan-view/share/Reporter.py
+++ b/clang/tools/scan-view/share/Reporter.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Methods for reporting bugs."""
diff --git a/clang/tools/scan-view/share/startfile.py b/clang/tools/scan-view/share/startfile.py
index c72475e8b6212..a10df214d0046 100644
--- a/clang/tools/scan-view/share/startfile.py
+++ b/clang/tools/scan-view/share/startfile.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Utility for opening a file using the default application in a cross-platform
diff --git a/clang/utils/ABITest/ABITestGen.py b/clang/utils/ABITest/ABITestGen.py
index 119b3299ffa60..b04cc3d29d8d8 100755
--- a/clang/utils/ABITest/ABITestGen.py
+++ b/clang/utils/ABITest/ABITestGen.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
from __future__ import absolute_import, division, print_function
from pprint import pprint
diff --git a/clang/utils/CIndex/completion_logger_server.py b/clang/utils/CIndex/completion_logger_server.py
index ff33331fc53c5..5888fb10fc768 100755
--- a/clang/utils/CIndex/completion_logger_server.py
+++ b/clang/utils/CIndex/completion_logger_server.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
from __future__ import absolute_import, division, print_function
import sys
from socket import *
diff --git a/clang/utils/CaptureCmd b/clang/utils/CaptureCmd
index 705585c3bb041..5ffdfe560edf0 100755
--- a/clang/utils/CaptureCmd
+++ b/clang/utils/CaptureCmd
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
"""CaptureCmd - A generic tool for capturing information about the
invocations of another program.
diff --git a/clang/utils/CmpDriver b/clang/utils/CmpDriver
index 0732baa76d01c..fcf20751a8b0b 100755
--- a/clang/utils/CmpDriver
+++ b/clang/utils/CmpDriver
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
"""
A simple utility that compares tool invocations and exit codes issued by
diff --git a/clang/utils/FindSpecRefs b/clang/utils/FindSpecRefs
index 9097f93f28d63..3ad581b3dd7d1 100755
--- a/clang/utils/FindSpecRefs
+++ b/clang/utils/FindSpecRefs
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import os
import re
diff --git a/clang/utils/FuzzTest b/clang/utils/FuzzTest
index 0e043df7cf08e..c4c956b6eb501 100755
--- a/clang/utils/FuzzTest
+++ b/clang/utils/FuzzTest
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
"""
This is a generic fuzz testing tool, see --help for more information.
diff --git a/clang/utils/TestUtils/deep-stack.py b/clang/utils/TestUtils/deep-stack.py
index 4cf5789abdb12..85376dcedc280 100755
--- a/clang/utils/TestUtils/deep-stack.py
+++ b/clang/utils/TestUtils/deep-stack.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
from __future__ import absolute_import, division, print_function
diff --git a/clang/utils/analyzer/CmpRuns.py b/clang/utils/analyzer/CmpRuns.py
index 94c9907bff315..76444d2a44580 100644
--- a/clang/utils/analyzer/CmpRuns.py
+++ b/clang/utils/analyzer/CmpRuns.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
"""
CmpRuns - A simple tool for comparing two static analyzer runs to determine
diff --git a/clang/utils/analyzer/SATest.py b/clang/utils/analyzer/SATest.py
index d70e33f24c2df..8b07effd8b83b 100755
--- a/clang/utils/analyzer/SATest.py
+++ b/clang/utils/analyzer/SATest.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import argparse
import sys
diff --git a/clang/utils/analyzer/SATestAdd.py b/clang/utils/analyzer/SATestAdd.py
index 84e6d44b42822..05bebabb3601b 100644
--- a/clang/utils/analyzer/SATestAdd.py
+++ b/clang/utils/analyzer/SATestAdd.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
"""
Static Analyzer qualification infrastructure: adding a new project to
diff --git a/clang/utils/analyzer/SATestBuild.py b/clang/utils/analyzer/SATestBuild.py
index 66e1ab72985cd..ff1a42de2c569 100644
--- a/clang/utils/analyzer/SATestBuild.py
+++ b/clang/utils/analyzer/SATestBuild.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
"""
Static Analyzer qualification infrastructure.
diff --git a/clang/utils/analyzer/SATestUpdateDiffs.py b/clang/utils/analyzer/SATestUpdateDiffs.py
index 1c5ffaaa2e330..e1416510d0178 100644
--- a/clang/utils/analyzer/SATestUpdateDiffs.py
+++ b/clang/utils/analyzer/SATestUpdateDiffs.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
"""
Update reference results for static analyzer.
diff --git a/clang/utils/analyzer/SumTimerInfo.py b/clang/utils/analyzer/SumTimerInfo.py
index 01614e41a065c..9772bff335f4b 100644
--- a/clang/utils/analyzer/SumTimerInfo.py
+++ b/clang/utils/analyzer/SumTimerInfo.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
"""
Script to Summarize statistics in the scan-build output.
diff --git a/clang/utils/analyzer/exploded-graph-rewriter.py b/clang/utils/analyzer/exploded-graph-rewriter.py
index dcda91e8a6809..9198fcbfd184e 100755
--- a/clang/utils/analyzer/exploded-graph-rewriter.py
+++ b/clang/utils/analyzer/exploded-graph-rewriter.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
#
# ===- exploded-graph-rewriter.py - ExplodedGraph dump tool -----*- python -*--#
#
diff --git a/clang/utils/check_cfc/check_cfc.py b/clang/utils/check_cfc/check_cfc.py
index 7658f6c27009b..642bc2bf7f2d6 100755
--- a/clang/utils/check_cfc/check_cfc.py
+++ b/clang/utils/check_cfc/check_cfc.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
"""Check CFC - Check Compile Flow Consistency
diff --git a/clang/utils/check_cfc/obj_diff.py b/clang/utils/check_cfc/obj_diff.py
index 9d602593a4e1a..02e0ebdf0efcd 100755
--- a/clang/utils/check_cfc/obj_diff.py
+++ b/clang/utils/check_cfc/obj_diff.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
from __future__ import absolute_import, division, print_function
diff --git a/clang/utils/check_cfc/test_check_cfc.py b/clang/utils/check_cfc/test_check_cfc.py
index cd4441b702cde..a23ad2ccbee41 100755
--- a/clang/utils/check_cfc/test_check_cfc.py
+++ b/clang/utils/check_cfc/test_check_cfc.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
"""Test internal functions within check_cfc.py."""
diff --git a/clang/utils/clangdiag.py b/clang/utils/clangdiag.py
index 8c47b1cbcfff3..e4b94e5757cbc 100755
--- a/clang/utils/clangdiag.py
+++ b/clang/utils/clangdiag.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# ----------------------------------------------------------------------
# Be sure to add the python path that points to the LLDB shared library.
diff --git a/clang/utils/modfuzz.py b/clang/utils/modfuzz.py
index 49ac522cd17e1..7c00102c2cca5 100644
--- a/clang/utils/modfuzz.py
+++ b/clang/utils/modfuzz.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# To use:
# 1) Update the 'decls' list below with your fuzzing configuration.
diff --git a/clang/utils/token-delta.py b/clang/utils/token-delta.py
index 7c2375c03013f..4fe5798033f41 100755
--- a/clang/utils/token-delta.py
+++ b/clang/utils/token-delta.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
from __future__ import absolute_import, division, print_function
import os
diff --git a/clang/www/builtins.py b/clang/www/builtins.py
index 2a4930cba5a81..c80e4a1e2df2e 100755
--- a/clang/www/builtins.py
+++ b/clang/www/builtins.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import sys, fileinput
More information about the cfe-commits
mailing list