Diff python-2.7.17 with a python-2.7.17-r1

/usr/portage/dev-lang/python/python-2.7.17-r1.ebuild 2020-02-12 22:39:00.000000000 +0300
1 1
# Copyright 1999-2020 Gentoo Authors
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

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

  
7 7
inherit autotools flag-o-matic pax-utils python-utils-r1 toolchain-funcs
8 8

  
9 9
MY_P="Python-${PV}"
10
PATCHSET_VERSION="2.7.17"
10
PYVER=$(ver_cut 1-2)
11
PATCHSET="python-gentoo-patches-2.7.17-r1"
11 12

  
12 13
DESCRIPTION="An interpreted, interactive, object-oriented programming language"
13 14
HOMEPAGE="https://www.python.org/"
14 15
SRC_URI="https://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz
15
	https://dev.gentoo.org/~mgorny/dist/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz"
16
	https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz"
17
S="${WORKDIR}/${MY_P}"
16 18

  
17 19
LICENSE="PSF-2"
18
SLOT="2.7"
19
KEYWORDS="~alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 s390 ~sh sparc x86"
20
IUSE="-berkdb bluetooth build doc elibc_uclibc examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
20
SLOT="${PYVER}"
21
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
22
IUSE="-berkdb bluetooth build elibc_uclibc examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
21 23

  
22 24
# Do not add a dependency on dev-lang/python to this ebuild.
23 25
# If you need to apply a patch which requires python for bootstrapping, please
24 26
# run the bootstrap code on your dev box and include the results in the
25 27
# patchset. See bug 447752.
26 28

  
27
RDEPEND="app-arch/bzip2:0=
28
	>=sys-libs/zlib-1.1.3:0=
29
RDEPEND="app-arch/bzip2:=
30
	>=sys-libs/zlib-1.1.3:=
31
	virtual/libcrypt:=
29 32
	virtual/libffi:=
30 33
	virtual/libintl
31 34
	berkdb? ( || (
......
39 42
		sys-libs/db:4.3
40 43
		sys-libs/db:4.2
41 44
	) )
42
	gdbm? ( sys-libs/gdbm:0=[berkdb] )
43
	ncurses? ( >=sys-libs/ncurses-5.2:0= )
44
	readline? ( >=sys-libs/readline-4.1:0= )
45
	gdbm? ( sys-libs/gdbm:=[berkdb] )
46
	ncurses? ( >=sys-libs/ncurses-5.2:= )
47
	readline? ( >=sys-libs/readline-4.1:= )
45 48
	sqlite? ( >=dev-db/sqlite-3.3.8:3= )
46 49
	ssl? (
47
		!libressl? ( dev-libs/openssl:0= )
48
		libressl? ( dev-libs/libressl:0= )
50
		!libressl? ( dev-libs/openssl:= )
51
		libressl? ( dev-libs/libressl:= )
49 52
	)
50 53
	tk? (
51
		>=dev-lang/tcl-8.0:0=
52
		>=dev-lang/tk-8.0:0=
53
		dev-tcltk/blt:0=
54
		>=dev-lang/tcl-8.0:=
55
		>=dev-lang/tk-8.0:=
56
		dev-tcltk/blt:=
54 57
		dev-tcltk/tix
55 58
	)
56
	xml? ( >=dev-libs/expat-2.1 )
57
	!!<sys-apps/portage-2.1.9"
59
	xml? ( >=dev-libs/expat-2.1:= )"
58 60
# bluetooth requires headers from bluez
59 61
DEPEND="${RDEPEND}
60 62
	bluetooth? ( net-wireless/bluez )
61 63
	virtual/pkgconfig
62
	>=sys-devel/autoconf-2.65
63 64
	!sys-devel/gcc[libffi(-)]"
64
RDEPEND+=" !build? ( app-misc/mime-types )
65
	doc? ( dev-python/python-docs:${SLOT} )"
