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