Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pycparser/
Date: Fri, 26 Nov 2021 08:20:55
Message-Id: 1637914838.f1832cdac19a0b8da2eb1f07371516168bd0af69.sam@gentoo
1 commit: f1832cdac19a0b8da2eb1f07371516168bd0af69
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Fri Nov 26 08:03:28 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Fri Nov 26 08:20:38 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f1832cda
7
8 dev-python/pycparser: add 2.21
9
10 Signed-off-by: Sam James <sam <AT> gentoo.org>
11
12 dev-python/pycparser/Manifest | 1 +
13 dev-python/pycparser/pycparser-2.21.ebuild | 74 ++++++++++++++++++++++++++++++
14 2 files changed, 75 insertions(+)
15
16 diff --git a/dev-python/pycparser/Manifest b/dev-python/pycparser/Manifest
17 index 5ec1265d1176..c619d5054644 100644
18 --- a/dev-python/pycparser/Manifest
19 +++ b/dev-python/pycparser/Manifest
20 @@ -1 +1,2 @@
21 DIST pycparser-2.20.tar.gz 161330 BLAKE2B 9a114e4b73e6c3c495bd78c393957146ec425eb5b15d72266cbf424f15e8d2e2e6402ef36d60a9dff41b393aab80fe1356befd25549517f398e129836a76b037 SHA512 ff0853c9f981b43b4f2e879350715c07b02cf9dab223d4980d8fe0a3138c98041b5f848a9355ae4f1cb45e7f137c03a88843008e18d77af9250e0d9c55f5ca1b
22 +DIST pycparser-2.21.tar.gz 170877 BLAKE2B ae6bf42dfc552bf1e3bfb5430cdb0c15b5e011ec53cbd03e0e2507c08a1a78690cefce2de134bd984caccc5dbde90661cb4c18df5c289217967213aac4d52404 SHA512 e61fbdde484d1cf74d4b27bdde40cf2da4b7028ca8ecd37c83d77473dab707d457321aecaf97da3b114c1d58a4eb200290b76f9c958044b57e5fed949895b5f0
23
24 diff --git a/dev-python/pycparser/pycparser-2.21.ebuild b/dev-python/pycparser/pycparser-2.21.ebuild
25 new file mode 100644
26 index 000000000000..0f74443174f6
27 --- /dev/null
28 +++ b/dev-python/pycparser/pycparser-2.21.ebuild
29 @@ -0,0 +1,74 @@
30 +# Copyright 1999-2021 Gentoo Authors
31 +# Distributed under the terms of the GNU General Public License v2
32 +
33 +# please keep this ebuild at EAPI 7 -- sys-apps/portage dep
34 +EAPI=7
35 +
36 +PYTHON_COMPAT=( python3_{7..10} pypy3 )
37 +
38 +inherit distutils-r1
39 +
40 +DESCRIPTION="C parser and AST generator written in Python"
41 +HOMEPAGE="https://github.com/eliben/pycparser"
42 +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
43 +
44 +LICENSE="BSD"
45 +SLOT="0"
46 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~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"
47 +
48 +RDEPEND="dev-python/ply:=[${PYTHON_USEDEP}]"
49 +BDEPEND="${RDEPEND}
50 + dev-python/setuptools[${PYTHON_USEDEP}]"
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_compile() {
70 + distutils-r1_python_compile
71 +
72 + # note: tables built by py3.5+ are incompatible with older versions
73 + # because of 100 group limit of 're' module -- just generate them
74 + # separately optimized for each target instead
75 + pushd "${BUILD_DIR}"/lib/pycparser > /dev/null || die
76 + "${PYTHON}" _build_tables.py || die
77 + popd > /dev/null || die
78 +}
79 +
80 +python_test() {
81 + # Skip tests if cpp is not in PATH
82 + type -P cpp >/dev/null || return 0
83 + # change workdir to avoid '.' import
84 + cd tests || die
85 +
86 + # Ensure that 'cpp' is called with the right arguments
87 + # Tests don't seem to always pass the include they intend to use.
88 + mkdir -p "${T}"/bin || die
89 + cat > "${T}"/bin/cpp <<-EOF || die
90 + #!${BROOT}/bin/bash
91 + exec ${BROOT}/usr/bin/cpp -I${S}/utils/fake_libc_include/ \$@
92 + EOF
93 + chmod +x "${T}"/bin/cpp || die
94 +
95 + PATH="${T}/bin:${PATH}" eunittest
96 +}
97 +
98 +python_install() {
99 + distutils-r1_python_install
100 +
101 + # setup.py generates {c_ast,lextab,yacctab}.py with bytecode disabled.
102 + python_optimize
103 +}