Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pycparser/
Date: Tue, 10 May 2022 21:53:02
Message-Id: 1652219555.c2d3fb4878771ba52615d920f97b5874d2d2b186.mgorny@gentoo
1 commit: c2d3fb4878771ba52615d920f97b5874d2d2b186
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Tue May 10 21:18:13 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Tue May 10 21:52:35 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c2d3fb48
7
8 dev-python/pycparser: Use PEP517 build
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-python/pycparser/pycparser-2.21-r1.ebuild | 65 +++++++++++++++++++++++++++
13 1 file changed, 65 insertions(+)
14
15 diff --git a/dev-python/pycparser/pycparser-2.21-r1.ebuild b/dev-python/pycparser/pycparser-2.21-r1.ebuild
16 new file mode 100644
17 index 000000000000..42027444d3ee
18 --- /dev/null
19 +++ b/dev-python/pycparser/pycparser-2.21-r1.ebuild
20 @@ -0,0 +1,65 @@
21 +# Copyright 1999-2022 Gentoo Authors
22 +# Distributed under the terms of the GNU General Public License v2
23 +
24 +# please keep this ebuild at EAPI 7 -- sys-apps/portage dep
25 +EAPI=7
26 +
27 +DISTUTILS_USE_PEP517=setuptools
28 +PYTHON_COMPAT=( python3_{8..10} pypy3 )
29 +
30 +inherit distutils-r1
31 +
32 +DESCRIPTION="C parser and AST generator written in Python"
33 +HOMEPAGE="
34 + https://github.com/eliben/pycparser/
35 + https://pypi.org/project/pycparser/
36 +"
37 +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
38 +
39 +LICENSE="BSD"
40 +SLOT="0"
41 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
42 +
43 +RDEPEND="
44 + dev-python/ply:=[${PYTHON_USEDEP}]
45 +"
46 +BDEPEND="
47 + ${RDEPEND}
48 +"
49 +
50 +distutils_enable_tests unittest
51 +
52 +python_prepare_all() {
53 + # remove the original files to guarantee their regen
54 + rm pycparser/{c_ast,lextab,yacctab}.py || die
55 +
56 + # kill sys.path manipulations to force the tests to use built files
57 + sed -i -e '/sys\.path/d' tests/*.py || die
58 +
59 + # Ensure we can find tests in our directory
60 + sed -i -e 's/from tests.test_util/from test_util/g' tests/test_*.py || die
61 +
62 + ln -s "${S}"/examples tests/examples || die
63 +
64 + rm tests/test_examples.py || die
65 +
66 + distutils-r1_python_prepare_all
67 +}
68 +
69 +python_test() {
70 + # Skip tests if cpp is not in PATH
71 + type -P cpp >/dev/null || return 0
72 + # change workdir to avoid '.' import
73 + cd tests || die
74 +
75 + # Ensure that 'cpp' is called with the right arguments
76 + # Tests don't seem to always pass the include they intend to use.
77 + mkdir -p "${T}"/bin || die
78 + cat > "${T}"/bin/cpp <<-EOF || die
79 + #!${BROOT}/bin/bash
80 + exec ${BROOT}/usr/bin/cpp -I${S}/utils/fake_libc_include/ \$@
81 + EOF
82 + chmod +x "${T}"/bin/cpp || die
83 +
84 + PATH="${T}/bin:${PATH}" eunittest
85 +}