65
RDEPEND+=" !build? ( app-misc/mime-types )"
66 66
PDEPEND=">=app-eselect/eselect-python-20140125-r1"
67 67

  
68
S="${WORKDIR}/${MY_P}"
69

  
70 68
pkg_setup() {
71 69
	if use berkdb; then
72 70
		ewarn "'bsddb' module is out-of-date and no longer maintained inside"
......
84 82

  
85 83
src_prepare() {
86 84
	# Ensure that internal copies of expat, libffi and zlib are not used.
87
	rm -r Modules/expat || die
88
	rm -r Modules/_ctypes/libffi* || die
89
	rm -r Modules/zlib || die
90

  
91
	if tc-is-cross-compiler; then
92
		rm "${WORKDIR}/patches/0006-Regenerate-platform-specific-modules.patch" || die
93
	fi
85
	rm -fr Modules/expat || die
86
	rm -fr Modules/_ctypes/libffi* || die
87
	rm -fr Modules/zlib || die
94 88

  
95 89
	local PATCHES=(
96
		"${WORKDIR}/patches"
97
		# Fix for cross-compiling.
98
		"${FILESDIR}/python-2.7.5-nonfatal-compileall.patch"
99
		"${FILESDIR}/python-2.7.9-ncurses-pkg-config.patch"
100
		"${FILESDIR}/python-2.7.10-cross-compile-warn-test.patch"
101
		"${FILESDIR}/python-2.7.10-system-libffi.patch"
90
		"${WORKDIR}/${PATCHSET}"
102 91
	)
103 92

  
104 93
	default
......
118 107
}
119 108

  
120 109
src_configure() {
121
		# dbm module can be linked against berkdb or gdbm.
122
		# Defaults to gdbm when both are enabled, #204343.
123
		local disable
124
		use berkdb   || use gdbm || disable+=" dbm"
125
		use berkdb   || disable+=" _bsddb"
126
		# disable automagic bluetooth headers detection
127
		use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no
128
		use gdbm     || disable+=" gdbm"
129
		use ncurses  || disable+=" _curses _curses_panel"
130
		use readline || disable+=" readline"
131
		use sqlite   || disable+=" _sqlite3"
132
		use ssl      || export PYTHON_DISABLE_SSL="1"
133
		use tk       || disable+=" _tkinter"
134
		use xml      || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
135
		export PYTHON_DISABLE_MODULES="${disable}"
136

  
137
		if ! use xml; then
138
			ewarn "You have configured Python without XML support."
139
			ewarn "This is NOT a recommended configuration as you"
140
			ewarn "may face problems parsing any XML documents."
141
		fi
110
	# dbm module can be linked against berkdb or gdbm.
111
	# Defaults to gdbm when both are enabled, #204343.
112
	local disable
113
	use berkdb    || use gdbm || disable+=" dbm"
114
	use berkdb    || disable+=" _bsddb"
115
	# disable automagic bluetooth headers detection
116
	use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no
117
	use gdbm      || disable+=" gdbm"
118
	use ncurses   || disable+=" _curses _curses_panel"
119
	use readline  || disable+=" readline"
120
	use sqlite    || disable+=" _sqlite3"
121
	use ssl       || export PYTHON_DISABLE_SSL="1"
122
	use tk        || disable+=" _tkinter"
123
	use xml       || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
124
	export PYTHON_DISABLE_MODULES="${disable}"
125

  
126
	if ! use xml; then
127
		ewarn "You have configured Python without XML support."
128
		ewarn "This is NOT a recommended configuration as you"
129
		ewarn "may face problems parsing any XML documents."
130
	fi
142 131

  
143 132
	if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
144 133
		einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
......
203 192
		--without-ensurepip
204 193
	)
205 194

  
206
	OPT= econf "${myeconfargs[@]}"
195
	OPT="" econf "${myeconfargs[@]}"
207 196

  
208 197
	if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
209 198
		eerror "configure has detected that the sem_open function is broken."
......
213 202
}
214 203

  
215 204
src_compile() {
205
	# Ensure sed works as expected
206
	# https://bugs.gentoo.org/594768
207
	local -x LC_ALL=C
208

  
216 209
	# Avoid invoking pgen for cross-compiles.
217 210
	touch Include/graminit.h Python/graminit.c
218 211

  
......
262 255
	done
263 256

  
264 257
	elog "If you would like to run them, you may:"
265
	elog "cd '${EPREFIX}/usr/$(get_libdir)/python${SLOT}/test'"
258
	elog "cd '${EPREFIX}/usr/$(get_libdir)/python${PYVER}/test'"
266 259
	elog "and run the tests separately."
267 260

  
268
	if [[ "${result}" -ne 0 ]]; then
261
	if [[ ${result} -ne 0 ]]; then
269 262
		die "emake test failed"
270 263
	fi
271 264
}
272 265

  
273 266
src_install() {
274
	local libdir=${ED}/usr/$(get_libdir)/python${SLOT}
267
	local libdir=${ED}/usr/$(get_libdir)/python${PYVER}
275 268

  
276 269
	emake DESTDIR="${D}" altinstall
277 270

  
278
	sed -e "s/\(LDFLAGS=\).*/\1/" -i "${libdir}/config/Makefile" || die "sed failed"
271
	sed -e "s/\(LDFLAGS=\).*/\1/" -i "${libdir}/config/Makefile" || die
279 272

  
280 273
	# Fix collisions between different slots of Python.
281
	mv "${ED}usr/bin/2to3" "${ED}usr/bin/2to3-${SLOT}"
282
	mv "${ED}usr/bin/pydoc" "${ED}usr/bin/pydoc${SLOT}"
283
	mv "${ED}usr/bin/idle" "${ED}usr/bin/idle${SLOT}"
284
	rm -f "${ED}usr/bin/smtpd.py"
274
	mv "${ED}/usr/bin/2to3" "${ED}/usr/bin/2to3-${PYVER}" || die
275
	mv "${ED}/usr/bin/pydoc" "${ED}/usr/bin/pydoc${PYVER}" || die
276
	mv "${ED}/usr/bin/idle" "${ED}/usr/bin/idle${PYVER}" || die
277
	rm "${ED}/usr/bin/smtpd.py" || die
285 278

  
286 279
	use berkdb || rm -r "${libdir}/"{bsddb,dbhash.py*,test/test_bsddb*} || die
287 280
	use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
288
	use tk || rm -r "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,lib-tk} || die
281
	use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,lib-tk} || die
