diff options
author | Dirkjan Ochtman <djc@gentoo.org> | 2011-06-27 08:28:31 +0000 |
---|---|---|
committer | Dirkjan Ochtman <djc@gentoo.org> | 2011-06-27 08:28:31 +0000 |
commit | 01e105ee19ccb4801a3f5f3acc5f99dc5e9e3327 (patch) | |
tree | f6a46b47bf1dce2e8c4406669cc82c7a909e7fea /dev-lang | |
parent | Changelog typo fix: 1.8 -> 1.6.2; more caffeine required. (diff) | |
download | historical-01e105ee19ccb4801a3f5f3acc5f99dc5e9e3327.tar.gz historical-01e105ee19ccb4801a3f5f3acc5f99dc5e9e3327.tar.bz2 historical-01e105ee19ccb4801a3f5f3acc5f99dc5e9e3327.zip |
Version bumps. Ebuilds and patchsets by Arfrever.
Package-Manager: portage-2.1.10.3/cvs/Linux x86_64
Diffstat (limited to 'dev-lang')
-rw-r--r-- | dev-lang/python/ChangeLog | 10 | ||||
-rw-r--r-- | dev-lang/python/Manifest | 27 | ||||
-rw-r--r-- | dev-lang/python/python-2.6.7.ebuild | 372 | ||||
-rw-r--r-- | dev-lang/python/python-2.7.2.ebuild | 387 | ||||
-rw-r--r-- | dev-lang/python/python-3.1.4.ebuild | 350 |
5 files changed, 1131 insertions, 15 deletions
diff --git a/dev-lang/python/ChangeLog b/dev-lang/python/ChangeLog index 2f35772aaec1..15e668391dd9 100644 --- a/dev-lang/python/ChangeLog +++ b/dev-lang/python/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for dev-lang/python # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/ChangeLog,v 1.536 2011/05/17 15:19:21 arfrever Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/ChangeLog,v 1.537 2011/06/27 08:28:31 djc Exp $ + +*python-3.1.4 (27 Jun 2011) +*python-2.7.2 (27 Jun 2011) +*python-2.6.7 (27 Jun 2011) + + 27 Jun 2011; Dirkjan Ochtman <djc@gentoo.org> +python-2.6.7.ebuild, + +python-2.7.2.ebuild, +python-3.1.4.ebuild: + Version bumps. Ebuilds and patchsets by Arfrever. *python-2.7.1-r2 (17 May 2011) diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest index b62399c33dd7..49168ef907e3 100644 --- a/dev-lang/python/Manifest +++ b/dev-lang/python/Manifest @@ -12,41 +12,40 @@ DIST Python-2.4.6.tar.bz2 8154677 RMD160 0687989193dec2ac108142759281be7ddcf7f31 DIST Python-2.5.4.tar.bz2 9821313 RMD160 3a76c83464c3b1c38a60351ab054e33ac7195663 SHA1 0f2e819d6381f72f26c734e00a6780b3933ea404 SHA256 bc8d896a2bfe5523ba93b8d89b71017b74e8e6cb21dc676a0ccff668c8780110 DIST Python-2.6.5.tar.bz2 11095581 RMD160 909c6a13749396f2b19fed51821d3e2577b2833b SHA1 24c94f5428a8c94c9d0b316e3019fee721fdb5d1 SHA256 62da62eb685621ede2be1275f11b89fa0e0be578db8daa5320d0a7855c0a9ebc DIST Python-2.6.6.tar.bz2 11080872 RMD160 2d63f4f0ad3c124a8e62215ca94bd0231350e912 SHA1 a1daf2c2c7cffe0939c015260447572fe75c7e50 SHA256 134c5e0736bae2e5570d0b915693374f11108ded63c35a23a35d282737d2ce83 +DIST Python-2.6.7.tar.bz2 11084667 RMD160 513e84a7cb76ca876e3803bb03ed558bd0378063 SHA1 5d35eb746e85fb3deaff8518448137c9b9fb6daa SHA256 4502c1a064ce68416188005662c0269d31175b855502f64c6dfa8f51226a0e5c DIST Python-2.7.1.tar.bz2 11722546 RMD160 3ce59305f6cd3fb320a53771d0ea01ec0687005f SHA1 fbe1894322ff91b80726e269c97454f4129fc2a3 SHA256 80e387bcf57eae8ce26726753584fd63e060ec11682d1145af921e85fd612292 +DIST Python-2.7.2.tar.bz2 11754834 RMD160 c3bf4f09b7c429a4d9f4cc251c795304cd5232c5 SHA1 417bdeea77abfaf1b9257fc6b4a04aaa209f4547 SHA256 5057eb067eb5b5a6040dbd0e889e06550bde9ec041dadaa855ee9490034cbdab DIST Python-3.1.3.tar.bz2 9875464 RMD160 730f3b8eb1a41f1b7c469fc81be734bb802cb9f9 SHA1 aeadf1eb7f450aab77a8972c042bc5f49bcf2288 SHA256 77f6f41a51be4ca85d83670405c8281dd1237bb00d8be8a7560cb3ccdf5558cb +DIST Python-3.1.4.tar.xz 8184052 RMD160 beb24a2a1227aa2bc036263b4c808daa72fa3e02 SHA1 e5767a4fc92433816451de75c8721f2e1a81f6ea SHA256 21aa936b3989a8e32ba17799fcf235e0979a2e1c95e70bcd3bc066185a559afc DIST Python-3.2.tar.xz 8877208 RMD160 25e958dbb17223d6c2060520e0921e6d9c9f7906 SHA1 55a3a9d39f31563370d0c494373bb6d38e4d1a00 SHA256 38a3de4ed38e92e1c3dd81e230caf6569d41bf8df6537d099541a6d3dca1b132 DIST python-gentoo-patches-2.4.6.tar.bz2 10983 RMD160 c06dc76edec86d708a0c0e37126ae50f49f61bd3 SHA1 bbc04083fe74cff8c723c5c3cab70b1b814c987f SHA256 0508a66408f218c655823303833599344d2edeec1ffc683c6ada3fc33731590d DIST python-gentoo-patches-2.5.4-r3.tar.bz2 19473 RMD160 c3a807693103f9e26c3cce4add5a1f3d975ef216 SHA1 c6170894865ee8aac8c813916c21a0d0458691bc SHA256 03f5bdb0a4ac8eb498a90c5cd444a5c76ed7e79bff5e8dca00efe77cf80c6391 DIST python-gentoo-patches-2.6.5-r5.tar.bz2 1482491 RMD160 a7978912b8598a589a82746642fa5b676369c599 SHA1 26c983e79ac32b63a3bc6e411d96b9233524733b SHA256 6cb8cf0e1418cad035a243c08dfeee2e9395397dda74ada49667b3eba63bb76c DIST python-gentoo-patches-2.6.6-r2.tar.bz2 16277 RMD160 432a63f7313e98a99cd300ee3c1f905d343c401e SHA1 30f5ba4e5eb25833331f193966c3e00be4470cf9 SHA256 2754d2aa27086efccc2de73442cf0022f3f9768431b10ff72c9181c4ddd95428 +DIST python-gentoo-patches-2.6.7.tar.bz2 15173 RMD160 0ffb5eb49d463f54e3398973603dd9ead0ab2f9a SHA1 7590bc2dc31ee2c1f6cd04968393137fa43c59f4 SHA256 dcaca7d0a5f266c41c72a3047db24d23e675ce4a0ac9196dae42d7892d5edb33 DIST python-gentoo-patches-2.7.1-r1.tar.bz2 13384 RMD160 d79de2520244a8b9c5de61c9bc591a4e538a7736 SHA1 72a0b75ab891ee20041a65dc2642ee6cf40642be SHA256 cc9b4239a3276c6fd447e3bb3ab8a2f94fbc49e08bb5b20ba5f05b4becda2bf8 DIST python-gentoo-patches-2.7.1-r2.tar.bz2 13610 RMD160 13163307b7bebae8eff27ef47859ce449d50aa4b SHA1 54a1d1d1412cd231d039134dfff179f60a7bcda6 SHA256 f56bca3ef0dca20bfd43a130ba8ecc06f062d1457092070a3e97ee2d3315b29b +DIST python-gentoo-patches-2.7.2.tar.bz2 14485 RMD160 6b66705d61b525d0089326ddb700ad3c5ad6e23e SHA1 94fc9b00cc7e7c60cce41640dc09fd2395a5c5d9 SHA256 29616ce50244c0f7c85b903dcb939d656bfd9d5e8a930d90bff6cf878f3ac5a5 DIST python-gentoo-patches-3.1.3-r1.tar.bz2 13730 RMD160 73f922d850e464e589c7a3cfb8f755d36167d156 SHA1 9228b63c980b80dd7e8dd9e0276c29af18692e33 SHA256 f23056436b298ed0ff9823b52902aaaa63eae0c4585a4a19e47571685127631e +DIST python-gentoo-patches-3.1.4.tar.bz2 12930 RMD160 5ba5d20e065e6c346848d0c3ed12d65cd6b089be SHA1 b6bb595e03a78a87e3164874a9a12711bee4b9f8 SHA256 9800f3a9989c8aac4c96a7e6411baf96af0c18c041627a330681783a84cb4316 DIST python-gentoo-patches-3.2.tar.bz2 11826 RMD160 8d450939f3f2f7f5c779b8701097fcf92909c36b SHA1 bdc922a4b94bbb616dbf702e913f74984ad8bda5 SHA256 43799206ed8c81936e3b3e68e8c562334b346652d30383c5b7b93fe9741ad0db EBUILD python-2.4.6.ebuild 9314 RMD160 de356959ee97e81f345a595066d6400c7a505461 SHA1 b4c771a3876343087928d8d7a786fe017ea40189 SHA256 f36f2dc2cc7fee7fdc03338c9b1a98134e326cb7149eab030eb7632bf64f80a7 EBUILD python-2.5.4-r4.ebuild 9664 RMD160 6da8e6907b3c0675a560952cc45372ec56f419fd SHA1 7d43770dbeabbd0a19bc006bd2bf5187bf84ca68 SHA256 fda530914fba4f8bb4010e6b84c3feee3bf9d5654a808e66c7541038c1d972a2 EBUILD python-2.6.5-r3.ebuild 9460 RMD160 97f44070c60fb4ca097ece0132adc845616f4595 SHA1 7ccce712ce3c94ced869d84cafe30adbbce4c6aa SHA256 5612199d7112e2d7e59f00981dbdf038d57d8abda2b373ca56aa158bf14e6f1b EBUILD python-2.6.6-r2.ebuild 10546 RMD160 48acd2266821d2475a87e60ceb327910f55c3637 SHA1 31bd4e799a77eee7d27f9ce2bad8f7a2656f8021 SHA256 806e1514641dc2a60ce3e0a959bf126501bb763895873c01f8f51494326b9a6c +EBUILD python-2.6.7.ebuild 11425 RMD160 dd85a9176ffd531e761c6d50f8216da8c6631320 SHA1 5bc125ef1be8f0e143a3c810c77d85dd94907a63 SHA256 58b73d96bcef81f7e670417cc3c20e0ecb2cc485f26f8206a1fe5d4e8a928119 EBUILD python-2.7.1-r1.ebuild 11120 RMD160 31a17a4a78201fc4991453d4790acb90e0ffe7b2 SHA1 83aeceed035031758547a668ca9543e94d1cc2f5 SHA256 097372f26e0410438e1f511b6c13678ed16ae68b3d0779a1f848630813ca2dcf EBUILD python-2.7.1-r2.ebuild 11588 RMD160 39548918ba1768e74d18331f3de63d8868607760 SHA1 edd5f2f36627596afec09ff9586bcbb1b4df1a93 SHA256 7e4cc811e03062e871fb2ad12d242cec599a60f568dfa658845d716d69be22a9 +EBUILD python-2.7.2.ebuild 11730 RMD160 b2e61cfa4e6ec27e93fecd894beb1e2d0f8bf70c SHA1 5b0e7fa0285ed508495542d7c1b18fcf9697d4c0 SHA256 b4e7fadc8220b0b966d0efdb73fd28274bf3f31bb47aaa156d833c449d30b5c3 EBUILD python-3.1.3-r1.ebuild 9798 RMD160 20b97be4899f2adba70e79d24134d11e31d1c513 SHA1 b61c32e968662d7c2984221ea48146b020d56498 SHA256 a2680419e5280a2e354a4491bd8a95094675473cf31ae8a7c07f6847fcb16703 +EBUILD python-3.1.4.ebuild 10172 RMD160 f82f03e199a260c118eecbcbb2af5a65d2be8817 SHA1 d617ab7753a1f7667dde13773b94beca27ff0671 SHA256 c294139fc5af41e6d66e928ae1ef69be8256fd94ed9da2c8597413843f22785b EBUILD python-3.2.ebuild 10124 RMD160 cb6ab202ac3be39cb7ef8d28cc7b8b7203358d2d SHA1 56ae059afb4685c316847c32eff1a8a2769e02ab SHA256 66509e8c80ab3d2e1a004d311fdf097b6eff21c1a9d659e0c31df73f6c135ebc -MISC ChangeLog 95590 RMD160 fa4169ae32bf2bb9714627e548bcbec5f011069a SHA1 ecd20bcebe447bbbd08b162593e0ce97fdcb312e SHA256 44f6963a5017a3d3af76a4cb95a7fa15b89902c379dcc5b6032115e4083b9ef8 +MISC ChangeLog 95839 RMD160 3431a8b802192db78513b289561907341bb061ad SHA1 bf158939b213c73cf1390c4aa2c3bbdb7874d494 SHA256 ba8e19432b0bade6b53dabe80968841cb5f457b64f036cc50eba996cfe16e354 MISC metadata.xml 661 RMD160 54831d16b8807086bfabdbb3df9d33336b5d42a0 SHA1 9867c337fe9e6f4e967004fc9409763e0fedf43b SHA256 2c6c3407251f7ccd6501dee49494e539a9544f2fbae99a4373eefdf4e83e8908 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (GNU/Linux) -iQIcBAEBAgAGBQJN0pISAAoJEE70JXb4HvNVPe0P/AtbLxBSGgKDFmstK+FIU6Yn -LHwc1dgsUrsjTRD6UWCvCC35mZX9S5RcQHC+mB3eFiUS2bSsXOXZ7lXUrnEdv1O2 -VdhJzAM6W3j+7iQceyP4cJdXbh0KeWhiyNKtSvBv1eqGwuKlgHKo/rQNB21ILztJ -HiK9+3Vv42tv4Wk3E82otKPeot4etiM6VcqycOHqiszLwgCF3ywyPK17LAMWgN03 -ZoFcp9rBPoNSCn94ZbzwiH6qjNbaGs1dblwLSh8f3fzsMj2EyhIFP+V/QoPoh6l4 -mopwCLrUR6+Fd2VwPJy4FixJPuv4MqIvKBtH95b1gAK4hoD9z/2wNxlRTxy0iwhr -HOntBP7mCwFkgbDOIunIclOZDhtq1oSR1eNBj983tPwaHduBcjsvTduwisHcme5d -7zbZ+RZw/k23kHfz9UqJ6zhYy50M6UH/eI1BmRzd10Oy2wBkE1DraxCwixaVqsHR -pjhDatfx2COM9I45U5GG3XSjYcqFkExiK1KX3FoSWyuH4pKRf/tqj7pXMls16VO9 -+ivZ0oLNaAfVXUBWUqJY4HNRouu87F+op6xQliPSTu6EkkoOCz/JjmS1YewHw5e9 -3cKK3SfbfvwUL+bDo5GAYf8zdy8DSC47aZlJm/YpTe5+r/H1IG7avLO/aNznE0Bt -/fmmUHLa0OaTNQoYi2Zp -=cx99 +iEYEARECAAYFAk4IQBQACgkQxeMuLWsGW/vhwQCfUt6yJ0Xn0BlsuoYDjN5E6OSf +J9wAoJYGNkx3LuYqMgwDDOw7yRsXI3so +=wbqp -----END PGP SIGNATURE----- diff --git a/dev-lang/python/python-2.6.7.ebuild b/dev-lang/python/python-2.6.7.ebuild new file mode 100644 index 000000000000..c25d7597d937 --- /dev/null +++ b/dev-lang/python/python-2.6.7.ebuild @@ -0,0 +1,372 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-2.6.7.ebuild,v 1.1 2011/06/27 08:28:31 djc Exp $ + +EAPI="2" +WANT_AUTOMAKE="none" + +inherit autotools eutils flag-o-matic multilib python toolchain-funcs + +if [[ "${PV}" == *_pre* ]]; then + inherit mercurial + + EHG_REPO_URI="http://hg.python.org/cpython" + EHG_REVISION="" +else + MY_PV="${PV%_p*}" + MY_P="Python-${MY_PV}" +fi + +PATCHSET_REVISION="0" + +DESCRIPTION="Python is an interpreted, interactive, object-oriented programming language." +HOMEPAGE="http://www.python.org/" +if [[ "${PV}" == *_pre* ]]; then + SRC_URI="" +else + SRC_URI="http://www.python.org/ftp/python/${MY_PV}/${MY_P}.tar.bz2 + mirror://gentoo/python-gentoo-patches-${MY_PV}$([[ "${PATCHSET_REVISION}" != "0" ]] && echo "-r${PATCHSET_REVISION}").tar.bz2" +fi + +LICENSE="PSF-2.2" +SLOT="2.6" +PYTHON_ABI="${SLOT}" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd" +IUSE="-berkdb build doc elibc_uclibc examples gdbm ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml" + +RDEPEND=">=app-admin/eselect-python-20091230 + app-arch/bzip2 + >=sys-libs/zlib-1.1.3 + virtual/libffi + virtual/libintl + !build? ( + berkdb? ( || ( + sys-libs/db:4.7 + sys-libs/db:4.6 + sys-libs/db:4.5 + sys-libs/db:4.4 + sys-libs/db:4.3 + sys-libs/db:4.2 + ) ) + gdbm? ( sys-libs/gdbm ) + ncurses? ( + >=sys-libs/ncurses-5.2 + readline? ( >=sys-libs/readline-4.1 ) + ) + sqlite? ( >=dev-db/sqlite-3.3.3:3 ) + ssl? ( dev-libs/openssl ) + tk? ( + >=dev-lang/tk-8.0 + dev-tcltk/blt + ) + xml? ( >=dev-libs/expat-2 ) + ) + !!<sys-apps/portage-2.1.9" +DEPEND="${RDEPEND} + $([[ "${PV}" == *_pre* ]] && echo "=${CATEGORY}/${PN}-${PV%%.*}*") + dev-util/pkgconfig + $([[ "${PV}" =~ ^[[:digit:]]+\.[[:digit:]]+_pre ]] && echo "doc? ( dev-python/sphinx )") + !sys-devel/gcc[libffi]" +RDEPEND+=" !build? ( app-misc/mime-types ) + $([[ "${PV}" =~ ^[[:digit:]]+\.[[:digit:]]+_pre ]] || echo "doc? ( dev-python/python-docs:${SLOT} )")" +PDEPEND="app-admin/python-updater" + +if [[ "${PV}" != *_pre* ]]; then + S="${WORKDIR}/${MY_P}" +fi + +pkg_setup() { + python_pkg_setup + + if use berkdb; then + ewarn "\"bsddb\" module is out-of-date and no longer maintained inside dev-lang/python." + ewarn "\"bsddb\" and \"dbhash\" modules have been additionally removed in Python 3." + ewarn "You should use external, still maintained \"bsddb3\" module provided by dev-python/bsddb3," + ewarn "which supports both Python 2 and Python 3." + else + if has_version "=${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"; then + ewarn "You are migrating from =${CATEGORY}/${PN}-${PV%%.*}*[berkdb] to =${CATEGORY}/${PN}-${PV%%.*}*[-berkdb]." + ewarn "You might need to migrate your databases." + fi + fi +} + +src_prepare() { + # Ensure that internal copies of expat, libffi and zlib are not used. + rm -fr Modules/expat + rm -fr Modules/_ctypes/libffi* + rm -fr Modules/zlib + + if [[ "${PV}" =~ ^[[:digit:]]+\.[[:digit:]]+_pre ]]; then + if [[ "$(hg branch)" != "default" ]]; then + die "Invalid EHG_REVISION" + fi + fi + + if [[ "${PV}" =~ ^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+_pre ]]; then + if [[ "$(hg branch)" != "${SLOT}" ]]; then + die "Invalid EHG_REVISION" + fi + + if grep -Eq '#define PY_RELEASE_LEVEL[[:space:]]+PY_RELEASE_LEVEL_FINAL' Include/patchlevel.h; then + # Update micro version, release level and version string. + local micro_version="${PV%_pre*}" + micro_version="${micro_version##*.}" + local version_string="${PV%.*}.$((${micro_version} - 1))+" + sed \ + -e "s/\(#define PY_MICRO_VERSION[[:space:]]\+\)[^[:space:]]\+/\1${micro_version}/" \ + -e "s/\(#define PY_RELEASE_LEVEL[[:space:]]\+\)[^[:space:]]\+/\1PY_RELEASE_LEVEL_ALPHA/" \ + -e "s/\(#define PY_VERSION[[:space:]]\+\"\)[^\"]\+\(\"\)/\1${version_string}\2/" \ + -i Include/patchlevel.h || die "sed failed" + fi + fi + + local excluded_patches + if ! tc-is-cross-compiler; then + excluded_patches="*_all_crosscompile.patch" + fi + + local patchset_dir + if [[ "${PV}" == *_pre* ]]; then + patchset_dir="${FILESDIR}/${SLOT}-${PATCHSET_REVISION}" + else + patchset_dir="${WORKDIR}/${MY_PV}" + fi + + EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" epatch "${patchset_dir}" + + sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ + Lib/distutils/command/install.py \ + Lib/distutils/sysconfig.py \ + Lib/site.py \ + Makefile.pre.in \ + Modules/Setup.dist \ + Modules/getpath.c \ + setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@" + + eautoreconf +} + +src_configure() { + if use build; then + # Disable extraneous modules with extra dependencies. + export PYTHON_DISABLE_MODULES="dbm _bsddb gdbm _curses _curses_panel readline _sqlite3 _tkinter _elementtree pyexpat" + export PYTHON_DISABLE_SSL="1" + else + # dbm module can be linked against berkdb or gdbm. + # Defaults to gdbm when both are enabled, #204343. + local disable + use berkdb || use gdbm || disable+=" dbm" + use berkdb || disable+=" _bsddb" + 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 + 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 + + [[ "${ARCH}" == "alpha" ]] && append-flags -fPIC + + # 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 + + if tc-is-cross-compiler; then + OPT="-O1" CFLAGS="" LDFLAGS="" CC="" \ + ./configure --{build,host}=${CBUILD} || die "cross-configure failed" + emake python Parser/pgen || die "cross-make failed" + mv python hostpython + mv Parser/pgen Parser/hostpgen + make distclean + sed -i \ + -e "/^HOSTPYTHON/s:=.*:=./hostpython:" \ + -e "/^HOSTPGEN/s:=.*:=./Parser/hostpgen:" \ + Makefile.pre.in || die "sed failed" + fi + + # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile. + tc-export CXX + + # Set LDFLAGS so we link modules with -lpython2.6 correctly. + # Needed on FreeBSD unless Python 2.6 is already installed. + # Please query BSD team before removing this! + append-ldflags "-L." + + OPT="" econf \ + --with-fpectl \ + --enable-shared \ + $(use_enable ipv6) \ + $(use_with threads) \ + $(use wide-unicode && echo "--enable-unicode=ucs4" || echo "--enable-unicode=ucs2") \ + --infodir='${prefix}/share/info' \ + --mandir='${prefix}/share/man' \ + --with-libc="" \ + --with-system-ffi +} + +src_compile() { + emake EPYTHON="python${PV%%.*}" || die "emake failed" +} + +src_test() { + # Tests will not work when cross compiling. + if tc-is-cross-compiler; then + elog "Disabling tests due to crosscompiling." + return + fi + + # Byte compiling should be enabled here. + # Otherwise test_import fails. + python_enable_pyc + + # Skip failing tests. + local skipped_tests="distutils tcl" + + for test in ${skipped_tests}; do + mv "${S}/Lib/test/test_${test}.py" "${T}" + done + + # Rerun failed tests in verbose mode (regrtest -w). + emake test EXTRATESTOPTS="-w" < /dev/tty + local result="$?" + + for test in ${skipped_tests}; do + mv "${T}/test_${test}.py" "${S}/Lib/test/test_${test}.py" + 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}$(python_get_libdir)/test'" + elog "and run the tests separately." + + python_disable_pyc + + if [[ "${result}" -ne 0 ]]; then + die "emake test failed" + fi +} + +src_install() { + [[ -z "${ED}" ]] && ED="${D%/}${EPREFIX}/" + + emake DESTDIR="${D}" altinstall maninstall || die "emake altinstall maninstall failed" + python_clean_installation_image -q + + mv "${ED}usr/bin/python${SLOT}-config" "${ED}usr/bin/python-config-${SLOT}" + + # Fix collisions between different slots of Python. + mv "${ED}usr/bin/2to3" "${ED}usr/bin/2to3-${SLOT}" + mv "${ED}usr/bin/pydoc" "${ED}usr/bin/pydoc${SLOT}" + mv "${ED}usr/bin/idle" "${ED}usr/bin/idle${SLOT}" + mv "${ED}usr/share/man/man1/python.1" "${ED}usr/share/man/man1/python${SLOT}.1" + rm -f "${ED}usr/bin/smtpd.py" + + if use build; then + rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{bsddb,dbhash.py,idlelib,lib-tk,sqlite3,test} + else + use elibc_uclibc && rm -fr "${ED}$(python_get_libdir)/"{bsddb/test,test} + use berkdb || rm -fr "${ED}$(python_get_libdir)/"{bsddb,dbhash.py,test/test_bsddb*} + use sqlite || rm -fr "${ED}$(python_get_libdir)/"{sqlite3,test/test_sqlite*} + use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{idlelib,lib-tk} + fi + + use threads || rm -fr "${ED}$(python_get_libdir)/multiprocessing" + use wininst || rm -f "${ED}$(python_get_libdir)/distutils/command/"wininst-*.exe + + dodoc Misc/{ACKS,HISTORY,NEWS} || die "dodoc failed" + + if use examples; then + insinto /usr/share/doc/${PF}/examples + doins -r "${S}/Tools" || die "doins failed" + fi + + newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT} || die "newconfd failed" + newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT} || die "newinitd failed" + sed \ + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \ + -e "s:@PYDOC@:pydoc${SLOT}:" \ + -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed" + + # Do not install empty directory. + rmdir "${ED}$(python_get_libdir)/lib-old" +} + +pkg_preinst() { + if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version "${CATEGORY}/${PN}:2.6" && ! has_version "${CATEGORY}/${PN}:2.7"; then + python_updater_warning="1" + fi +} + +eselect_python_update() { + [[ -z "${EROOT}" || (! -d "${EROOT}" && -d "${ROOT}") ]] && EROOT="${ROOT%/}${EPREFIX}/" + + 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 + + python_mod_optimize -f -x "/(site-packages|test|tests)/" $(python_get_libdir) + + if [[ "${python_updater_warning}" == "1" ]]; then + ewarn + ewarn "\e[1;31m************************************************************************\e[0m" + ewarn + ewarn "You have just upgraded from an older version of Python." + ewarn "You should switch active version of Python ${PV%%.*} and run" + ewarn "'python-updater \${options}' to rebuild Python modules." + ewarn + ewarn "\e[1;31m************************************************************************\e[0m" + ewarn + + local n + for ((n = 0; n < 12; n++)); do + echo -ne "\a" + sleep 1 + done + fi + + if [[ "${PV}" != *_pre* ]]; then + elog + elog "If you want to help in testing of recent changes in Python, then you can use" + elog "snapshots of Python from python overlay." + elog + fi +} + +pkg_postrm() { + eselect_python_update + + python_mod_cleanup $(python_get_libdir) +} diff --git a/dev-lang/python/python-2.7.2.ebuild b/dev-lang/python/python-2.7.2.ebuild new file mode 100644 index 000000000000..7362df8a1d95 --- /dev/null +++ b/dev-lang/python/python-2.7.2.ebuild @@ -0,0 +1,387 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-2.7.2.ebuild,v 1.1 2011/06/27 08:28:31 djc Exp $ + +EAPI="2" +WANT_AUTOMAKE="none" + +inherit autotools eutils flag-o-matic multilib python toolchain-funcs + +if [[ "${PV}" == *_pre* ]]; then + inherit mercurial + + EHG_REPO_URI="http://hg.python.org/cpython" + EHG_REVISION="" +else + MY_PV="${PV%_p*}" + MY_P="Python-${MY_PV}" +fi + +PATCHSET_REVISION="0" + +DESCRIPTION="Python is an interpreted, interactive, object-oriented programming language." +HOMEPAGE="http://www.python.org/" +if [[ "${PV}" == *_pre* ]]; then + SRC_URI="" +else + SRC_URI="http://www.python.org/ftp/python/${MY_PV}/${MY_P}.tar.bz2 + mirror://gentoo/python-gentoo-patches-${MY_PV}$([[ "${PATCHSET_REVISION}" != "0" ]] && echo "-r${PATCHSET_REVISION}").tar.bz2" +fi + +LICENSE="PSF-2.2" +SLOT="2.7" +PYTHON_ABI="${SLOT}" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd" +IUSE="-berkdb build doc elibc_uclibc examples gdbm ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml" + +RDEPEND=">=app-admin/eselect-python-20091230 + app-arch/bzip2 + >=sys-libs/zlib-1.1.3 + virtual/libffi + virtual/libintl + !build? ( + berkdb? ( || ( + sys-libs/db:4.8 + sys-libs/db:4.7 + sys-libs/db:4.6 + sys-libs/db:4.5 + sys-libs/db:4.4 + sys-libs/db:4.3 + sys-libs/db:4.2 + ) ) + gdbm? ( sys-libs/gdbm ) + ncurses? ( + >=sys-libs/ncurses-5.2 + readline? ( >=sys-libs/readline-4.1 ) + ) + sqlite? ( >=dev-db/sqlite-3.3.8:3[extensions] ) + ssl? ( dev-libs/openssl ) + tk? ( + >=dev-lang/tk-8.0 + dev-tcltk/blt + ) + xml? ( >=dev-libs/expat-2 ) + ) + !!<sys-apps/portage-2.1.9" +DEPEND="${RDEPEND} + $([[ "${PV}" == *_pre* ]] && echo "=${CATEGORY}/${PN}-${PV%%.*}*") + dev-util/pkgconfig + $([[ "${PV}" =~ ^[[:digit:]]+\.[[:digit:]]+_pre ]] && echo "doc? ( dev-python/sphinx )") + !sys-devel/gcc[libffi]" +RDEPEND+=" !build? ( app-misc/mime-types ) + $([[ "${PV}" =~ ^[[:digit:]]+\.[[:digit:]]+_pre ]] || echo "doc? ( dev-python/python-docs:${SLOT} )")" +PDEPEND="app-admin/python-updater" + +if [[ "${PV}" != *_pre* ]]; then + S="${WORKDIR}/${MY_P}" +fi + +pkg_setup() { + python_pkg_setup + + if use berkdb; then + ewarn "\"bsddb\" module is out-of-date and no longer maintained inside dev-lang/python." + ewarn "\"bsddb\" and \"dbhash\" modules have been additionally removed in Python 3." + ewarn "You should use external, still maintained \"bsddb3\" module provided by dev-python/bsddb3," + ewarn "which supports both Python 2 and Python 3." + else + if has_version "=${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"; then + ewarn "You are migrating from =${CATEGORY}/${PN}-${PV%%.*}*[berkdb] to =${CATEGORY}/${PN}-${PV%%.*}*[-berkdb]." + ewarn "You might need to migrate your databases." + fi + fi +} + +src_prepare() { + # Ensure that internal copies of expat, libffi and zlib are not used. + rm -fr Modules/expat + rm -fr Modules/_ctypes/libffi* + rm -fr Modules/zlib + + if [[ "${PV}" =~ ^[[:digit:]]+\.[[:digit:]]+_pre ]]; then + if [[ "$(hg branch)" != "default" ]]; then + die "Invalid EHG_REVISION" + fi + fi + + if [[ "${PV}" =~ ^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+_pre ]]; then + if [[ "$(hg branch)" != "${SLOT}" ]]; then + die "Invalid EHG_REVISION" + fi + + if grep -Eq '#define PY_RELEASE_LEVEL[[:space:]]+PY_RELEASE_LEVEL_FINAL' Include/patchlevel.h; then + # Update micro version, release level and version string. + local micro_version="${PV%_pre*}" + micro_version="${micro_version##*.}" + local version_string="${PV%.*}.$((${micro_version} - 1))+" + sed \ + -e "s/\(#define PY_MICRO_VERSION[[:space:]]\+\)[^[:space:]]\+/\1${micro_version}/" \ + -e "s/\(#define PY_RELEASE_LEVEL[[:space:]]\+\)[^[:space:]]\+/\1PY_RELEASE_LEVEL_ALPHA/" \ + -e "s/\(#define PY_VERSION[[:space:]]\+\"\)[^\"]\+\(\"\)/\1${version_string}\2/" \ + -i Include/patchlevel.h || die "sed failed" + fi + fi + + local excluded_patches + if ! tc-is-cross-compiler; then + excluded_patches="*_all_crosscompile.patch" + fi + + local patchset_dir + if [[ "${PV}" == *_pre* ]]; then + patchset_dir="${FILESDIR}/${SLOT}-${PATCHSET_REVISION}" + else + patchset_dir="${WORKDIR}/${MY_PV}" + fi + + EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" epatch "${patchset_dir}" + + sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ + Lib/distutils/command/install.py \ + Lib/distutils/sysconfig.py \ + Lib/site.py \ + Lib/sysconfig.py \ + Lib/test/test_site.py \ + Makefile.pre.in \ + Modules/Setup.dist \ + Modules/getpath.c \ + setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@" + + eautoreconf +} + +src_configure() { + if use build; then + # Disable extraneous modules with extra dependencies. + export PYTHON_DISABLE_MODULES="dbm _bsddb gdbm _curses _curses_panel readline _sqlite3 _tkinter _elementtree pyexpat" + export PYTHON_DISABLE_SSL="1" + else + # dbm module can be linked against berkdb or gdbm. + # Defaults to gdbm when both are enabled, #204343. + local disable + use berkdb || use gdbm || disable+=" dbm" + use berkdb || disable+=" _bsddb" + 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 + 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 + + [[ "${ARCH}" == "alpha" ]] && append-flags -fPIC + + # 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 + + if tc-is-cross-compiler; then + OPT="-O1" CFLAGS="" LDFLAGS="" CC="" \ + ./configure --{build,host}=${CBUILD} || die "cross-configure failed" + emake python Parser/pgen || die "cross-make failed" + mv python hostpython + mv Parser/pgen Parser/hostpgen + make distclean + sed -i \ + -e "/^HOSTPYTHON/s:=.*:=./hostpython:" \ + -e "/^HOSTPGEN/s:=.*:=./Parser/hostpgen:" \ + Makefile.pre.in || die "sed failed" + fi + + # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile. + tc-export CXX + + # Set LDFLAGS so we link modules with -lpython2.7 correctly. + # Needed on FreeBSD unless Python 2.7 is already installed. + # Please query BSD team before removing this! + append-ldflags "-L." + + local dbmliborder + if use gdbm; then + dbmliborder+="${dbmliborder:+:}gdbm" + fi + if use berkdb; then + dbmliborder+="${dbmliborder:+:}bdb" + fi + + OPT="" econf \ + --with-fpectl \ + --enable-shared \ + $(use_enable ipv6) \ + $(use_with threads) \ + $(use wide-unicode && echo "--enable-unicode=ucs4" || echo "--enable-unicode=ucs2") \ + --infodir='${prefix}/share/info' \ + --mandir='${prefix}/share/man' \ + --with-dbmliborder="${dbmliborder}" \ + --with-libc="" \ + --enable-loadable-sqlite-extensions \ + --with-system-expat \ + --with-system-ffi +} + +src_compile() { + emake EPYTHON="python${PV%%.*}" || die "emake failed" +} + +src_test() { + # Tests will not work when cross compiling. + if tc-is-cross-compiler; then + elog "Disabling tests due to crosscompiling." + return + fi + + # Byte compiling should be enabled here. + # Otherwise test_import fails. + python_enable_pyc + + # Skip failing tests. + local skipped_tests="distutils gdb" + + for test in ${skipped_tests}; do + mv "${S}/Lib/test/test_${test}.py" "${T}" + done + + # Rerun failed tests in verbose mode (regrtest -w). + emake test EXTRATESTOPTS="-w" < /dev/tty + local result="$?" + + for test in ${skipped_tests}; do + mv "${T}/test_${test}.py" "${S}/Lib/test/test_${test}.py" + 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}$(python_get_libdir)/test'" + elog "and run the tests separately." + + python_disable_pyc + + if [[ "${result}" -ne 0 ]]; then + die "emake test failed" + fi +} + +src_install() { + [[ -z "${ED}" ]] && ED="${D%/}${EPREFIX}/" + + emake DESTDIR="${D}" altinstall maninstall || die "emake altinstall maninstall failed" + python_clean_installation_image -q + + sed -e "s/\(LDFLAGS=\).*/\1/" -i "${ED}$(python_get_libdir)/config/Makefile" || die "sed failed" + + mv "${ED}usr/bin/python${SLOT}-config" "${ED}usr/bin/python-config-${SLOT}" + + # Fix collisions between different slots of Python. + mv "${ED}usr/bin/2to3" "${ED}usr/bin/2to3-${SLOT}" + mv "${ED}usr/bin/pydoc" "${ED}usr/bin/pydoc${SLOT}" + mv "${ED}usr/bin/idle" "${ED}usr/bin/idle${SLOT}" + rm -f "${ED}usr/bin/smtpd.py" + + if use build; then + rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{bsddb,dbhash.py,idlelib,lib-tk,sqlite3,test} + else + use elibc_uclibc && rm -fr "${ED}$(python_get_libdir)/"{bsddb/test,test} + use berkdb || rm -fr "${ED}$(python_get_libdir)/"{bsddb,dbhash.py,test/test_bsddb*} + use sqlite || rm -fr "${ED}$(python_get_libdir)/"{sqlite3,test/test_sqlite*} + use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{idlelib,lib-tk} + fi + + use threads || rm -fr "${ED}$(python_get_libdir)/multiprocessing" + use wininst || rm -f "${ED}$(python_get_libdir)/distutils/command/"wininst-*.exe + + dodoc Misc/{ACKS,HISTORY,NEWS} || die "dodoc failed" + + if use examples; then + insinto /usr/share/doc/${PF}/examples + doins -r "${S}/Tools" || die "doins failed" + fi + + newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT} || die "newconfd failed" + newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT} || die "newinitd failed" + sed \ + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \ + -e "s:@PYDOC@:pydoc${SLOT}:" \ + -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed" + + # Do not install empty directory. + rmdir "${ED}$(python_get_libdir)/lib-old" +} + +pkg_preinst() { + if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version "${CATEGORY}/${PN}:2.7"; then + python_updater_warning="1" + fi +} + +eselect_python_update() { + [[ -z "${EROOT}" || (! -d "${EROOT}" && -d "${ROOT}") ]] && EROOT="${ROOT%/}${EPREFIX}/" + + 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 + + python_mod_optimize -f -x "/(site-packages|test|tests)/" $(python_get_libdir) + + if [[ "${python_updater_warning}" == "1" ]]; then + ewarn + ewarn "\e[1;31m************************************************************************\e[0m" + ewarn + ewarn "You have just upgraded from an older version of Python." + ewarn "You should switch active version of Python ${PV%%.*} and run" + ewarn "'python-updater \${options}' to rebuild Python modules." + ewarn + ewarn "\e[1;31m************************************************************************\e[0m" + ewarn + + local n + for ((n = 0; n < 12; n++)); do + echo -ne "\a" + sleep 1 + done + fi + + if [[ "${PV}" != *_pre* ]]; then + elog + elog "If you want to help in testing of recent changes in Python, then you can use" + elog "snapshots of Python from python overlay." + elog + fi +} + +pkg_postrm() { + eselect_python_update + + python_mod_cleanup $(python_get_libdir) +} diff --git a/dev-lang/python/python-3.1.4.ebuild b/dev-lang/python/python-3.1.4.ebuild new file mode 100644 index 000000000000..e40bce854aee --- /dev/null +++ b/dev-lang/python/python-3.1.4.ebuild @@ -0,0 +1,350 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-3.1.4.ebuild,v 1.1 2011/06/27 08:28:31 djc Exp $ + +EAPI="3" +WANT_AUTOMAKE="none" + +inherit autotools eutils flag-o-matic multilib python toolchain-funcs + +if [[ "${PV}" == *_pre* ]]; then + inherit mercurial + + EHG_REPO_URI="http://hg.python.org/cpython" + EHG_REVISION="" +else + MY_PV="${PV%_p*}" + MY_P="Python-${MY_PV}" +fi + +PATCHSET_REVISION="0" + +DESCRIPTION="Python is an interpreted, interactive, object-oriented programming language." +HOMEPAGE="http://www.python.org/" +if [[ "${PV}" == *_pre* ]]; then + SRC_URI="" +else + SRC_URI="http://www.python.org/ftp/python/${MY_PV}/${MY_P}.tar.xz + mirror://gentoo/python-gentoo-patches-${MY_PV}$([[ "${PATCHSET_REVISION}" != "0" ]] && echo "-r${PATCHSET_REVISION}").tar.bz2" +fi + +LICENSE="PSF-2.2" +SLOT="3.1" +PYTHON_ABI="${SLOT}" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd" +IUSE="build doc elibc_uclibc examples gdbm ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml" + +RDEPEND=">=app-admin/eselect-python-20091230 + app-arch/bzip2 + >=sys-libs/zlib-1.1.3 + virtual/libffi + virtual/libintl + !build? ( + gdbm? ( sys-libs/gdbm ) + ncurses? ( + >=sys-libs/ncurses-5.2 + readline? ( >=sys-libs/readline-4.1 ) + ) + sqlite? ( >=dev-db/sqlite-3.3.3:3 ) + ssl? ( dev-libs/openssl ) + tk? ( + >=dev-lang/tk-8.0 + dev-tcltk/blt + ) + xml? ( >=dev-libs/expat-2 ) + )" +DEPEND="${RDEPEND} + $([[ "${PV}" == *_pre* ]] && echo "=${CATEGORY}/${PN}-${PV%%.*}*") + dev-util/pkgconfig + $([[ "${PV}" =~ ^[[:digit:]]+\.[[:digit:]]+_pre ]] && echo "doc? ( dev-python/sphinx )") + !sys-devel/gcc[libffi]" +RDEPEND+=" !build? ( app-misc/mime-types ) + $([[ "${PV}" =~ ^[[:digit:]]+\.[[:digit:]]+_pre ]] || echo "doc? ( dev-python/python-docs:${SLOT} )")" +PDEPEND="app-admin/python-updater" + +if [[ "${PV}" != *_pre* ]]; then + S="${WORKDIR}/${MY_P}" +fi + +pkg_setup() { + python_pkg_setup +} + +src_prepare() { + # Ensure that internal copies of expat, libffi and zlib are not used. + rm -fr Modules/expat + rm -fr Modules/_ctypes/libffi* + rm -fr Modules/zlib + + if [[ "${PV}" =~ ^[[:digit:]]+\.[[:digit:]]+_pre ]]; then + if [[ "$(hg branch)" != "default" ]]; then + die "Invalid EHG_REVISION" + fi + fi + + if [[ "${PV}" =~ ^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+_pre ]]; then + if [[ "$(hg branch)" != "${SLOT}" ]]; then + die "Invalid EHG_REVISION" + fi + + if grep -Eq '#define PY_RELEASE_LEVEL[[:space:]]+PY_RELEASE_LEVEL_FINAL' Include/patchlevel.h; then + # Update micro version, release level and version string. + local micro_version="${PV%_pre*}" + micro_version="${micro_version##*.}" + local version_string="${PV%.*}.$((${micro_version} - 1))+" + sed \ + -e "s/\(#define PY_MICRO_VERSION[[:space:]]\+\)[^[:space:]]\+/\1${micro_version}/" \ + -e "s/\(#define PY_RELEASE_LEVEL[[:space:]]\+\)[^[:space:]]\+/\1PY_RELEASE_LEVEL_ALPHA/" \ + -e "s/\(#define PY_VERSION[[:space:]]\+\"\)[^\"]\+\(\"\)/\1${version_string}\2/" \ + -i Include/patchlevel.h || die "sed failed" + fi + fi + + local excluded_patches + if ! tc-is-cross-compiler; then + excluded_patches="*_all_crosscompile.patch" + fi + + local patchset_dir + if [[ "${PV}" == *_pre* ]]; then + patchset_dir="${FILESDIR}/${SLOT}-${PATCHSET_REVISION}" + else + patchset_dir="${WORKDIR}/${MY_PV}" + fi + + EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" epatch "${patchset_dir}" + + sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ + Lib/distutils/command/install.py \ + Lib/distutils/sysconfig.py \ + Lib/site.py \ + Makefile.pre.in \ + Modules/Setup.dist \ + Modules/getpath.c \ + setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@" + + eautoreconf +} + +src_configure() { + if use build; then + # Disable extraneous modules with extra dependencies. + export PYTHON_DISABLE_MODULES="gdbm _curses _curses_panel readline _sqlite3 _tkinter _elementtree pyexpat" + export PYTHON_DISABLE_SSL="1" + else + local disable + 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 + 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 + + [[ "${ARCH}" == "alpha" ]] && append-flags -fPIC + + # 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 + + if tc-is-cross-compiler; then + OPT="-O1" CFLAGS="" LDFLAGS="" CC="" \ + ./configure --{build,host}=${CBUILD} || die "cross-configure failed" + emake python Parser/pgen || die "cross-make failed" + mv python hostpython + mv Parser/pgen Parser/hostpgen + make distclean + sed -i \ + -e "/^HOSTPYTHON/s:=.*:=./hostpython:" \ + -e "/^HOSTPGEN/s:=.*:=./Parser/hostpgen:" \ + Makefile.pre.in || die "sed failed" + 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.1 correctly. + # Needed on FreeBSD unless Python 3.1 is already installed. + # Please query BSD team before removing this! + append-ldflags "-L." + + local dbmliborder + if use gdbm; then + dbmliborder+="${dbmliborder:+:}gdbm" + fi + + OPT="" econf \ + --with-fpectl \ + --enable-shared \ + $(use_enable ipv6) \ + $(use_with threads) \ + $(use_with wide-unicode) \ + --infodir='${prefix}/share/info' \ + --mandir='${prefix}/share/man' \ + --with-computed-gotos \ + --with-dbmliborder="${dbmliborder}" \ + --with-libc="" \ + --with-system-ffi +} + +src_compile() { + emake EPYTHON="python${PV%%.*}" || die "emake failed" +} + +src_test() { + # Tests will not work when cross compiling. + if tc-is-cross-compiler; then + elog "Disabling tests due to crosscompiling." + return + fi + + if ! use threads; then + ewarn "Disabling tests due to USE=\"-threads\"" + return + fi + + # Byte compiling should be enabled here. + # Otherwise test_import fails. + python_enable_pyc + + # Skip failing tests. + local skipped_tests="distutils" + + for test in ${skipped_tests}; do + mv "${S}/Lib/test/test_${test}.py" "${T}" + done + + # Rerun failed tests in verbose mode (regrtest -w). + emake test EXTRATESTOPTS="-w" < /dev/tty + local result="$?" + + for test in ${skipped_tests}; do + mv "${T}/test_${test}.py" "${S}/Lib/test/test_${test}.py" + 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}$(python_get_libdir)/test'" + elog "and run the tests separately." + + python_disable_pyc + + if [[ "${result}" -ne 0 ]]; then + die "emake test failed" + fi +} + +src_install() { + emake DESTDIR="${D}" altinstall || die "emake altinstall failed" + python_clean_installation_image -q + + mv "${ED}usr/bin/python${SLOT}-config" "${ED}usr/bin/python-config-${SLOT}" + + # Fix collisions between different slots of Python. + mv "${ED}usr/bin/2to3" "${ED}usr/bin/2to3-${SLOT}" + mv "${ED}usr/bin/pydoc3" "${ED}usr/bin/pydoc${SLOT}" + mv "${ED}usr/bin/idle3" "${ED}usr/bin/idle${SLOT}" + rm -f "${ED}usr/bin/smtpd.py" + + if use build; then + rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{idlelib,sqlite3,test,tkinter} + else + use elibc_uclibc && rm -fr "${ED}$(python_get_libdir)/test" + use sqlite || rm -fr "${ED}$(python_get_libdir)/"{sqlite3,test/test_sqlite*} + use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{idlelib,tkinter,test/test_tk*} + fi + + use threads || rm -fr "${ED}$(python_get_libdir)/multiprocessing" + use wininst || rm -f "${ED}$(python_get_libdir)/distutils/command/"wininst-*.exe + + dodoc Misc/{ACKS,HISTORY,NEWS} || die "dodoc failed" + + if use examples; then + insinto /usr/share/doc/${PF}/examples + doins -r "${S}/Tools" || die "doins failed" + fi + + newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT} || die "newconfd failed" + newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT} || die "newinitd failed" + sed \ + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \ + -e "s:@PYDOC@:pydoc${SLOT}:" \ + -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed" +} + +pkg_preinst() { + if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version ">=${CATEGORY}/${PN}-${SLOT}_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 + + python_mod_optimize -f -x "/(site-packages|test|tests)/" $(python_get_libdir) + + if [[ "${python_updater_warning}" == "1" ]]; then + ewarn + ewarn "\e[1;31m************************************************************************\e[0m" + ewarn + ewarn "You have just upgraded from an older version of Python." + ewarn "You should switch active version of Python ${PV%%.*} and run" + ewarn "'python-updater \${options}' to rebuild Python modules." + ewarn + ewarn "\e[1;31m************************************************************************\e[0m" + ewarn + + local n + for ((n = 0; n < 12; n++)); do + echo -ne "\a" + sleep 1 + done + fi + + if [[ "${PV}" != *_pre* ]]; then + elog + elog "If you want to help in testing of recent changes in Python, then you can use" + elog "snapshots of Python from python overlay." + elog + fi +} + +pkg_postrm() { + eselect_python_update + + python_mod_cleanup $(python_get_libdir) +} |