Diff python-2.7.18_p10 with a python-3.6.13_p3

/usr/portage/dev-lang/python/python-3.6.13_p3.ebuild 2021-05-07 02:39:00.000000000 +0300
4 4
EAPI="7"
5 5
WANT_LIBTOOL="none"
6 6

  
7
inherit autotools flag-o-matic pax-utils \
7
inherit autotools flag-o-matic multiprocessing pax-utils \
8 8
	python-utils-r1 toolchain-funcs verify-sig
9 9

  
10 10
MY_P="Python-${PV%_p*}"
......
21 21
S="${WORKDIR}/${MY_P}"
22 22

  
23 23
LICENSE="PSF-2"
24
SLOT="${PYVER}"
25
KEYWORDS="~alpha ~amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ~ppc64 ~s390 sparc ~x86"
26
IUSE="berkdb bluetooth build elibc_uclibc examples gdbm hardened ipv6 +ncurses +readline +sqlite +ssl +threads tk +wide-unicode wininst +xml"
24
SLOT="${PYVER}/${PYVER}m"
25
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~s390 sparc x86"
26
IUSE="bluetooth build examples gdbm hardened ipv6 +ncurses +readline +sqlite +ssl test +threads tk wininst +xml"
27
RESTRICT="!test? ( test )"
27 28

  
28 29
# Do not add a dependency on dev-lang/python to this ebuild.
29 30
# If you need to apply a patch which requires python for bootstrapping, please
......
31 32
# patchset. See bug 447752.
32 33

  
33 34
RDEPEND="app-arch/bzip2:=
35
	app-arch/xz-utils:=
34 36
	dev-libs/libffi:=
35 37
	>=sys-libs/zlib-1.1.3:=
36 38
	virtual/libcrypt:=
37 39
	virtual/libintl
38
	berkdb? ( || (
39
		sys-libs/db:5.3
40
		sys-libs/db:5.1
41
		sys-libs/db:4.8
42
		sys-libs/db:4.7
43
		sys-libs/db:4.6
44
		sys-libs/db:4.5
45
		sys-libs/db:4.4
46
		sys-libs/db:4.3
47
		sys-libs/db:4.2
48
	) )
49 40
	gdbm? ( sys-libs/gdbm:=[berkdb] )
50 41
	ncurses? ( >=sys-libs/ncurses-5.2:= )
51 42
	readline? ( >=sys-libs/readline-4.1:= )
......
60 51
	xml? ( >=dev-libs/expat-2.1:= )"
61 52
# bluetooth requires headers from bluez
62 53
DEPEND="${RDEPEND}
63
	bluetooth? ( net-wireless/bluez )"
54
	bluetooth? ( net-wireless/bluez )
55
	test? ( app-arch/xz-utils[extra-filters(+)] )"
64 56
BDEPEND="
65 57
	virtual/pkgconfig
66 58
	verify-sig? ( app-crypt/openpgp-keys-python )
67 59
	!sys-devel/gcc[libffi(-)]"
68 60
PDEPEND="app-eselect/eselect-python"
69
RDEPEND+="
70
	!build? ( app-misc/mime-types )
71
	!<=dev-lang/python-exec-2.4.6-r1"
61
RDEPEND+=" !build? ( app-misc/mime-types )"
72 62

  
73 63
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/python.org.asc
74 64

  
75
pkg_setup() {
76
	if use berkdb; then
77
		ewarn "'bsddb' module is out-of-date and no longer maintained inside"
78
		ewarn "dev-lang/python. 'bsddb' and 'dbhash' modules have been additionally"
79
		ewarn "removed in Python 3. A maintained alternative of 'bsddb3' module"
80
		ewarn "is provided by dev-python/bsddb3."
81
	else
82
		if has_version "=${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"; then
83
			ewarn "You are migrating from =${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"
84
			ewarn "to =${CATEGORY}/${PN}-${PV%%.*}*[-berkdb]."
85
			ewarn "You might need to migrate your databases."
86
		fi
87
	fi
88
}
89

  
90 65
src_unpack() {
91 66
	if use verify-sig; then
92 67
		verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc}
......
115 90
		Makefile.pre.in \
116 91
		Modules/Setup.dist \
117 92
		Modules/getpath.c \
93
		configure.ac \
118 94
		setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
119 95

  
96
	# force correct number of jobs
97
	# https://bugs.gentoo.org/737660
98
	local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")
99
	sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die
100

  
120 101
	eautoreconf