289 282
	use elibc_uclibc && rm -fr "${libdir}/"{bsddb/test,test}
290 283

  
291 284
	use threads || rm -r "${libdir}/multiprocessing" || die
292
	use wininst || rm -r "${libdir}/distutils/command/"wininst-*.exe || die
285
	use wininst || rm "${libdir}/distutils/command/"wininst-*.exe || die
293 286

  
294
	dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS}
287
	dodoc Misc/{ACKS,HISTORY,NEWS}
295 288

  
296 289
	if use examples; then
297 290
		docinto examples
298
		dodoc -r "${S}"/Tools
291
		dodoc -r Tools
299 292
	fi
300 293
	insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
301 294
	local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
302 295
		emake --no-print-directory -s -f - 2>/dev/null)
303 296
	newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
304 297

  
305
	newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT}
306
	newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT}
298
	newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
299
	newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
307 300
	sed \
308
		-e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \
309
		-e "s:@PYDOC@:pydoc${SLOT}:" \
310
		-i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed"
301
		-e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
302
		-e "s:@PYDOC@:pydoc${PYVER}:" \
303
		-i "${ED}/etc/conf.d/pydoc-${PYVER}" \
304
		"${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed"
311 305

  
312 306
	# for python-exec
313 307
	local vars=( EPYTHON PYTHON_SITEDIR PYTHON_SCRIPTDIR )
......
320 314
		vars=( PYTHON "${vars[@]}" )
321 315
	fi
322 316

  
323
	python_export "python${SLOT}" "${vars[@]}"
317
	python_export "python${PYVER}" "${vars[@]}"
324 318
	echo "EPYTHON='${EPYTHON}'" > epython.py || die
325 319
	python_domodule epython.py
326 320

  
327 321
	# python-exec wrapping support
328
	local pymajor=${SLOT%.*}
322
	local pymajor=${PYVER%.*}
329 323
	mkdir -p "${D}${PYTHON_SCRIPTDIR}" || die
330 324
	# python and pythonX
331
	ln -s "../../../bin/python${SLOT}" "${D}${PYTHON_SCRIPTDIR}/python${pymajor}" || die
325
	ln -s "../../../bin/python${PYVER}" \
326
		"${D}${PYTHON_SCRIPTDIR}/python${pymajor}" || die
332 327
	ln -s "python${pymajor}" "${D}${PYTHON_SCRIPTDIR}/python" || die
333 328
	# python-config and pythonX-config
334
	ln -s "../../../bin/python${SLOT}-config" "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die
335
	ln -s "python${pymajor}-config" "${D}${PYTHON_SCRIPTDIR}/python-config" || die
329
	ln -s "../../../bin/python${PYVER}-config" \
330
		"${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die
331
	ln -s "python${pymajor}-config" \
332
		"${D}${PYTHON_SCRIPTDIR}/python-config" || die
336 333
	# 2to3, pydoc, pyvenv
337
	ln -s "../../../bin/2to3-${SLOT}" "${D}${PYTHON_SCRIPTDIR}/2to3" || die
338
	ln -s "../../../bin/pydoc${SLOT}" "${D}${PYTHON_SCRIPTDIR}/pydoc" || die
334
	ln -s "../../../bin/2to3-${PYVER}" \
335
		"${D}${PYTHON_SCRIPTDIR}/2to3" || die
336
	ln -s "../../../bin/pydoc${PYVER}" \
337
		"${D}${PYTHON_SCRIPTDIR}/pydoc" || die
339 338
	# idle
340 339
	if use tk; then
341
		ln -s "../../../bin/idle${SLOT}" "${D}${PYTHON_SCRIPTDIR}/idle" || die
340
		ln -s "../../../bin/idle${PYVER}" \
341
			"${D}${PYTHON_SCRIPTDIR}/idle" || die
342 342
	fi
343 343
}
344 344

  
345 345
eselect_python_update() {
346
	if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
346
	if [[ -z "$(eselect python show)" || \
347
			! -f "${EROOT}/usr/bin/$(eselect python show)" ]]; then
347 348
		eselect python update
348 349
	fi
349 350

  
350
	if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
351
	if [[ -z "$(eselect python show --python${PV%%.*})" || \
352
			! -f "${EROOT}/usr/bin/$(eselect python show --python${PV%%.*})" ]]
353
	then
351 354
		eselect python update --python${PV%%.*}
352 355
	fi
353 356
}
Thank you!