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/pypy3-exe/
Date: Thu, 27 Jan 2022 15:17:43
Message-Id: 1643296656.e8fb87dba65069140ef50ee7227ccb722475b418.mgorny@gentoo
1 commit: e8fb87dba65069140ef50ee7227ccb722475b418
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jan 27 10:14:24 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Thu Jan 27 15:17:36 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e8fb87db
7
8 dev-python/pypy3-exe: Bump to 7.3.8_rc1 (PyPy3.9!)
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-python/pypy3-exe/Manifest | 2 +
13 dev-python/pypy3-exe/pypy3-exe-7.3.8_rc1.ebuild | 166 ++++++++++++++++++++++++
14 2 files changed, 168 insertions(+)
15
16 diff --git a/dev-python/pypy3-exe/Manifest b/dev-python/pypy3-exe/Manifest
17 index 44d6013d0c6e..fb3fc7b75b9a 100644
18 --- a/dev-python/pypy3-exe/Manifest
19 +++ b/dev-python/pypy3-exe/Manifest
20 @@ -1,2 +1,4 @@
21 DIST pypy3.8-gentoo-patches-7.3.7.tar.xz 4396 BLAKE2B adc33a02ada4d22eae0484292ec6cc295805d9f254b7a9110c622628aa40011621a1833ca62d3251e4e5056c406f648e7ad0439bd60e77c38808dd9df46973a5 SHA512 1cda8467de2d749d98fa20d7d200b5f96dae0ca68cf44a054d03f3f148bc3946ba1f1c474ac0336560f79c78b3eddcd4ba24386e83de283c83475b8e4b75bdf8
22 DIST pypy3.8-v7.3.7-src.tar.bz2 24375444 BLAKE2B 44fe19ee63d95243c499ecb0b84e77873c73da93320b1e028a5c6c4b167441d223812dc66b16e070308cba48c4d8774738f827319cce9d1769b3f4346e15487c SHA512 9e6701cc441d5535968656cfb0cfa9076c364f9ba32bc6f0ef64f06ab343281e2458dbe88791c0e02401457fbf80d367f397fc904f6146bff68e04a15e05fda2
23 +DIST pypy3.9-gentoo-patches-7.3.8rc1.tar.xz 1232 BLAKE2B 9f56ed8fb2e40a5a52a30cd43973fa8ff777ffee49d07c72a1a15cac5be57b6e9531671832abb2f9d645b75e070f8fedc13197b19d680adc718bc5294be30418 SHA512 ff0aa40124270d1b4765aac99c86968ef32f26b4b59d073a59ea0883958d964fc4bed668e5b8b304f7d7c97d50040c1650788ae196d33c53e276f869ba57e841
24 +DIST pypy3.9-v7.3.8rc1-src.tar.bz2 26254113 BLAKE2B fb4eca88080eee91d4ec8886abb484de11997c73d5b60c5f9acab7cd7b8cbc9d80190608bb905d82b6bcd1bbf602b6afc53257c9263458fc51a2b5f32510a164 SHA512 d1b1942fbacc7f8d642c85ceb4c4c9796e73bd5836615e2db81f4ddabf9e4f94c230f2d946ea9c49b642d41304aeed3906df1931a52ec40c56d14f1028139978
25
26 diff --git a/dev-python/pypy3-exe/pypy3-exe-7.3.8_rc1.ebuild b/dev-python/pypy3-exe/pypy3-exe-7.3.8_rc1.ebuild
27 new file mode 100644
28 index 000000000000..90dcbda05096
29 --- /dev/null
30 +++ b/dev-python/pypy3-exe/pypy3-exe-7.3.8_rc1.ebuild
31 @@ -0,0 +1,166 @@
32 +# Copyright 1999-2022 Gentoo Authors
33 +# Distributed under the terms of the GNU General Public License v2
34 +
35 +EAPI=8
36 +
37 +# pypy3 needs to be built using python 2
38 +PYTHON_COMPAT=( python2_7 )
39 +inherit check-reqs pax-utils python-any-r1 toolchain-funcs
40 +
41 +PYPY_PV=${PV%_p*}
42 +MY_P=pypy3.9-v${PYPY_PV/_}
43 +PATCHSET="pypy3.9-gentoo-patches-${PV/_}"
44 +
45 +DESCRIPTION="PyPy3 executable (build from source)"
46 +HOMEPAGE="https://www.pypy.org/"
47 +SRC_URI="https://buildbot.pypy.org/pypy/${MY_P}-src.tar.bz2
48 + https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz"
49 +S="${WORKDIR}/${MY_P}-src"
50 +
51 +LICENSE="MIT"
52 +SLOT="3.9-${PYPY_PV}"
53 +KEYWORDS=""
54 +IUSE="bzip2 +jit low-memory ncurses cpu_flags_x86_sse2"
55 +
56 +RDEPEND=">=sys-libs/zlib-1.1.3:0=
57 + dev-libs/libffi:0=
58 + virtual/libintl:0=
59 + dev-libs/expat:0=
60 + bzip2? ( app-arch/bzip2:0= )
61 + ncurses? ( sys-libs/ncurses:0= )
62 + !dev-python/pypy3-exe-bin:${PYPY_PV}"
63 +DEPEND="${RDEPEND}"
64 +BDEPEND="
65 + low-memory? ( dev-python/pypy )
66 + !low-memory? (
67 + || (
68 + dev-python/pypy
69 + dev-lang/python:2.7
70 + )
71 + )"
72 +
73 +check_env() {
74 + if use low-memory; then
75 + CHECKREQS_MEMORY="1750M"
76 + use amd64 && CHECKREQS_MEMORY="3500M"
77 + else
78 + CHECKREQS_MEMORY="3G"
79 + use amd64 && CHECKREQS_MEMORY="6G"
80 + fi
81 +
82 + check-reqs_pkg_pretend
83 +}
84 +
85 +pkg_pretend() {
86 + [[ ${MERGE_TYPE} != binary ]] && check_env
87 +}
88 +
89 +pkg_setup() {
90 + if [[ ${MERGE_TYPE} != binary ]]; then
91 + check_env
92 +
93 + # unset to allow forcing pypy below :)
94 + use low-memory && EPYTHON=
95 + if [[ ! ${EPYTHON} || ${EPYTHON} == pypy ]] &&
96 + { has_version -b dev-python/pypy ||
97 + has_version -b dev-python/pypy-bin; }
98 + then
99 + einfo "Using PyPy to perform the translation."
100 + EPYTHON=pypy
101 + else
102 + einfo "Using ${EPYTHON:-python2} to perform the translation. Please note that upstream"
103 + einfo "recommends using PyPy for that. If you wish to do so, please install"
104 + einfo "dev-python/pypy and ensure that EPYTHON variable is unset."
105 + python-any-r1_pkg_setup
106 + fi
107 + fi
108 +}
109 +
110 +src_prepare() {
111 + local PATCHES=(
112 + "${WORKDIR}/${PATCHSET}"
113 + )
114 + default
115 +}
116 +
117 +src_configure() {
118 + tc-export CC
119 +
120 + local jit_backend
121 + if use jit; then
122 + jit_backend='--jit-backend='
123 +
124 + # We only need the explicit sse2 switch for x86.
125 + # On other arches we can rely on autodetection which uses
126 + # compiler macros. Plus, --jit-backend= doesn't accept all
127 + # the modern values...
128 +
129 + if use x86; then
130 + if use cpu_flags_x86_sse2; then
131 + jit_backend+=x86
132 + else
133 + jit_backend+=x86-without-sse2
134 + fi
135 + else
136 + jit_backend+=auto
137 + fi
138 + fi
139 +
140 + local args=(
141 + --no-shared
142 + $(usex jit -Ojit -O2)
143 +
144 + ${jit_backend}
145 +
146 + pypy/goal/targetpypystandalone
147 + )
148 +
149 + # Avoid linking against libraries disabled by use flags
150 + local opts=(
151 + bzip2:bz2
152 + ncurses:_minimal_curses
153 + )
154 +
155 + local opt
156 + for opt in "${opts[@]}"; do
157 + local flag=${opt%:*}
158 + local mod=${opt#*:}
159 +
160 + args+=(
161 + $(usex ${flag} --withmod --withoutmod)-${mod}
162 + )
163 + done
164 +
165 + local interp=( "${EPYTHON}" )
166 + if use low-memory; then
167 + interp=( env PYPY_GC_MAX_DELTA=200MB
168 + "${EPYTHON}" --jit loop_longevity=300 )
169 + fi
170 +
171 + if [[ ${EPYTHON} != pypy ]]; then
172 + # reuse bundled pycparser to avoid external dep
173 + mkdir -p "${T}"/pymod/cffi || die
174 + : > "${T}"/pymod/cffi/__init__.py || die
175 + cp -r lib_pypy/cffi/_pycparser "${T}"/pymod/cffi/ || die
176 + local -x PYTHONPATH=${T}/pymod:${PYTHONPATH}
177 + fi
178 +
179 + # translate into the C sources
180 + # we're going to build them ourselves since otherwise pypy does not
181 + # free up the unneeded memory before spawning the compiler
182 + set -- "${interp[@]}" rpython/bin/rpython --batch --source "${args[@]}"
183 + echo -e "\033[1m${@}\033[0m"
184 + "${@}" || die "translation failed"
185 +}
186 +
187 +src_compile() {
188 + emake -C "${T}"/usession*-0/testing_1
189 +}
190 +
191 +src_install() {
192 + cd "${T}"/usession*-0 || die
193 + newbin testing_1/pypy3.9-c pypy3.9-c-${PYPY_PV}
194 + insinto /usr/include/pypy3.9/${PYPY_PV}
195 + doins pypy_*.h
196 + pax-mark m "${ED}/usr/bin/pypy3.9-c-${PYPY_PV}"
197 +}