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/pypy-exe/
Date: Fri, 30 Dec 2022 14:33:03
Message-Id: 1672410772.239125afda2cbe9d0b90de42758435d03b79d951.mgorny@gentoo
1 commit: 239125afda2cbe9d0b90de42758435d03b79d951
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Fri Dec 30 11:02:18 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Fri Dec 30 14:32:52 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=239125af
7
8 dev-python/pypy-exe: Bump to 7.3.11
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-python/pypy-exe/Manifest | 2 +
13 dev-python/pypy-exe/pypy-exe-7.3.11.ebuild | 177 +++++++++++++++++++++++++++++
14 2 files changed, 179 insertions(+)
15
16 diff --git a/dev-python/pypy-exe/Manifest b/dev-python/pypy-exe/Manifest
17 index 82c1162a336f..cc6b7d01daff 100644
18 --- a/dev-python/pypy-exe/Manifest
19 +++ b/dev-python/pypy-exe/Manifest
20 @@ -1,2 +1,4 @@
21 DIST pypy2.7-gentoo-patches-7.3.10.tar.xz 5312 BLAKE2B 3ca6d3a01914ae92d93fbd185705dae6bebfd4869a818f4a8058c9df3ea243fd9f1e5b962351f8d07a9679e8020499e81b7d1114d4f1b7493dc1d34c8c04409e SHA512 6758894f6d66dc99a13471cf373c5a2d2bbf37ac561e8d7c4f57ec2f1a9653cf9859547d9a7a80e7f0f7df16078030a4b1cee69536958176f0261da49493310e
22 +DIST pypy2.7-gentoo-patches-7.3.11.tar.xz 5312 BLAKE2B 3692453a184a88d61fe1dd7aa815aa02a4bdf4b29defd2e98a354261784643f78799b979bb356c19311b40932cc7f8b8e050e10553755a846938951a87021bc9 SHA512 24308317d92b278f9f7d74327303ebba34628a2d8dd5798ae3d472d14fd0519a470b6f9c420da88e07251215342a1e4f5cf8d4230f9663119274d3194d3811a5
23 DIST pypy2.7-v7.3.10-src.tar.bz2 19865458 BLAKE2B 0ba83b873daf99b20bd38ee63734c7ceb47b6a7e9cb4bdab1ebbd5672767411f0bf926a19a7074cbfc154a8d83e3679c98fe38c5b6e00c1a4a3fab5424b5ba5d SHA512 750427ce03fdc39f8b6df528f5a2b17f33429433f583a7c46a6b9564f7e398616ae61efb635a4bc0a1f8916ca1881bf1f6347a7ea1748c09ae02e4d88315986d
24 +DIST pypy2.7-v7.3.11-src.tar.bz2 19850421 BLAKE2B ed8bd61e3857c37689f24a23d38d5043bd190ee0e6de5d7906284ea2eab5e7aeff5c994c22f97195f5a1ded2867725f74dc562b375c0165b6231eae69213c06e SHA512 31fd93fe3e761fd096ff52c2a0afa40f78e4df700deb911e221d1682b35e8374c9deac7ba19b474f7ca7a366d3ae9b36ebaf78e81c4ec8306431fd0873daea55
25
26 diff --git a/dev-python/pypy-exe/pypy-exe-7.3.11.ebuild b/dev-python/pypy-exe/pypy-exe-7.3.11.ebuild
27 new file mode 100644
28 index 000000000000..16adc0e787e0
29 --- /dev/null
30 +++ b/dev-python/pypy-exe/pypy-exe-7.3.11.ebuild
31 @@ -0,0 +1,177 @@
32 +# Copyright 1999-2022 Gentoo Authors
33 +# Distributed under the terms of the GNU General Public License v2
34 +
35 +EAPI=8
36 +
37 +inherit check-reqs pax-utils toolchain-funcs
38 +
39 +PYPY_PV=${PV%_p*}
40 +MY_P=pypy2.7-v${PYPY_PV/_}
41 +PATCHSET="pypy2.7-gentoo-patches-${PV/_}"
42 +
43 +DESCRIPTION="PyPy executable (build from source)"
44 +HOMEPAGE="https://www.pypy.org/"
45 +SRC_URI="
46 + https://buildbot.pypy.org/pypy/${MY_P}-src.tar.bz2
47 + https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz
48 +"
49 +S="${WORKDIR}/${MY_P}-src"
50 +
51 +LICENSE="MIT"
52 +SLOT="${PYPY_PV}"
53 +KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86 ~amd64-linux ~x86-linux"
54 +IUSE="bzip2 +jit low-memory ncurses cpu_flags_x86_sse2"
55 +
56 +DEPEND="
57 + >=sys-libs/zlib-1.1.3:0=
58 + dev-libs/libffi:0=
59 + virtual/libintl:0=
60 + dev-libs/expat:0=
61 + bzip2? ( app-arch/bzip2:0= )
62 + ncurses? ( sys-libs/ncurses:0= )
63 +"
64 +RDEPEND="
65 + ${DEPEND}
66 + !dev-python/pypy-exe-bin:${PYPY_PV}
67 +"
68 +# don't enforce the dep on dev-python/pypy with USE=low-memory
69 +# since it's going to cause circular dep with unhelpful error message
70 +BDEPEND="
71 + !low-memory? (
72 + || (
73 + dev-python/pypy
74 + dev-lang/python:2.7
75 + )
76 + )
77 +"
78 +
79 +check_env() {
80 + if ! has_version -b dev-python/pypy; then
81 + if use low-memory; then
82 + eerror "USE=low-memory requires (a prior version of) dev-python/pypy"
83 + eerror "installed."
84 + else
85 + ewarn "CPython 2.7 will be used to perform the translation. Upstream"
86 + ewarn "recommends using (a prior version of) dev-python/pypy instead."
87 + fi
88 + elog "You can install a prebuilt version of PyPy first using e.g.:"
89 + elog " $ emerge -1v dev-python/pypy dev-python/pypy-exe-bin"
90 +
91 + if use low-memory; then
92 + die "dev-python/pypy needs to be installed for USE=low-memory"
93 + fi
94 + fi
95 +
96 + if use low-memory; then
97 + CHECKREQS_MEMORY="1750M"
98 + use amd64 && CHECKREQS_MEMORY="3500M"
99 + else
100 + CHECKREQS_MEMORY="3G"
101 + use amd64 && CHECKREQS_MEMORY="6G"
102 + fi
103 +
104 + check-reqs_pkg_pretend
105 +}
106 +
107 +pkg_pretend() {
108 + [[ ${MERGE_TYPE} != binary ]] && check_env
109 +}
110 +
111 +pkg_setup() {
112 + [[ ${MERGE_TYPE} != binary ]] && check_env
113 +}
114 +
115 +src_prepare() {
116 + local PATCHES=(
117 + "${WORKDIR}/${PATCHSET}"
118 + )
119 + default
120 +}
121 +
122 +src_configure() {
123 + tc-export CC
124 +
125 + local jit_backend
126 + if use jit; then
127 + jit_backend='--jit-backend='
128 +
129 + # We only need the explicit sse2 switch for x86.
130 + # On other arches we can rely on autodetection which uses
131 + # compiler macros. Plus, --jit-backend= doesn't accept all
132 + # the modern values...
133 +
134 + if use x86; then
135 + if use cpu_flags_x86_sse2; then
136 + jit_backend+=x86
137 + else
138 + jit_backend+=x86-without-sse2
139 + fi
140 + else
141 + jit_backend+=auto
142 + fi
143 + fi
144 +
145 + local args=(
146 + --no-shared
147 + $(usex jit -Ojit -O2)
148 +
149 + ${jit_backend}
150 +
151 + pypy/goal/targetpypystandalone
152 + )
153 +
154 + # Avoid linking against libraries disabled by use flags
155 + local opts=(
156 + bzip2:bz2
157 + ncurses:_minimal_curses
158 + )
159 +
160 + local opt
161 + for opt in "${opts[@]}"; do
162 + local flag=${opt%:*}
163 + local mod=${opt#*:}
164 +
165 + args+=(
166 + $(usex ${flag} --withmod --withoutmod)-${mod}
167 + )
168 + done
169 +
170 + local interp
171 + if use low-memory || has_version -b dev-python/pypy; then
172 + einfo "Using already-installed PyPy to perform the translation."
173 + interp=( pypy )
174 + if use low-memory; then
175 + local -x PYPY_GC_MAX_DELTA=200MB
176 + interp+=( --jit loop_longevity=300 )
177 + fi
178 + else
179 + einfo "Using CPython 2.7 to perform the translation."
180 + interp=( python2.7 )
181 +
182 + # reuse bundled pycparser to avoid external dep
183 + mkdir -p "${T}"/pymod/cffi || die
184 + : > "${T}"/pymod/cffi/__init__.py || die
185 + cp -r lib_pypy/cffi/_pycparser "${T}"/pymod/cffi/ || die
186 + local -x PYTHONPATH=${T}/pymod:${PYTHONPATH}
187 + fi
188 +
189 + # translate into the C sources
190 + # we're going to build them ourselves since otherwise pypy does not
191 + # free up the unneeded memory before spawning the compiler
192 + set -- "${interp[@]}" rpython/bin/rpython --batch --source "${args[@]}"
193 + echo -e "\033[1m${@}\033[0m"
194 + "${@}" || die "translation failed"
195 +}
196 +
197 +src_compile() {
198 + emake -C "${T}"/usession*-0/testing_1
199 +}
200 +
201 +src_install() {
202 + local dest=/usr/lib/pypy2.7
203 + exeinto "${dest}"
204 + newexe "${T}"/usession*-0/testing_1/pypy-c pypy-c-${PYPY_PV}
205 + insinto "${dest}"/include/${PYPY_PV}
206 + doins include/pypy_*
207 + pax-mark m "${ED}${dest}/pypy-c-${PYPY_PV}"
208 +}