mirror of
https://src.fedoraproject.org/rpms/llvm.git
synced 2024-11-30 19:28:18 +00:00
90a16211f1
Port the changes from https://github.com/llvm/llvm-project/pull/89490 to Python 3.6.
101 lines
3.2 KiB
Diff
101 lines
3.2 KiB
Diff
From 74f3d3579ef636a20d7832b39bf1355c0f734848 Mon Sep 17 00:00:00 2001
|
|
From: Nikita Popov <npopov@redhat.com>
|
|
Date: Fri, 19 Jul 2024 14:52:49 +0200
|
|
Subject: [PATCH] Add back support for Python 3.6
|
|
|
|
---
|
|
.../clang-tidy/tool/run-clang-tidy.py | 21 ++++++++++++++++---
|
|
llvm/CMakeLists.txt | 2 +-
|
|
llvm/utils/update_test_body.py | 6 ++++--
|
|
3 files changed, 23 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
|
|
index 48401ba5ea42..c6552db36587 100755
|
|
--- a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
|
|
+++ b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
|
|
@@ -36,7 +36,6 @@ http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html
|
|
|
|
import argparse
|
|
import asyncio
|
|
-from dataclasses import dataclass
|
|
import glob
|
|
import json
|
|
import multiprocessing
|
|
@@ -223,7 +222,6 @@ async def run_with_semaphore(
|
|
return await f(*args, **kwargs)
|
|
|
|
|
|
-@dataclass
|
|
class ClangTidyResult:
|
|
filename: str
|
|
invocation: List[str]
|
|
@@ -232,6 +230,22 @@ class ClangTidyResult:
|
|
stderr: str
|
|
elapsed: float
|
|
|
|
+ def __init(
|
|
+ self,
|
|
+ filename: str,
|
|
+ invocation: List[str],
|
|
+ returncode: int,
|
|
+ stdout: str,
|
|
+ stderr: str,
|
|
+ elapsed: float,
|
|
+ ):
|
|
+ self.filename = filename
|
|
+ self.invocation = invocation
|
|
+ self.returncode = returncode
|
|
+ self.stdout = stdout
|
|
+ self.stderr = stderr
|
|
+ self.elapsed = elapsed
|
|
+
|
|
|
|
async def run_tidy(
|
|
args: argparse.Namespace,
|
|
@@ -623,4 +637,5 @@ async def main() -> None:
|
|
|
|
|
|
if __name__ == "__main__":
|
|
- asyncio.run(main())
|
|
+ loop = asyncio.new_event_loop()
|
|
+ loop.run_until_complete(main())
|
|
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
|
|
index 12618966c4ad..9c4df0082a9a 100644
|
|
--- a/llvm/CMakeLists.txt
|
|
+++ b/llvm/CMakeLists.txt
|
|
@@ -932,7 +932,7 @@ set(LLVM_PROFDATA_FILE "" CACHE FILEPATH
|
|
|
|
if(LLVM_INCLUDE_TESTS)
|
|
# All LLVM Python files should be compatible down to this minimum version.
|
|
- set(LLVM_MINIMUM_PYTHON_VERSION 3.8)
|
|
+ set(LLVM_MINIMUM_PYTHON_VERSION 3.6)
|
|
else()
|
|
# FIXME: it is unknown if this is the actual minimum bound
|
|
set(LLVM_MINIMUM_PYTHON_VERSION 3.0)
|
|
diff --git a/llvm/utils/update_test_body.py b/llvm/utils/update_test_body.py
|
|
index 661b0270d783..152d0c5f8476 100755
|
|
--- a/llvm/utils/update_test_body.py
|
|
+++ b/llvm/utils/update_test_body.py
|
|
@@ -57,7 +57,8 @@ def process(args, path):
|
|
input="\n".join(
|
|
prolog[:-1] if prolog[-1].startswith(".endif") else prolog
|
|
).encode(),
|
|
- capture_output=True,
|
|
+ stdout=subprocess.PIPE,
|
|
+ stderr=subprocess.PIPE,
|
|
check=True,
|
|
)
|
|
except subprocess.CalledProcessError as ex:
|
|
@@ -71,7 +72,8 @@ def process(args, path):
|
|
|
|
sub = subprocess.run(
|
|
["sh", "-eu", "gen"],
|
|
- capture_output=True,
|
|
+ stdout=subprocess.PIPE,
|
|
+ stderr=subprocess.PIPE,
|
|
# Don't encode the directory information to the Clang output.
|
|
# Remove unneeded details (.ident) as well.
|
|
env=dict(
|
|
--
|
|
2.45.2
|
|
|