121 102
}
122 103

  
123 104
src_configure() {
124
	# dbm module can be linked against berkdb or gdbm.
125
	# Defaults to gdbm when both are enabled, #204343.
126 105
	local disable
127
	use berkdb    || use gdbm || disable+=" dbm"
128
	use berkdb    || disable+=" _bsddb"
129 106
	# disable automagic bluetooth headers detection
130 107
	use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no
131 108
	use gdbm      || disable+=" gdbm"
......
159 136
		use hardened && replace-flags -O3 -O2
160 137
	fi
161 138

  
162
	if tc-is-cross-compiler; then
163
		# Force some tests that try to poke fs paths.
164
		export ac_cv_file__dev_ptc=no
165
		export ac_cv_file__dev_ptmx=yes
166
	fi
167

  
168
	# Export CXX so it ends up in /usr/lib/python2.X/config/Makefile.
139
	# Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
169 140
	tc-export CXX
170
	# The configure script fails to use pkg-config correctly.
171
	# http://bugs.python.org/issue15506
172
	export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
173 141

  
174 142
	local dbmliborder
175 143
	if use gdbm; then
176 144
		dbmliborder+="${dbmliborder:+:}gdbm"
177 145
	fi
178
	if use berkdb; then
179
		dbmliborder+="${dbmliborder:+:}bdb"
180
	fi
181 146

  
182 147
	local myeconfargs=(
183
		# The check is broken on clang, and gives false positive:
184
		# https://bugs.gentoo.org/596798
185
		# (upstream dropped this flag in 3.2a4 anyway)
186
		ac_cv_opt_olimit_ok=no
187 148
		# glibc-2.30 removes it; since we can't cleanly force-rebuild
188 149
		# Python on glibc upgrade, remove it proactively to give
189 150
		# a chance for users rebuilding python before glibc
......
193 154
		--enable-shared
194 155
		$(use_enable ipv6)
195 156
		$(use_with threads)
196
		$(use wide-unicode && echo "--enable-unicode=ucs4" || echo "--enable-unicode=ucs2")
197 157
		--infodir='${prefix}/share/info'
198 158
		--mandir='${prefix}/share/man'
199 159
		--with-computed-gotos
200 160
		--with-dbmliborder="${dbmliborder}"
201 161
		--with-libc=
202 162
		--enable-loadable-sqlite-extensions
163
		--without-ensurepip
203 164
		--with-system-expat
204 165
		--with-system-ffi
205
		--without-ensurepip
206 166
	)
207 167

  
208 168
	OPT="" econf "${myeconfargs[@]}"
......
219 179
	# https://bugs.gentoo.org/594768
220 180
	local -x LC_ALL=C
221 181

  
222
	# Avoid invoking pgen for cross-compiles.
223
	touch Include/graminit.h Python/graminit.c
224

  
225
	emake
182
	emake CPPFLAGS= CFLAGS= LDFLAGS=
226 183

  
227 184
	# Work around bug 329499. See also bug 413751 and 457194.
228 185
	if has_version dev-libs/libffi[pax_kernel]; then
......
240 197
	fi
241 198

  
242 199
	# Skip failing tests.
243
	local skipped_tests="distutils gdb"
200
	local skipped_tests="gdb faulthandler"
244 201

  
245 202
	for test in ${skipped_tests}; do
246 203
		mv "${S}"/Lib/test/test_${test}.py "${T}"
......
248 205

  
249 206
	# bug 660358
250 207
	local -x COLUMNS=80
208
	local -x PYTHONDONTWRITEBYTECODE=
251 209

  
252
	# Daylight saving time problem
253
	# https://bugs.python.org/issue22067
254
	# https://bugs.gentoo.org/610628
255
	local -x TZ=UTC
256

  
257
	# Rerun failed tests in verbose mode (regrtest -w).
258
	emake test EXTRATESTOPTS="-w" < /dev/tty
259
	local result="$?"
210
	local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")
211

  
212
	emake test EXTRATESTOPTS="-u-network -j${jobs}" \
213
		CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
214
	local result=$?
260 215

  
261 216
	for test in ${skipped_tests}; do
262 217
		mv "${T}/test_${test}.py" "${S}"/Lib/test
......
281 236

  
282 237
	emake DESTDIR="${D}" altinstall
283 238

  
284
	sed -e "s/\(LDFLAGS=\).*/\1/" -i "${libdir}/config/Makefile" || die
239
	# Remove static library
240
	rm "${ED}"/usr/$(get_libdir)/libpython*.a || die
241

  
242
	sed \
243
		-e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \
244
		-e "s/\(PY_LDFLAGS=\).*/\1/" \
245
		-i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed"
285 246

  
286 247
	# Fix collisions between different slots of Python.
287
	mv "${ED}/usr/bin/2to3" "${ED}/usr/bin/2to3-${PYVER}" || die
288
	mv "${ED}/usr/bin/pydoc" "${ED}/usr/bin/pydoc${PYVER}" || die
289
	mv "${ED}/usr/bin/idle" "${ED}/usr/bin/idle${PYVER}" || die
290
	rm "${ED}/usr/bin/smtpd.py" || die
248
	rm "${ED}/usr/$(get_libdir)/libpython3.so" || die
249

  
250
	# Cheap hack to get version with ABIFLAGS
251
	local abiver=$(cd "${ED}/usr/include"; echo python*)
252
	if [[ ${abiver} != python${PYVER} ]]; then
253
		# Replace python3.X with a symlink to python3.Xm
254
		rm "${ED}/usr/bin/python${PYVER}" || die
255
		dosym "${abiver}" "/usr/bin/python${PYVER}"
256
		# Create python3.X-config symlink
257
		dosym "${abiver}-config" "/usr/bin/python${PYVER}-config"
258
		# Create python-3.5m.pc symlink
259
		dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc"
260
	fi
261

  
262
	# python seems to get rebuilt in src_install (bug 569908)
263
	# Work around it for now.
264
	if has_version dev-libs/libffi[pax_kernel]; then
265
		pax-mark E "${ED}/usr/bin/${abiver}"
266
	else
267
		pax-mark m "${ED}/usr/bin/${abiver}"
268
	fi
291 269

  
292
	use berkdb || rm -r "${libdir}/"{bsddb,dbhash.py*,test/test_bsddb*} || die
293 270
	use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
294
	use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,lib-tk} || die
