diff --git a/0001-re-enable-HTML-reports-under-Python3.patch b/0001-re-enable-HTML-reports-under-Python3.patch new file mode 100644 index 0000000..7dcb5a8 --- /dev/null +++ b/0001-re-enable-HTML-reports-under-Python3.patch @@ -0,0 +1,47 @@ +From 0125a130fb3352ecd435b3f9f8e880a4f60a5c4c Mon Sep 17 00:00:00 2001 +From: Lukas Atkinson +Date: Fri, 30 Dec 2016 00:39:19 +0100 +Subject: [PATCH] re-enable HTML reports under Python3 + +In commit 1cc987a23, the `commonpath()` function was added, which quite +sensibly tries to figure out real path names. Unfortunately, it uses +`iterools.izip()` which is not available under Python3. Instead, that +functionality is now provided by the `zip()` builtin. + +We therefore define an `izip()` function as an alias for +`itertools.izip()` if that is available, or else use `zip()`. + +Since `commonpath()` is used in HTML reports, it was previously +impossible to create HTML reports with GCOVR under Python3. +To prevent such problems in the future, the existing HTML tests should +be updated and enabled. +--- + scripts/gcovr | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/scripts/gcovr b/scripts/gcovr +index a7b733e..000d0b7 100755 +--- a/scripts/gcovr ++++ b/scripts/gcovr +@@ -55,6 +55,12 @@ try: + except NameError: + xrange = range + ++# In Python3, zip is equivalent to izip ++try: ++ izip = itertools.izip ++except AttributeError: ++ izip = zip ++ + medium_coverage = 75.0 + high_coverage = 90.0 + low_color = "LightPink" +@@ -410,7 +416,7 @@ def commonpath( files ): + path = os.path.realpath(f) + dirs = path.split( os.path.sep ) + common = [] +- for a, b in itertools.izip( dirs, common_dirs ): ++ for a, b in izip( dirs, common_dirs ): + if a == b: + common.append( a ) + elif common: diff --git a/gcovr.spec b/gcovr.spec index ac210f8..0ea8509 100644 --- a/gcovr.spec +++ b/gcovr.spec @@ -1,12 +1,16 @@ Name: gcovr Version: 3.3 -Release: 3%{?dist} +Release: 4%{?dist} Summary: A code coverage report generator using GNU gcov License: BSD URL: http://gcovr.com/ Source0: https://github.com/gcovr/%{name}/archive/%{version}/%{name}-%{version}.tar.gz +# Fix HTML reports for Python 3 (rhbz#1428277) +# From: https://github.com/gcovr/gcovr/pull/163 +Patch0001: 0001-re-enable-HTML-reports-under-Python3.patch + BuildRequires: python3-devel BuildRequires: python3-setuptools @@ -27,7 +31,7 @@ generates an HTML-formatted report. %prep -%autosetup +%autosetup -p1 %build @@ -46,6 +50,9 @@ rm -rf %{buildroot}%{python3_sitelib} %{_bindir}/gcovr %changelog +* Mon Mar 06 2017 Neal Gompa - 3.3-4 +- Fix HTML reports for Python 3 (#1428277) + * Fri Feb 10 2017 Fedora Release Engineering - 3.3-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild