Diff python-3.11.6 with a python-3.12.0

/usr/portage/dev-lang/python/python-3.12.0.ebuild 2023-10-09 14:52:29.472368350 +0300
1 1
# Copyright 1999-2023 Gentoo Authors
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4
EAPI="7"
4
EAPI="8"
5 5
WANT_LIBTOOL="none"
6 6

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

  
10 10
MY_PV=${PV/_rc/rc}
11 11
MY_P="Python-${MY_PV%_p*}"
......
50 50
	>=sys-libs/zlib-1.1.3:=
51 51
	virtual/libcrypt:=
52 52
	virtual/libintl
53
	ensurepip? ( dev-python/ensurepip-wheels )
53
	ensurepip? ( dev-python/ensurepip-pip )
54 54
	gdbm? ( sys-libs/gdbm:=[berkdb] )
55 55
	kernel_linux? ( sys-apps/util-linux:= )
56 56
	ncurses? ( >=sys-libs/ncurses-5.2:= )
......
71 71
DEPEND="
72 72
	${RDEPEND}
73 73
	bluetooth? ( net-wireless/bluez )
74
	test? ( app-arch/xz-utils[extra-filters(+)] )
74
	test? (
75
		app-arch/xz-utils[extra-filters(+)]
76
		dev-python/ensurepip-pip
77
		dev-python/ensurepip-setuptools
78
		dev-python/ensurepip-wheel
79
	)
75 80
	valgrind? ( dev-util/valgrind )
76 81
"
77 82
# autoconf-archive needed to eautoreconf
......
79 84
	sys-devel/autoconf-archive
80 85
	app-alternatives/awk
81 86
	virtual/pkgconfig
82
	verify-sig? ( sec-keys/openpgp-keys-python )
87
	verify-sig? ( >=sec-keys/openpgp-keys-python-20221025 )
83 88
"
84 89
RDEPEND+="
85 90
	!build? ( app-misc/mime-types )
......
116 121

  
117 122
src_prepare() {
118 123
	# Ensure that internal copies of expat and libffi are not used.
119
	rm -r Modules/expat || die
120
	rm -r Modules/_ctypes/libffi* || die
124
	# TODO: Makefile has annoying deps on expat headers
125
	#rm -r Modules/expat || die
121 126

  
122 127
	local PATCHES=(
123 128
		"${WORKDIR}/${PATCHSET}"
......
125 130

  
126 131
	default
127 132

  
128
	# https://bugs.gentoo.org/850151
129
	sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" setup.py || die
130

  
131 133
	# force the correct number of jobs
132 134
	# https://bugs.gentoo.org/737660
133
	local jobs=$(makeopts_jobs)
134
	sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die
135
	sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die
135
	sed -i -e "s:-j0:-j$(makeopts_jobs):" Makefile.pre.in || die
136 136

  
137 137
	eautoreconf
138 138
}
......
171 171

  
172 172
	mkdir "${WORKDIR}"/${P}-${CBUILD} || die
173 173
	pushd "${WORKDIR}"/${P}-${CBUILD} &> /dev/null || die
174
	# We disable _ctypes and _crypt for CBUILD because Python's setup.py can't handle locating
175
	# libdir correctly for cross.
176
	PYTHON_DISABLE_MODULES+=" _ctypes _crypt" \
177
		ECONF_SOURCE="${S}" econf_build "${myeconfargs_cbuild[@]}"
178 174

  
179 175
	# Avoid as many dependencies as possible for the cross build.
180
	cat >> Makefile <<-EOF || die
181
		MODULE_NIS_STATE=disabled
182
		MODULE__DBM_STATE=disabled
183
		MODULE__GDBM_STATE=disabled
184
		MODULE__DBM_STATE=disabled
185
		MODULE__SQLITE3_STATE=disabled
186
		MODULE__HASHLIB_STATE=disabled
187
		MODULE__SSL_STATE=disabled
188
		MODULE__CURSES_STATE=disabled
189
		MODULE__CURSES_PANEL_STATE=disabled
190
		MODULE_READLINE_STATE=disabled
191
		MODULE__TKINTER_STATE=disabled
192
		MODULE_PYEXPAT_STATE=disabled
193
		MODULE_ZLIB_STATE=disabled
176
	mkdir Modules || die
177
	cat > Modules/Setup.local <<-EOF || die
178
		*disabled*
179
		nis
180
		_dbm _gdbm
181
		_sqlite3
182
		_hashlib _ssl
183
		_curses _curses_panel
184
		readline
185
		_tkinter
186
		pyexpat
187
		zlib
188
		# We disabled these for CBUILD because Python's setup.py can't handle locating
189
		# libdir correctly for cross. This should be rechecked for the pure Makefile approach,
190
		# and uncommented if needed.
191
		#_ctypes _crypt
194 192
	EOF
195 193

  
194
	ECONF_SOURCE="${S}" econf_build "${myeconfargs_cbuild[@]}"
195

  
196 196
	# Unfortunately, we do have to build this immediately, and
197 197
	# not in src_compile, because CHOST configure for Python
198 198
	# will check the existence of the --with-build-python value
199 199
	# immediately.
200
	PYTHON_DISABLE_MODULES+=" _ctypes _crypt" emake
200
	emake
201 201
	popd &> /dev/null || die
202 202
}
203 203

  
......
280 280
		--enable-loadable-sqlite-extensions
