1 |
commit: c8ae4ab9c1cc9eddc47acdf363fe2743fd1dbc2a |
2 |
Author: Mike Gilbert <floppym <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Dec 4 16:17:59 2017 +0000 |
4 |
Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Dec 4 16:20:43 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c8ae4ab9 |
7 |
|
8 |
dev-lang/python: disable nis for 3.4.5 |
9 |
|
10 |
Package-Manager: Portage-2.3.15, Repoman-2.3.6_p7 |
11 |
|
12 |
dev-lang/python/python-3.4.5-r1.ebuild | 358 +++++++++++++++++++++++++++++++++ |
13 |
1 file changed, 358 insertions(+) |
14 |
|
15 |
diff --git a/dev-lang/python/python-3.4.5-r1.ebuild b/dev-lang/python/python-3.4.5-r1.ebuild |
16 |
new file mode 100644 |
17 |
index 00000000000..bb01c7623e5 |
18 |
--- /dev/null |
19 |
+++ b/dev-lang/python/python-3.4.5-r1.ebuild |
20 |
@@ -0,0 +1,358 @@ |
21 |
+# Copyright 1999-2017 Gentoo Foundation |
22 |
+# Distributed under the terms of the GNU General Public License v2 |
23 |
+ |
24 |
+EAPI="5" |
25 |
+WANT_LIBTOOL="none" |
26 |
+ |
27 |
+inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs multiprocessing |
28 |
+ |
29 |
+MY_P="Python-${PV/_/}" |
30 |
+PATCHSET_VERSION="3.4.5-0" |
31 |
+ |
32 |
+DESCRIPTION="An interpreted, interactive, object-oriented programming language" |
33 |
+HOMEPAGE="https://www.python.org/" |
34 |
+SRC_URI="https://www.python.org/ftp/python/${PV%_rc*}/${MY_P}.tar.xz |
35 |
+ https://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz" |
36 |
+ |
37 |
+LICENSE="PSF-2" |
38 |
+SLOT="3.4/3.4m" |
39 |
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd" |
40 |
+IUSE="build elibc_uclibc examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl +threads tk wininst +xml" |
41 |
+ |
42 |
+# Do not add a dependency on dev-lang/python to this ebuild. |
43 |
+# If you need to apply a patch which requires python for bootstrapping, please |
44 |
+# run the bootstrap code on your dev box and include the results in the |
45 |
+# patchset. See bug 447752. |
46 |
+ |
47 |
+RDEPEND="app-arch/bzip2:0= |
48 |
+ app-arch/xz-utils:0= |
49 |
+ >=sys-libs/zlib-1.1.3:0= |
50 |
+ virtual/libffi |
51 |
+ virtual/libintl |
52 |
+ gdbm? ( sys-libs/gdbm:0=[berkdb] ) |
53 |
+ ncurses? ( |
54 |
+ >=sys-libs/ncurses-5.2:0= |
55 |
+ readline? ( >=sys-libs/readline-4.1:0= ) |
56 |
+ ) |
57 |
+ sqlite? ( >=dev-db/sqlite-3.3.8:3= ) |
58 |
+ ssl? ( |
59 |
+ !libressl? ( dev-libs/openssl:0= ) |
60 |
+ libressl? ( dev-libs/libressl:= ) |
61 |
+ ) |
62 |
+ tk? ( |
63 |
+ >=dev-lang/tcl-8.0:0= |
64 |
+ >=dev-lang/tk-8.0:0= |
65 |
+ dev-tcltk/blt:0= |
66 |
+ dev-tcltk/tix |
67 |
+ ) |
68 |
+ xml? ( >=dev-libs/expat-2.1:0= ) |
69 |
+ !!<sys-apps/sandbox-2.6-r1" |
70 |
+DEPEND="${RDEPEND} |
71 |
+ virtual/pkgconfig |
72 |
+ >=sys-devel/autoconf-2.65 |
73 |
+ !sys-devel/gcc[libffi(-)]" |
74 |
+RDEPEND+=" !build? ( app-misc/mime-types )" |
75 |
+PDEPEND=">=app-eselect/eselect-python-20140125-r1" |
76 |
+ |
77 |
+S="${WORKDIR}/${MY_P}" |
78 |
+ |
79 |
+PYVER=${SLOT%/*} |
80 |
+ |
81 |
+src_prepare() { |
82 |
+ # Ensure that internal copies of expat, libffi and zlib are not used. |
83 |
+ rm -fr Modules/expat |
84 |
+ rm -fr Modules/_ctypes/libffi* |
85 |
+ rm -fr Modules/zlib |
86 |
+ |
87 |
+ if tc-is-cross-compiler; then |
88 |
+ # Invokes BUILDPYTHON, which is built for the host arch |
89 |
+ local EPATCH_EXCLUDE="*_regenerate_platform-specific_modules.patch" |
90 |
+ fi |
91 |
+ |
92 |
+ EPATCH_SUFFIX="patch" epatch "${WORKDIR}/patches" |
93 |
+ epatch "${FILESDIR}/${PN}-3.4.3-ncurses-pkg-config.patch" |
94 |
+ epatch "${FILESDIR}/${PN}-3.4.5-cross.patch" |
95 |
+ epatch "${FILESDIR}/3.4-getentropy-linux.patch" |
96 |
+ epatch "${FILESDIR}/3.6-disable-nis.patch" |
97 |
+ |
98 |
+ epatch_user |
99 |
+ |
100 |
+ sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ |
101 |
+ configure.ac \ |
102 |
+ Lib/distutils/command/install.py \ |
103 |
+ Lib/distutils/sysconfig.py \ |
104 |
+ Lib/site.py \ |
105 |
+ Lib/sysconfig.py \ |
106 |
+ Lib/test/test_site.py \ |
107 |
+ Makefile.pre.in \ |
108 |
+ Modules/Setup.dist \ |
109 |
+ Modules/getpath.c \ |
110 |
+ setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@" |
111 |
+ |
112 |
+ eautoreconf |
113 |
+} |
114 |
+ |
115 |
+src_configure() { |
116 |
+ local disable |
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 |
131 |
+ |
132 |
+ if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then |
133 |
+ einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}" |
134 |
+ fi |
135 |
+ |
136 |
+ if [[ "$(gcc-major-version)" -ge 4 ]]; then |
137 |
+ append-flags -fwrapv |
138 |
+ fi |
139 |
+ |
140 |
+ filter-flags -malign-double |
141 |
+ |
142 |
+ # https://bugs.gentoo.org/show_bug.cgi?id=50309 |
143 |
+ if is-flagq -O3; then |
144 |
+ is-flagq -fstack-protector-all && replace-flags -O3 -O2 |
145 |
+ use hardened && replace-flags -O3 -O2 |
146 |
+ fi |
147 |
+ |
148 |
+ # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. |
149 |
+ tc-export CXX |
150 |
+ |
151 |
+ # The configure script fails to use pkg-config correctly. |
152 |
+ # http://bugs.python.org/issue15506 |
153 |
+ export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG) |
154 |
+ |
155 |
+ # Set LDFLAGS so we link modules with -lpython3.2 correctly. |
156 |
+ # Needed on FreeBSD unless Python 3.2 is already installed. |
157 |
+ # Please query BSD team before removing this! |
158 |
+ append-ldflags "-L." |
159 |
+ |
160 |
+ local dbmliborder |
161 |
+ if use gdbm; then |
162 |
+ dbmliborder+="${dbmliborder:+:}gdbm" |
163 |
+ fi |
164 |
+ |
165 |
+ BUILD_DIR="${WORKDIR}/${CHOST}" |
166 |
+ mkdir -p "${BUILD_DIR}" || die |
167 |
+ cd "${BUILD_DIR}" || die |
168 |
+ |
169 |
+ ECONF_SOURCE="${S}" OPT="" \ |
170 |
+ econf \ |
171 |
+ --with-fpectl \ |
172 |
+ --enable-shared \ |
173 |
+ $(use_enable ipv6) \ |
174 |
+ $(use_with threads) \ |
175 |
+ --infodir='${prefix}/share/info' \ |
176 |
+ --mandir='${prefix}/share/man' \ |
177 |
+ --with-computed-gotos \ |
178 |
+ --with-dbmliborder="${dbmliborder}" \ |
179 |
+ --with-libc="" \ |
180 |
+ --enable-loadable-sqlite-extensions \ |
181 |
+ --with-system-expat \ |
182 |
+ --with-system-ffi \ |
183 |
+ --without-ensurepip |
184 |
+ |
185 |
+ if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then |
186 |
+ eerror "configure has detected that the sem_open function is broken." |
187 |
+ eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777." |
188 |
+ die "Broken sem_open function (bug 496328)" |
189 |
+ fi |
190 |
+} |
191 |
+ |
192 |
+src_compile() { |
193 |
+ # Ensure sed works as expected |
194 |
+ # https://bugs.gentoo.org/594768 |
195 |
+ local -x LC_ALL=C |
196 |
+ |
197 |
+ # Avoid invoking pgen for cross-compiles. |
198 |
+ touch Include/graminit.h Python/graminit.c || die |
199 |
+ |
200 |
+ cd "${BUILD_DIR}" || die |
201 |
+ |
202 |
+ emake CPPFLAGS= CFLAGS= LDFLAGS= |
203 |
+ |
204 |
+ # Work around bug 329499. See also bug 413751 and 457194. |
205 |
+ if has_version dev-libs/libffi[pax_kernel]; then |
206 |
+ pax-mark E python |
207 |
+ else |
208 |
+ pax-mark m python |
209 |
+ fi |
210 |
+} |
211 |
+ |
212 |
+src_test() { |
213 |
+ # Tests will not work when cross compiling. |
214 |
+ if tc-is-cross-compiler; then |
215 |
+ elog "Disabling tests due to crosscompiling." |
216 |
+ return |
217 |
+ fi |
218 |
+ |
219 |
+ cd "${BUILD_DIR}" || die |
220 |
+ |
221 |
+ # Skip failing tests. |
222 |
+ local skipped_tests="gdb" |
223 |
+ |
224 |
+ for test in ${skipped_tests}; do |
225 |
+ mv "${S}"/Lib/test/test_${test}.py "${T}" |
226 |
+ done |
227 |
+ |
228 |
+ local -x PYTHONDONTWRITEBYTECODE= |
229 |
+ emake test EXTRATESTOPTS="-u-network" CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty |
230 |
+ local result=$? |
231 |
+ |
232 |
+ for test in ${skipped_tests}; do |
233 |
+ mv "${T}/test_${test}.py" "${S}"/Lib/test |
234 |
+ done |
235 |
+ |
236 |
+ elog "The following tests have been skipped:" |
237 |
+ for test in ${skipped_tests}; do |
238 |
+ elog "test_${test}.py" |
239 |
+ done |
240 |
+ |
241 |
+ elog "If you would like to run them, you may:" |
242 |
+ elog "cd '${EPREFIX}/usr/$(get_libdir)/python${PYVER}/test'" |
243 |
+ elog "and run the tests separately." |
244 |
+ |
245 |
+ if [[ ${result} -ne 0 ]]; then |
246 |
+ die "emake test failed" |
247 |
+ fi |
248 |
+} |
249 |
+ |
250 |
+src_install() { |
251 |
+ local libdir=${ED}/usr/$(get_libdir)/python${PYVER} |
252 |
+ |
253 |
+ cd "${BUILD_DIR}" || die |
254 |
+ |
255 |
+ emake DESTDIR="${D}" altinstall |
256 |
+ |
257 |
+ sed \ |
258 |
+ -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \ |
259 |
+ -e "s/\(PY_LDFLAGS=\).*/\1/" \ |
260 |
+ -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed" |
261 |
+ |
262 |
+ # Fix collisions between different slots of Python. |
263 |
+ rm -f "${ED}usr/$(get_libdir)/libpython3.so" |
264 |
+ |
265 |
+ # Cheap hack to get version with ABIFLAGS |
266 |
+ local abiver=$(cd "${ED}usr/include"; echo python*) |
267 |
+ if [[ ${abiver} != python${PYVER} ]]; then |
268 |
+ # Replace python3.X with a symlink to python3.Xm |
269 |
+ rm "${ED}usr/bin/python${PYVER}" || die |
270 |
+ dosym "${abiver}" "/usr/bin/python${PYVER}" |
271 |
+ # Create python3.X-config symlink |
272 |
+ dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" |
273 |
+ # Create python-3.5m.pc symlink |
274 |
+ dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" |
275 |
+ fi |
276 |
+ |
277 |
+ use elibc_uclibc && rm -fr "${libdir}/test" |
278 |
+ use sqlite || rm -fr "${libdir}/"{sqlite3,test/test_sqlite*} |
279 |
+ use tk || rm -fr "${ED}usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} |
280 |
+ |
281 |
+ use threads || rm -fr "${libdir}/multiprocessing" |
282 |
+ use wininst || rm -f "${libdir}/distutils/command/"wininst-*.exe |
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}" \ |
323 |
+ "${D}${PYTHON_SCRIPTDIR}/python${pymajor}" || die |
324 |
+ ln -s "python${pymajor}" \ |
325 |
+ "${D}${PYTHON_SCRIPTDIR}/python" || die |
326 |
+ # python-config and pythonX-config |
327 |
+ # note: we need to create a wrapper rather than symlinking it due |
328 |
+ # to some random dirname(argv[0]) magic performed by python-config |
329 |
+ cat > "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" <<-EOF || die |
330 |
+ #!/bin/sh |
331 |
+ exec "${abiver}-config" "\${@}" |
332 |
+ EOF |
333 |
+ chmod +x "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die |
334 |
+ ln -s "python${pymajor}-config" \ |
335 |
+ "${D}${PYTHON_SCRIPTDIR}/python-config" || die |
336 |
+ # 2to3, pydoc, pyvenv |
337 |
+ ln -s "../../../bin/2to3-${PYVER}" \ |
338 |
+ "${D}${PYTHON_SCRIPTDIR}/2to3" || die |
339 |
+ ln -s "../../../bin/pydoc${PYVER}" \ |
340 |
+ "${D}${PYTHON_SCRIPTDIR}/pydoc" || die |
341 |
+ ln -s "../../../bin/pyvenv-${PYVER}" \ |
342 |
+ "${D}${PYTHON_SCRIPTDIR}/pyvenv" || die |
343 |
+ # idle |
344 |
+ if use tk; then |
345 |
+ ln -s "../../../bin/idle${PYVER}" \ |
346 |
+ "${D}${PYTHON_SCRIPTDIR}/idle" || die |
347 |
+ fi |
348 |
+} |
349 |
+ |
350 |
+pkg_preinst() { |
351 |
+ if has_version "<${CATEGORY}/${PN}-${PYVER}" && ! has_version ">=${CATEGORY}/${PN}-${PYVER}_alpha"; then |
352 |
+ python_updater_warning="1" |
353 |
+ fi |
354 |
+} |
355 |
+ |
356 |
+eselect_python_update() { |
357 |
+ if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then |
358 |
+ eselect python update |
359 |
+ fi |
360 |
+ |
361 |
+ if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then |
362 |
+ eselect python update --python${PV%%.*} |
363 |
+ fi |
364 |
+} |
365 |
+ |
366 |
+pkg_postinst() { |
367 |
+ eselect_python_update |
368 |
+ |
369 |
+ if [[ "${python_updater_warning}" == "1" ]]; then |
370 |
+ ewarn "You have just upgraded from an older version of Python." |
371 |
+ ewarn |
372 |
+ ewarn "Please adjust PYTHON_TARGETS (if so desired), and run emerge with the --newuse or --changed-use option to rebuild packages installing python modules." |
373 |
+ fi |
374 |
+} |
375 |
+ |
376 |
+pkg_postrm() { |
377 |
+ eselect_python_update |
378 |
+} |