Drop python2 dependency from clang package

This commit is contained in:
Tom Stellard 2018-09-07 21:01:14 +00:00
parent c823f68df9
commit 17d16059d3
2 changed files with 64 additions and 1 deletions

View File

@ -0,0 +1,52 @@
From a1bccf89a02accab69b359ef004faa95257333c0 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com>
Date: Fri, 7 Sep 2018 18:27:16 +0000
Subject: [PATCH] Convert clang-format-diff.py to python3 using 2to3
---
tools/clang-format/clang-format-diff.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/clang-format/clang-format-diff.py b/tools/clang-format/clang-format-diff.py
index ffa30e70dd..1525a3815c 100755
--- a/tools/clang-format/clang-format-diff.py
+++ b/tools/clang-format/clang-format-diff.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
#
#===- clang-format-diff.py - ClangFormat Diff Reformatter ----*- python -*--===#
#
@@ -27,7 +27,7 @@ import difflib
import re
import string
import subprocess
-import StringIO
+import io
import sys
@@ -89,9 +89,9 @@ def main():
['-lines', str(start_line) + ':' + str(end_line)])
# Reformat files containing changes in place.
- for filename, lines in lines_by_file.iteritems():
+ for filename, lines in lines_by_file.items():
if args.i and args.verbose:
- print 'Formatting', filename
+ print('Formatting', filename)
command = [args.binary, filename]
if args.i:
command.append('-i')
@@ -109,7 +109,7 @@ def main():
if not args.i:
with open(filename) as f:
code = f.readlines()
- formatted_code = StringIO.StringIO(stdout).readlines()
+ formatted_code = io.StringIO(stdout).readlines()
diff = difflib.unified_diff(code, formatted_code,
filename, filename,
'(before formatting)', '(after formatting)')
--
2.14.3

View File

@ -59,7 +59,7 @@
Name: %pkg_name Name: %pkg_name
Version: %{maj_ver}.%{min_ver}.%{patch_ver} Version: %{maj_ver}.%{min_ver}.%{patch_ver}
Release: 0.8.rc%{rc_ver}%{?dist} Release: 0.9.rc%{rc_ver}%{?dist}
Summary: A C language family front-end for LLVM Summary: A C language family front-end for LLVM
License: NCSA License: NCSA
@ -84,6 +84,7 @@ Patch1: 0001-GCC-compatibility-Ignore-fstack-clash-protection.patch
Patch2: 0001-Driver-Prefer-vendor-supplied-gcc-toolchain.patch Patch2: 0001-Driver-Prefer-vendor-supplied-gcc-toolchain.patch
Patch4: 0001-gtest-reorg.patch Patch4: 0001-gtest-reorg.patch
Patch5: 0001-Don-t-prefer-python2.7.patch Patch5: 0001-Don-t-prefer-python2.7.patch
Patch6: 0001-Convert-clang-format-diff.py-to-python3-using-2to3.patch
BuildRequires: gcc BuildRequires: gcc
BuildRequires: gcc-c++ BuildRequires: gcc-c++
@ -116,6 +117,8 @@ BuildRequires: python2-rpm-macros
BuildRequires: python3-sphinx BuildRequires: python3-sphinx
BuildRequires: libatomic BuildRequires: libatomic
# We need python3-devel for pathfix.py.
BuildRequires: python3-devel
Requires: %{name}-libs%{?_isa} = %{version}-%{release} Requires: %{name}-libs%{?_isa} = %{version}-%{release}
@ -231,8 +234,13 @@ suite can be run with any compiler, not just clang.
%patch2 -p1 -b .vendor-gcc %patch2 -p1 -b .vendor-gcc
%patch4 -p1 -b .gtest %patch4 -p1 -b .gtest
%patch5 -p1 -b .no-python2 %patch5 -p1 -b .no-python2
%patch6 -p1 -b .clang-format-diff-py3
mv ../%{clang_tools_srcdir} tools/extra mv ../%{clang_tools_srcdir} tools/extra
pathfix.py -i %{__python3} -pn \
tools/clang-format/*.py \
utils/hmaptool/hmaptool
%endif %endif
%build %build
@ -427,6 +435,9 @@ false
%endif %endif
%changelog %changelog
* Fri Sep 07 2018 Tom Stellard <tstellar@redhat.com> - 7.0.0-0.9.rc2
- Drop python2 dependency from clang package
* Thu Sep 06 2018 Tom Stellard <tstellar@redhat.com> - 7.0.0-0.8.rc2 * Thu Sep 06 2018 Tom Stellard <tstellar@redhat.com> - 7.0.0-0.8.rc2
- Drop all uses of python2 from lit tests - Drop all uses of python2 from lit tests