281 281
		--without-ensurepip
282 282
		--with-system-expat
283
		--with-system-ffi
284 283
		--with-platlibdir=lib
285 284
		--with-pkg-config=yes
286 285
		--with-wheel-pkg-dir="${EPREFIX}"/usr/lib/python/ensurepip
......
291 290
		$(use_with readline readline "$(usex libedit editline readline)")
292 291
		$(use_with valgrind)
293 292
	)
293
	# Force-disable modules we don't want built.
294
	# See Modules/Setup for docs on how this works. Setup.local contains our local deviations.
295
	cat > Modules/Setup.local <<-EOF || die
296
		*disabled*
297
		nis
298
		$(usev !gdbm '_gdbm _dbm')
299
		$(usev !sqlite '_sqlite3')
300
		$(usev !ssl '_hashlib _ssl')
301
		$(usev !ncurses '_curses _curses_panel')
302
		$(usev !readline 'readline')
303
		$(usev !tk '_tkinter')
304
	EOF
294 305

  
295 306
	# disable implicit optimization/debugging flags
296 307
	local -x OPT=
......
315 326
		append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
316 327
	fi
317 328

  
318
	hprefixify setup.py
319 329
	econf "${myeconfargs[@]}"
320 330

  
321 331
	if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
......
324 334
		die "Broken sem_open function (bug 496328)"
325 335
	fi
326 336

  
327
	# force-disable modules we don't want built
328
	local disable_modules=( NIS )
329
	use gdbm || disable_modules+=( _GDBM _DBM )
330
	use sqlite || disable_modules+=( _SQLITE3 )
331
	use ssl || disable_modules+=( _HASHLIB _SSL )
332
	use ncurses || disable_modules+=( _CURSES _CURSES_PANEL )
333
	use readline || disable_modules+=( READLINE )
334
	use tk || disable_modules+=( _TKINTER )
335

  
336
	local mod
337
	for mod in "${disable_modules[@]}"; do
338
		echo "MODULE_${mod}_STATE=disabled"
339
	done >> Makefile || die
340

  
341 337
	# install epython.py as part of stdlib
342 338
	echo "EPYTHON='python${PYVER}'" > Lib/epython.py || die
343 339
}
......
346 342
	# Ensure sed works as expected
347 343
	# https://bugs.gentoo.org/594768
348 344
	local -x LC_ALL=C
349
	# Prevent using distutils bundled by setuptools.
350
	# https://bugs.gentoo.org/823728
351
	export SETUPTOOLS_USE_DISTUTILS=stdlib
352 345
	export PYTHONSTRICTEXTENSIONBUILD=1
353 346

  
354 347
	# Save PYTHONDONTWRITEBYTECODE so that 'has_version' doesn't
......
430 423
src_install() {
431 424
	local libdir=${ED}/usr/lib/python${PYVER}
432 425

  
426
	# the Makefile rules are broken
427
	# https://github.com/python/cpython/issues/100221
428
	mkdir -p "${libdir}"/lib-dynload || die
429

  
433 430
	# -j1 hack for now for bug #843458
434 431
	emake -j1 DESTDIR="${D}" altinstall
435 432

  
Thank you!