diff --git a/0001-Convert-clang-format-diff.py-to-python3-using-2to3.patch b/0001-Convert-clang-format-diff.py-to-python3-using-2to3.patch new file mode 100644 index 0000000..2c15ece --- /dev/null +++ b/0001-Convert-clang-format-diff.py-to-python3-using-2to3.patch @@ -0,0 +1,52 @@ +From a1bccf89a02accab69b359ef004faa95257333c0 Mon Sep 17 00:00:00 2001 +From: Tom Stellard +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 + diff --git a/clang.spec b/clang.spec index 43d8664..ff30021 100644 --- a/clang.spec +++ b/clang.spec @@ -59,7 +59,7 @@ Name: %pkg_name 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 License: NCSA @@ -84,6 +84,7 @@ Patch1: 0001-GCC-compatibility-Ignore-fstack-clash-protection.patch Patch2: 0001-Driver-Prefer-vendor-supplied-gcc-toolchain.patch Patch4: 0001-gtest-reorg.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-c++ @@ -116,6 +117,8 @@ BuildRequires: python2-rpm-macros BuildRequires: python3-sphinx BuildRequires: libatomic +# We need python3-devel for pathfix.py. +BuildRequires: python3-devel 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 %patch4 -p1 -b .gtest %patch5 -p1 -b .no-python2 +%patch6 -p1 -b .clang-format-diff-py3 mv ../%{clang_tools_srcdir} tools/extra + +pathfix.py -i %{__python3} -pn \ + tools/clang-format/*.py \ + utils/hmaptool/hmaptool %endif %build @@ -427,6 +435,9 @@ false %endif %changelog +* Fri Sep 07 2018 Tom Stellard - 7.0.0-0.9.rc2 +- Drop python2 dependency from clang package + * Thu Sep 06 2018 Tom Stellard - 7.0.0-0.8.rc2 - Drop all uses of python2 from lit tests