295
	use elibc_uclibc && rm -fr "${libdir}/"{bsddb/test,test}
271
	use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
296 272

  
297 273
	use threads || rm -r "${libdir}/multiprocessing" || die
298 274
	use wininst || rm "${libdir}/distutils/command/"wininst-*.exe || die
......
301 277

  
302 278
	if use examples; then
303 279
		docinto examples
280
		find Tools -name __pycache__ -exec rm -fr {} + || die
304 281
		dodoc -r Tools
305 282
	fi
306 283
	insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
......
329 306
	python_domodule epython.py
330 307

  
331 308
	# python-exec wrapping support
309
	local pymajor=${PYVER%.*}
332 310
	local scriptdir=${D}$(python_get_scriptdir)
333 311
	mkdir -p "${scriptdir}" || die
334
	# python
335
	ln -s "../../../bin/python${PYVER}" \
336
		"${scriptdir}/python" || die
337
	# python-config
338
	ln -s "../../../bin/python${PYVER}-config" \
312
	# python and pythonX
313
	ln -s "../../../bin/${abiver}" \
314
		"${scriptdir}/python${pymajor}" || die
315
	ln -s "python${pymajor}" "${scriptdir}/python" || die
316
	# python-config and pythonX-config
317
	# note: we need to create a wrapper rather than symlinking it due
318
	# to some random dirname(argv[0]) magic performed by python-config
319
	cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die
320
		#!/bin/sh
321
		exec "${abiver}-config" "\${@}"
322
	EOF
323
	chmod +x "${scriptdir}/python${pymajor}-config" || die
324
	ln -s "python${pymajor}-config" \
339 325
		"${scriptdir}/python-config" || die
340 326
	# 2to3, pydoc, pyvenv
341 327
	ln -s "../../../bin/2to3-${PYVER}" \
342 328
		"${scriptdir}/2to3" || die
343 329
	ln -s "../../../bin/pydoc${PYVER}" \
344 330
		"${scriptdir}/pydoc" || die
331
	ln -s "../../../bin/pyvenv-${PYVER}" \
332
		"${scriptdir}/pyvenv" || die
345 333
	# idle
346 334
	if use tk; then
347 335
		ln -s "../../../bin/idle${PYVER}" \
348 336
			"${scriptdir}/idle" || die
349 337
	fi
350

  
351
	# python2* is no longer wrapped, so just symlink it
352
	local pymajor=${PYVER%.*}
353
	dosym "python${PYVER}" "/usr/bin/python${pymajor}"
354
	dosym "python${PYVER}-config" "/usr/bin/python${pymajor}-config"
355 338
}
Thank you!