Drop python2 dependency from clang-tools-extra

This commit is contained in:
Tom Stellard 2018-11-30 19:37:53 +00:00
parent d49953335b
commit 52edfa5810
2 changed files with 71 additions and 4 deletions

View File

@ -0,0 +1,61 @@
From 6430ef09aecb30bce588c2d7f35b2294d219c835 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com>
Date: Mon, 26 Nov 2018 19:18:12 -0800
Subject: [PATCH] Convert run-find-all-symbols.py to python3 using 2to3
---
include-fixer/find-all-symbols/tool/run-find-all-symbols.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/include-fixer/find-all-symbols/tool/run-find-all-symbols.py b/include-fixer/find-all-symbols/tool/run-find-all-symbols.py
index 461d959..89a6cf5 100755
--- a/include-fixer/find-all-symbols/tool/run-find-all-symbols.py
+++ b/include-fixer/find-all-symbols/tool/run-find-all-symbols.py
@@ -27,7 +27,7 @@ import argparse
import json
import multiprocessing
import os
-import Queue
+import queue
import shutil
import subprocess
import sys
@@ -40,7 +40,7 @@ def find_compilation_database(path):
result = './'
while not os.path.isfile(os.path.join(result, path)):
if os.path.realpath(result) == '/':
- print 'Error: could not find compilation database.'
+ print('Error: could not find compilation database.')
sys.exit(1)
result += '../'
return os.path.realpath(result)
@@ -50,7 +50,7 @@ def MergeSymbols(directory, args):
"""Merge all symbol files (yaml) in a given directaory into a single file."""
invocation = [args.binary, '-merge-dir='+directory, args.saving_path]
subprocess.call(invocation)
- print 'Merge is finished. Saving results in ' + args.saving_path
+ print('Merge is finished. Saving results in ' + args.saving_path)
def run_find_all_symbols(args, tmpdir, build_path, queue):
@@ -96,7 +96,7 @@ def main():
try:
# Spin up a bunch of tidy-launching threads.
- queue = Queue.Queue(max_task)
+ queue = queue.Queue(max_task)
for _ in range(max_task):
t = threading.Thread(target=run_find_all_symbols,
args=(args, tmpdir, build_path, queue))
@@ -116,7 +116,7 @@ def main():
except KeyboardInterrupt:
# This is a sad hack. Unfortunately subprocess goes
# bonkers with ctrl-c and we start forking merrily.
- print '\nCtrl-C detected, goodbye.'
+ print('\nCtrl-C detected, goodbye.')
os.kill(0, 9)
--
1.8.3.1

View File

@ -57,7 +57,7 @@
Name: %pkg_name
Version: %{maj_ver}.%{min_ver}.%{patch_ver}
Release: 6%{?dist}
Release: 7%{?dist}
Summary: A C language family front-end for LLVM
License: NCSA
@ -75,6 +75,9 @@ Patch5: 0001-Don-t-prefer-python2.7.patch
Patch6: 0001-Convert-clang-format-diff.py-to-python3-using-2to3.patch
Patch7: 0001-Convert-scan-view-to-python3-using-2to3.patch
# clang-tools-extra patches
Patch100: 0001-Convert-run-find-all-symbols.py-to-python3-using-2to.patch
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: cmake
@ -200,10 +203,10 @@ Requires: python2
%else
%setup -T -q -b 1 -n %{clang_tools_srcdir}
pathfix.py -i %{__python3} -pn \
clang-tidy/tool/*.py
%patch100 -p1 -b .find-all-symbols-py3
pathfix.py -i %{__python2} -pn \
pathfix.py -i %{__python3} -pn \
clang-tidy/tool/*.py \
include-fixer/find-all-symbols/tool/run-find-all-symbols.py
%setup -q -n %{clang_srcdir}
@ -403,6 +406,9 @@ false
%endif
%changelog
* Fri Nov 30 2018 Tom Stellard <tstellar@redhat.com> - 7.0.0-7
- Drop python2 dependency from clang-tools-extra
* Wed Nov 21 2018 sguelton@redhat.com - 7.0.0-6
- Prune unneeded reference to llvm-test-suite sub-package