Gentoo Archives: gentoo-commits

From: David Seifert <soap@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-cpp/catch/, dev-cpp/catch/files/
Date: Tue, 24 Apr 2018 09:22:03
Message-Id: 1524561695.e010deea863f6efa2c7cbb6fd9eb1c447614b2e7.soap@gentoo
1 commit: e010deea863f6efa2c7cbb6fd9eb1c447614b2e7
2 Author: David Seifert <soap <AT> gentoo <DOT> org>
3 AuthorDate: Tue Apr 24 09:19:17 2018 +0000
4 Commit: David Seifert <soap <AT> gentoo <DOT> org>
5 CommitDate: Tue Apr 24 09:21:35 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e010deea
7
8 dev-cpp/catch: Version bump to 2.2.2
9
10 * Backport python3 patch from master
11 * Fix choice of python interpreter automagic
12
13 Closes: https://bugs.gentoo.org/650958
14 Package-Manager: Portage-2.3.31, Repoman-2.3.9
15
16 dev-cpp/catch/Manifest | 1 +
17 dev-cpp/catch/catch-2.2.2.ebuild | 49 ++++++++++++++++++++++
18 .../catch/files/catch-2.2.2-python-automagic.patch | 25 +++++++++++
19 dev-cpp/catch/files/catch-2.2.2-test-python3.patch | 44 +++++++++++++++++++
20 4 files changed, 119 insertions(+)
21
22 diff --git a/dev-cpp/catch/Manifest b/dev-cpp/catch/Manifest
23 index b52d91471f0..fda12f94f2e 100644
24 --- a/dev-cpp/catch/Manifest
25 +++ b/dev-cpp/catch/Manifest
26 @@ -1,3 +1,4 @@
27 DIST Catch-1.11.0.tar.gz 376132 BLAKE2B 23a1a6292dd91ec1c71923b4902b42b59ff6be5227b666f68ef0dc33756a58a63edd70a9b139dda0b1860c2b7a0cfec7ab9262e6447eff3184cfe28ea9b0aa77 SHA512 33085c2671f78c7562eace909564b2730eabcaf4490cd463402e66ab4ac2be1fe4fe360916c11aa589ba4a010622444126ee2ae747783b5869b5d7276361f132
28 DIST Catch2-2.1.1.tar.gz 481236 BLAKE2B 8a8110611aaf4ea913462884d8293bcae7d0abf3075253a26385a56b2cb5bf50b769e2117430c9712e4644f430cc16461fabfef921c5fbfceb82effb0da74e93 SHA512 64947672e614301a45efd812eb3eef98d871c9719005a441b6f6bb1dc26820bd9643ba285bcc0eaef9b212c5ab6ada4a875433c47a020ce436bcc411cdc8ad72
29 DIST Catch2-2.2.0.tar.gz 487585 BLAKE2B 2d8f58e8d3630cb30e438da7a169df3afff387d38dd3054cfcdb8860aa507ecc3c614471fa1110f64b0dba3d6855edfc68ee4e0b7eb97164be833827078e82fd SHA512 9dcc409939df61f84b965ee3147a7a7578b3a816ff285e103b7666115bf38a608d9a0075e06e98f93b9f06882d2e41d6c51cdaae352abbfaa2a3c1b408f22df7
30 +DIST Catch2-2.2.2.tar.gz 497244 BLAKE2B d5073d56b9399bd7f50bafc7758e60e31ba4434e229f92ca92cd04257f4a54cec925ad3180cc964c4f69edbaa7fc14f8af8e828421e2bb2b4f6c59eaea5cc06d SHA512 ab91036c6c3ace087d0382ce99f26b2c30a4b75d52f285619ca282a618470fe388afe47495f3b2764268d600c6834c60ba464483d06f3a1c4316c099477c8e38
31
32 diff --git a/dev-cpp/catch/catch-2.2.2.ebuild b/dev-cpp/catch/catch-2.2.2.ebuild
33 new file mode 100644
34 index 00000000000..2cce0298b3a
35 --- /dev/null
36 +++ b/dev-cpp/catch/catch-2.2.2.ebuild
37 @@ -0,0 +1,49 @@
38 +# Copyright 1999-2018 Gentoo Foundation
39 +# Distributed under the terms of the GNU General Public License v2
40 +
41 +EAPI=6
42 +
43 +PYTHON_COMPAT=( python2_7 python3_{5,6} )
44 +
45 +: ${CMAKE_MAKEFILE_GENERATOR:=ninja}
46 +inherit cmake-utils python-any-r1
47 +
48 +if [[ ${PV} == *9999 ]]; then
49 + inherit git-r3
50 + EGIT_REPO_URI="https://github.com/catchorg/Catch2.git"
51 +else
52 + MY_P=${PN^}2-${PV}
53 + SRC_URI="https://github.com/catchorg/Catch2/archive/v${PV}.tar.gz -> ${MY_P}.tar.gz"
54 + KEYWORDS="~amd64 ~x86"
55 +
56 + S=${WORKDIR}/${MY_P}
57 +fi
58 +
59 +DESCRIPTION="Modern C++ header-only framework for unit-tests"
60 +HOMEPAGE="https://github.com/catchorg/Catch2"
61 +
62 +LICENSE="Boost-1.0"
63 +SLOT="0"
64 +IUSE="test"
65 +RESTRICT="!test? ( test )"
66 +
67 +DEPEND="test? ( ${PYTHON_DEPS} )"
68 +
69 +PATCHES=(
70 + "${FILESDIR}"/${PN}-2.2.2-test-python3.patch
71 + "${FILESDIR}"/${PN}-2.2.2-python-automagic.patch
72 +)
73 +
74 +pkg_setup() {
75 + use test && python-any-r1_pkg_setup
76 +}
77 +
78 +src_configure() {
79 + local mycmakeargs=(
80 + -DCATCH_ENABLE_WERROR=OFF
81 + -DBUILD_TESTING=$(usex test)
82 + -DCMAKE_INSTALL_DOCDIR="share/doc/${PF}"
83 + -DPYTHON_EXECUTABLE="${PYTHON}"
84 + )
85 + cmake-utils_src_configure
86 +}
87
88 diff --git a/dev-cpp/catch/files/catch-2.2.2-python-automagic.patch b/dev-cpp/catch/files/catch-2.2.2-python-automagic.patch
89 new file mode 100644
90 index 00000000000..ecc99905d7f
91 --- /dev/null
92 +++ b/dev-cpp/catch/files/catch-2.2.2-python-automagic.patch
93 @@ -0,0 +1,25 @@
94 +--- a/CMakeLists.txt
95 ++++ b/CMakeLists.txt
96 +@@ -308,6 +308,9 @@
97 +
98 + include(CTest)
99 +
100 ++# Approval tests require python 2.7 or 3
101 ++find_package(PythonInterp)
102 ++
103 + if (BUILD_TESTING AND NOT_SUBPROJECT)
104 + add_executable(SelfTest ${TEST_SOURCES} ${IMPL_SOURCES} ${REPORTER_SOURCES} ${SURROGATE_SOURCES} ${HEADERS})
105 + target_include_directories(SelfTest PRIVATE ${HEADER_DIR})
106 +@@ -384,7 +387,11 @@
107 + set_tests_properties(NoTest PROPERTIES PASS_REGULAR_EXPRESSION "No test cases matched")
108 +
109 + # AppVeyor has a Python 2.7 in path, but doesn't have .py files as autorunnable
110 +- add_test(NAME ApprovalTests COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/scripts/approvalTests.py $<TARGET_FILE:SelfTest>)
111 ++ if(NOT ${PYTHONINTERP_FOUND})
112 ++ message(FATAL_ERROR "Python not found, but required for running tests!")
113 ++ endif()
114 ++
115 ++ add_test(NAME ApprovalTests COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/approvalTests.py $<TARGET_FILE:SelfTest>)
116 + set_tests_properties(ApprovalTests PROPERTIES FAIL_REGULAR_EXPRESSION "Results differed")
117 +
118 + if (CATCH_USE_VALGRIND)
119
120 diff --git a/dev-cpp/catch/files/catch-2.2.2-test-python3.patch b/dev-cpp/catch/files/catch-2.2.2-test-python3.patch
121 new file mode 100644
122 index 00000000000..0712f157707
123 --- /dev/null
124 +++ b/dev-cpp/catch/files/catch-2.2.2-test-python3.patch
125 @@ -0,0 +1,44 @@
126 +From dc6b83bec9bdcc149db08711cc9dfd555a8620fa Mon Sep 17 00:00:00 2001
127 +From: Tom Hughes <tom@×××××××.nu>
128 +Date: Fri, 6 Apr 2018 13:59:08 +0100
129 +Subject: [PATCH] Support Python3 in approval tests
130 +
131 +---
132 + scripts/approvalTests.py | 15 +++++++++++----
133 + 1 file changed, 11 insertions(+), 4 deletions(-)
134 +
135 +diff --git a/scripts/approvalTests.py b/scripts/approvalTests.py
136 +index a2ab5d5a2..16cc7b7d2 100755
137 +--- a/scripts/approvalTests.py
138 ++++ b/scripts/approvalTests.py
139 +@@ -72,10 +72,17 @@
140 +
141 + overallResult = 0
142 +
143 ++def openFile(file, mode):
144 ++ try:
145 ++ return open(file, mode, encoding='utf-8', errors='surrogateescape')
146 ++ except TypeError:
147 ++ import io
148 ++ return io.open(file, mode, encoding='utf-8', errors='surrogateescape')
149 ++
150 + def diffFiles(fileA, fileB):
151 +- with open(fileA, 'r') as file:
152 ++ with openFile(fileA, 'r') as file:
153 + aLines = [line.rstrip() for line in file.readlines()]
154 +- with open(fileB, 'r') as file:
155 ++ with openFile(fileB, 'r') as file:
156 + bLines = [line.rstrip() for line in file.readlines()]
157 +
158 + shortenedFilenameA = fileA.rsplit(os.sep, 1)[-1]
159 +@@ -139,8 +146,8 @@ def approve(baseName, args):
160 + subprocess.call(args, stdout=f, stderr=f)
161 + f.close()
162 +
163 +- rawFile = open(rawResultsPath, 'r')
164 +- filteredFile = open(filteredResultsPath, 'w')
165 ++ rawFile = openFile(rawResultsPath, 'r')
166 ++ filteredFile = openFile(filteredResultsPath, 'w')
167 + for line in rawFile:
168 + filteredFile.write(filterLine(line).rstrip() + "\n")
169 + filteredFile.close()