From c2262f56e55776bf22a3d3e24bb470acc6292264 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Thu, 21 Jan 2021 12:15:41 +0100 Subject: dev-lang/python: cleanup/fix vulnerable non-masked versions - bump 3.8.7-r1, 3.9.1-r1 - remove 3.7.8-r2, 3.8.6-r1 Bug: https://bugs.gentoo.org/766189 Package-Manager: Portage-3.0.12.0.2-prefix, Repoman-3.0.2 Signed-off-by: Fabian Groffen --- dev-lang/python/Manifest | 11 +- dev-lang/python/python-3.7.8-r2.ebuild | 447 --------------------------------- dev-lang/python/python-3.8.6-r1.ebuild | 431 ------------------------------- dev-lang/python/python-3.8.7-r1.ebuild | 390 ++++++++++++++++++++++++++++ dev-lang/python/python-3.8.7.ebuild | 424 ------------------------------- dev-lang/python/python-3.9.1-r1.ebuild | 392 +++++++++++++++++++++++++++++ dev-lang/python/python-3.9.1.ebuild | 392 ----------------------------- 7 files changed, 784 insertions(+), 1703 deletions(-) delete mode 100644 dev-lang/python/python-3.7.8-r2.ebuild delete mode 100644 dev-lang/python/python-3.8.6-r1.ebuild create mode 100644 dev-lang/python/python-3.8.7-r1.ebuild delete mode 100644 dev-lang/python/python-3.8.7.ebuild create mode 100644 dev-lang/python/python-3.9.1-r1.ebuild delete mode 100644 dev-lang/python/python-3.9.1.ebuild (limited to 'dev-lang/python') diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest index 8a7d4980f2..19b6623fb0 100644 --- a/dev-lang/python/Manifest +++ b/dev-lang/python/Manifest @@ -1,17 +1,10 @@ DIST Python-2.7.16.tar.xz 12752104 BLAKE2B 7d6b5b853f9974d44e04dd35ecdffaab87511e183b4b01dd4f8f4ee109c4b4ab208f045708f69717be9d3a706aa078b71438ed482c062c0b89c12730eae074ae SHA512 16e814e8dcffc707b595ca2919bd2fa3db0d15794c63d977364652c4a5b92e90e72b8c9e1cc83b5020398bd90a1b397dbdd7cb931c49f1aa4af6ef95414b43e0 -DIST Python-3.7.8.tar.xz 17399552 BLAKE2B 4bf6c47b1132b6d31a79232002c4d38e2cd123ac05d52b21d6bfba5a4e19ec9130b8df8698d5ce6627e4297c4cf756643f036e694e36364c235306c72ef34bf8 SHA512 d2ba299e3cf8ed0f8fed9317f42bcd8d9af7e0e6175939b4be1be289c1658418bed17899e2608d762ffb15575021956cf6bf2054d7863c04b3bd7642f5b8c7ea -DIST Python-3.8.6.tar.xz 18233864 BLAKE2B c8a8ef6055e344dda30eb808804cfa62016b4f840257cffd5a495e5932f5696e50579d49b8181a487c9cd4a89bdb95656e80981039783a21d20f7980aa2c9883 SHA512 22faec84f6e172e1ac7c6bd6fd37e9b6ae4afc91cf5136aa8cac8ebbed8d18793f9196e8749b8ccc43447cb6c41cb450f65ea72dd363c06dfaeb14e0455f5560 DIST Python-3.8.7.tar.xz 18261096 BLAKE2B 6ac20efef41e828cb796aabcb7808400d494b9b48759950c8c15ee90762394f6763163d8e37ab407c1c79ebb9cda09189eaa969a75f96c86a96ccee962443924 SHA512 6a27d8eab3076930df46b0cf127f9b664f8d4147349b2b98132f464deb7f69d87e0167e8ee8e6c64249125ad73760d965ecbc81c252b63a1e7aac95594c62b74 DIST Python-3.9.1.tar.xz 18897104 BLAKE2B bcbce176510e8e7c6ba6070588bedc52121c21c5271f59b3d629dfb542c51ee62622b2ca53a6e2041f1a51b2d089368cc4de9bb749e8ebad9a2c4eb4de83538e SHA512 b90029d6825751685983e9dcf0e0ec9e46f18e6c7d37b0dd7a245a94316f8c0090308ad7c2b2b49ed2514b0b909177231dd5bcad03031bf4624e37136fcf8019 DIST python-gentoo-patches-2.7.16.tar.xz 13904 BLAKE2B 218b46f8656f4a792dcd47eabca6d59a1558276b77676544991ee75914cd76dda84c36f43e72e477b850dd4cb52374d289f20dccd244a3b52ae5debaf3363432 SHA512 83f90545231c663a34c6925352a357a2b15997ac0362578a1893304c5070b5251922585ae8bc1bafb68d306bcddd4cdba4b6406648d473bd3e980eef65fe3ecd -DIST python-gentoo-patches-3.7.8-r3.tar.xz 13232 BLAKE2B 9df47b1f61d08f62a80221bc48d73ec27cd74a9ade8219912c5b02eaea919b70d91b1154837cd03c0129a5839186e9c970167ca3398129c044c25c7853f1f920 SHA512 e1477d425cb6125ca2286d816f4aa4e9e3c789d6a4f4907bd7b78549598356cae5766f642e2cad9e7c3abe2e82c12cf3cb7db3513be68aa213cb64cc0abc678a -DIST python-gentoo-patches-3.8.6-r1.tar.xz 15880 BLAKE2B 9a08cd23af56bcc2ed0dffe4850698be6e0bcf7c44d3eafeb250e328a93833dc3e9ce084f1be89450d1e123cd72d81c6271edfe34046d1bab3d7c10a98d0d9c5 SHA512 83474915cab0928d1d2f4229832bef7c093b2943770fa900a7445bfaa633544f50791aa8b4bc4191662af56feef166814d98eb6fad2c0a0eb9db1f8f4806e689 -DIST python-gentoo-patches-3.8.6.tar.xz 10956 BLAKE2B e3241d97f886d0a37f85735102db8f00902df59ee12e8501b6c7f549dd4b26a6289bf34ff8dba02b369ed7875fad3d18e177afe9e367db4cb06f2ee908482f9e SHA512 7afa8e54f7b7e6ab35edc16d4214384b8ad8a03068d1984656876d6477b278af931e8c797d03d1bed2f10f9d58ac387db1a43921e54fb17cf4b779f33820abc0 -DIST python-gentoo-patches-3.9.0rc1.tar.xz 8856 BLAKE2B 7bd032dfd047640c6a53633b5b9ee7b24199106b985230f772dda978d3b79fe0406eea64c4a842603a20afb71a90469befa7ec59a5ef1f793e4c901aa85952d1 SHA512 85a7d4397abf2a0f3c3d07a94a3e184ba3dcb347f3b70ee2cb77e81aac63846b01323a0228afd0fd1d32b3cafb64b18f82e6f5bfd88e4d564261ddae11e747eb +DIST python-gentoo-patches-3.8.7-r1.tar.xz 12572 BLAKE2B 7658ae56993674a7f57cb2b6d9f23e9d01fa75f00edcc67dc3474bba0361373555c44d47c155cf9ffcbd8551ff2ae56bc22a25bef1bf6b3efed7314b2824d777 SHA512 76d0e4d18fbeedc28430a3dd1656cfafdfefdae28978baddd3e0102d0fce83be173b58da74203fc6a90cf50c63fa612f0b78e65bc59a41dce4739eead398d352 +DIST python-gentoo-patches-3.9.1-r1.tar.xz 10464 BLAKE2B d69ce207020b7a34eb45c149ce88001167704763fbc373a8d5aff48a1d6337774dfb6c75d477442516b8dceb87b116e6d8cf3231334ced9b03aa970aa0d2e8e1 SHA512 72b1e37b1ceac9a0e95aa63a7dd404c69f60ae7a8aac472b8c17100c873a4d28d3291231643862c9d1cfaf990040f8e780590274314047adee199c159d745369 DIST python-prefix-2.7.16-gentoo-patches-r0.tar.xz 14636 BLAKE2B 54320f5197bb7adeca1e7c97447253e6535a11f380b6d66bc2ce46fa671fe23697aced8fd5619633a00e3ea19ae9dbc3ffe2981173d83dcab6b447d514555c43 SHA512 5380d9b92eb81603ec4d60ff9c940a3a061c06bd6f593d5837e600da5d4417b529d20d98d758aa95cef18fac10bdb5c33f90fa943deb15fdaf048492cf286581 -DIST python-prefix-gentoo-3.7.8-patches-r0.tar.xz 13068 BLAKE2B 32e8baf8a0d5bdcb973ba880dbc35a3bd5c6cba88bf2f647e18fc4839fe8bae94658e403e050bcecc5dd5ddadf5beaf8a489829bc2835589d77b968628c29233 SHA512 1a7c17424edc43b36867d45ac019f48734444328bf17b5eddd07a2b63ef26e74147dea83e1286a9e45372acc85640a8d72fed33cbe551170acd785fe12b43d74 -DIST python-prefix-gentoo-3.8.6-patches-r2.tar.xz 8132 BLAKE2B 07b2fed42257a89612c2f402e1adadaef171d483f7f28b85a5a9548713406ad97267a5df6ce39f0e363f76850266292d4b7c43854ef6067e09758d8939411131 SHA512 505f4ade99e4c5ca3f6bef84bc1c97e7197d5b5d6ed4229823df1d142ce00241a7f0f0c336bd01065e4834919dc162ec6797d5272a3c753e0507663eb9b6a94c DIST python-prefix-gentoo-3.8.7-patches-r2.tar.xz 8312 BLAKE2B 268f3cff62dc51d4f91994c3f6b05cea0e29edb1ccf39476ba52485fb94c3cad72b54ed5cd941c227bdad004a7ae0069d60ee6bbde5a30d16115263d0dc2a5c3 SHA512 e43ce1e9e851bebce968ee025f765fc9a558c8edc4ee2d51616043183fd12301ab3d5c7f92915238e53b5cf92f6c00617ab0fcf9859d4cebe0966271e6f64725 DIST python-prefix-gentoo-3.9.1-patches-r2.tar.xz 6996 BLAKE2B 5de68537998c19d19cc1b2f630da73da3e70a88581c010028107cb7c9571c821637388022ab7659bd20992a8cf683199af22863cc5af25eb1030e2a5956e156d SHA512 c3d6998b3a00fb4bf7f84fe5fa6788b3f725120a73991075e7feb5762ff0186e27bfb455354365f3b84844ec28876792bf11baf124776a1ea3375ed2d0e1882e DIST python2-cygwinports-7be648659ef46f33db6913ca0ca5a809219d5629.zip 9199 BLAKE2B 85803bc1677bd16650cb5fc4a2c54fdac0228326f25cfba4fcd098ac9d689312d3e0dde6fca57f720d5235361d6462461cf018325c23fda9139e0f1683055aff SHA512 cabc21d2d7379daf1f4bafe7ab00b70e5b4f707d3102496b96ff0dfdced26347097ad771c69e0b9488b7c54b1ef36f9bc019bee72f1ffcbb55dcd0e71095edfe -DIST python37-cygwinports-6df749d21f131eeafa485d40eb1294b28d30ba6a.tar.gz 8102 BLAKE2B 7331142fc9c2fd71e5ec5ae45d6aaebe8e39430b5719d01a673966a5ba10b344bba924d6f7f05cc444cedbf28b11cef2db1c2613ebf45fcceb90354895b9b42c SHA512 da669c3a518af73c4caa7c9cc35af2fd971f98e7ba9b91ae0223b2f031e74acc70644fb2411ad5a8d4b39e2c449b5c256bea4877d957030cb81c0d08e84b38dd diff --git a/dev-lang/python/python-3.7.8-r2.ebuild b/dev-lang/python/python-3.7.8-r2.ebuild deleted file mode 100644 index 521d70bcab..0000000000 --- a/dev-lang/python/python-3.7.8-r2.ebuild +++ /dev/null @@ -1,447 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI="7" -WANT_LIBTOOL="none" - -inherit autotools flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs - -MY_P="Python-${PV}" -PYVER=$(ver_cut 1-2) -PATCHSET="python-gentoo-patches-3.7.8-r3" -PREFIX_PATCHSET="python-prefix-gentoo-3.7.8-patches-r0" -CYGWINPORTS_GITREV="6df749d21f131eeafa485d40eb1294b28d30ba6a" - -DESCRIPTION="An interpreted, interactive, object-oriented programming language" -HOMEPAGE="https://www.python.org/" -SRC_URI="https://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz - https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz - https://dev.gentoo.org/~grobian/distfiles/${PREFIX_PATCHSET}.tar.xz" -[[ -n ${CYGWINPORTS_GITREV} ]] && -SRC_URI+=" elibc_Cygwin? ( - https://github.com/cygwinports/python37/archive/${CYGWINPORTS_GITREV}.tar.gz - -> python37-cygwinports-${CYGWINPORTS_GITREV}.tar.gz )" -S="${WORKDIR}/${MY_P}" - -LICENSE="PSF-2" -SLOT="${PYVER}/${PYVER}m" -KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" -IUSE="aqua bluetooth build examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl test tk wininst +xml" -RESTRICT="!test? ( test )" - -# Do not add a dependency on dev-lang/python to this ebuild. -# If you need to apply a patch which requires python for bootstrapping, please -# run the bootstrap code on your dev box and include the results in the -# patchset. See bug 447752. - -RDEPEND="app-arch/bzip2:= - app-arch/xz-utils:= - dev-libs/libffi:= - kernel_linux? ( sys-apps/util-linux:= ) - >=sys-libs/zlib-1.1.3:= - virtual/libcrypt:= - virtual/libintl - gdbm? ( sys-libs/gdbm:=[berkdb] ) - ncurses? ( >=sys-libs/ncurses-5.2:= ) - readline? ( >=sys-libs/readline-4.1:= ) - sqlite? ( >=dev-db/sqlite-3.3.8:3= ) - ssl? ( - !libressl? ( dev-libs/openssl:= ) - libressl? ( dev-libs/libressl:= ) - ) - tk? ( - >=dev-lang/tcl-8.0:= - >=dev-lang/tk-8.0:= - dev-tcltk/blt:= - dev-tcltk/tix - ) - xml? ( >=dev-libs/expat-2.1:= )" -# bluetooth requires headers from bluez -DEPEND="${RDEPEND} - bluetooth? ( net-wireless/bluez ) - test? ( app-arch/xz-utils[extra-filters(+)] ) - virtual/pkgconfig - !sys-devel/gcc[libffi(-)]" -RDEPEND+=" !build? ( app-misc/mime-types )" -PDEPEND=">=app-eselect/eselect-python-20140125-r1" - -src_prepare() { - # Ensure that internal copies of expat, libffi and zlib are not used. - rm -fr Modules/expat || die - rm -fr Modules/_ctypes/libffi* || die - rm -fr Modules/zlib || die - - local PATCHES=( - "${WORKDIR}/${PATCHSET}" - # Prefix' round of patches - "${WORKDIR}"/${PREFIX_PATCHSET} - ) - - rm "${WORKDIR}"/${PREFIX_PATCHSET}/*_m68k-mint_* - - default - - if [[ -n ${CYGWINPORTS_GITREV} ]] && use elibc_Cygwin; then - local p d="${WORKDIR}/python37-${CYGWINPORTS_GITREV}" - for p in $( - sed -ne '/PATCH_URI="/,/"/{s/.*="//;s/".*$//;p}' \ - < "${d}/python3.cygport" - ); do - # dropped by 01_all_prefix-no-patch-invention.patch - [[ ${p} == *-tkinter-* ]] && continue - eapply "${d}/${p}" - done - fi - - # we provide a fully working readline also on Darwin, so don't force - # usage of less functional libedit - sed -i -e 's/__APPLE__/__NO_MUCKING_AROUND__/g' Modules/readline.c || die - - # missed patch - sed -i -e '/is_macosx_sdk_path(zlib_h):/s/darwin/no-darwin/' setup.py || die - - sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ - setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@" - - # workaround a development build env problem and muck around - # framework install to get the best of both worlds (non-standard) - sed -i \ - -e "s:FRAMEWORKINSTALLAPPSPREFIX=\":FRAMEWORKINSTALLAPPSPREFIX=\"${EPREFIX}:" \ - -e '/RUNSHARED=DYLD_FRAMEWORK_PATH/s/FRAMEWORK/LIBRARY/g' \ - configure.ac configure || die - sed -i -e '/find/s/$/ || true/' Mac/PythonLauncher/Makefile.in || die - - # workaround a problem on ppc-macos with >=GCC-8 where dtoa gets - # miscompiled when optimisation is being used - if [[ ${CHOST} == powerpc*-darwin* ]] && \ - tc-is-gcc && [[ $(gcc-major-version) -ge 8 ]] ; - then - sed -i \ - -e '/^CFLAGS_ALIASING=/s/$/ -fno-tree-ter/' Makefile.pre.in || die - fi - - # Darwin 9's kqueue seems to act up (at least at this stage), so - # make Python's selectors resort to poll() or select() - if [[ ${CHOST} == powerpc*-darwin* ]] ; then - sed -i \ - -e 's/KQUEUE/KQUEUE_DISABLED/' \ - configure.ac configure || die - fi - - # side-effect of disabling scproxy (see below), make sure we don't - # try to use it on Darwin either - sed -i -e '/sys.platform/s/darwin/disabled-darwin/' \ - Lib/urllib/request.py || die - - eautoreconf -} - -src_configure() { - local disable - # disable automagic bluetooth headers detection - use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no - use gdbm || disable+=" gdbm" - use ncurses || disable+=" _curses _curses_panel" - use readline || disable+=" readline" - use sqlite || disable+=" _sqlite3" - use ssl || export PYTHON_DISABLE_SSL="1" - use tk || disable+=" _tkinter" - use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. - [[ ${CHOST} == *-darwin* ]] && disable+=" _scproxy" # header issue - export PYTHON_DISABLE_MODULES="${disable}" - - if ! use xml; then - ewarn "You have configured Python without XML support." - ewarn "This is NOT a recommended configuration as you" - ewarn "may face problems parsing any XML documents." - fi - - if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then - einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}" - fi - - if [[ "$(gcc-major-version)" -ge 4 ]]; then - append-flags -fwrapv - fi - - filter-flags -malign-double - - # https://bugs.gentoo.org/show_bug.cgi?id=50309 - if is-flagq -O3; then - is-flagq -fstack-protector-all && replace-flags -O3 -O2 - use hardened && replace-flags -O3 -O2 - fi - - # Export CC so even AIX will use gcc instead of xlc_r. - # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. - tc-export CC CXX - - # Set LDFLAGS so we link modules with -lpython3.2 correctly. - # Needed on FreeBSD unless Python 3.2 is already installed. - # Please query BSD team before removing this! - append-ldflags "-L." - - # Fix implicit declarations on cross and prefix builds. Bug #674070. - use ncurses && append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw - use prefix && append-ldflags -L"${ESYSROOT}"/lib -L"${ESYSROOT}"/usr/lib - - local dbmliborder - if use gdbm; then - dbmliborder+="${dbmliborder:+:}gdbm" - fi - - if use aqua ; then - ECONF_SOURCE="${S}" OPT="" \ - econf \ - --enable-framework="${EPREFIX}"/usr/lib \ - --config-cache - fi - - local myeconfargs=( - # glibc-2.30 removes it; since we can't cleanly force-rebuild - # Python on glibc upgrade, remove it proactively to give - # a chance for users rebuilding python before glibc - # except on non-glibc systems this breaks the build, so be - # conservative! - $(use elibc_glibc && echo ac_cv_header_stropts_h=no) - - $(use aqua && echo --config-cache) - --enable-shared - $(use_enable ipv6) - --infodir='${prefix}/share/info' - --mandir='${prefix}/share/man' - --with-computed-gotos - --with-dbmliborder="${dbmliborder}" - --with-libc= - --enable-loadable-sqlite-extensions - --without-ensurepip - --with-system-expat - --with-system-ffi - ) - - OPT="" econf "${myeconfargs[@]}" -} - -src_compile() { - # Ensure sed works as expected - # https://bugs.gentoo.org/594768 - local -x LC_ALL=C - - emake CPPFLAGS= CFLAGS= LDFLAGS= - - # Work around bug 329499. See also bug 413751 and 457194. - if has_version dev-libs/libffi[pax_kernel]; then - pax-mark E python - else - pax-mark m python - fi -} - -src_test() { - # Tests will not work when cross compiling. - if tc-is-cross-compiler; then - elog "Disabling tests due to crosscompiling." - return - fi - - # Skip failing tests. - local skipped_tests="gdb" - - for test in ${skipped_tests}; do - mv "${S}"/Lib/test/test_${test}.py "${T}" - done - - # bug 660358 - local -x COLUMNS=80 - - local -x PYTHONDONTWRITEBYTECODE= - - emake test EXTRATESTOPTS="-u-network" CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty - local result=$? - - for test in ${skipped_tests}; do - mv "${T}/test_${test}.py" "${S}"/Lib/test - done - - elog "The following tests have been skipped:" - for test in ${skipped_tests}; do - elog "test_${test}.py" - done - - elog "If you would like to run them, you may:" - elog "cd '${EPREFIX}/usr/lib/python${PYVER}/test'" - elog "and run the tests separately." - - if [[ ${result} -ne 0 ]]; then - die "emake test failed" - fi -} - -src_install() { - local libdir=${ED}/usr/lib/python${PYVER} - - emake DESTDIR="${D}" altinstall - - if use aqua ; then - # avoid config.status to be triggered - find Mac -name "Makefile" -exec touch \{\} + || die - - # Python_Launcher is kind of a wrapper, and we should fix it for - # Prefix (it uses /usr/bin/pythonw) so useless - # IDLE doesn't run, no idea, but definitely not used - emake DESTDIR="${D}" -C Mac install_Python || die - rmdir "${ED}"/Applications/Python* || die - rmdir "${ED}"/Applications || die - - local fwdir=/usr/$(get_libdir)/Python.framework/Versions/${PYVER} - ln -s "${EPREFIX}"/usr/include/python${PYVER} \ - "${ED}${fwdir}"/Headers || die - ln -s "${EPREFIX}"/usr/lib/libpython${PYVER}.dylib \ - "${ED}${fwdir}"/Python || die - fi - - # Remove static library - rm "${ED}"/usr/$(get_libdir)/libpython*.a || die - - if use elibc_Cygwin; then - # We may recreate symlinks, but without any .exe extension. Cygwin - # can resolv either without it, so just drop .exe from shebangs: - sed -i -e '1s/\.exe//' "$ED"/usr/bin/* || die - fi - - sed \ - -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \ - -e "s/\(PY_LDFLAGS=\).*/\1/" \ - -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed" - - # Fix collisions between different slots of Python. - rm -f "${ED}/usr/$(get_libdir)/libpython3$(get_libname)" || die - - # Cheap hack to get version with ABIFLAGS - local abiver=$(cd "${ED}/usr/include"; echo python*) - if [[ ${abiver} != python${PYVER} ]]; then - # Replace python3.X with a symlink to python3.Xm - rm "${ED}/usr/bin/python${PYVER}" || die - dosym "${abiver}" "/usr/bin/python${PYVER}" - # Create python3.X-config symlink - dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" - # Create python-3.5m.pc symlink - dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" - fi - - # python seems to get rebuilt in src_install (bug 569908) - # Work around it for now. - if has_version dev-libs/libffi[pax_kernel]; then - pax-mark E "${ED}/usr/bin/${abiver}" - else - pax-mark m "${ED}/usr/bin/${abiver}" - fi - - use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die - use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die - - use wininst || rm "${libdir}/distutils/command/"wininst-*.exe || die - - dodoc Misc/{ACKS,HISTORY,NEWS} - - if use examples; then - docinto examples - find Tools -name __pycache__ -exec rm -fr {} + || die - dodoc -r Tools - fi - insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 - if use aqua ; then - # we do framework, so the emake trick below returns a pathname - # since that won't work here, use a (cheap) trick instead - local libname=libpython${PYVER} - else - local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \ - emake --no-print-directory -s -f - 2>/dev/null) - fi - newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py - - newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER} - newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER} - sed \ - -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ - -e "s:@PYDOC@:pydoc${PYVER}:" \ - -i "${ED}/etc/conf.d/pydoc-${PYVER}" \ - "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed" - - local -x EPYTHON=python${PYVER} - # if not using a cross-compiler, use the fresh binary - if ! tc-is-cross-compiler; then - local -x PYTHON=./python$(sed -n '/BUILDEXE=/s/^.*=\s\+//p' Makefile) - local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD} - local -x DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH+${DYLD_LIBRARY_PATH}:}${PWD} - else - local -x PYTHON=${EPREFIX}/usr/bin/${EPYTHON} - fi - - echo "EPYTHON='${EPYTHON}'" > epython.py || die - python_domodule epython.py - - # python-exec wrapping support - local pymajor=${PYVER%.*} - local scriptdir=${D}$(python_get_scriptdir) - mkdir -p "${scriptdir}" || die - # python and pythonX - ln -s "../../../bin/${abiver}" \ - "${scriptdir}/python${pymajor}" || die - ln -s "python${pymajor}" "${scriptdir}/python" || die - # python-config and pythonX-config - # note: we need to create a wrapper rather than symlinking it due - # to some random dirname(argv[0]) magic performed by python-config - cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die - #!/bin/sh - exec "${abiver}-config" "\${@}" - EOF - chmod +x "${scriptdir}/python${pymajor}-config" || die - ln -s "python${pymajor}-config" \ - "${scriptdir}/python-config" || die - # 2to3, pydoc, pyvenv - ln -s "../../../bin/2to3-${PYVER}" \ - "${scriptdir}/2to3" || die - ln -s "../../../bin/pydoc${PYVER}" \ - "${scriptdir}/pydoc" || die - ln -s "../../../bin/pyvenv-${PYVER}" \ - "${scriptdir}/pyvenv" || die - # idle - if use tk; then - ln -s "../../../bin/idle${PYVER}" \ - "${scriptdir}/idle" || die - fi -} - -pkg_preinst() { - if has_version "<${CATEGORY}/${PN}-${PYVER}" && ! has_version ">=${CATEGORY}/${PN}-${PYVER}_alpha"; then - python_updater_warning="1" - fi -} - -eselect_python_update() { - if [[ -z "$(eselect python show)" || \ - ! -f "${EROOT}/usr/bin/$(eselect python show)" ]]; then - eselect python update - fi - - if [[ -z "$(eselect python show --python${PV%%.*})" || \ - ! -f "${EROOT}/usr/bin/$(eselect python show --python${PV%%.*})" ]] - then - eselect python update --python${PV%%.*} - fi -} - -pkg_postinst() { - eselect_python_update - - if [[ "${python_updater_warning}" == "1" ]]; then - ewarn "You have just upgraded from an older version of Python." - ewarn - ewarn "Please adjust PYTHON_TARGETS (if so desired), and run emerge with the --newuse or --changed-use option to rebuild packages installing python modules." - fi -} - -pkg_postrm() { - eselect_python_update -} diff --git a/dev-lang/python/python-3.8.6-r1.ebuild b/dev-lang/python/python-3.8.6-r1.ebuild deleted file mode 100644 index 6997b98853..0000000000 --- a/dev-lang/python/python-3.8.6-r1.ebuild +++ /dev/null @@ -1,431 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI="7" -WANT_LIBTOOL="none" - -inherit autotools flag-o-matic multiprocessing pax-utils \ - python-utils-r1 toolchain-funcs - -MY_P="Python-${PV}" -PYVER=$(ver_cut 1-2) -PATCHSET="python-gentoo-patches-${PV}-r1" -PREFIX_PATCHSET="python-prefix-gentoo-${PV}-patches-r2" - -DESCRIPTION="An interpreted, interactive, object-oriented programming language" -HOMEPAGE="https://www.python.org/" -SRC_URI="https://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz - https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz - https://dev.gentoo.org/~grobian/distfiles/${PREFIX_PATCHSET}.tar.xz" -S="${WORKDIR}/${MY_P}" - -LICENSE="PSF-2" -SLOT="${PYVER}" -KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" -IUSE="aqua bluetooth build examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl test tk wininst +xml" -RESTRICT="!test? ( test )" - -# Do not add a dependency on dev-lang/python to this ebuild. -# If you need to apply a patch which requires python for bootstrapping, please -# run the bootstrap code on your dev box and include the results in the -# patchset. See bug 447752. - -RDEPEND="app-arch/bzip2:= - app-arch/xz-utils:= - dev-libs/libffi:= - kernel_linux? ( sys-apps/util-linux:= ) - >=sys-libs/zlib-1.1.3:= - virtual/libcrypt:= - virtual/libintl - gdbm? ( sys-libs/gdbm:=[berkdb] ) - ncurses? ( >=sys-libs/ncurses-5.2:= ) - readline? ( >=sys-libs/readline-4.1:= ) - sqlite? ( >=dev-db/sqlite-3.3.8:3= ) - ssl? ( - !libressl? ( dev-libs/openssl:= ) - libressl? ( dev-libs/libressl:= ) - ) - tk? ( - >=dev-lang/tcl-8.0:= - >=dev-lang/tk-8.0:= - dev-tcltk/blt:= - dev-tcltk/tix - ) - xml? ( >=dev-libs/expat-2.1:= )" -# bluetooth requires headers from bluez -DEPEND="${RDEPEND} - bluetooth? ( net-wireless/bluez ) - test? ( app-arch/xz-utils[extra-filters(+)] ) - virtual/pkgconfig - !sys-devel/gcc[libffi(-)]" -RDEPEND+=" !build? ( app-misc/mime-types )" -PDEPEND=">=app-eselect/eselect-python-20140125-r1" - -src_prepare() { - # Ensure that internal copies of expat, libffi and zlib are not used. - rm -fr Modules/expat || die - rm -fr Modules/_ctypes/libffi* || die - rm -fr Modules/zlib || die - - local PATCHES=( - "${WORKDIR}/${PATCHSET}" - # Prefix' round of patches - "${WORKDIR}"/${PREFIX_PATCHSET} - ) - - default - - sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ - setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@" - - # force correct number of jobs - # https://bugs.gentoo.org/737660 - local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") - sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die - sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die - - # workaround a problem on ppc-macos with >=GCC-8 where dtoa gets - # miscompiled when optimisation is being used - if [[ ${CHOST} == powerpc*-darwin* ]] && \ - tc-is-gcc && [[ $(gcc-major-version) -ge 8 ]] ; - then - sed -i \ - -e '/^CFLAGS_ALIASING=/s/$/ -fno-tree-ter/' Makefile.pre.in || die - fi - - # Darwin 9's kqueue seems to act up (at least at this stage), so - # make Python's selectors resort to poll() or select() - if [[ ${CHOST} == powerpc*-darwin9 ]] ; then - sed -i \ - -e 's/KQUEUE/KQUEUE_DISABLED/' \ - configure.ac configure || die - fi - - # Python doesn't know about arm64-macos yet - if [[ ${CHOST} == arm64-*-darwin* ]] ; then - # Teach Python a new trick (arm64) - sed -i \ - -e "/Unexpected output of 'arch' on OSX/d" \ - configure.ac configure || die - fi - - # side-effect of disabling scproxy (see below), make sure we don't - # try to use it on Darwin either - sed -i -e '/sys.platform/s/darwin/disabled-darwin/' \ - Lib/urllib/request.py || die - - # disable SDK usage on Darwin/macOS - sed -i -e '/^MACOS = /s/darwin/no-darwin/' setup.py || die - - eautoreconf -} - -src_configure() { - local disable - # disable automagic bluetooth headers detection - use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no - use gdbm || disable+=" gdbm" - use ncurses || disable+=" _curses _curses_panel" - use readline || disable+=" readline" - use sqlite || disable+=" _sqlite3" - use ssl || export PYTHON_DISABLE_SSL="1" - use tk || disable+=" _tkinter" - use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. - [[ ${CHOST} == *-darwin* ]] && disable+=" _scproxy" # header issue - export PYTHON_DISABLE_MODULES="${disable}" - - if ! use xml; then - ewarn "You have configured Python without XML support." - ewarn "This is NOT a recommended configuration as you" - ewarn "may face problems parsing any XML documents." - fi - - if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then - einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}" - fi - - if [[ "$(gcc-major-version)" -ge 4 ]]; then - append-flags -fwrapv - fi - - filter-flags -malign-double - - # https://bugs.gentoo.org/show_bug.cgi?id=50309 - if is-flagq -O3; then - is-flagq -fstack-protector-all && replace-flags -O3 -O2 - use hardened && replace-flags -O3 -O2 - fi - - # https://bugs.gentoo.org/700012 - if is-flagq -flto || is-flagq '-flto=*'; then - append-cflags $(test-flags-CC -ffat-lto-objects) - fi - - # Export CC so even AIX will use gcc instead of xlc_r. - # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. - tc-export CC CXX - - # Set LDFLAGS so we link modules with -lpython3.2 correctly. - # Needed on FreeBSD unless Python 3.2 is already installed. - # Please query BSD team before removing this! - append-ldflags "-L." - - # Fix implicit declarations on cross and prefix builds. Bug #674070. - use ncurses && append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw - use prefix && append-ldflags -L"${ESYSROOT}"/lib -L"${ESYSROOT}"/usr/lib - - local dbmliborder - if use gdbm; then - dbmliborder+="${dbmliborder:+:}gdbm" - fi - - if use aqua ; then - ECONF_SOURCE="${S}" OPT="" \ - econf \ - --enable-framework="${EPREFIX}" \ - --config-cache - fi - - # flock on 32-bits sparc Solaris is broken - [[ ${CHOST} == sparc-*-solaris* ]] && \ - export ac_cv_flock_decl=no - - local myeconfargs=( - # glibc-2.30 removes it; since we can't cleanly force-rebuild - # Python on glibc upgrade, remove it proactively to give - # a chance for users rebuilding python before glibc - # except on non-glibc systems this breaks the build, so be - # conservative! - $(use elibc_glibc && echo ac_cv_header_stropts_h=no) - - $(use aqua && echo --config-cache) - --enable-shared - $(use_enable ipv6) - --infodir='${prefix}/share/info' - --mandir='${prefix}/share/man' - --with-computed-gotos - --with-dbmliborder="${dbmliborder}" - --with-libc= - --enable-loadable-sqlite-extensions - --without-ensurepip - --with-system-expat - --with-system-ffi - ) - - OPT="" econf "${myeconfargs[@]}" -} - -src_compile() { - # Ensure sed works as expected - # https://bugs.gentoo.org/594768 - local -x LC_ALL=C - - emake CPPFLAGS= CFLAGS= LDFLAGS= - - # Work around bug 329499. See also bug 413751 and 457194. - if has_version dev-libs/libffi[pax_kernel]; then - pax-mark E python - else - pax-mark m python - fi -} - -src_test() { - # Tests will not work when cross compiling. - if tc-is-cross-compiler; then - elog "Disabling tests due to crosscompiling." - return - fi - - # Skip failing tests. - local skipped_tests="gdb" - - for test in ${skipped_tests}; do - mv "${S}"/Lib/test/test_${test}.py "${T}" - done - - # bug 660358 - local -x COLUMNS=80 - local -x PYTHONDONTWRITEBYTECODE= - - emake test EXTRATESTOPTS="-u-network" CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty - local result=$? - - for test in ${skipped_tests}; do - mv "${T}/test_${test}.py" "${S}"/Lib/test - done - - elog "The following tests have been skipped:" - for test in ${skipped_tests}; do - elog "test_${test}.py" - done - - elog "If you would like to run them, you may:" - elog "cd '${EPREFIX}/usr/lib/python${PYVER}/test'" - elog "and run the tests separately." - - if [[ ${result} -ne 0 ]]; then - die "emake test failed" - fi -} - -src_install() { - local libdir=${ED}/usr/lib/python${PYVER} - - emake DESTDIR="${D}" altinstall - - if use aqua ; then - # avoid config.status to be triggered - find Mac -name "Makefile" -exec touch \{\} + || die - - # Python_Launcher is kind of a wrapper, and we should fix it for - # Prefix (it uses /usr/bin/pythonw) so useless - # IDLE doesn't run, no idea, but definitely not used - emake DESTDIR="${D}" -C Mac install_Python || die - rmdir "${ED}"/Applications/Python* || die - rmdir "${ED}"/Applications || die - - local fwdir=/Frameworks/Python.framework/Versions/${PYVER} - ln -s "${EPREFIX}"/usr/include/python${PYVER} \ - "${ED}${fwdir}"/Headers || die - ln -s "${EPREFIX}"/usr/lib/libpython${PYVER}.dylib \ - "${ED}${fwdir}"/Python || die - fi - - # Remove static library - rm "${ED}"/usr/$(get_libdir)/libpython*.a || die - - sed \ - -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \ - -e "s/\(PY_LDFLAGS=\).*/\1/" \ - -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed" - - # Fix collisions between different slots of Python. - rm -f "${ED}/usr/$(get_libdir)/libpython3$(get_libname)" || die - - # Cheap hack to get version with ABIFLAGS - local abiver=$(cd "${ED}/usr/include"; echo python*) - if [[ ${abiver} != python${PYVER} ]]; then - # Replace python3.X with a symlink to python3.Xm - rm "${ED}/usr/bin/python${PYVER}" || die - dosym "${abiver}" "/usr/bin/python${PYVER}" - # Create python3.X-config symlink - dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" - # Create python-3.5m.pc symlink - dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" - fi - - # python seems to get rebuilt in src_install (bug 569908) - # Work around it for now. - if has_version dev-libs/libffi[pax_kernel]; then - pax-mark E "${ED}/usr/bin/${abiver}" - else - pax-mark m "${ED}/usr/bin/${abiver}" - fi - - use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die - use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die - - use wininst || rm "${libdir}/distutils/command/"wininst-*.exe || die - - dodoc Misc/{ACKS,HISTORY,NEWS} - - if use examples; then - docinto examples - find Tools -name __pycache__ -exec rm -fr {} + || die - dodoc -r Tools - fi - insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 - if use aqua ; then - # we do framework, so the emake trick below returns a pathname - # since that won't work here, use a (cheap) trick instead - local libname=libpython${PYVER} - else - local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \ - emake --no-print-directory -s -f - 2>/dev/null) - fi - newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py - - newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER} - newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER} - sed \ - -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ - -e "s:@PYDOC@:pydoc${PYVER}:" \ - -i "${ED}/etc/conf.d/pydoc-${PYVER}" \ - "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed" - - local -x EPYTHON=python${PYVER} - # if not using a cross-compiler, use the fresh binary - if ! tc-is-cross-compiler; then - local -x PYTHON=./python$(sed -n '/BUILDEXE=/s/^.*=\s\+//p' Makefile) - local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD} - local -x DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH+${DYLD_LIBRARY_PATH}:}${PWD} - else - local -x PYTHON=${EPREFIX}/usr/bin/${EPYTHON} - fi - - echo "EPYTHON='${EPYTHON}'" > epython.py || die - python_domodule epython.py - - # python-exec wrapping support - local pymajor=${PYVER%.*} - local scriptdir=${D}$(python_get_scriptdir) - mkdir -p "${scriptdir}" || die - # python and pythonX - ln -s "../../../bin/${abiver}" \ - "${scriptdir}/python${pymajor}" || die - ln -s "python${pymajor}" "${scriptdir}/python" || die - # python-config and pythonX-config - # note: we need to create a wrapper rather than symlinking it due - # to some random dirname(argv[0]) magic performed by python-config - cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die - #!/bin/sh - exec "${abiver}-config" "\${@}" - EOF - chmod +x "${scriptdir}/python${pymajor}-config" || die - ln -s "python${pymajor}-config" \ - "${scriptdir}/python-config" || die - # 2to3, pydoc - ln -s "../../../bin/2to3-${PYVER}" \ - "${scriptdir}/2to3" || die - ln -s "../../../bin/pydoc${PYVER}" \ - "${scriptdir}/pydoc" || die - # idle - if use tk; then - ln -s "../../../bin/idle${PYVER}" \ - "${scriptdir}/idle" || die - fi -} - -pkg_preinst() { - if has_version "<${CATEGORY}/${PN}-${PYVER}" && ! has_version ">=${CATEGORY}/${PN}-${PYVER}_alpha"; then - python_updater_warning="1" - fi -} - -eselect_python_update() { - if [[ -z "$(eselect python show)" || \ - ! -f "${EROOT}/usr/bin/$(eselect python show)" ]]; then - eselect python update - fi - - if [[ -z "$(eselect python show --python${PV%%.*})" || \ - ! -f "${EROOT}/usr/bin/$(eselect python show --python${PV%%.*})" ]] - then - eselect python update --python${PV%%.*} - fi -} - -pkg_postinst() { - eselect_python_update - - if [[ "${python_updater_warning}" == "1" ]]; then - ewarn "You have just upgraded from an older version of Python." - ewarn - ewarn "Please adjust PYTHON_TARGETS (if so desired), and run emerge with the --newuse or --changed-use option to rebuild packages installing python modules." - fi -} - -pkg_postrm() { - eselect_python_update -} diff --git a/dev-lang/python/python-3.8.7-r1.ebuild b/dev-lang/python/python-3.8.7-r1.ebuild new file mode 100644 index 0000000000..33ad89be02 --- /dev/null +++ b/dev-lang/python/python-3.8.7-r1.ebuild @@ -0,0 +1,390 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="7" +WANT_LIBTOOL="none" + +inherit autotools flag-o-matic multiprocessing pax-utils \ + python-utils-r1 toolchain-funcs + +MY_P="Python-${PV}" +PYVER=$(ver_cut 1-2) +PATCHSET="python-gentoo-patches-3.8.7-r1" +PREFIX_PATCHSET="python-prefix-gentoo-${PV}-patches-r2" + +DESCRIPTION="An interpreted, interactive, object-oriented programming language" +HOMEPAGE="https://www.python.org/" +SRC_URI="https://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz + https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz + https://dev.gentoo.org/~grobian/distfiles/${PREFIX_PATCHSET}.tar.xz" +S="${WORKDIR}/${MY_P}" + +LICENSE="PSF-2" +SLOT="${PYVER}" +KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="aqua bluetooth build examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl test tk wininst +xml" +RESTRICT="!test? ( test )" + +# Do not add a dependency on dev-lang/python to this ebuild. +# If you need to apply a patch which requires python for bootstrapping, please +# run the bootstrap code on your dev box and include the results in the +# patchset. See bug 447752. + +RDEPEND="app-arch/bzip2:= + app-arch/xz-utils:= + dev-libs/libffi:= + kernel_linux? ( sys-apps/util-linux:= ) + >=sys-libs/zlib-1.1.3:= + virtual/libcrypt:= + virtual/libintl + gdbm? ( sys-libs/gdbm:=[berkdb] ) + ncurses? ( >=sys-libs/ncurses-5.2:= ) + readline? ( >=sys-libs/readline-4.1:= ) + sqlite? ( >=dev-db/sqlite-3.3.8:3= ) + ssl? ( + !libressl? ( dev-libs/openssl:= ) + libressl? ( dev-libs/libressl:= ) + ) + tk? ( + >=dev-lang/tcl-8.0:= + >=dev-lang/tk-8.0:= + dev-tcltk/blt:= + dev-tcltk/tix + ) + xml? ( >=dev-libs/expat-2.1:= )" +# bluetooth requires headers from bluez +DEPEND="${RDEPEND} + bluetooth? ( net-wireless/bluez ) + test? ( app-arch/xz-utils[extra-filters(+)] ) + virtual/pkgconfig + !sys-devel/gcc[libffi(-)]" +RDEPEND+=" !build? ( app-misc/mime-types )" + +src_prepare() { + # Ensure that internal copies of expat, libffi and zlib are not used. + rm -fr Modules/expat || die + rm -fr Modules/_ctypes/libffi* || die + rm -fr Modules/zlib || die + + local PATCHES=( + "${WORKDIR}/${PATCHSET}" + # Prefix' round of patches + "${WORKDIR}"/${PREFIX_PATCHSET} + ) + + default + + sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ + setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@" + + # force correct number of jobs + # https://bugs.gentoo.org/737660 + local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") + sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die + sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die + + # workaround a problem on ppc-macos with >=GCC-8 where dtoa gets + # miscompiled when optimisation is being used + if [[ ${CHOST} == powerpc*-darwin* ]] && \ + tc-is-gcc && [[ $(gcc-major-version) -ge 8 ]] ; + then + sed -i \ + -e '/^CFLAGS_ALIASING=/s/$/ -fno-tree-ter/' Makefile.pre.in || die + fi + + # Darwin 9's kqueue seems to act up (at least at this stage), so + # make Python's selectors resort to poll() or select() + if [[ ${CHOST} == powerpc*-darwin9 ]] ; then + sed -i \ + -e 's/KQUEUE/KQUEUE_DISABLED/' \ + configure.ac configure || die + fi + + # Python doesn't know about arm64-macos yet + if [[ ${CHOST} == arm64-*-darwin* ]] ; then + # Teach Python a new trick (arm64) + sed -i \ + -e "/Unexpected output of 'arch' on OSX/d" \ + configure.ac configure || die + fi + + eautoreconf +} + +src_configure() { + local disable + # disable automagic bluetooth headers detection + use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no + use gdbm || disable+=" gdbm" + use ncurses || disable+=" _curses _curses_panel" + use readline || disable+=" readline" + use sqlite || disable+=" _sqlite3" + use ssl || export PYTHON_DISABLE_SSL="1" + use tk || disable+=" _tkinter" + use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. + export PYTHON_DISABLE_MODULES="${disable}" + + if ! use xml; then + ewarn "You have configured Python without XML support." + ewarn "This is NOT a recommended configuration as you" + ewarn "may face problems parsing any XML documents." + fi + + if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then + einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}" + fi + + if [[ "$(gcc-major-version)" -ge 4 ]]; then + append-flags -fwrapv + fi + + filter-flags -malign-double + + # https://bugs.gentoo.org/show_bug.cgi?id=50309 + if is-flagq -O3; then + is-flagq -fstack-protector-all && replace-flags -O3 -O2 + use hardened && replace-flags -O3 -O2 + fi + + # https://bugs.gentoo.org/700012 + if is-flagq -flto || is-flagq '-flto=*'; then + append-cflags $(test-flags-CC -ffat-lto-objects) + fi + + # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. + tc-export CXX + + # Set LDFLAGS so we link modules with -lpython3.2 correctly. + # Needed on FreeBSD unless Python 3.2 is already installed. + # Please query BSD team before removing this! + append-ldflags "-L." + + # Fix implicit declarations on cross and prefix builds. Bug #674070. + use ncurses && append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw + use prefix && append-ldflags -L"${ESYSROOT}"/lib -L"${ESYSROOT}"/usr/lib + + local dbmliborder + if use gdbm; then + dbmliborder+="${dbmliborder:+:}gdbm" + fi + + if use aqua ; then + ECONF_SOURCE="${S}" OPT="" \ + econf \ + --enable-framework="${EPREFIX}" \ + --config-cache + fi + + # flock on 32-bits sparc Solaris is broken + [[ ${CHOST} == sparc-*-solaris* ]] && \ + export ac_cv_flock_decl=no + + local myeconfargs=( + # glibc-2.30 removes it; since we can't cleanly force-rebuild + # Python on glibc upgrade, remove it proactively to give + # a chance for users rebuilding python before glibc + # except on non-glibc systems this breaks the build, so be + # conservative! + $(use elibc_glibc && echo ac_cv_header_stropts_h=no) + + $(use aqua && echo --config-cache) + --enable-shared + $(use_enable ipv6) + --infodir='${prefix}/share/info' + --mandir='${prefix}/share/man' + --with-computed-gotos + --with-dbmliborder="${dbmliborder}" + --with-libc= + --enable-loadable-sqlite-extensions + --without-ensurepip + --with-system-expat + --with-system-ffi + ) + + OPT="" econf "${myeconfargs[@]}" +} + +src_compile() { + # Ensure sed works as expected + # https://bugs.gentoo.org/594768 + local -x LC_ALL=C + + emake CPPFLAGS= CFLAGS= LDFLAGS= + + # Work around bug 329499. See also bug 413751 and 457194. + if has_version dev-libs/libffi[pax_kernel]; then + pax-mark E python + else + pax-mark m python + fi +} + +src_test() { + # Tests will not work when cross compiling. + if tc-is-cross-compiler; then + elog "Disabling tests due to crosscompiling." + return + fi + + # Skip failing tests. + local skipped_tests="gdb" + + for test in ${skipped_tests}; do + mv "${S}"/Lib/test/test_${test}.py "${T}" + done + + # bug 660358 + local -x COLUMNS=80 + local -x PYTHONDONTWRITEBYTECODE= + + local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") + + emake test EXTRATESTOPTS="-u-network -j${jobs}" \ + CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty + local result=$? + + for test in ${skipped_tests}; do + mv "${T}/test_${test}.py" "${S}"/Lib/test + done + + elog "The following tests have been skipped:" + for test in ${skipped_tests}; do + elog "test_${test}.py" + done + + elog "If you would like to run them, you may:" + elog "cd '${EPREFIX}/usr/lib/python${PYVER}/test'" + elog "and run the tests separately." + + if [[ ${result} -ne 0 ]]; then + die "emake test failed" + fi +} + +src_install() { + local libdir=${ED}/usr/lib/python${PYVER} + + emake DESTDIR="${D}" altinstall + + if use aqua ; then + # avoid config.status to be triggered + find Mac -name "Makefile" -exec touch \{\} + || die + + # Python_Launcher is kind of a wrapper, and we should fix it for + # Prefix (it uses /usr/bin/pythonw) so useless + # IDLE doesn't run, no idea, but definitely not used + emake DESTDIR="${D}" -C Mac install_Python || die + rmdir "${ED}"/Applications/Python* || die + rmdir "${ED}"/Applications || die + + local fwdir=/Frameworks/Python.framework/Versions/${PYVER} + ln -s "${EPREFIX}"/usr/include/python${PYVER} \ + "${ED}${fwdir}"/Headers || die + ln -s "${EPREFIX}"/usr/lib/libpython${PYVER}.dylib \ + "${ED}${fwdir}"/Python || die + fi + + # Remove static library + rm "${ED}"/usr/$(get_libdir)/libpython*.a || die + + sed \ + -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \ + -e "s/\(PY_LDFLAGS=\).*/\1/" \ + -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed" + + # Fix collisions between different slots of Python. + rm -f "${ED}/usr/$(get_libdir)/libpython3$(get_libname)" || die + + # Cheap hack to get version with ABIFLAGS + local abiver=$(cd "${ED}/usr/include"; echo python*) + if [[ ${abiver} != python${PYVER} ]]; then + # Replace python3.X with a symlink to python3.Xm + rm "${ED}/usr/bin/python${PYVER}" || die + dosym "${abiver}" "/usr/bin/python${PYVER}" + # Create python3.X-config symlink + dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" + # Create python-3.5m.pc symlink + dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" + fi + + # python seems to get rebuilt in src_install (bug 569908) + # Work around it for now. + if has_version dev-libs/libffi[pax_kernel]; then + pax-mark E "${ED}/usr/bin/${abiver}" + else + pax-mark m "${ED}/usr/bin/${abiver}" + fi + + use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die + use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die + + use wininst || rm "${libdir}/distutils/command/"wininst-*.exe || die + + dodoc Misc/{ACKS,HISTORY,NEWS} + + if use examples; then + docinto examples + find Tools -name __pycache__ -exec rm -fr {} + || die + dodoc -r Tools + fi + insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 + if use aqua ; then + # we do framework, so the emake trick below returns a pathname + # since that won't work here, use a (cheap) trick instead + local libname=libpython${PYVER} + else + local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \ + emake --no-print-directory -s -f - 2>/dev/null) + fi + newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py + + newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER} + newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER} + sed \ + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ + -e "s:@PYDOC@:pydoc${PYVER}:" \ + -i "${ED}/etc/conf.d/pydoc-${PYVER}" \ + "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed" + + local -x EPYTHON=python${PYVER} + # if not using a cross-compiler, use the fresh binary + if ! tc-is-cross-compiler; then + local -x PYTHON=./python$(sed -n '/BUILDEXE=/s/^.*=\s\+//p' Makefile) + local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD} + local -x DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH+${DYLD_LIBRARY_PATH}:}${PWD} + else + local -x PYTHON=${EPREFIX}/usr/bin/${EPYTHON} + fi + + echo "EPYTHON='${EPYTHON}'" > epython.py || die + python_domodule epython.py + + # python-exec wrapping support + local pymajor=${PYVER%.*} + local scriptdir=${D}$(python_get_scriptdir) + mkdir -p "${scriptdir}" || die + # python and pythonX + ln -s "../../../bin/${abiver}" \ + "${scriptdir}/python${pymajor}" || die + ln -s "python${pymajor}" "${scriptdir}/python" || die + # python-config and pythonX-config + # note: we need to create a wrapper rather than symlinking it due + # to some random dirname(argv[0]) magic performed by python-config + cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die + #!/bin/sh + exec "${abiver}-config" "\${@}" + EOF + chmod +x "${scriptdir}/python${pymajor}-config" || die + ln -s "python${pymajor}-config" \ + "${scriptdir}/python-config" || die + # 2to3, pydoc + ln -s "../../../bin/2to3-${PYVER}" \ + "${scriptdir}/2to3" || die + ln -s "../../../bin/pydoc${PYVER}" \ + "${scriptdir}/pydoc" || die + # idle + if use tk; then + ln -s "../../../bin/idle${PYVER}" \ + "${scriptdir}/idle" || die + fi +} diff --git a/dev-lang/python/python-3.8.7.ebuild b/dev-lang/python/python-3.8.7.ebuild deleted file mode 100644 index aef6d89455..0000000000 --- a/dev-lang/python/python-3.8.7.ebuild +++ /dev/null @@ -1,424 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI="7" -WANT_LIBTOOL="none" - -inherit autotools flag-o-matic multiprocessing pax-utils \ - python-utils-r1 toolchain-funcs - -MY_P="Python-${PV}" -PYVER=$(ver_cut 1-2) -PATCHSET="python-gentoo-patches-3.8.6" -PREFIX_PATCHSET="python-prefix-gentoo-${PV}-patches-r2" - -DESCRIPTION="An interpreted, interactive, object-oriented programming language" -HOMEPAGE="https://www.python.org/" -SRC_URI="https://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz - https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz - https://dev.gentoo.org/~grobian/distfiles/${PREFIX_PATCHSET}.tar.xz" -S="${WORKDIR}/${MY_P}" - -LICENSE="PSF-2" -SLOT="${PYVER}" -KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" -IUSE="aqua bluetooth build examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl test tk wininst +xml" -RESTRICT="!test? ( test )" - -# Do not add a dependency on dev-lang/python to this ebuild. -# If you need to apply a patch which requires python for bootstrapping, please -# run the bootstrap code on your dev box and include the results in the -# patchset. See bug 447752. - -RDEPEND="app-arch/bzip2:= - app-arch/xz-utils:= - dev-libs/libffi:= - kernel_linux? ( sys-apps/util-linux:= ) - >=sys-libs/zlib-1.1.3:= - virtual/libcrypt:= - virtual/libintl - gdbm? ( sys-libs/gdbm:=[berkdb] ) - ncurses? ( >=sys-libs/ncurses-5.2:= ) - readline? ( >=sys-libs/readline-4.1:= ) - sqlite? ( >=dev-db/sqlite-3.3.8:3= ) - ssl? ( - !libressl? ( dev-libs/openssl:= ) - libressl? ( dev-libs/libressl:= ) - ) - tk? ( - >=dev-lang/tcl-8.0:= - >=dev-lang/tk-8.0:= - dev-tcltk/blt:= - dev-tcltk/tix - ) - xml? ( >=dev-libs/expat-2.1:= )" -# bluetooth requires headers from bluez -DEPEND="${RDEPEND} - bluetooth? ( net-wireless/bluez ) - test? ( app-arch/xz-utils[extra-filters(+)] ) - virtual/pkgconfig - !sys-devel/gcc[libffi(-)]" -RDEPEND+=" !build? ( app-misc/mime-types )" -PDEPEND=">=app-eselect/eselect-python-20140125-r1" - -src_prepare() { - # Ensure that internal copies of expat, libffi and zlib are not used. - rm -fr Modules/expat || die - rm -fr Modules/_ctypes/libffi* || die - rm -fr Modules/zlib || die - - local PATCHES=( - "${WORKDIR}/${PATCHSET}" - # Prefix' round of patches - "${WORKDIR}"/${PREFIX_PATCHSET} - ) - - default - - sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ - setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@" - - # force correct number of jobs - # https://bugs.gentoo.org/737660 - local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") - sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die - sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die - - # workaround a problem on ppc-macos with >=GCC-8 where dtoa gets - # miscompiled when optimisation is being used - if [[ ${CHOST} == powerpc*-darwin* ]] && \ - tc-is-gcc && [[ $(gcc-major-version) -ge 8 ]] ; - then - sed -i \ - -e '/^CFLAGS_ALIASING=/s/$/ -fno-tree-ter/' Makefile.pre.in || die - fi - - # Darwin 9's kqueue seems to act up (at least at this stage), so - # make Python's selectors resort to poll() or select() - if [[ ${CHOST} == powerpc*-darwin9 ]] ; then - sed -i \ - -e 's/KQUEUE/KQUEUE_DISABLED/' \ - configure.ac configure || die - fi - - # Python doesn't know about arm64-macos yet - if [[ ${CHOST} == arm64-*-darwin* ]] ; then - # Teach Python a new trick (arm64) - sed -i \ - -e "/Unexpected output of 'arch' on OSX/d" \ - configure.ac configure || die - fi - - eautoreconf -} - -src_configure() { - local disable - # disable automagic bluetooth headers detection - use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no - use gdbm || disable+=" gdbm" - use ncurses || disable+=" _curses _curses_panel" - use readline || disable+=" readline" - use sqlite || disable+=" _sqlite3" - use ssl || export PYTHON_DISABLE_SSL="1" - use tk || disable+=" _tkinter" - use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. - export PYTHON_DISABLE_MODULES="${disable}" - - if ! use xml; then - ewarn "You have configured Python without XML support." - ewarn "This is NOT a recommended configuration as you" - ewarn "may face problems parsing any XML documents." - fi - - if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then - einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}" - fi - - if [[ "$(gcc-major-version)" -ge 4 ]]; then - append-flags -fwrapv - fi - - filter-flags -malign-double - - # https://bugs.gentoo.org/show_bug.cgi?id=50309 - if is-flagq -O3; then - is-flagq -fstack-protector-all && replace-flags -O3 -O2 - use hardened && replace-flags -O3 -O2 - fi - - # https://bugs.gentoo.org/700012 - if is-flagq -flto || is-flagq '-flto=*'; then - append-cflags $(test-flags-CC -ffat-lto-objects) - fi - - # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. - tc-export CXX - - # Set LDFLAGS so we link modules with -lpython3.2 correctly. - # Needed on FreeBSD unless Python 3.2 is already installed. - # Please query BSD team before removing this! - append-ldflags "-L." - - # Fix implicit declarations on cross and prefix builds. Bug #674070. - use ncurses && append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw - use prefix && append-ldflags -L"${ESYSROOT}"/lib -L"${ESYSROOT}"/usr/lib - - local dbmliborder - if use gdbm; then - dbmliborder+="${dbmliborder:+:}gdbm" - fi - - if use aqua ; then - ECONF_SOURCE="${S}" OPT="" \ - econf \ - --enable-framework="${EPREFIX}" \ - --config-cache - fi - - # flock on 32-bits sparc Solaris is broken - [[ ${CHOST} == sparc-*-solaris* ]] && \ - export ac_cv_flock_decl=no - - local myeconfargs=( - # glibc-2.30 removes it; since we can't cleanly force-rebuild - # Python on glibc upgrade, remove it proactively to give - # a chance for users rebuilding python before glibc - # except on non-glibc systems this breaks the build, so be - # conservative! - $(use elibc_glibc && echo ac_cv_header_stropts_h=no) - - $(use aqua && echo --config-cache) - --enable-shared - $(use_enable ipv6) - --infodir='${prefix}/share/info' - --mandir='${prefix}/share/man' - --with-computed-gotos - --with-dbmliborder="${dbmliborder}" - --with-libc= - --enable-loadable-sqlite-extensions - --without-ensurepip - --with-system-expat - --with-system-ffi - ) - - OPT="" econf "${myeconfargs[@]}" -} - -src_compile() { - # Ensure sed works as expected - # https://bugs.gentoo.org/594768 - local -x LC_ALL=C - - emake CPPFLAGS= CFLAGS= LDFLAGS= - - # Work around bug 329499. See also bug 413751 and 457194. - if has_version dev-libs/libffi[pax_kernel]; then - pax-mark E python - else - pax-mark m python - fi -} - -src_test() { - # Tests will not work when cross compiling. - if tc-is-cross-compiler; then - elog "Disabling tests due to crosscompiling." - return - fi - - # Skip failing tests. - local skipped_tests="gdb" - - for test in ${skipped_tests}; do - mv "${S}"/Lib/test/test_${test}.py "${T}" - done - - # bug 660358 - local -x COLUMNS=80 - local -x PYTHONDONTWRITEBYTECODE= - - local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") - - emake test EXTRATESTOPTS="-u-network -j${jobs}" \ - CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty - local result=$? - - for test in ${skipped_tests}; do - mv "${T}/test_${test}.py" "${S}"/Lib/test - done - - elog "The following tests have been skipped:" - for test in ${skipped_tests}; do - elog "test_${test}.py" - done - - elog "If you would like to run them, you may:" - elog "cd '${EPREFIX}/usr/lib/python${PYVER}/test'" - elog "and run the tests separately." - - if [[ ${result} -ne 0 ]]; then - die "emake test failed" - fi -} - -src_install() { - local libdir=${ED}/usr/lib/python${PYVER} - - emake DESTDIR="${D}" altinstall - - if use aqua ; then - # avoid config.status to be triggered - find Mac -name "Makefile" -exec touch \{\} + || die - - # Python_Launcher is kind of a wrapper, and we should fix it for - # Prefix (it uses /usr/bin/pythonw) so useless - # IDLE doesn't run, no idea, but definitely not used - emake DESTDIR="${D}" -C Mac install_Python || die - rmdir "${ED}"/Applications/Python* || die - rmdir "${ED}"/Applications || die - - local fwdir=/Frameworks/Python.framework/Versions/${PYVER} - ln -s "${EPREFIX}"/usr/include/python${PYVER} \ - "${ED}${fwdir}"/Headers || die - ln -s "${EPREFIX}"/usr/lib/libpython${PYVER}.dylib \ - "${ED}${fwdir}"/Python || die - fi - - # Remove static library - rm "${ED}"/usr/$(get_libdir)/libpython*.a || die - - sed \ - -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \ - -e "s/\(PY_LDFLAGS=\).*/\1/" \ - -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed" - - # Fix collisions between different slots of Python. - rm -f "${ED}/usr/$(get_libdir)/libpython3$(get_libname)" || die - - # Cheap hack to get version with ABIFLAGS - local abiver=$(cd "${ED}/usr/include"; echo python*) - if [[ ${abiver} != python${PYVER} ]]; then - # Replace python3.X with a symlink to python3.Xm - rm "${ED}/usr/bin/python${PYVER}" || die - dosym "${abiver}" "/usr/bin/python${PYVER}" - # Create python3.X-config symlink - dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" - # Create python-3.5m.pc symlink - dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" - fi - - # python seems to get rebuilt in src_install (bug 569908) - # Work around it for now. - if has_version dev-libs/libffi[pax_kernel]; then - pax-mark E "${ED}/usr/bin/${abiver}" - else - pax-mark m "${ED}/usr/bin/${abiver}" - fi - - use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die - use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die - - use wininst || rm "${libdir}/distutils/command/"wininst-*.exe || die - - dodoc Misc/{ACKS,HISTORY,NEWS} - - if use examples; then - docinto examples - find Tools -name __pycache__ -exec rm -fr {} + || die - dodoc -r Tools - fi - insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 - if use aqua ; then - # we do framework, so the emake trick below returns a pathname - # since that won't work here, use a (cheap) trick instead - local libname=libpython${PYVER} - else - local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \ - emake --no-print-directory -s -f - 2>/dev/null) - fi - newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py - - newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER} - newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER} - sed \ - -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ - -e "s:@PYDOC@:pydoc${PYVER}:" \ - -i "${ED}/etc/conf.d/pydoc-${PYVER}" \ - "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed" - - local -x EPYTHON=python${PYVER} - # if not using a cross-compiler, use the fresh binary - if ! tc-is-cross-compiler; then - local -x PYTHON=./python$(sed -n '/BUILDEXE=/s/^.*=\s\+//p' Makefile) - local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD} - local -x DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH+${DYLD_LIBRARY_PATH}:}${PWD} - else - local -x PYTHON=${EPREFIX}/usr/bin/${EPYTHON} - fi - - echo "EPYTHON='${EPYTHON}'" > epython.py || die - python_domodule epython.py - - # python-exec wrapping support - local pymajor=${PYVER%.*} - local scriptdir=${D}$(python_get_scriptdir) - mkdir -p "${scriptdir}" || die - # python and pythonX - ln -s "../../../bin/${abiver}" \ - "${scriptdir}/python${pymajor}" || die - ln -s "python${pymajor}" "${scriptdir}/python" || die - # python-config and pythonX-config - # note: we need to create a wrapper rather than symlinking it due - # to some random dirname(argv[0]) magic performed by python-config - cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die - #!/bin/sh - exec "${abiver}-config" "\${@}" - EOF - chmod +x "${scriptdir}/python${pymajor}-config" || die - ln -s "python${pymajor}-config" \ - "${scriptdir}/python-config" || die - # 2to3, pydoc - ln -s "../../../bin/2to3-${PYVER}" \ - "${scriptdir}/2to3" || die - ln -s "../../../bin/pydoc${PYVER}" \ - "${scriptdir}/pydoc" || die - # idle - if use tk; then - ln -s "../../../bin/idle${PYVER}" \ - "${scriptdir}/idle" || die - fi -} - -pkg_preinst() { - if has_version "<${CATEGORY}/${PN}-${PYVER}" && ! has_version ">=${CATEGORY}/${PN}-${PYVER}_alpha"; then - python_updater_warning="1" - fi -} - -eselect_python_update() { - if [[ -z "$(eselect python show)" || \ - ! -f "${EROOT}/usr/bin/$(eselect python show)" ]]; then - eselect python update - fi - - if [[ -z "$(eselect python show --python${PV%%.*})" || \ - ! -f "${EROOT}/usr/bin/$(eselect python show --python${PV%%.*})" ]] - then - eselect python update --python${PV%%.*} - fi -} - -pkg_postinst() { - eselect_python_update - - if [[ "${python_updater_warning}" == "1" ]]; then - ewarn "You have just upgraded from an older version of Python." - ewarn - ewarn "Please adjust PYTHON_TARGETS (if so desired), and run emerge with the --newuse or --changed-use option to rebuild packages installing python modules." - fi -} - -pkg_postrm() { - eselect_python_update -} diff --git a/dev-lang/python/python-3.9.1-r1.ebuild b/dev-lang/python/python-3.9.1-r1.ebuild new file mode 100644 index 0000000000..f67fbc4715 --- /dev/null +++ b/dev-lang/python/python-3.9.1-r1.ebuild @@ -0,0 +1,392 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="7" +WANT_LIBTOOL="none" + +inherit autotools check-reqs flag-o-matic multiprocessing pax-utils \ + python-utils-r1 toolchain-funcs + +MY_P="Python-${PV/_/}" +PYVER=$(ver_cut 1-2) +PATCHSET="python-gentoo-patches-3.9.1-r1" +PREFIX_PATCHSET="python-prefix-gentoo-${PV}-patches-r2" + +DESCRIPTION="An interpreted, interactive, object-oriented programming language" +HOMEPAGE="https://www.python.org/" +SRC_URI="https://www.python.org/ftp/python/${PV%_*}/${MY_P}.tar.xz + https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz + https://dev.gentoo.org/~grobian/distfiles/${PREFIX_PATCHSET}.tar.xz" +S="${WORKDIR}/${MY_P}" + +LICENSE="PSF-2" +SLOT="${PYVER}" +KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="aqua bluetooth build examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl test tk +xml" +RESTRICT="!test? ( test )" + +# Do not add a dependency on dev-lang/python to this ebuild. +# If you need to apply a patch which requires python for bootstrapping, please +# run the bootstrap code on your dev box and include the results in the +# patchset. See bug 447752. + +RDEPEND="app-arch/bzip2:= + app-arch/xz-utils:= + dev-libs/libffi:= + kernel_linux? ( sys-apps/util-linux:= ) + >=sys-libs/zlib-1.1.3:= + virtual/libcrypt:= + virtual/libintl + gdbm? ( sys-libs/gdbm:=[berkdb] ) + ncurses? ( >=sys-libs/ncurses-5.2:= ) + readline? ( >=sys-libs/readline-4.1:= ) + sqlite? ( >=dev-db/sqlite-3.3.8:3= ) + ssl? ( + !libressl? ( dev-libs/openssl:= ) + libressl? ( dev-libs/libressl:= ) + ) + tk? ( + >=dev-lang/tcl-8.0:= + >=dev-lang/tk-8.0:= + dev-tcltk/blt:= + dev-tcltk/tix + ) + xml? ( >=dev-libs/expat-2.1:= )" +# bluetooth requires headers from bluez +DEPEND="${RDEPEND} + bluetooth? ( net-wireless/bluez ) + test? ( app-arch/xz-utils[extra-filters(+)] ) + virtual/pkgconfig + !sys-devel/gcc[libffi(-)]" +RDEPEND+=" !build? ( app-misc/mime-types )" +PDEPEND=">=app-eselect/eselect-python-20140125-r1" + +# large file tests involve a 2.5G file being copied (duplicated) +CHECKREQS_DISK_BUILD=5500M + +pkg_pretend() { + use test && check-reqs_pkg_pretend +} + +pkg_setup() { + use test && check-reqs_pkg_setup +} + +src_prepare() { + # Ensure that internal copies of expat, libffi and zlib are not used. + rm -fr Modules/expat || die + rm -fr Modules/_ctypes/libffi* || die + rm -fr Modules/zlib || die + + local PATCHES=( + "${WORKDIR}/${PATCHSET}" + # Prefix' round of patches + "${WORKDIR}"/${PREFIX_PATCHSET} + ) + + default + + sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ + setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@" + + # force correct number of jobs + # https://bugs.gentoo.org/737660 + local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") + sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die + sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die + + # workaround a problem on ppc-macos with >=GCC-8 where dtoa gets + # miscompiled when optimisation is being used + if [[ ${CHOST} == powerpc*-darwin* ]] && \ + tc-is-gcc && [[ $(gcc-major-version) -ge 8 ]] ; + then + sed -i \ + -e '/^CFLAGS_ALIASING=/s/$/ -fno-tree-ter/' Makefile.pre.in || die + fi + + # Darwin 9's kqueue seems to act up (at least at this stage), so + # make Python's selectors resort to poll() or select() + if [[ ${CHOST} == powerpc*-darwin9 ]] ; then + sed -i \ + -e 's/KQUEUE/KQUEUE_DISABLED/' \ + configure.ac configure || die + fi + + eautoreconf +} + +src_configure() { + local disable + # disable automagic bluetooth headers detection + use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no + use gdbm || disable+=" gdbm" + use ncurses || disable+=" _curses _curses_panel" + use readline || disable+=" readline" + use sqlite || disable+=" _sqlite3" + use ssl || export PYTHON_DISABLE_SSL="1" + use tk || disable+=" _tkinter" + use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. + export PYTHON_DISABLE_MODULES="${disable}" + + if ! use xml; then + ewarn "You have configured Python without XML support." + ewarn "This is NOT a recommended configuration as you" + ewarn "may face problems parsing any XML documents." + fi + + if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then + einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}" + fi + + if [[ "$(gcc-major-version)" -ge 4 ]]; then + append-flags -fwrapv + fi + + filter-flags -malign-double + + # https://bugs.gentoo.org/show_bug.cgi?id=50309 + if is-flagq -O3; then + is-flagq -fstack-protector-all && replace-flags -O3 -O2 + use hardened && replace-flags -O3 -O2 + fi + + # https://bugs.gentoo.org/700012 + if is-flagq -flto || is-flagq '-flto=*'; then + append-cflags $(test-flags-CC -ffat-lto-objects) + fi + + # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. + tc-export CXX + + # Set LDFLAGS so we link modules with -lpython3.2 correctly. + # Needed on FreeBSD unless Python 3.2 is already installed. + # Please query BSD team before removing this! + append-ldflags "-L." + + # Fix implicit declarations on cross and prefix builds. Bug #674070. + use ncurses && append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw + use prefix && append-ldflags -L"${ESYSROOT}"/lib -L"${ESYSROOT}"/usr/lib + + local dbmliborder + if use gdbm; then + dbmliborder+="${dbmliborder:+:}gdbm" + fi + + if use aqua ; then + ECONF_SOURCE="${S}" OPT="" \ + econf \ + --enable-framework="${EPREFIX}" \ + --config-cache + fi + + # flock on 32-bits sparc Solaris is broken + [[ ${CHOST} == sparc-*-solaris* ]] && \ + export ac_cv_flock_decl=no + + local myeconfargs=( + # glibc-2.30 removes it; since we can't cleanly force-rebuild + # Python on glibc upgrade, remove it proactively to give + # a chance for users rebuilding python before glibc + # except on non-glibc systems this breaks the build, so be + # conservative! + $(use elibc_glibc && echo ac_cv_header_stropts_h=no) + + $(use aqua && echo --config-cache) + --enable-shared + $(use_enable ipv6) + --infodir='${prefix}/share/info' + --mandir='${prefix}/share/man' + --with-computed-gotos + --with-dbmliborder="${dbmliborder}" + --with-libc= + --enable-loadable-sqlite-extensions + --without-ensurepip + --with-system-expat + --with-system-ffi + ) + + OPT="" econf "${myeconfargs[@]}" +} + +src_compile() { + # Ensure sed works as expected + # https://bugs.gentoo.org/594768 + local -x LC_ALL=C + + emake CPPFLAGS= CFLAGS= LDFLAGS= + + # Work around bug 329499. See also bug 413751 and 457194. + if has_version dev-libs/libffi[pax_kernel]; then + pax-mark E python + else + pax-mark m python + fi +} + +src_test() { + # Tests will not work when cross compiling. + if tc-is-cross-compiler; then + elog "Disabling tests due to crosscompiling." + return + fi + + # Skip failing tests. + local skipped_tests="gdb" + + for test in ${skipped_tests}; do + mv "${S}"/Lib/test/test_${test}.py "${T}" + done + + # bug 660358 + local -x COLUMNS=80 + local -x PYTHONDONTWRITEBYTECODE= + + local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") + + emake test EXTRATESTOPTS="-u-network -j${jobs}" \ + CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty + local result=$? + + for test in ${skipped_tests}; do + mv "${T}/test_${test}.py" "${S}"/Lib/test + done + + elog "The following tests have been skipped:" + for test in ${skipped_tests}; do + elog "test_${test}.py" + done + + elog "If you would like to run them, you may:" + elog "cd '${EPREFIX}/usr/lib/python${PYVER}/test'" + elog "and run the tests separately." + + if [[ ${result} -ne 0 ]]; then + die "emake test failed" + fi +} + +src_install() { + local libdir=${ED}/usr/lib/python${PYVER} + + emake DESTDIR="${D}" altinstall + + if use aqua ; then + # avoid config.status to be triggered + find Mac -name "Makefile" -exec touch \{\} + || die + + # Python_Launcher is kind of a wrapper, and we should fix it for + # Prefix (it uses /usr/bin/pythonw) so useless + # IDLE doesn't run, no idea, but definitely not used + emake DESTDIR="${D}" -C Mac install_Python || die + rmdir "${ED}"/Applications/Python* || die + rmdir "${ED}"/Applications || die + + local fwdir=/Frameworks/Python.framework/Versions/${PYVER} + ln -s "${EPREFIX}"/usr/include/python${PYVER} \ + "${ED}${fwdir}"/Headers || die + ln -s "${EPREFIX}"/usr/lib/libpython${PYVER}.dylib \ + "${ED}${fwdir}"/Python || die + fi + + # Remove static library + rm "${ED}"/usr/$(get_libdir)/libpython*.a || die + + sed \ + -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \ + -e "s/\(PY_LDFLAGS=\).*/\1/" \ + -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed" + + # Fix collisions between different slots of Python. + rm -f "${ED}/usr/$(get_libdir)/libpython3$(get_libname)" || die + + # Cheap hack to get version with ABIFLAGS + local abiver=$(cd "${ED}/usr/include"; echo python*) + if [[ ${abiver} != python${PYVER} ]]; then + # Replace python3.X with a symlink to python3.Xm + rm "${ED}/usr/bin/python${PYVER}" || die + dosym "${abiver}" "/usr/bin/python${PYVER}" + # Create python3.X-config symlink + dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" + # Create python-3.5m.pc symlink + dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" + fi + + # python seems to get rebuilt in src_install (bug 569908) + # Work around it for now. + if has_version dev-libs/libffi[pax_kernel]; then + pax-mark E "${ED}/usr/bin/${abiver}" + else + pax-mark m "${ED}/usr/bin/${abiver}" + fi + + use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die + use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die + + dodoc Misc/{ACKS,HISTORY,NEWS} + + if use examples; then + docinto examples + find Tools -name __pycache__ -exec rm -fr {} + || die + dodoc -r Tools + fi + insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 + if use aqua ; then + # we do framework, so the emake trick below returns a pathname + # since that won't work here, use a (cheap) trick instead + local libname=libpython${PYVER} + else + local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \ + emake --no-print-directory -s -f - 2>/dev/null) + fi + newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py + + newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER} + newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER} + sed \ + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ + -e "s:@PYDOC@:pydoc${PYVER}:" \ + -i "${ED}/etc/conf.d/pydoc-${PYVER}" \ + "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed" + + local -x EPYTHON=python${PYVER} + # if not using a cross-compiler, use the fresh binary + if ! tc-is-cross-compiler; then + local -x PYTHON=./python$(sed -n '/BUILDEXE=/s/^.*=\s\+//p' Makefile) + local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD} + local -x DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH+${DYLD_LIBRARY_PATH}:}${PWD} + else + local -x PYTHON=${EPREFIX}/usr/bin/${EPYTHON} + fi + + echo "EPYTHON='${EPYTHON}'" > epython.py || die + python_domodule epython.py + + # python-exec wrapping support + local pymajor=${PYVER%.*} + local scriptdir=${D}$(python_get_scriptdir) + mkdir -p "${scriptdir}" || die + # python and pythonX + ln -s "../../../bin/${abiver}" \ + "${scriptdir}/python${pymajor}" || die + ln -s "python${pymajor}" "${scriptdir}/python" || die + # python-config and pythonX-config + # note: we need to create a wrapper rather than symlinking it due + # to some random dirname(argv[0]) magic performed by python-config + cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die + #!/bin/sh + exec "${abiver}-config" "\${@}" + EOF + chmod +x "${scriptdir}/python${pymajor}-config" || die + ln -s "python${pymajor}-config" \ + "${scriptdir}/python-config" || die + # 2to3, pydoc + ln -s "../../../bin/2to3-${PYVER}" \ + "${scriptdir}/2to3" || die + ln -s "../../../bin/pydoc${PYVER}" \ + "${scriptdir}/pydoc" || die + # idle + if use tk; then + ln -s "../../../bin/idle${PYVER}" \ + "${scriptdir}/idle" || die + fi +} diff --git a/dev-lang/python/python-3.9.1.ebuild b/dev-lang/python/python-3.9.1.ebuild deleted file mode 100644 index 5705cc3527..0000000000 --- a/dev-lang/python/python-3.9.1.ebuild +++ /dev/null @@ -1,392 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI="7" -WANT_LIBTOOL="none" - -inherit autotools check-reqs flag-o-matic multiprocessing pax-utils \ - python-utils-r1 toolchain-funcs - -MY_P="Python-${PV/_/}" -PYVER=$(ver_cut 1-2) -PATCHSET="python-gentoo-patches-3.9.0rc1" -PREFIX_PATCHSET="python-prefix-gentoo-${PV}-patches-r2" - -DESCRIPTION="An interpreted, interactive, object-oriented programming language" -HOMEPAGE="https://www.python.org/" -SRC_URI="https://www.python.org/ftp/python/${PV%_*}/${MY_P}.tar.xz - https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz - https://dev.gentoo.org/~grobian/distfiles/${PREFIX_PATCHSET}.tar.xz" -S="${WORKDIR}/${MY_P}" - -LICENSE="PSF-2" -SLOT="${PYVER}" -KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" -IUSE="aqua bluetooth build examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl test tk +xml" -RESTRICT="!test? ( test )" - -# Do not add a dependency on dev-lang/python to this ebuild. -# If you need to apply a patch which requires python for bootstrapping, please -# run the bootstrap code on your dev box and include the results in the -# patchset. See bug 447752. - -RDEPEND="app-arch/bzip2:= - app-arch/xz-utils:= - dev-libs/libffi:= - kernel_linux? ( sys-apps/util-linux:= ) - >=sys-libs/zlib-1.1.3:= - virtual/libcrypt:= - virtual/libintl - gdbm? ( sys-libs/gdbm:=[berkdb] ) - ncurses? ( >=sys-libs/ncurses-5.2:= ) - readline? ( >=sys-libs/readline-4.1:= ) - sqlite? ( >=dev-db/sqlite-3.3.8:3= ) - ssl? ( - !libressl? ( dev-libs/openssl:= ) - libressl? ( dev-libs/libressl:= ) - ) - tk? ( - >=dev-lang/tcl-8.0:= - >=dev-lang/tk-8.0:= - dev-tcltk/blt:= - dev-tcltk/tix - ) - xml? ( >=dev-libs/expat-2.1:= )" -# bluetooth requires headers from bluez -DEPEND="${RDEPEND} - bluetooth? ( net-wireless/bluez ) - test? ( app-arch/xz-utils[extra-filters(+)] ) - virtual/pkgconfig - !sys-devel/gcc[libffi(-)]" -RDEPEND+=" !build? ( app-misc/mime-types )" -PDEPEND=">=app-eselect/eselect-python-20140125-r1" - -# large file tests involve a 2.5G file being copied (duplicated) -CHECKREQS_DISK_BUILD=5500M - -pkg_pretend() { - use test && check-reqs_pkg_pretend -} - -pkg_setup() { - use test && check-reqs_pkg_setup -} - -src_prepare() { - # Ensure that internal copies of expat, libffi and zlib are not used. - rm -fr Modules/expat || die - rm -fr Modules/_ctypes/libffi* || die - rm -fr Modules/zlib || die - - local PATCHES=( - "${WORKDIR}/${PATCHSET}" - # Prefix' round of patches - "${WORKDIR}"/${PREFIX_PATCHSET} - ) - - default - - sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ - setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@" - - # force correct number of jobs - # https://bugs.gentoo.org/737660 - local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") - sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die - sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die - - # workaround a problem on ppc-macos with >=GCC-8 where dtoa gets - # miscompiled when optimisation is being used - if [[ ${CHOST} == powerpc*-darwin* ]] && \ - tc-is-gcc && [[ $(gcc-major-version) -ge 8 ]] ; - then - sed -i \ - -e '/^CFLAGS_ALIASING=/s/$/ -fno-tree-ter/' Makefile.pre.in || die - fi - - # Darwin 9's kqueue seems to act up (at least at this stage), so - # make Python's selectors resort to poll() or select() - if [[ ${CHOST} == powerpc*-darwin9 ]] ; then - sed -i \ - -e 's/KQUEUE/KQUEUE_DISABLED/' \ - configure.ac configure || die - fi - - eautoreconf -} - -src_configure() { - local disable - # disable automagic bluetooth headers detection - use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no - use gdbm || disable+=" gdbm" - use ncurses || disable+=" _curses _curses_panel" - use readline || disable+=" readline" - use sqlite || disable+=" _sqlite3" - use ssl || export PYTHON_DISABLE_SSL="1" - use tk || disable+=" _tkinter" - use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. - export PYTHON_DISABLE_MODULES="${disable}" - - if ! use xml; then - ewarn "You have configured Python without XML support." - ewarn "This is NOT a recommended configuration as you" - ewarn "may face problems parsing any XML documents." - fi - - if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then - einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}" - fi - - if [[ "$(gcc-major-version)" -ge 4 ]]; then - append-flags -fwrapv - fi - - filter-flags -malign-double - - # https://bugs.gentoo.org/show_bug.cgi?id=50309 - if is-flagq -O3; then - is-flagq -fstack-protector-all && replace-flags -O3 -O2 - use hardened && replace-flags -O3 -O2 - fi - - # https://bugs.gentoo.org/700012 - if is-flagq -flto || is-flagq '-flto=*'; then - append-cflags $(test-flags-CC -ffat-lto-objects) - fi - - # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. - tc-export CXX - - # Set LDFLAGS so we link modules with -lpython3.2 correctly. - # Needed on FreeBSD unless Python 3.2 is already installed. - # Please query BSD team before removing this! - append-ldflags "-L." - - # Fix implicit declarations on cross and prefix builds. Bug #674070. - use ncurses && append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw - use prefix && append-ldflags -L"${ESYSROOT}"/lib -L"${ESYSROOT}"/usr/lib - - local dbmliborder - if use gdbm; then - dbmliborder+="${dbmliborder:+:}gdbm" - fi - - if use aqua ; then - ECONF_SOURCE="${S}" OPT="" \ - econf \ - --enable-framework="${EPREFIX}" \ - --config-cache - fi - - # flock on 32-bits sparc Solaris is broken - [[ ${CHOST} == sparc-*-solaris* ]] && \ - export ac_cv_flock_decl=no - - local myeconfargs=( - # glibc-2.30 removes it; since we can't cleanly force-rebuild - # Python on glibc upgrade, remove it proactively to give - # a chance for users rebuilding python before glibc - # except on non-glibc systems this breaks the build, so be - # conservative! - $(use elibc_glibc && echo ac_cv_header_stropts_h=no) - - $(use aqua && echo --config-cache) - --enable-shared - $(use_enable ipv6) - --infodir='${prefix}/share/info' - --mandir='${prefix}/share/man' - --with-computed-gotos - --with-dbmliborder="${dbmliborder}" - --with-libc= - --enable-loadable-sqlite-extensions - --without-ensurepip - --with-system-expat - --with-system-ffi - ) - - OPT="" econf "${myeconfargs[@]}" -} - -src_compile() { - # Ensure sed works as expected - # https://bugs.gentoo.org/594768 - local -x LC_ALL=C - - emake CPPFLAGS= CFLAGS= LDFLAGS= - - # Work around bug 329499. See also bug 413751 and 457194. - if has_version dev-libs/libffi[pax_kernel]; then - pax-mark E python - else - pax-mark m python - fi -} - -src_test() { - # Tests will not work when cross compiling. - if tc-is-cross-compiler; then - elog "Disabling tests due to crosscompiling." - return - fi - - # Skip failing tests. - local skipped_tests="gdb" - - for test in ${skipped_tests}; do - mv "${S}"/Lib/test/test_${test}.py "${T}" - done - - # bug 660358 - local -x COLUMNS=80 - local -x PYTHONDONTWRITEBYTECODE= - - local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") - - emake test EXTRATESTOPTS="-u-network -j${jobs}" \ - CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty - local result=$? - - for test in ${skipped_tests}; do - mv "${T}/test_${test}.py" "${S}"/Lib/test - done - - elog "The following tests have been skipped:" - for test in ${skipped_tests}; do - elog "test_${test}.py" - done - - elog "If you would like to run them, you may:" - elog "cd '${EPREFIX}/usr/lib/python${PYVER}/test'" - elog "and run the tests separately." - - if [[ ${result} -ne 0 ]]; then - die "emake test failed" - fi -} - -src_install() { - local libdir=${ED}/usr/lib/python${PYVER} - - emake DESTDIR="${D}" altinstall - - if use aqua ; then - # avoid config.status to be triggered - find Mac -name "Makefile" -exec touch \{\} + || die - - # Python_Launcher is kind of a wrapper, and we should fix it for - # Prefix (it uses /usr/bin/pythonw) so useless - # IDLE doesn't run, no idea, but definitely not used - emake DESTDIR="${D}" -C Mac install_Python || die - rmdir "${ED}"/Applications/Python* || die - rmdir "${ED}"/Applications || die - - local fwdir=/Frameworks/Python.framework/Versions/${PYVER} - ln -s "${EPREFIX}"/usr/include/python${PYVER} \ - "${ED}${fwdir}"/Headers || die - ln -s "${EPREFIX}"/usr/lib/libpython${PYVER}.dylib \ - "${ED}${fwdir}"/Python || die - fi - - # Remove static library - rm "${ED}"/usr/$(get_libdir)/libpython*.a || die - - sed \ - -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \ - -e "s/\(PY_LDFLAGS=\).*/\1/" \ - -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed" - - # Fix collisions between different slots of Python. - rm -f "${ED}/usr/$(get_libdir)/libpython3$(get_libname)" || die - - # Cheap hack to get version with ABIFLAGS - local abiver=$(cd "${ED}/usr/include"; echo python*) - if [[ ${abiver} != python${PYVER} ]]; then - # Replace python3.X with a symlink to python3.Xm - rm "${ED}/usr/bin/python${PYVER}" || die - dosym "${abiver}" "/usr/bin/python${PYVER}" - # Create python3.X-config symlink - dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" - # Create python-3.5m.pc symlink - dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" - fi - - # python seems to get rebuilt in src_install (bug 569908) - # Work around it for now. - if has_version dev-libs/libffi[pax_kernel]; then - pax-mark E "${ED}/usr/bin/${abiver}" - else - pax-mark m "${ED}/usr/bin/${abiver}" - fi - - use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die - use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die - - dodoc Misc/{ACKS,HISTORY,NEWS} - - if use examples; then - docinto examples - find Tools -name __pycache__ -exec rm -fr {} + || die - dodoc -r Tools - fi - insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 - if use aqua ; then - # we do framework, so the emake trick below returns a pathname - # since that won't work here, use a (cheap) trick instead - local libname=libpython${PYVER} - else - local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \ - emake --no-print-directory -s -f - 2>/dev/null) - fi - newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py - - newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER} - newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER} - sed \ - -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ - -e "s:@PYDOC@:pydoc${PYVER}:" \ - -i "${ED}/etc/conf.d/pydoc-${PYVER}" \ - "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed" - - local -x EPYTHON=python${PYVER} - # if not using a cross-compiler, use the fresh binary - if ! tc-is-cross-compiler; then - local -x PYTHON=./python$(sed -n '/BUILDEXE=/s/^.*=\s\+//p' Makefile) - local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD} - local -x DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH+${DYLD_LIBRARY_PATH}:}${PWD} - else - local -x PYTHON=${EPREFIX}/usr/bin/${EPYTHON} - fi - - echo "EPYTHON='${EPYTHON}'" > epython.py || die - python_domodule epython.py - - # python-exec wrapping support - local pymajor=${PYVER%.*} - local scriptdir=${D}$(python_get_scriptdir) - mkdir -p "${scriptdir}" || die - # python and pythonX - ln -s "../../../bin/${abiver}" \ - "${scriptdir}/python${pymajor}" || die - ln -s "python${pymajor}" "${scriptdir}/python" || die - # python-config and pythonX-config - # note: we need to create a wrapper rather than symlinking it due - # to some random dirname(argv[0]) magic performed by python-config - cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die - #!/bin/sh - exec "${abiver}-config" "\${@}" - EOF - chmod +x "${scriptdir}/python${pymajor}-config" || die - ln -s "python${pymajor}-config" \ - "${scriptdir}/python-config" || die - # 2to3, pydoc - ln -s "../../../bin/2to3-${PYVER}" \ - "${scriptdir}/2to3" || die - ln -s "../../../bin/pydoc${PYVER}" \ - "${scriptdir}/pydoc" || die - # idle - if use tk; then - ln -s "../../../bin/idle${PYVER}" \ - "${scriptdir}/idle" || die - fi -} -- cgit v1.2.3