Gentoo Archives: gentoo-commits

From: Mike Gilbert <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/python/
Date: Sun, 03 Mar 2019 16:52:13
Message-Id: 1551631860.27d42c807129ca0a9bb9351426d3fefe99e416e6.floppym@gentoo
1 commit: 27d42c807129ca0a9bb9351426d3fefe99e416e6
2 Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
3 AuthorDate: Sun Mar 3 15:44:07 2019 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Sun Mar 3 16:51:00 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=27d42c80
7
8 dev-lang/python: bump to 3.7.2
9
10 Bug: https://bugs.gentoo.org/671590
11 Package-Manager: Portage-2.3.59_p2, Repoman-2.3.12_p67
12 Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
13
14 dev-lang/python/Manifest | 2 +
15 dev-lang/python/python-3.7.2.ebuild | 324 ++++++++++++++++++++++++++++++++++++
16 2 files changed, 326 insertions(+)
17
18 diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
19 index e280e2dba6b..cdfd2498cea 100644
20 --- a/dev-lang/python/Manifest
21 +++ b/dev-lang/python/Manifest
22 @@ -9,6 +9,7 @@ DIST Python-3.6.4.tar.xz 16992824 BLAKE2B 2347a70bb25468221178b1542ddd4376f136a5
23 DIST Python-3.6.5.tar.xz 17049912 BLAKE2B f393e9563a18a46c457afcd2e174d9eacda20fe2b0ae5461e11c582fa4d27b85c01bbe7b602f45511b6b44f635c6330205b12fb3e8325ffd07e87b78a8258889 SHA512 6b26fcd296b9bd8e67861eff10d14db7507711ddba947288d16d6def53135c39326b7f969c04bb2b2993f924d9e7ad3f5c5282a3915760bc0885cf0a8ea5eb51
24 DIST Python-3.6.6.tar.xz 17156744 BLAKE2B fa4333149f84570cc4a0d1ec76c819610888750a51268b9db7d05df7d9c11e5ed72daff5d81b404015d9c678cb034d8a32034262ce73629ee8f96772853a706c SHA512 c71f87c5906e770322a14cacad228655659f782207db826320449d12bf86091c3662f317e1773158dec52f8b052eaedfb4c03b561cc2a6cfcd381597fd2d2b04
25 DIST Python-3.7.0.tar.xz 16922100 BLAKE2B cd2afd9ad1847ca793bc64ecb637906c35e0c8da8392d626cce3ebf19be5ccde1e6dcc499b933359cb24dcdbd024b3aaa916f96ed893b1f52d9825e404f27e5f SHA512 8bb11233fb67ee9ab8ed1b72f8fdc62f66e26a6beaaeb92448bce681cf065269833b1658d3ed2459127f25ba43adb0eab73cf27c59834a2a803fb529b4216739
26 +DIST Python-3.7.2.tar.xz 17042320 BLAKE2B 79b06b7d38590b7ad00850a4323156bfee07c4cf8531cbc09d262c6eb38721e32b8b0591fc21017e56948dd81763e9061f118f204eda5b9cc0b84e7132b42979 SHA512 6cd2d6d8455558783b99d55985cd7b22d67b98f41a09b4fdd96f680a630a4e035220d2b903f8c59ed513aa5ffe6730fa947ddb55bb72ce36f0e945ef8af5d971
27 DIST python-gentoo-patches-2.7.15.tar.xz 16208 BLAKE2B 5739c2b3a236d48f8e33f0fe6515bfe7a8f99096f6223b402653988feac2513d37d26b6e40e5e049852f42657358170e468ca60097e0e2294e760787c12ad591 SHA512 687fd008d1d41b1e65ce5417f6f6aba84ffd42f7af44ef97c03a7806b28e6888f8df043a0c15187a8b229cc17642853e6feb25494db97f4d10f8a66f8ebcbcca
28 DIST python-gentoo-patches-3.4.5-0.tar.xz 12044 BLAKE2B 7fb3cc7dcd987debd5aa263d8e26b21aad439d8e3177c06c3683406a53bbda9652175673b09b6300f6a5b62148190cd8a75c9b65a5de04d770866733fcc0ebcb SHA512 108a4845667ecdf4001fcbeffab0cfbbac87439a449a7351428b0f3e2f159e3848ee0c0dfa45c9fba893b9f9584b33722fc8bb0bd7485a1d0909c3a35ede6ed8
29 DIST python-gentoo-patches-3.4.6-0.tar.xz 11728 BLAKE2B 2a636f5500f4c7d354f421133f086cba9a25c30d5feaaa2dc25c9c588125d7c9097baecaa11f31548fa598b5dc137ca310ad86222510c0a955fa632a6d0a4b06 SHA512 41c22dc8f1db8800fc0b97eed2b27bf1873e5de1369bd4aecf7a7a91e609a78e45a4b56fc89d575317f33a7704c0c1cad1494e8a993415a198f256e8338f49ab
30 @@ -17,3 +18,4 @@ DIST python-gentoo-patches-3.6.2-0.tar.xz 10744 BLAKE2B 3075754627617ac2ceee879e
31 DIST python-gentoo-patches-3.6.4.tar.xz 12888 BLAKE2B 7cf49ae22df53e855f2e99df51686b5d4bd0da82ef4c22836e24726ea9ed561808352c0305a5659b052d38b843f1ff61b6466a7bc3673b7e5cfb4d81d22fa4bc SHA512 90a1b685f2539872ffd67f96581f70145b7afaf18af19f4a7f4a61214103d2a10bf0069c1769dac229ae011fceaf8538f041082b33c1671905246d018d184dd7
32 DIST python-gentoo-patches-3.6.6.tar.xz 13876 BLAKE2B 4be56b54e70c9b83209734097e03a7dbaa8f46ae13e268fc6a7f465ffd052ce03ca9e1fc45f1d432f2de17d4ce16ca8bc684b24344862cd8f52f9d1a90d90b7a SHA512 534b9eaefcbc45908119852a103bf10e400a8628c66aa599812fbceda36810d626d33e6701d1b7866e4df68397f717df6a217cb414049ca6f378eff9f43a27ab
33 DIST python-gentoo-patches-3.7.0.tar.xz 12268 BLAKE2B 758b635ff53b6f7bfabb1db632ee2a5c14b163d6d6f14e4e44c31c9ac1591d411f597d42b05707f586f9ff7c3a030703502307bae732bcf003987939eb5b036d SHA512 19dd5bac06bb40622e74e3b16c7fba83f1178417e686eaf61b2b207602c76beebc8c78d675e401ec4d18add1ca033fd47baf2e48e9abb487593b7d821bcaf509
34 +DIST python-gentoo-patches-3.7.2.tar.xz 9776 BLAKE2B fe451c3fb44a1ace4489d1bc68db9848b4227422fe9135659594248d057a8916e2abfe8e2677ef6efc9c962dbefe3ca7cd05cbd62b325d53eef6b05928f82017 SHA512 55e932624333b78b55e8981aaa7e7bfbddb635a61f594353a77a6bd5c2b57de31a4ee9ae04e072c4e2eb0fddd1c2702b4bd6133cf0a2c94ab35808df86550156
35
36 diff --git a/dev-lang/python/python-3.7.2.ebuild b/dev-lang/python/python-3.7.2.ebuild
37 new file mode 100644
38 index 00000000000..d962144e24d
39 --- /dev/null
40 +++ b/dev-lang/python/python-3.7.2.ebuild
41 @@ -0,0 +1,324 @@
42 +# Copyright 1999-2019 Gentoo Authors
43 +# Distributed under the terms of the GNU General Public License v2
44 +
45 +EAPI="6"
46 +WANT_LIBTOOL="none"
47 +
48 +inherit autotools flag-o-matic pax-utils python-utils-r1 toolchain-funcs
49 +
50 +MY_P="Python-${PV}"
51 +PATCHSET_VERSION="3.7.2"
52 +
53 +DESCRIPTION="An interpreted, interactive, object-oriented programming language"
54 +HOMEPAGE="https://www.python.org/"
55 +SRC_URI="https://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz
56 + https://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz"
57 +
58 +LICENSE="PSF-2"
59 +SLOT="3.7/3.7m"
60 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
61 +IUSE="bluetooth build examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl test tk wininst +xml"
62 +RESTRICT="!test? ( test )"
63 +
64 +# Do not add a dependency on dev-lang/python to this ebuild.
65 +# If you need to apply a patch which requires python for bootstrapping, please
66 +# run the bootstrap code on your dev box and include the results in the
67 +# patchset. See bug 447752.
68 +
69 +RDEPEND="app-arch/bzip2:0=
70 + app-arch/xz-utils:0=
71 + >=sys-libs/zlib-1.1.3:0=
72 + virtual/libffi:=
73 + virtual/libintl
74 + gdbm? ( sys-libs/gdbm:0=[berkdb] )
75 + ncurses? ( >=sys-libs/ncurses-5.2:0= )
76 + readline? ( >=sys-libs/readline-4.1:0= )
77 + sqlite? ( >=dev-db/sqlite-3.3.8:3= )
78 + ssl? (
79 + !libressl? ( dev-libs/openssl:0= )
80 + libressl? ( dev-libs/libressl:0= )
81 + )
82 + tk? (
83 + >=dev-lang/tcl-8.0:0=
84 + >=dev-lang/tk-8.0:0=
85 + dev-tcltk/blt:0=
86 + dev-tcltk/tix
87 + )
88 + xml? ( >=dev-libs/expat-2.1:0= )
89 + !!<sys-apps/sandbox-2.6-r1"
90 +# bluetooth requires headers from bluez
91 +DEPEND="${RDEPEND}
92 + bluetooth? ( net-wireless/bluez )
93 + test? ( app-arch/xz-utils[extra-filters(+)] )
94 + virtual/pkgconfig
95 + !sys-devel/gcc[libffi(-)]"
96 +RDEPEND+=" !build? ( app-misc/mime-types )"
97 +PDEPEND=">=app-eselect/eselect-python-20140125-r1"
98 +
99 +S="${WORKDIR}/${MY_P}"
100 +PYVER=${SLOT%/*}
101 +
102 +src_prepare() {
103 + # Ensure that internal copies of expat, libffi and zlib are not used.
104 + rm -fr Modules/expat
105 + rm -fr Modules/_ctypes/libffi*
106 + rm -fr Modules/zlib
107 +
108 + local PATCHES=(
109 + "${WORKDIR}/patches"
110 + )
111 +
112 + default
113 +
114 + sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
115 + setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
116 +
117 + eautoreconf
118 +}
119 +
120 +src_configure() {
121 + local disable
122 + # disable automagic bluetooth headers detection
123 + use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no
124 + use gdbm || disable+=" gdbm"
125 + use ncurses || disable+=" _curses _curses_panel"
126 + use readline || disable+=" readline"
127 + use sqlite || disable+=" _sqlite3"
128 + use ssl || export PYTHON_DISABLE_SSL="1"
129 + use tk || disable+=" _tkinter"
130 + use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
131 + export PYTHON_DISABLE_MODULES="${disable}"
132 +
133 + if ! use xml; then
134 + ewarn "You have configured Python without XML support."
135 + ewarn "This is NOT a recommended configuration as you"
136 + ewarn "may face problems parsing any XML documents."
137 + fi
138 +
139 + if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
140 + einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
141 + fi
142 +
143 + if [[ "$(gcc-major-version)" -ge 4 ]]; then
144 + append-flags -fwrapv
145 + fi
146 +
147 + filter-flags -malign-double
148 +
149 + # https://bugs.gentoo.org/show_bug.cgi?id=50309
150 + if is-flagq -O3; then
151 + is-flagq -fstack-protector-all && replace-flags -O3 -O2
152 + use hardened && replace-flags -O3 -O2
153 + fi
154 +
155 + # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
156 + tc-export CXX
157 +
158 + # Set LDFLAGS so we link modules with -lpython3.2 correctly.
159 + # Needed on FreeBSD unless Python 3.2 is already installed.
160 + # Please query BSD team before removing this!
161 + append-ldflags "-L."
162 +
163 + local dbmliborder
164 + if use gdbm; then
165 + dbmliborder+="${dbmliborder:+:}gdbm"
166 + fi
167 +
168 + local myeconfargs=(
169 + --enable-shared
170 + $(use_enable ipv6)
171 + --infodir='${prefix}/share/info'
172 + --mandir='${prefix}/share/man'
173 + --with-computed-gotos
174 + --with-dbmliborder="${dbmliborder}"
175 + --with-libc=
176 + --enable-loadable-sqlite-extensions
177 + --without-ensurepip
178 + --with-system-expat
179 + --with-system-ffi
180 + )
181 +
182 + OPT="" econf "${myeconfargs[@]}"
183 +}
184 +
185 +src_compile() {
186 + # Ensure sed works as expected
187 + # https://bugs.gentoo.org/594768
188 + local -x LC_ALL=C
189 +
190 + emake CPPFLAGS= CFLAGS= LDFLAGS=
191 +
192 + # Work around bug 329499. See also bug 413751 and 457194.
193 + if has_version dev-libs/libffi[pax_kernel]; then
194 + pax-mark E python
195 + else
196 + pax-mark m python
197 + fi
198 +}
199 +
200 +src_test() {
201 + # Tests will not work when cross compiling.
202 + if tc-is-cross-compiler; then
203 + elog "Disabling tests due to crosscompiling."
204 + return
205 + fi
206 +
207 + # Skip failing tests.
208 + local skipped_tests="gdb"
209 +
210 + for test in ${skipped_tests}; do
211 + mv "${S}"/Lib/test/test_${test}.py "${T}"
212 + done
213 +
214 + # bug 660358
215 + local -x COLUMNS=80
216 +
217 + local -x PYTHONDONTWRITEBYTECODE=
218 +
219 + emake test EXTRATESTOPTS="-u-network" CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
220 + local result=$?
221 +
222 + for test in ${skipped_tests}; do
223 + mv "${T}/test_${test}.py" "${S}"/Lib/test
224 + done
225 +
226 + elog "The following tests have been skipped:"
227 + for test in ${skipped_tests}; do
228 + elog "test_${test}.py"
229 + done
230 +
231 + elog "If you would like to run them, you may:"
232 + elog "cd '${EPREFIX}/usr/lib/python${PYVER}/test'"
233 + elog "and run the tests separately."
234 +
235 + if [[ ${result} -ne 0 ]]; then
236 + die "emake test failed"
237 + fi
238 +}
239 +
240 +src_install() {
241 + local libdir=${ED%/}/usr/lib/python${PYVER}
242 +
243 + emake DESTDIR="${D}" altinstall
244 +
245 + sed \
246 + -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \
247 + -e "s/\(PY_LDFLAGS=\).*/\1/" \
248 + -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed"
249 +
250 + # Fix collisions between different slots of Python.
251 + rm -f "${ED%/}/usr/$(get_libdir)/libpython3.so"
252 +
253 + # Cheap hack to get version with ABIFLAGS
254 + local abiver=$(cd "${ED%/}/usr/include"; echo python*)
255 + if [[ ${abiver} != python${PYVER} ]]; then
256 + # Replace python3.X with a symlink to python3.Xm
257 + rm "${ED%/}/usr/bin/python${PYVER}" || die
258 + dosym "${abiver}" "/usr/bin/python${PYVER}"
259 + # Create python3.X-config symlink
260 + dosym "${abiver}-config" "/usr/bin/python${PYVER}-config"
261 + # Create python-3.5m.pc symlink
262 + dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc"
263 + fi
264 +
265 + # python seems to get rebuilt in src_install (bug 569908)
266 + # Work around it for now.
267 + if has_version dev-libs/libffi[pax_kernel]; then
268 + pax-mark E "${ED%/}/usr/bin/${abiver}"
269 + else
270 + pax-mark m "${ED%/}/usr/bin/${abiver}"
271 + fi
272 +
273 + use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
274 + use tk || rm -r "${ED%/}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
275 +
276 + use wininst || rm "${libdir}/distutils/command/"wininst-*.exe || die
277 +
278 + dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS}
279 +
280 + if use examples; then
281 + insinto /usr/share/doc/${PF}/examples
282 + find "${S}"/Tools -name __pycache__ -print0 | xargs -0 rm -fr
283 + doins -r "${S}"/Tools
284 + fi
285 + insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
286 + local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
287 + emake --no-print-directory -s -f - 2>/dev/null)
288 + newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
289 +
290 + newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
291 + newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
292 + sed \
293 + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
294 + -e "s:@PYDOC@:pydoc${PYVER}:" \
295 + -i "${ED%/}/etc/conf.d/pydoc-${PYVER}" "${ED%/}/etc/init.d/pydoc-${PYVER}" || die "sed failed"
296 +
297 + # for python-exec
298 + local vars=( EPYTHON PYTHON_SITEDIR PYTHON_SCRIPTDIR )
299 +
300 + # if not using a cross-compiler, use the fresh binary
301 + if ! tc-is-cross-compiler; then
302 + local -x PYTHON=./python
303 + local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD}
304 + else
305 + vars=( PYTHON "${vars[@]}" )
306 + fi
307 +
308 + python_export "python${PYVER}" "${vars[@]}"
309 + echo "EPYTHON='${EPYTHON}'" > epython.py || die
310 + python_domodule epython.py
311 +
312 + # python-exec wrapping support
313 + local pymajor=${PYVER%.*}
314 + mkdir -p "${D%/}${PYTHON_SCRIPTDIR}" || die
315 + # python and pythonX
316 + ln -s "../../../bin/${abiver}" "${D%/}${PYTHON_SCRIPTDIR}/python${pymajor}" || die
317 + ln -s "python${pymajor}" "${D%/}${PYTHON_SCRIPTDIR}/python" || die
318 + # python-config and pythonX-config
319 + # note: we need to create a wrapper rather than symlinking it due
320 + # to some random dirname(argv[0]) magic performed by python-config
321 + cat > "${D%/}${PYTHON_SCRIPTDIR}/python${pymajor}-config" <<-EOF || die
322 + #!/bin/sh
323 + exec "${abiver}-config" "\${@}"
324 + EOF
325 + chmod +x "${D%/}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die
326 + ln -s "python${pymajor}-config" "${D%/}${PYTHON_SCRIPTDIR}/python-config" || die
327 + # 2to3, pydoc, pyvenv
328 + ln -s "../../../bin/2to3-${PYVER}" "${D%/}${PYTHON_SCRIPTDIR}/2to3" || die
329 + ln -s "../../../bin/pydoc${PYVER}" "${D%/}${PYTHON_SCRIPTDIR}/pydoc" || die
330 + ln -s "../../../bin/pyvenv-${PYVER}" "${D%/}${PYTHON_SCRIPTDIR}/pyvenv" || die
331 + # idle
332 + if use tk; then
333 + ln -s "../../../bin/idle${PYVER}" "${D%/}${PYTHON_SCRIPTDIR}/idle" || die
334 + fi
335 +}
336 +
337 +pkg_preinst() {
338 + if has_version "<${CATEGORY}/${PN}-${PYVER}" && ! has_version ">=${CATEGORY}/${PN}-${PYVER}_alpha"; then
339 + python_updater_warning="1"
340 + fi
341 +}
342 +
343 +eselect_python_update() {
344 + if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
345 + eselect python update
346 + fi
347 +
348 + if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
349 + eselect python update --python${PV%%.*}
350 + fi
351 +}
352 +
353 +pkg_postinst() {
354 + eselect_python_update
355 +
356 + if [[ "${python_updater_warning}" == "1" ]]; then
357 + ewarn "You have just upgraded from an older version of Python."
358 + ewarn
359 + ewarn "Please adjust PYTHON_TARGETS (if so desired), and run emerge with the --newuse or --changed-use option to rebuild packages installing python modules."
360 + fi
361 +}
362 +
363 +pkg_postrm() {
364 + eselect_python_update
365 +}