diff options
author | testuser <testuser@gentoo64.(none)> | 2011-11-24 17:51:05 +0800 |
---|---|---|
committer | testuser <testuser@gentoo64.(none)> | 2011-11-24 17:51:05 +0800 |
commit | 7a68094d2ff1ef2ad14ff812794291f0fbba8583 (patch) | |
tree | aa1767d27d8feedf61644a45db4cf02a1a20e8ab | |
parent | python 2.7.2-r2 with fix test failure in Bug 321075, python-yadis with fix to... (diff) | |
download | improvise-7a68094d2ff1ef2ad14ff812794291f0fbba8583.tar.gz improvise-7a68094d2ff1ef2ad14ff812794291f0fbba8583.tar.bz2 improvise-7a68094d2ff1ef2ad14ff812794291f0fbba8583.zip |
Adding app-arch/cfv, app-arch/createrepo, app-arch/hardlink, app-cdr/burn-cd,
app-crypt/openssl-blacklist, app-doc/doxygen
59 files changed, 6542 insertions, 0 deletions
diff --git a/app-arch/cfv/Manifest b/app-arch/cfv/Manifest new file mode 100644 index 0000000..f0acc28 --- /dev/null +++ b/app-arch/cfv/Manifest @@ -0,0 +1,9 @@ +AUX cfv-1.18.1-modulefix.patch 729 RMD160 e4da5e01e677082e27197b46fc415c3e32e4061a SHA1 c72d9906e8829628452be17cf36d2205d5748b67 SHA256 221f6f493be8f06d3a4ef8ddd5793daffeeb17a6dcb5569c70d5d4443edda9b2 +DIST cfv-1.18.1.tar.gz 65578 RMD160 95bd23c4ef8f8f38926841ba4719fa2dc2e3a939 SHA1 435f155235ee1c62baadde2d7d0bbcfc4245bc12 SHA256 1164efc88b908257e8cb5adc826bc901e56022b304a8e76dc92d800d822a6c69 +DIST cfv-1.18.2.tar.gz 67970 RMD160 25fdecb396a7c6f1281731c16ed0caecc015ecca SHA1 e7abc43ade93799956820119858723b77d005950 SHA256 73fc368e3717cdc7062c3c909778d03d15128bc9a18a76c7e4f7a75e8a99f391 +DIST cfv-1.18.3.tar.gz 68030 RMD160 d239e5fe212b2458f5a3612b55591c7625a2318d SHA1 8f3361fb9c13fe2645f1df8c177c61459f50e846 SHA256 ff28a8aa679932b83eb3b248ed2557c6da5860d5f8456ffe24686253a354cff6 +EBUILD cfv-1.18.1.ebuild 778 RMD160 1f15738efcd3fefb2a014acfa813b6fa8148926c SHA1 a37040eb55b1bac7b05e9727e7d51a520e3d48dd SHA256 5171eaf91a2b97a02ed57b41f9fb275c8f0c3ca406cd8df8b0978320f4cc6675 +EBUILD cfv-1.18.2.ebuild 676 RMD160 62af13ce8fd1e2c69adff8f3a8c22f9fed230875 SHA1 95ffd6c1a71f2cf2b3d7550451bea5a82cca7d84 SHA256 df22972c3113f85b35e607455b3ac009f1583174eddd139833acd4ad55de5429 +EBUILD cfv-1.18.3.ebuild 837 RMD160 7023e67c06f859aad7870956766afb89a436f486 SHA1 50d5356a483366ed53d0bb4057a2c1457fd28baf SHA256 c9903174e81d22c1cfd369ca5e8c7e8aead72e1da930b9839855ef2d1d8d3293 +MISC ChangeLog 3959 RMD160 22149783d42ec23e97ccabe0ecb4934734ac66f4 SHA1 e3fbb9b049061d39a70d065a84852bc9a238fcdf SHA256 73d3abadab0bf9f89df88e4c1cedc3b75bbab5e9f62d2ab4ee141b5e45384ab1 +MISC metadata.xml 594 RMD160 7560adf430208eab316d0c028e544d459c166d5d SHA1 8859ddde5fe25cfa7c8d91894e2224ca0f50d95d SHA256 6f459b9ffec73ad1192ab3c72827031fbfc39190878c1ee3a02dcf431ca491be diff --git a/app-arch/cfv/cfv-1.18.2.ebuild b/app-arch/cfv/cfv-1.18.2.ebuild new file mode 100644 index 0000000..f9ef0e5 --- /dev/null +++ b/app-arch/cfv/cfv-1.18.2.ebuild @@ -0,0 +1,26 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-arch/cfv/cfv-1.18.2.ebuild,v 1.5 2009/03/17 12:06:16 tcunha Exp $ + +DESCRIPTION="Utility to test and create .sfv, .csv, .crc and md5sum files" +HOMEPAGE="http://cfv.sourceforge.net/" +SRC_URI="mirror://sourceforge/cfv/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +IUSE="" +KEYWORDS="amd64 hppa ppc sparc x86 ~x86-fbsd" + +DEPEND="" +RDEPEND="dev-lang/python + dev-python/python-fchksum" + +src_compile() { + true +} + +src_install() { + dobin cfv || die "dobin failed" + doman cfv.1 || die "doman failed" + dodoc README Changelog || die "dodoc failed" +} diff --git a/app-arch/cfv/cfv-1.18.3.ebuild b/app-arch/cfv/cfv-1.18.3.ebuild new file mode 100644 index 0000000..4c702a0 --- /dev/null +++ b/app-arch/cfv/cfv-1.18.3.ebuild @@ -0,0 +1,32 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-arch/cfv/cfv-1.18.3.ebuild,v 1.4 2011/05/19 19:22:51 grobian Exp $ + +DESCRIPTION="Utility to test and create .sfv, .csv, .crc and md5sum files" +HOMEPAGE="http://cfv.sourceforge.net/" +SRC_URI="mirror://sourceforge/cfv/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +IUSE="bittorrent" +KEYWORDS="~amd64 ~hppa ~ppc ~sparc ~x86 ~x86-fbsd ~x86-freebsd ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos" + +DEPEND="" +RDEPEND="dev-lang/python + dev-python/python-fchksum + bittorrent? ( + || ( + net-p2p/bittorrent + net-p2p/bittornado + ) + )" + +src_compile() { + true +} + +src_install() { + dobin cfv || die "dobin failed" + doman cfv.1 || die "doman failed" + dodoc README Changelog || die "dodoc failed" +} diff --git a/app-arch/cfv/files/cfv-1.18.1-modulefix.patch b/app-arch/cfv/files/cfv-1.18.1-modulefix.patch new file mode 100644 index 0000000..a415a3a --- /dev/null +++ b/app-arch/cfv/files/cfv-1.18.1-modulefix.patch @@ -0,0 +1,21 @@ +--- branches/cfv-1_x-branch/cfv/cfv 2006/03/28 07:29:01 340 ++++ branches/cfv-1_x-branch/cfv/cfv 2007/03/04 01:57:56 401 +@@ -1360,12 +1360,15 @@ + #---------- .torrent ---------- + _btimporterror = None + try: +- from BitTorrent import bencode, btformats ++ from BTL import bencode, btformats + except ImportError, e1: + try: +- from BitTornado import bencode; from BitTornado.BT1 import btformats ++ from BitTorrent import bencode, btformats + except ImportError, e2: +- _btimporterror = '%s and %s'%(e1,e2) ++ try: ++ from BitTornado import bencode; from BitTornado.BT1 import btformats ++ except ImportError, e3: ++ _btimporterror = '%s and %s and %s'%(e1,e2,e3) + + class Torrent(ChksumType): + description = 'BitTorrent metainfo' diff --git a/app-arch/cfv/metadata.xml b/app-arch/cfv/metadata.xml new file mode 100644 index 0000000..7ea34e9 --- /dev/null +++ b/app-arch/cfv/metadata.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer> + <email>swegener@gentoo.org</email> + <description>Primary Maintainer</description> + </maintainer> + <longdescription> + cfv is a utility to both test and create .sfv, .csv, .crc, + .md5(sfv-like), md5sum, bsd md5, sha1sum, and .torrent files. These + files are commonly used to ensure the correct retrieval or storage of + data. + </longdescription> + <use> + <flag name='bittorrent'>Enable support for checking .torrent files</flag> + </use> +</pkgmetadata> diff --git a/app-arch/createrepo/Manifest b/app-arch/createrepo/Manifest new file mode 100644 index 0000000..5b363a1 --- /dev/null +++ b/app-arch/createrepo/Manifest @@ -0,0 +1,7 @@ +DIST createrepo-0.9.7.tar.gz 55303 RMD160 e3cd3cecc5dcc1922c05552a99477d72f6bd413a SHA1 8738a208cda03fa175d02dcbf7ed3e4b8a9c0e95 SHA256 dae4b4893fad534b4c3496966696dde9cdf96d41d7f8487fae4ca0e1e5c0bd79 +DIST createrepo-0.9.8.tar.gz 57973 RMD160 aa6021d6cc3e01f8b7dde108a966210dd7480509 SHA1 b4964ea3caf039954467374ffd7769cc6875c70a SHA256 736842bda7d404a03470775332ccda339a114f14772d7a354d99bf64f38ecd14 +EBUILD createrepo-0.9.7.ebuild 722 RMD160 e9e3cafb0a4c97b9a03485353577b7ca27ef413f SHA1 daf1d504d6b3acea2358a4aacbaff9f3310548e2 SHA256 48459f9fa9162b39d7981de750a0af92820bdd79017d8e515a21b281303b35d4 +EBUILD createrepo-0.9.8-r1.ebuild 919 RMD160 2f86445a34c586fe527446298acc2cba6d9769ea SHA1 8363afba95dd073d341514cdc683bfbb56182ab1 SHA256 9188d2dfc4a1a50f515df324981d965cf8d2f384f212d8764f5980f175d04896 +EBUILD createrepo-0.9.8.ebuild 900 RMD160 579dc8b48809f1a0c563842fbf8ecf2d43124182 SHA1 08b02cac8eecdbc28e70976de0f02585935126ef SHA256 983bcb7c3a028aa64cef78d29e03bba7f8857f9f3469cc6d0012461b5190e9c1 +MISC ChangeLog 910 RMD160 d6c1e97a4314b226639e6a32a367b186538567cc SHA1 b7be5826b03d849af438e5e2b9fe05c629dbd43e SHA256 c9829d839acc174867c9b0b6d53ce1122f7cda0e9f0ff2978660e27e20dd9fc3 +MISC metadata.xml 279 RMD160 63585c0011148cb70b208c36ef92965b1b1f790e SHA1 322cc4ba4dceef5bf5766a67d1d18e6d60f2b391 SHA256 0e85e33b007bcbaf8ffeaa81271e082efd848de91c4712bd30266b3104554092 diff --git a/app-arch/createrepo/createrepo-0.9.7.ebuild b/app-arch/createrepo/createrepo-0.9.7.ebuild new file mode 100644 index 0000000..9c50ea8 --- /dev/null +++ b/app-arch/createrepo/createrepo-0.9.7.ebuild @@ -0,0 +1,31 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-arch/createrepo/createrepo-0.9.7.ebuild,v 1.1 2009/04/12 07:31:37 vapier Exp $ + +EAPI="3" + +PYTHON_DEPEND="2:2.6" +PYTHON_USE_WITH="xml" + +inherit python + +DESCRIPTION="Creates a common metadata repository" +HOMEPAGE="http://createrepo.baseurl.org/" +SRC_URI="http://createrepo.baseurl.org/download/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="" + +RDEPEND="dev-lang/python + >=dev-python/urlgrabber-2.9.0 + >=app-arch/rpm-4.0[python] + dev-libs/libxml2[python]" + +src_compile() { :; } + +src_install() { + emake install DESTDIR="${D}" || die + dodoc ChangeLog README +} diff --git a/app-arch/createrepo/createrepo-0.9.8-r1.ebuild b/app-arch/createrepo/createrepo-0.9.8-r1.ebuild new file mode 100644 index 0000000..f099d8d --- /dev/null +++ b/app-arch/createrepo/createrepo-0.9.8-r1.ebuild @@ -0,0 +1,44 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-arch/createrepo/createrepo-0.9.8-r1.ebuild,v 1.1 2011/11/12 19:37:12 maksbotan Exp $ + +EAPI="3" + +PYTHON_DEPEND="2:2.6" +PYTHON_USE_WITH="xml" + +inherit python eutils + +DESCRIPTION="Creates a common metadata repository" +HOMEPAGE="http://createrepo.baseurl.org/" +SRC_URI="http://createrepo.baseurl.org/download/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="" + +RDEPEND=" + >=dev-python/urlgrabber-2.9.0 + >=app-arch/rpm-4.0[python] + dev-libs/libxml2[python] + >=sys-apps/yum-3.2.23" + +pkg_setup() { + python_pkg_setup + python_set_active_version 2 +} + +src_prepare() { + sed -i \ + -e '/^sysconfdir/s:=.*/:=/:' \ + Makefile +} + +src_compile() { :; } + +src_install() { + emake install DESTDIR="${ED}" || die + dodoc ChangeLog README + python_convert_shebangs -r 2 "${ED}" +} diff --git a/app-arch/createrepo/createrepo-0.9.8.ebuild b/app-arch/createrepo/createrepo-0.9.8.ebuild new file mode 100644 index 0000000..b197ab1 --- /dev/null +++ b/app-arch/createrepo/createrepo-0.9.8.ebuild @@ -0,0 +1,33 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-arch/createrepo/createrepo-0.9.8.ebuild,v 1.2 2010/06/16 20:45:25 patrick Exp $ + +EAPI="2" + +DESCRIPTION="Creates a common metadata repository" +HOMEPAGE="http://createrepo.baseurl.org/" +SRC_URI="http://createrepo.baseurl.org/download/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="" + +RDEPEND="dev-lang/python + >=dev-python/urlgrabber-2.9.0 + >=app-arch/rpm-4.0[python] + dev-libs/libxml2[python] + >=sys-apps/yum-3.2.23" + +src_prepare() { + sed -i \ + -e '/^sysconfdir/s:=.*/:=/:' \ + Makefile +} + +src_compile() { :; } + +src_install() { + emake install DESTDIR="${D}" || die + dodoc ChangeLog README +} diff --git a/app-arch/createrepo/metadata.xml b/app-arch/createrepo/metadata.xml new file mode 100644 index 0000000..633b5da --- /dev/null +++ b/app-arch/createrepo/metadata.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<herd>python</herd> +<herd>proxy-maintainers</herd> +<maintainer> + <email>johneed@hotmail.com</email> + <name>Ian Delaney</name> +</maintainer> +</pkgmetadata> diff --git a/app-arch/hardlink/Manifest b/app-arch/hardlink/Manifest new file mode 100644 index 0000000..dc09c6e --- /dev/null +++ b/app-arch/hardlink/Manifest @@ -0,0 +1,4 @@ +DIST hardlink_0.1.1.tar.gz 6306 RMD160 2ef8baafbae9645bd20e1d0833c3de44f5001b4b SHA1 fb68c11fb2eaa68613818be7799fd84e3577f62a SHA256 b6ecd4fee72b66054ed941e23177e46537abefd4cc71d9c05b1b587d766f8273 +EBUILD hardlink-0.1.1.ebuild 566 RMD160 fa43a987c00dd01d7e6f481df18061c48338281c SHA1 bab35fe6abe3024c8a715ecdedcbc6464135c82a SHA256 8fb255159338b0c2455ae5b3a365cfa2d1a730737d30092b2d0100d0963277a8 +MISC ChangeLog 493 RMD160 93d6ffdf6c913cba97153d5bca2d2ede8959a315 SHA1 1193df31873234cb55e867e3e05b4f2441fb56b6 SHA256 22157bf388bcf39a290b01702f5f89501fdbe7a8d3d505c5dd06f5cb8efeb039 +MISC metadata.xml 202 RMD160 ca69c6e7044d6681415f1e86a1c084f890ff08ef SHA1 62ab18bf0e1da311494ca0912e5a79daeceb46ad SHA256 76dbb4a720140d78f0ddfb2b2782c03852169c201c1f507eb17ef4d2a82f212a diff --git a/app-arch/hardlink/hardlink-0.1.1.ebuild b/app-arch/hardlink/hardlink-0.1.1.ebuild new file mode 100644 index 0000000..4d38ac5 --- /dev/null +++ b/app-arch/hardlink/hardlink-0.1.1.ebuild @@ -0,0 +1,19 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-arch/hardlink/hardlink-0.1.1.ebuild,v 1.2 2009/10/23 09:18:39 robba$ + +DESCRIPTION="replace file copies using hardlinks" +HOMEPAGE="http://jak-linux.org/projects/hardlink/" +SRC_URI="${HOMEPAGE}/${P/-/_}.tar.gz" +LICENSE="MIT" +SLOT="0" +KEYWORDS="~x86 ~amd64" +IUSE="" +DEPEND="" +RDEPEND="dev-lang/python" + +src_install() { + emake DESTDIR="${D}" install || die "Failed emake install" +} + + diff --git a/app-arch/hardlink/metadata.xml b/app-arch/hardlink/metadata.xml new file mode 100644 index 0000000..c6d8628 --- /dev/null +++ b/app-arch/hardlink/metadata.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<maintainer> + <email>robbat2@gentoo.org</email> +</maintainer> +</pkgmetadata> diff --git a/app-cdr/burn-cd/ChangeLog b/app-cdr/burn-cd/ChangeLog new file mode 100644 index 0000000..2e717b1 --- /dev/null +++ b/app-cdr/burn-cd/ChangeLog @@ -0,0 +1,17 @@ +# ChangeLog for app-cdr/burn-cd +# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/app-cdr/burn-cd/ChangeLog,v 1.3 2009/11/24 14:55:12 beandog Exp $ + +*burn-cd-1.8.0 (24 Nov 2009) + + 24 Nov 2009; Steve Dibb <beandog@gentoo.org> +burn-cd-1.8.0.ebuild: + Version bump, bug 290540 + + 01 Feb 2009; Markus Meier <maekke@gentoo.org> burn-cd-1.7.4.ebuild: + amd64/x86 stable, bug #256548 + +*burn-cd-1.7.4 (06 Jun 2008) + + 06 Jun 2008; Samuli Suominen <drac@gentoo.org> +burn-cd-1.7.4.ebuild: + Initial commit for bug 204841. Ebuild by Alexander Glyzov. + diff --git a/app-cdr/burn-cd/Manifest b/app-cdr/burn-cd/Manifest new file mode 100644 index 0000000..1aa28d9 --- /dev/null +++ b/app-cdr/burn-cd/Manifest @@ -0,0 +1,4 @@ +DIST burn-cd-1.8.0.gz 14977 RMD160 bc615018de034e4efa75eb85a5895f91744e407b SHA1 5ff77716a1e8d1b3f48f93296dcf5467d6a80492 SHA256 89b01f1c736ffa494aa3d089516db479e0567c5f3784c96df5ce87a4880bbf75 +EBUILD burn-cd-1.8.0.ebuild 579 RMD160 ac0da919ba2b4f928396619e3f5cc3b9bc431e01 SHA1 63478b8e8775b33c552e1379d5d41c773e80d71c SHA256 b2b509646694da1a63129e51f4da89133938f07db065affb628a753cd4092d64 +MISC ChangeLog 599 RMD160 d7d5843521e9a785fad234fe5ff5c675d03ca228 SHA1 ebfcb5a03827571eada1e4b567526a30fb5207a8 SHA256 e93933fa3789b739b105b96c77cba5cb5252088f3a6b42d630d8d4c4919840e4 +MISC metadata.xml 254 RMD160 f274a70fa23d8064efddcce296e0aed3344bd86b SHA1 ab52ea446603ae6242dae41e0c90fcf7ae8f09cf SHA256 21400abf2dad3e5b7b0d2f7f9586c33cba6336b42a97e1f2b3e7e8b9db0daae5 diff --git a/app-cdr/burn-cd/burn-cd-1.7.4.ebuild b/app-cdr/burn-cd/burn-cd-1.7.4.ebuild new file mode 100644 index 0000000..c8c91ee --- /dev/null +++ b/app-cdr/burn-cd/burn-cd-1.7.4.ebuild @@ -0,0 +1,27 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-cdr/burn-cd/burn-cd-1.7.4.ebuild,v 1.2 2009/02/01 12:11:55 maekke Exp $ + +EAPI="3" + +PYTHON_DEPEND="2" + +inherit python + +DESCRIPTION="Smart console frontend for virtual/cdrtools and dvd+rw-tools" +HOMEPAGE="http://burn-cd.sourceforge.net" +SRC_URI="mirror://sourceforge/${PN}/${P}.gz" + +LICENSE="LGPL-2" +SLOT="0" +KEYWORDS="amd64 x86" +IUSE="" + +RDEPEND="virtual/cdrtools + app-cdr/dvd+rw-tools" +DEPEND="" + +src_install() { + newbin ${P} ${PN} || die "newbin failed." + python_convert_shebangs -r 2 "${ED}" +} diff --git a/app-cdr/burn-cd/burn-cd-1.8.0.ebuild b/app-cdr/burn-cd/burn-cd-1.8.0.ebuild new file mode 100644 index 0000000..b9daa7b --- /dev/null +++ b/app-cdr/burn-cd/burn-cd-1.8.0.ebuild @@ -0,0 +1,21 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-cdr/burn-cd/burn-cd-1.8.0.ebuild,v 1.1 2009/11/24 14:55:12 beandog Exp $ + +DESCRIPTION="Smart console frontend for virtual/cdrtools and dvd+rw-tools" +HOMEPAGE="http://burn-cd.sourceforge.net" +SRC_URI="mirror://sourceforge/${PN}/${P}.gz" + +LICENSE="LGPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="" + +RDEPEND="dev-lang/python + virtual/cdrtools + app-cdr/dvd+rw-tools" +DEPEND="" + +src_install() { + newbin ${P} ${PN} || die "newbin failed." +} diff --git a/app-cdr/burn-cd/metadata.xml b/app-cdr/burn-cd/metadata.xml new file mode 100644 index 0000000..a3a36be --- /dev/null +++ b/app-cdr/burn-cd/metadata.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<herd>media-optical</herd> +<longdescription>CD and DVD command line recording and ripping tools.</longdescription> +</pkgmetadata> diff --git a/app-crypt/openssl-blacklist/ChangeLog b/app-crypt/openssl-blacklist/ChangeLog new file mode 100644 index 0000000..1d390bb --- /dev/null +++ b/app-crypt/openssl-blacklist/ChangeLog @@ -0,0 +1,48 @@ +# ChangeLog for app-crypt/openssl-blacklist +# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/app-crypt/openssl-blacklist/ChangeLog,v 1.9 2009/04/15 08:05:43 hanno Exp $ + +*openssl-blacklist-0.4.2 (15 Apr 2009) + + 15 Apr 2009; Hanno Boeck <hanno@gentoo.org> + +openssl-blacklist-0.4.2.ebuild: + Version bump. + + 02 Oct 2008; Jeroen Roovers <jer@gentoo.org> + openssl-blacklist-0.4.1.ebuild: + Stable for HPPA (bug #232992). + + 28 Jul 2008; Dawid Węgliński <cla@gentoo.org> + openssl-blacklist-0.4.1.ebuild: + Stable on x86/amd64 (bug #232992) + +*openssl-blacklist-0.4.1 (19 Jun 2008) + + 19 Jun 2008; Hanno Boeck <hanno@gentoo.org> + +openssl-blacklist-0.4.1.ebuild: + Version bump, install blacklists correctly. + +*openssl-blacklist-0.3.2 (03 Jun 2008) + + 03 Jun 2008; Hanno Boeck <hanno@gentoo.org> + +openssl-blacklist-0.3.2.ebuild: + Version bump. + + 31 May 2008; Alexis Ballier <aballier@gentoo.org> + openssl-blacklist-0.3.ebuild: + keyword ~x86-fbsd + +*openssl-blacklist-0.3 (26 May 2008) + + 26 May 2008; Hanno Boeck <hanno@gentoo.org> +openssl-blacklist-0.3.ebuild: + Version bump. + + 21 May 2008; Jeroen Roovers <jer@gentoo.org> openssl-blacklist-0.1.ebuild: + Marked ~hppa too. + +*openssl-blacklist-0.1 (17 May 2008) + + 17 May 2008; Hanno Boeck <hanno@gentoo.org> +openssl-blacklist-0.1.ebuild: + Initial commit of ubuntus tool to detect weak ssl-keys according to + CVE-2008-0166. + diff --git a/app-crypt/openssl-blacklist/Manifest b/app-crypt/openssl-blacklist/Manifest new file mode 100644 index 0000000..4c811dc --- /dev/null +++ b/app-crypt/openssl-blacklist/Manifest @@ -0,0 +1,6 @@ +DIST openssl-blacklist_0.4.1.tar.gz 32928403 RMD160 f10dd770843bc2ff38457c5b1a9459437fcf020d SHA1 befbc2d4fb15c624e24784b192ffd45805b595ab SHA256 1fc13066cbdf65bec886e989c35d74abbfde19ea936a1b909d69129720c7b313 +DIST openssl-blacklist_0.4.2.tar.gz 32928454 RMD160 ae9c59777307c4150b6c0afafd1a520c5e6c1bf1 SHA1 8ae73c6bfafb5f9195251d998d901a14b1c04fe9 SHA256 2eab66bfbcf12de78d7188d3dc41eaa3bf4bc04866c0228ab8e313842920988b +EBUILD openssl-blacklist-0.4.1.ebuild 1120 RMD160 d93f9a96e1fd3c301888b21352fe3f52497147fd SHA1 d1d9750cc8398f9a0baca6b0b12a0532a7d5ced9 SHA256 72cd24878f7d6fa6c8fed1d2d8137f24f47dc1e20815f138d0b54a77c7be3040 +EBUILD openssl-blacklist-0.4.2.ebuild 1167 RMD160 8a25b2747f96ced3a02ee3069e6e8f4bd8a5afd9 SHA1 d92d78af4a340a9e1b585bc587722ae69dc68f1e SHA256 b0868da8e0f33e0c0f78a4d80ae07fa3463113e0833cb33ffecb6034c8f05b3a +MISC ChangeLog 1444 RMD160 c1bb641bde30ea057a66d02a9ca8a23ba91fe205 SHA1 080c178a12f6f6fdda1e107069a04800982f6f84 SHA256 d6cafb877cd5d72ebb428627f9936bf925cd62ec2a28f25636af9bf91e427164 +MISC metadata.xml 196 RMD160 38d93373061ffec39f901f9710573fe2eb6224fc SHA1 9f792f2f8c83cd88b49c8d7e989604a2b21cff6e SHA256 e8ef5daeda229c876fcf81068b64452d16ca1674618ee72fe8c294f6ead29445 diff --git a/app-crypt/openssl-blacklist/metadata.xml b/app-crypt/openssl-blacklist/metadata.xml new file mode 100644 index 0000000..8cb5484 --- /dev/null +++ b/app-crypt/openssl-blacklist/metadata.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<maintainer><email>hanno@gentoo.org</email></maintainer> +</pkgmetadata> diff --git a/app-crypt/openssl-blacklist/openssl-blacklist-0.4.1.ebuild b/app-crypt/openssl-blacklist/openssl-blacklist-0.4.1.ebuild new file mode 100644 index 0000000..a4900e1 --- /dev/null +++ b/app-crypt/openssl-blacklist/openssl-blacklist-0.4.1.ebuild @@ -0,0 +1,30 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-crypt/openssl-blacklist/openssl-blacklist-0.4.1.ebuild,v 1.3 2008/10/02 18:16:52 jer Exp $ + +DESCRIPTION="Detection of weak ssl keys produced by certain debian versions between 2006 and 2008" +HOMEPAGE="https://launchpad.net/ubuntu/+source/openssl-blacklist/" +SRC_URI="mirror://debian/pool/main/o/${PN}/${PN}_${PV}.tar.gz" +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="amd64 hppa x86 ~x86-fbsd" +IUSE="" +DEPEND="dev-lang/python" +S="${WORKDIR}/trunk" + +src_compile() { + einfo nothing to compile +} + +src_install() { + dobin openssl-vulnkey || die "dobin failed" + doman openssl-vulnkey.1 || die "doman failed" + dodir /usr/share/openssl-blacklist/ + for keysize in 512 1024 2048 4096; do \ + cat "${S}/debian/blacklist.prefix" > "${D}/usr/share/openssl-blacklist/blacklist.RSA-$keysize" + cat "${S}"/blacklists/*/blacklist-$keysize.db \ + | cut -d ' ' -f 5 | cut -b21- | sort \ + >> "${D}/usr/share/openssl-blacklist/blacklist.RSA-$keysize" + done + python_convert_shebangs -r 2 "${ED}" +} diff --git a/app-crypt/openssl-blacklist/openssl-blacklist-0.4.2.ebuild b/app-crypt/openssl-blacklist/openssl-blacklist-0.4.2.ebuild new file mode 100644 index 0000000..687c6d5 --- /dev/null +++ b/app-crypt/openssl-blacklist/openssl-blacklist-0.4.2.ebuild @@ -0,0 +1,36 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-crypt/openssl-blacklist/openssl-blacklist-0.4.2.ebuild,v 1.1 2009/04/15 08:05:43 hanno Exp $ + +EAPI="3" +PYTHON_DEPEND="2" +inherit python + +DESCRIPTION="Detection of weak ssl keys produced by certain debian versions between 2006 and 2008" +HOMEPAGE="https://launchpad.net/ubuntu/+source/openssl-blacklist/" +SRC_URI="mirror://debian/pool/main/o/${PN}/${PN}_${PV}.tar.gz" +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~hppa ~x86 ~x86-fbsd" +IUSE="" +DEPEND="" +RDEPEND="${DEPEND}" +S="${WORKDIR}/trunk" + +src_compile() { + einfo nothing to compile +} + +src_install() { + dobin openssl-vulnkey || die "dobin failed" + doman openssl-vulnkey.1 || die "doman failed" + dodir /usr/share/openssl-blacklist/ + for keysize in 512 1024 2048 4096; do \ + cat "${S}/debian/blacklist.prefix" > "${D}/usr/share/openssl-blacklist/blacklist.RSA-$keysize" + cat "${S}"/blacklists/*/blacklist-$keysize.db \ + | cut -d ' ' -f 5 | cut -b21- | sort \ + >> "${D}/usr/share/openssl-blacklist/blacklist.RSA-$keysize" + done + python_convert_shebangs -r 2 "${ED}" +} + diff --git a/app-doc/doxygen/Manifest b/app-doc/doxygen/Manifest new file mode 100644 index 0000000..818b819 --- /dev/null +++ b/app-doc/doxygen/Manifest @@ -0,0 +1,9 @@ +AUX doxygen-1.7.1-dot-eps.patch 1359 RMD160 588347d4145638e6309395b8ad7cb4f441fc61ef SHA1 7b6ef31f3e1bc0835f8f9ffcc28d965cbf2d99aa SHA256 d45f040844707d439ee738f03ad81469df15cf14444f701fadf7eb97898771fd +AUX doxygen-1.7.5.1-dot-eps.patch 1263 RMD160 ee56be1b40acee4cb6af7420826fc6e14404e5d8 SHA1 cee4cd0d9d475605869c8c86c192f9549c97df72 SHA256 d824ec94f2b5234f2434870c9025f1806adbc45512cae652d5ac234b4f4c61b5 +AUX doxywizard.png 4231 RMD160 b194049b42aad3466a5ef9c69ff3504536223dae SHA1 0902260c7169e60a504b29feec419b3a4183081f SHA256 eb648ebd3a194a56d9ed6e47cc8dbf1af2e124d83c2c42af9bf86bd837984209 +DIST doxygen-1.7-tcl_support.patch.bz2 13843 RMD160 0125101bea93087e2100ec97d89d276607fd1d36 SHA1 cc7c687dba6b0d4e6f6c9ce37229fe9e8ce38a20 SHA256 67578895902c3afa59560000b78a5cdce735d03a7b80fdb240a6880d74ee507c +DIST doxygen-1.7.4.src.tar.gz 4570255 RMD160 bcdf00be04b4391f72decd008c5ceafcc4cc8c06 SHA1 4f68b655c93265cb15ef1b8c9ca35ebc39698cf0 SHA256 845c994440dcdbbde81afcb2feae16c4f4cafb85e5dd379b238530e4caf5df66 +DIST doxygen-1.7.5.1.src.tar.gz 4689511 RMD160 cd0552ea3e2e810dfb943700af70bb1cf9e0b6ae SHA1 15671defd1eefe255aa564b6f3097e30ab07ff55 SHA256 fdaec929502e3c4490bfcc87b48a916dab29310d3c7ef88d06f2806436e9ccd0 +EBUILD doxygen-1.7.4.ebuild 5320 RMD160 91014a6c3d8a32c81528c8488b76624219d50661 SHA1 ccd95ea2fe45d63ba0878a5e6ecc7dc1b34cf115 SHA256 754d9b93cbbfea01ac492e904908c3abcd0a6d4e8d885f83512a6c436ccc52e2 +EBUILD doxygen-1.7.5.1.ebuild 5193 RMD160 a19e9257ae3c672028cdc5f90ca63f7b1f332fc3 SHA1 ce721b96bdc76c1afa0dfbbf97b7e0309062c65f SHA256 c47bf6038374410bd9770a5cfa4db4a2b859737be4533a17a6ea854122a745b2 +MISC metadata.xml 831 RMD160 1a40ce1c3afecb14f2706c413b0d4a4fea3bb55f SHA1 258d06797a0b59edab6716e9ead66bb7df6b0e6e SHA256 802686f997f166ad02f46f8abc382dace5b23bac8db51c5f4a963afa3f75a6e2 diff --git a/app-doc/doxygen/doxygen-1.7.4.ebuild b/app-doc/doxygen/doxygen-1.7.4.ebuild new file mode 100644 index 0000000..0869177 --- /dev/null +++ b/app-doc/doxygen/doxygen-1.7.4.ebuild @@ -0,0 +1,184 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-doc/doxygen/doxygen-1.7.4.ebuild,v 1.3 2011/09/03 02:02:28 nerdboy Exp $ + +EAPI=3 + +inherit eutils flag-o-matic toolchain-funcs qt4-r2 fdo-mime + +DESCRIPTION="documentation system for C++, C, Java, Objective-C, Python, IDL, and other languages" +HOMEPAGE="http://www.doxygen.org/" +SRC_URI="ftp://ftp.stack.nl/pub/users/dimitri/${P}.src.tar.gz + tcl? ( mirror://gentoo/${PN}-1.7-tcl_support.patch.bz2 )" + +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~x86-solaris" + +IUSE="debug doc nodot qt4 latex tcl elibc_FreeBSD" +LICENSE="GPL-2" +SLOT="0" + +RDEPEND="qt4? ( x11-libs/qt-gui:4 ) + latex? ( >=app-text/texlive-2008[extra] ) + dev-lang/python + virtual/libiconv + media-libs/libpng + app-text/ghostscript-gpl + !nodot? ( >=media-gfx/graphviz-2.20.0 + media-libs/freetype )" +DEPEND=">=sys-apps/sed-4 + sys-devel/flex + ${RDEPEND}" + +EPATCH_SUFFIX="patch" + +src_prepare() { + # use CFLAGS, CXXFLAGS, LDFLAGS + export ECFLAGS="${CFLAGS}" ECXXFLAGS="${CXXFLAGS}" ELDFLAGS="${LDFLAGS}" + + sed -i.orig -e 's:^\(TMAKE_CFLAGS_RELEASE\t*\)= .*$:\1= $(ECFLAGS):' \ + -e 's:^\(TMAKE_CXXFLAGS_RELEASE\t*\)= .*$:\1= $(ECXXFLAGS):' \ + -e 's:^\(TMAKE_LFLAGS_RELEASE\s*\)=.*$:\1= $(ELDFLAGS):' \ + tmake/lib/{{linux,gnu,freebsd,netbsd,openbsd,solaris}-g++,macosx-c++,linux-64}/tmake.conf \ + || die "sed 1 failed" + + # Ensure we link to -liconv + if use elibc_FreeBSD; then + for pro in */*.pro.in */*/*.pro.in; do + echo "unix:LIBS += -liconv" >> "${pro}" + done + fi + + # Call dot with -Teps instead of -Tps for EPS generation - bug #282150 + epatch "${FILESDIR}"/${PN}-1.7.1-dot-eps.patch + + # prefix search tools patch, plus OSX fixes + epatch "${FILESDIR}"/${PN}-1.5.6-prefix-misc-alt.patch + + # fix final DESTDIR issue + sed -i.orig -e "s:\$(INSTALL):\$(DESTDIR)/\$(INSTALL):g" \ + addon/doxywizard/Makefile.in || die "sed 2 failed" + + # fix pdf doc + sed -i.orig -e "s:g_kowal:g kowal:" \ + doc/maintainers.txt || die "sed 3 failed" + + # add native TCL support + use tcl && epatch "${WORKDIR}"/${PN}-1.7-tcl_support.patch + + if is-flagq "-O3" ; then + echo + ewarn "Compiling with -O3 is known to produce incorrectly" + ewarn "optimized code which breaks doxygen." + echo + elog "Continuing with -O2 instead ..." + echo + replace-flags "-O3" "-O2" + fi +} + +src_configure() { + # set ./configure options (prefix, Qt based wizard, docdir) + + local my_conf="--shared" + + if use debug ; then + my_conf="${my_conf} --debug" + else + my_conf="${my_conf} --release " + fi + + use ppc64 && my_conf="${my_conf} --english-only" #263641 + + use qt4 && my_conf="${my_conf} --with-doxywizard" + + export CC="${QMAKE_CC}" + export CXX="${QMAKE_CXX}" + export LINK="${QMAKE_LINK}" + export LINK_SHLIB="${QMAKE_CXX}" + + ./configure --prefix "${EPREFIX}/usr" ${my_conf} \ + || die 'configure failed' +} + +src_compile() { + + # force stupid qmake to behave - if it works... + if use qt4 ; then + qt4-r2_src_compile + else + CFLAGS+="${ECFLAGS}" CXXFLAGS+="${ECXXFLAGS}" LFLAGS+="${ELDFLAGS}" \ + emake all || die 'emake failed' + fi + + # generate html and pdf (if tetex in use) documents. + # errors here are not considered fatal, hence the ewarn message + # TeX's font caching in /var/cache/fonts causes sandbox warnings, + # so we allow it. + if use doc; then + if use nodot; then + sed -i -e "s/HAVE_DOT = YES/HAVE_DOT = NO/" \ + {Doxyfile,doc/Doxyfile} \ + || ewarn "disabling dot failed" + fi + if use latex; then + addwrite /var/cache/fonts + addwrite /var/cache/fontconfig + addwrite /usr/share/texmf/fonts/pk + addwrite /usr/share/texmf/ls-R + make pdf || ewarn '"make pdf docs" failed.' + else + cp doc/Doxyfile doc/Doxyfile.orig + cp doc/Makefile doc/Makefile.orig + sed -i.orig -e "s/GENERATE_LATEX = YES/GENERATE_LATEX = NO/" \ + doc/Doxyfile + sed -i.orig -e "s/@epstopdf/# @epstopdf/" \ + -e "s/@cp Makefile.latex/# @cp Makefile.latex/" \ + -e "s/@sed/# @sed/" doc/Makefile + make docs || ewarn '"make html docs" failed.' + fi + fi +} + +src_install() { + make DESTDIR="${D}" MAN1DIR=share/man/man1 \ + install || die '"make install" failed.' + + if use qt4; then + doicon "${FILESDIR}/doxywizard.png" + make_desktop_entry doxywizard "DoxyWizard ${PV}" \ + "/usr/share/pixmaps/doxywizard.png" \ + "Application;Development" + fi + + dodoc INSTALL LANGUAGE.HOWTO README + + # pdf and html manuals + if use doc; then + dohtml -r html/* + if use latex; then + insinto /usr/share/doc/"${PF}" + doins latex/doxygen_manual.pdf + fi + fi +} + +pkg_postinst() { + fdo-mime_desktop_database_update + + elog + elog "The USE flags qt4, doc, and latex will enable doxywizard, or" + elog "the html and pdf documentation, respectively. For examples" + elog "and other goodies, see the source tarball. For some example" + elog "output, run doxygen on the doxygen source using the Doxyfile" + elog "provided in the top-level source dir." + elog + elog "Enabling the nodot USE flag will remove the GraphViz dependency," + elog "along with Doxygen's ability to generate diagrams in the docs." + elog "See the Doxygen homepage for additional helper tools to parse" + elog "more languages." + elog +} + +pkg_postrm() { + fdo-mime_desktop_database_update +} diff --git a/app-doc/doxygen/doxygen-1.7.5.1.ebuild b/app-doc/doxygen/doxygen-1.7.5.1.ebuild new file mode 100644 index 0000000..1abd92a --- /dev/null +++ b/app-doc/doxygen/doxygen-1.7.5.1.ebuild @@ -0,0 +1,182 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-doc/doxygen/doxygen-1.7.5.1.ebuild,v 1.1 2011/11/05 21:30:54 nerdboy Exp $ + +RESTRICT="mirror" +EAPI=3 + +inherit eutils flag-o-matic toolchain-funcs qt4-r2 fdo-mime + +DESCRIPTION="documentation system for C++, C, Java, Objective-C, Python, IDL, and other languages" +HOMEPAGE="http://www.doxygen.org/" +SRC_URI="ftp://ftp.stack.nl/pub/users/dimitri/${P}.src.tar.gz" + +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~x86-solaris" + +IUSE="debug doc nodot qt4 latex elibc_FreeBSD" +LICENSE="GPL-2" +SLOT="0" + +RDEPEND="qt4? ( x11-libs/qt-gui:4 ) + latex? ( >=app-text/texlive-2008[extra] ) + virtual/libiconv + media-libs/libpng + app-text/ghostscript-gpl + !nodot? ( >=media-gfx/graphviz-2.20.0 + media-libs/freetype )" + +DEPEND=">=sys-apps/sed-4 + doc? ( =dev-lang/python-2* ) + sys-devel/flex + ${RDEPEND}" + +EPATCH_SUFFIX="patch" + +src_prepare() { + # use CFLAGS, CXXFLAGS, LDFLAGS + export ECFLAGS="${CFLAGS}" ECXXFLAGS="${CXXFLAGS}" ELDFLAGS="${LDFLAGS}" + + sed -i.orig -e 's:^\(TMAKE_CFLAGS_RELEASE\t*\)= .*$:\1= $(ECFLAGS):' \ + -e 's:^\(TMAKE_CXXFLAGS_RELEASE\t*\)= .*$:\1= $(ECXXFLAGS):' \ + -e 's:^\(TMAKE_LFLAGS_RELEASE\s*\)=.*$:\1= $(ELDFLAGS):' \ + tmake/lib/{{linux,gnu,freebsd,netbsd,openbsd,solaris}-g++,macosx-c++,linux-64}/tmake.conf \ + || die "sed 1 failed" + + # Ensure we link to -liconv + if use elibc_FreeBSD; then + for pro in */*.pro.in */*/*.pro.in; do + echo "unix:LIBS += -liconv" >> "${pro}" + done + fi + + # Call dot with -Teps instead of -Tps for EPS generation - bug #282150 + epatch "${FILESDIR}"/${P}-dot-eps.patch + + # prefix search tools patch, plus OSX fixes + epatch "${FILESDIR}"/${PN}-1.5.6-prefix-misc-alt.patch + + # fix final DESTDIR issue + sed -i.orig -e "s:\$(INSTALL):\$(DESTDIR)/\$(INSTALL):g" \ + addon/doxywizard/Makefile.in || die "sed 2 failed" + + # fix pdf doc + sed -i.orig -e "s:g_kowal:g kowal:" \ + doc/maintainers.txt || die "sed 3 failed" + + if is-flagq "-O3" ; then + echo + ewarn "Compiling with -O3 is known to produce incorrectly" + ewarn "optimized code which breaks doxygen." + echo + elog "Continuing with -O2 instead ..." + echo + replace-flags "-O3" "-O2" + fi +} + +src_configure() { + # set ./configure options (prefix, Qt based wizard, docdir) + + local my_conf="--shared" + + if use debug ; then + my_conf="${my_conf} --debug" + else + my_conf="${my_conf} --release " + fi + + use ppc64 && my_conf="${my_conf} --english-only" #263641 + + use qt4 && my_conf="${my_conf} --with-doxywizard" + + export CC="${QMAKE_CC}" + export CXX="${QMAKE_CXX}" + export LINK="${QMAKE_LINK}" + export LINK_SHLIB="${QMAKE_CXX}" + + ./configure --prefix "${EPREFIX}/usr" ${my_conf} \ + || die 'configure failed' +} + +src_compile() { + + # force stupid qmake to behave - if it works... + if use qt4 ; then + qt4-r2_src_compile + else + CFLAGS+="${ECFLAGS}" CXXFLAGS+="${ECXXFLAGS}" LFLAGS+="${ELDFLAGS}" \ + emake all || die 'emake failed' + fi + + # generate html and pdf (if tetex in use) documents. + # errors here are not considered fatal, hence the ewarn message + # TeX's font caching in /var/cache/fonts causes sandbox warnings, + # so we allow it. + if use doc; then + if use nodot; then + sed -i -e "s/HAVE_DOT = YES/HAVE_DOT = NO/" \ + {Doxyfile,doc/Doxyfile} \ + || ewarn "disabling dot failed" + fi + if use latex; then + addwrite /var/cache/fonts + addwrite /var/cache/fontconfig + addwrite /usr/share/texmf/fonts/pk + addwrite /usr/share/texmf/ls-R + make pdf || ewarn '"make pdf docs" failed.' + else + cp doc/Doxyfile doc/Doxyfile.orig + cp doc/Makefile doc/Makefile.orig + sed -i.orig -e "s/GENERATE_LATEX = YES/GENERATE_LATEX = NO/" \ + doc/Doxyfile + sed -i.orig -e "s/@epstopdf/# @epstopdf/" \ + -e "s/@cp Makefile.latex/# @cp Makefile.latex/" \ + -e "s/@sed/# @sed/" doc/Makefile + make docs || ewarn '"make docs" failed.' + fi + fi +} + +src_install() { + make DESTDIR="${D}" MAN1DIR=share/man/man1 \ + install || die '"make install" failed.' + + if use qt4; then + doicon "${FILESDIR}/doxywizard.png" + make_desktop_entry doxywizard "DoxyWizard ${PV}" \ + "/usr/share/pixmaps/doxywizard.png" \ + "Application;Development" + fi + + dodoc INSTALL LANGUAGE.HOWTO README + + # pdf and html manuals + if use doc; then + dohtml -r html/* + if use latex; then + insinto /usr/share/doc/"${PF}" + doins latex/doxygen_manual.pdf + fi + fi +} + +pkg_postinst() { + fdo-mime_desktop_database_update + + elog + elog "The USE flags qt4, doc, and latex will enable doxywizard, or" + elog "the html and pdf documentation, respectively. For examples" + elog "and other goodies, see the source tarball. For some example" + elog "output, run doxygen on the doxygen source using the Doxyfile" + elog "provided in the top-level source dir." + elog + elog "Enabling the nodot USE flag will remove the GraphViz dependency," + elog "along with Doxygen's ability to generate diagrams in the docs." + elog "See the Doxygen homepage for additional helper tools to parse" + elog "more languages." + elog +} + +pkg_postrm() { + fdo-mime_desktop_database_update +} diff --git a/app-doc/doxygen/files/doxygen-1.7.1-dot-eps.patch b/app-doc/doxygen/files/doxygen-1.7.1-dot-eps.patch new file mode 100644 index 0000000..7342943 --- /dev/null +++ b/app-doc/doxygen/files/doxygen-1.7.1-dot-eps.patch @@ -0,0 +1,57 @@ +diff -ruN doxygen-1.7.0.orig/src/dot.cpp doxygen-1.7.0/src/dot.cpp +--- doxygen-1.7.0.orig/src/dot.cpp 2010-06-22 16:00:16.043394153 +0800 ++++ doxygen-1.7.0/src/dot.cpp 2010-06-22 16:00:52.509648230 +0800 +@@ -2366,7 +2366,7 @@ + } + else + { +- dotRun->addJob("ps",absEpsName); ++ dotRun->addJob("eps",absEpsName); + } + DotManager::instance()->addRun(dotRun); + } +@@ -2662,7 +2662,7 @@ + } + else + { +- dotRun->addJob("ps",absEpsName); ++ dotRun->addJob("eps",absEpsName); + } + DotManager::instance()->addRun(dotRun); + +@@ -2935,7 +2935,7 @@ + } + else + { +- dotRun->addJob("ps",absEpsName); ++ dotRun->addJob("eps",absEpsName); + } + DotManager::instance()->addRun(dotRun); + +@@ -3063,7 +3063,7 @@ + } + else + { +- dotRun->addJob("ps",absEpsName); ++ dotRun->addJob("eps",absEpsName); + } + DotManager::instance()->addRun(dotRun); + } +@@ -3193,7 +3193,7 @@ + } + else + { +- dotRun.addJob("ps",absOutFile+".eps"); ++ dotRun.addJob("eps",absOutFile+".eps"); + } + } + +@@ -3552,7 +3552,7 @@ + } + else + { +- dotRun->addJob("ps",absEpsName); ++ dotRun->addJob("eps",absEpsName); + } + DotManager::instance()->addRun(dotRun); + } diff --git a/app-doc/doxygen/files/doxygen-1.7.5.1-dot-eps.patch b/app-doc/doxygen/files/doxygen-1.7.5.1-dot-eps.patch new file mode 100644 index 0000000..e2125a3 --- /dev/null +++ b/app-doc/doxygen/files/doxygen-1.7.5.1-dot-eps.patch @@ -0,0 +1,56 @@ +--- src/dot.cpp.old 2011-10-29 17:52:54.000000000 +0200 ++++ src/dot.cpp 2011-10-29 17:53:15.000000000 +0200 +@@ -2894,7 +2894,7 @@ + } + else + { +- dotRun->addJob("ps",absEpsName); ++ dotRun->addJob("eps",absEpsName); + } + DotManager::instance()->addRun(dotRun); + } +@@ -3212,7 +3212,7 @@ + } + else + { +- dotRun->addJob("ps",absEpsName); ++ dotRun->addJob("eps",absEpsName); + } + DotManager::instance()->addRun(dotRun); + +@@ -3503,7 +3503,7 @@ + } + else + { +- dotRun->addJob("ps",absEpsName); ++ dotRun->addJob("eps",absEpsName); + } + DotManager::instance()->addRun(dotRun); + +@@ -3649,7 +3649,7 @@ + } + else + { +- dotRun->addJob("ps",absEpsName); ++ dotRun->addJob("eps",absEpsName); + } + DotManager::instance()->addRun(dotRun); + } +@@ -3810,7 +3810,7 @@ + } + else + { +- dotRun.addJob("ps",absOutFile+".eps"); ++ dotRun.addJob("eps",absOutFile+".eps"); + } + } + +@@ -4190,7 +4190,7 @@ + } + else + { +- dotRun->addJob("ps",absEpsName); ++ dotRun->addJob("eps",absEpsName); + } + DotManager::instance()->addRun(dotRun); + } diff --git a/app-doc/doxygen/files/doxywizard.png b/app-doc/doxygen/files/doxywizard.png Binary files differnew file mode 100644 index 0000000..c648231 --- /dev/null +++ b/app-doc/doxygen/files/doxywizard.png diff --git a/app-doc/doxygen/metadata.xml b/app-doc/doxygen/metadata.xml new file mode 100644 index 0000000..6098d46 --- /dev/null +++ b/app-doc/doxygen/metadata.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<herd>dev-tools</herd> +<maintainer> + <email>nerdboy@gentoo.org</email> + <name>Steve Arnold</name> +</maintainer> +<longdescription>Doxygen is a tool for analyzing, documenting, and reverse-engineering + source code of various languages using a variety of output formats + (try it and see). Doxygen supports C++, C, Java, Objective-C, Python, + IDL (Corba and Microsoft flavors) and to some extent PHP, C#, and D, + as well as other languages (using additional helper tools). +</longdescription> +<use> + <flag name='nodot'>removes graphviz dependency, along with dot graphs</flag> + <flag name='tcl'>adds experimental support for parsing/documenting Tcl source code</flag> +</use> +</pkgmetadata> diff --git a/app-forensics/afflib/Manifest b/app-forensics/afflib/Manifest new file mode 100644 index 0000000..2592e92 --- /dev/null +++ b/app-forensics/afflib/Manifest @@ -0,0 +1,6 @@ +AUX afflib-3.3.4-glibc-2.10.patch 867 RMD160 46fa71f88a38ffb5e3a28421b067aeb534790281 SHA1 962d58d1bed558b2191b8436d50d51e4e1227e07 SHA256 a7623e40b9ccb01e8f3363b4adc5bcef15b53160c7693bb86ab65929b1ede323 +AUX afflib-3.6.12-python-module.patch 335 RMD160 b48fddd0e2e7ecaf15aad40de0d7ba3509993215 SHA1 a8c80a79846114badf68021b62bcec3df960f88a SHA256 96a971b6e84a4e0a758a1a2991f2750853c5faaccb70ca0dc070d056645f83a3 +AUX pyaff.patch 1800 RMD160 740cde64ab71ec23e47022a4e9e69fcdb714307b SHA1 00d13057c61840c54e9c423969a44ded72c00ad1 SHA256 4f71c2d000b5c425d3bc7bbe9ea8afffc72d2890e7f43c5ba133d41f4b02290a +DIST afflib-3.6.12.tar.gz 767740 RMD160 aebb740513992d6ef24cf6a54a965ff3c1a5d9cb SHA1 1bd156a7e970253c3e2df5b55046142073b311fe SHA256 07e89cb01116663a631dcd24fa07f1ab44f5f3f60b0f5244084d6d2a71b623d0 +EBUILD afflib-3.6.12.ebuild 1450 RMD160 59b984e8197204eaaf23f0cdb659f65a76a449c1 SHA1 822801e109a63130e2f8a09c4d2b0994c4ce9b01 SHA256 613b3a7a4ab08561e9643584b96e3592d27b6fc739b7b4d0e10294d000ac96b8 +MISC metadata.xml 374 RMD160 fa171ee3cec42b99102931222a8adf79e0dca3e0 SHA1 7e93104f05308ea65433a75babeb7ca84ffaea02 SHA256 582492e3aa041d699a842ddc2cd5eab0fffbb916a7b011ac7ec6349178a30ede diff --git a/app-forensics/afflib/afflib-3.6.12.ebuild b/app-forensics/afflib/afflib-3.6.12.ebuild new file mode 100644 index 0000000..ee967df --- /dev/null +++ b/app-forensics/afflib/afflib-3.6.12.ebuild @@ -0,0 +1,59 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-forensics/afflib/afflib-3.6.12.ebuild,v 1.2 2011/07/24 18:23:44 armin76 Exp $ + +EAPI="4" +PYTHON_DEPEND="2" +inherit eutils autotools python + +DESCRIPTION="Library that implements the AFF image standard" +HOMEPAGE="http://www.afflib.org/" +SRC_URI="http://www.afflib.org/downloads/${P}.tar.gz" + +LICENSE="BSD-4" +SLOT="0" +KEYWORDS="~amd64 ~hppa ~ppc ~x86" +IUSE="fuse ncurses python qemu readline s3 static-libs threads" + +RDEPEND="dev-libs/expat + dev-libs/openssl + sys-libs/zlib + fuse? ( sys-fs/fuse ) + ncurses? ( sys-libs/ncurses ) + readline? ( sys-libs/readline ) + s3? ( net-misc/curl )" +DEPEND="${RDEPEND}" + +pkg_setup() { + if use python; then + python_set_active_version 2 + python_pkg_setup + fi +} + +src_prepare() { +# epatch "${FILESDIR}"/${P}-python-module.patch + epatch "${FILESDIR}"/pyaff.patch || die + sed -i -e "/FLAGS/s: -g::" configure.ac + sed -i -e "/-static/d" tools/Makefile.am + eautoreconf +} + +src_configure() { + # Hacks for automagic dependencies + use ncurses || export ac_cv_lib_ncurses_initscr=no + use readline || export ac_cv_lib_readline_readline=no + + econf \ + $(use_enable fuse) \ + $(use_enable python) \ + $(use_enable qemu) \ + $(use_enable s3) \ + $(use_enable static-libs static) \ + $(use_enable threads threading) +} + +src_install() { + default + find "${ED}" -name '*.la' -exec rm -f {} + +} diff --git a/app-forensics/afflib/files/afflib-3.3.4-glibc-2.10.patch b/app-forensics/afflib/files/afflib-3.3.4-glibc-2.10.patch new file mode 100644 index 0000000..b3ea15c --- /dev/null +++ b/app-forensics/afflib/files/afflib-3.3.4-glibc-2.10.patch @@ -0,0 +1,22 @@ +diff -up afflib-3.3.4/tools/afverify.cpp.gcc44 afflib-3.3.4/tools/afverify.cpp +--- afflib-3.3.4/tools/afverify.cpp.gcc44 2008-07-21 06:25:29.000000000 +0200 ++++ afflib-3.3.4/tools/afverify.cpp 2009-03-02 12:48:59.000000000 +0100 +@@ -240,12 +240,16 @@ string get_xml_field(const char *buf,con + int verify_bom_signature(AFFILE *af,const char *buf) + { + const char *cce = "</" AF_XML_AFFBOM ">\n"; +- char *chain_end = strstr(buf,cce); ++ char *buf_tmp; ++ char *cce_tmp; ++ strcpy(buf_tmp, buf); ++ strcpy(cce_tmp, cce); ++ char *chain_end = strstr(buf_tmp,cce_tmp); + if(!chain_end){ + warn("end of chain XML can't be found\n"); + return -1; // can't find it + } +- char *sig_start = chain_end + strlen(cce); ++ char *sig_start = chain_end + strlen(cce_tmp); + + BIO *seg = BIO_new_mem_buf((void *)buf,strlen(buf)); + BIO_seek(seg,0); diff --git a/app-forensics/afflib/files/afflib-3.6.12-python-module.patch b/app-forensics/afflib/files/afflib-3.6.12-python-module.patch new file mode 100644 index 0000000..f08ffb1 --- /dev/null +++ b/app-forensics/afflib/files/afflib-3.6.12-python-module.patch @@ -0,0 +1,10 @@ +--- afflib-3.6.12/pyaff/Makefile.am.orig ++++ afflib-3.6.12/pyaff/Makefile.am +@@ -7,7 +7,7 @@ + pyexec_LTLIBRARIES = pyaff.la + + pyaff_la_SOURCES = pyaff.c + pyaff_la_CPPFLAGS = $(PYTHON_CPPFLAGS) +-pyaff_la_LDFLAGS = -module -avoid-version $(PYTHON_LDFLAGS) ++pyaff_la_LDFLAGS = -module -avoid-version -shared $(PYTHON_LDFLAGS) + endif diff --git a/app-forensics/afflib/files/pyaff.patch b/app-forensics/afflib/files/pyaff.patch new file mode 100644 index 0000000..c454813 --- /dev/null +++ b/app-forensics/afflib/files/pyaff.patch @@ -0,0 +1,46 @@ +diff -ur afflib-3.6.12.orif/pyaff/Makefile.am afflib-3.6.12/pyaff/Makefile.am +--- afflib-3.6.12.orif/pyaff/Makefile.am 2010-02-14 22:19:46.000000000 +0800 ++++ afflib-3.6.12/pyaff/Makefile.am 2011-11-21 20:12:53.871903219 +0800 +@@ -4,7 +4,7 @@ + AM_CFLAGS = -I$(top_srcdir)/lib -include affconfig.h + + # This is for the pyaff python module +-pyexec_LTLIBRARIES = pyaff.la ++#pyexec_LTLIBRARIES = pyaff.la + + pyaff_la_SOURCES = pyaff.c + pyaff_la_LIBADD = ../lib/libafflib.la +diff -ur afflib-3.6.12.orif/pyaff/Makefile.in afflib-3.6.12/pyaff/Makefile.in +--- afflib-3.6.12.orif/pyaff/Makefile.in 2011-05-24 06:08:34.000000000 +0800 ++++ afflib-3.6.12/pyaff/Makefile.in 2011-11-21 20:13:27.270903211 +0800 +@@ -219,7 +219,7 @@ + @HAVE_PYTHON_TRUE@AM_CFLAGS = -I$(top_srcdir)/lib -include affconfig.h + + # This is for the pyaff python module +-@HAVE_PYTHON_TRUE@pyexec_LTLIBRARIES = pyaff.la ++#@HAVE_PYTHON_TRUE@pyexec_LTLIBRARIES = pyaff.la + @HAVE_PYTHON_TRUE@pyaff_la_SOURCES = pyaff.c + @HAVE_PYTHON_TRUE@pyaff_la_LIBADD = ../lib/libafflib.la + @HAVE_PYTHON_TRUE@pyaff_la_CPPFLAGS = $(PYTHON_CPPFLAGS) +@@ -284,7 +284,7 @@ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +-pyaff.la: $(pyaff_la_OBJECTS) $(pyaff_la_DEPENDENCIES) ++#pyaff.la: $(pyaff_la_OBJECTS) $(pyaff_la_DEPENDENCIES) + $(pyaff_la_LINK) $(am_pyaff_la_rpath) $(pyaff_la_OBJECTS) $(pyaff_la_LIBADD) $(LIBS) + + mostlyclean-compile: +diff -ur afflib-3.6.12.orif/pyaff/pyaff.c afflib-3.6.12/pyaff/pyaff.c +--- afflib-3.6.12.orif/pyaff/pyaff.c 2008-09-17 16:00:31.000000000 +0800 ++++ afflib-3.6.12/pyaff/pyaff.c 2011-11-21 20:13:35.035903207 +0800 +@@ -35,7 +35,7 @@ + + typedef struct { + PyObject_HEAD +- AFFILE *af; ++ AFFILE af; + uint64_t size; + } affile; + +Only in afflib-3.6.12/pyaff: pyaff.c~ diff --git a/app-forensics/afflib/metadata.xml b/app-forensics/afflib/metadata.xml new file mode 100644 index 0000000..54ca968 --- /dev/null +++ b/app-forensics/afflib/metadata.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<herd>forensics</herd> +<maintainer> + <email>forensics@gentoo.org</email> +</maintainer> +<use> + <flag name="ewf">Enable libewf extra formats</flag> + <flag name="fuse">Enable extra fuse thingies</flag> + <flag name="qemu">Enable qemu stuff</flag> + <flag name="s3">Enable S3</flag> + +</use> +</pkgmetadata> diff --git a/app-text/htp/Manifest b/app-text/htp/Manifest new file mode 100644 index 0000000..853b823 --- /dev/null +++ b/app-text/htp/Manifest @@ -0,0 +1,15 @@ +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA256 + +AUX strip.patch 261 RMD160 f2d3d45edf869c8397ebc71c07e9edfbe9c2df66 SHA1 3741931384e864d2309e6f55076cea81cf53f09d SHA256 d38007bf4e0d835f25e99b0acea17538e241db170a703df59d3ee38350a01760 +DIST htp-1.16.tar.gz 141133 RMD160 ff565a36fb4eacb87d6a8e915a892516ca884f21 SHA1 f2d421f27611d7bc9e7dda5a16f4efb129309b20 SHA256 905da83203be2d45d8bf0e454010ed73b78588dc65c0725b9ed712f01b7da8f2 +EBUILD htp-1.16.ebuild 1359 RMD160 0891d2b69e823282667baa386ddaf9d235e63d94 SHA1 ca2a16eba3be7c072581e7a1ff47f4a302f261c6 SHA256 99166e8159a1b96ea46866369d4d15e480cb9d0d558175143f0e2f6e339c3f52 +MISC ChangeLog 1304 RMD160 a670aec477e1f6e596e36ccf868151e405af5913 SHA1 6599fdd650a80c930563d6a9e3d81074d977700a SHA256 3406da589358fb0455f281e0948e3b11702d96dc4aa078a7b7a06c0d62ad9c16 +MISC metadata.xml 225 RMD160 7081530104e84534030353cb15c4a541bb8d5e05 SHA1 af63626385169ab58c44695ebe4df705d455f94b SHA256 0986f8971072c8d055fccbc67cc59ac43eecd1f5592cd9c0ae729b23e550cc96 +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v2.0.16 (GNU/Linux) + +iF4EAREIAAYFAk0dJ40ACgkQaC/OocHi7JYozwD+P7YfHRefoytuDpngwlo9DGZi +Ykf1/SyzdHd0AxmY1ZUA/2lxVv2VFVChpq0jzRaLoWtMZ4gEJUQKIcJMMwigqVut +=1zU/ +-----END PGP SIGNATURE----- diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest new file mode 100644 index 0000000..dea2a7f --- /dev/null +++ b/dev-lang/python/Manifest @@ -0,0 +1,24 @@ +AUX linux2.patch 606 RMD160 0cca6f619a98e6090d01f4a80c2178c323416a47 SHA1 8fc817c8da2f74d3ccc93d84a1bc713ed26c00e2 SHA256 a178120a3022ecb14044c82eff7e828f6d060b6885acacd4a4d8569fde372fd7 +AUX pydoc.conf 279 RMD160 85dcc3abd24faf09f3753b5c2299517f9b2ebc6a SHA1 c1faef486a0041c2175bfbc2cf10eccaa574e8c2 SHA256 6437e85d16d34efaf2665b3cabb0707392e6dee3df04989d3fcac63fd22997e8 +AUX pydoc.init 741 RMD160 f6414ad95d7f1258f34afa5c9ff5efaa508a4d9d SHA1 576b5e7ac3c7e36d2e809de5b419d87f1bf23aba SHA256 913be80dea585dd161d2fd439f56a358f148853d8305cb0dbf113c91eb1643f5 +AUX python-2.4.4-test-cross.patch 977 RMD160 8fdcd45dc202993988f7a1c2b3d918068883b99e SHA1 96f25777150ba05765282a43f08da6b6fab3cb73 SHA256 ff2a131776d560d188ec5069e17fea3eb09c26fdd02124ae5ff34d791c9fd9f6 +AUX python-2.5-cross-printf.patch 903 RMD160 8dc0ee148120aaf7667624bdb5574bb6af5d2a00 SHA1 596e05be8cde43e4cdd87c8ed06ebb40828f7cea SHA256 1e91e5123d74d89aa8fc9dc60d98516b785f851e43da9b634ae535130e24e780 +AUX python-2.6-chflags-cross.patch 1716 RMD160 b0ec772a41a24d51f4c7430b19bcc6251cd6be87 SHA1 4745cd53cef503c41c50573ad97f40eb89fd4bcd SHA256 7c36689db47720052069725036983c2fb6959f425e3777aae55976b2788d463f +AUX python-2.6-test-cross.patch 914 RMD160 1f421b5565d39a24b887e85cbecaf3857741f756 SHA1 9c05fbe28aac6373f24317db5c277bc4549dde0c SHA256 8264f6ffe5aedcce67bea00b0346e5416a5486da2229bf82fe748d87ec65c4de +AUX python-2.7.2-argparse.patch 954 RMD160 259dd398fd7db3343ec714eda0ce911602af76e7 SHA1 57f30c34ce340e4d101c5e08927e47ff80b5d44b SHA256 c6f439f2d518408974db4bb0583abe683020e710d83c3e76b0c0f5dd687189a2 +AUX python-3.2-argparse.patch 954 RMD160 259dd398fd7db3343ec714eda0ce911602af76e7 SHA1 57f30c34ce340e4d101c5e08927e47ff80b5d44b SHA256 c6f439f2d518408974db4bb0583abe683020e710d83c3e76b0c0f5dd687189a2 +AUX python-3.2-soname_typo.patch 1724 RMD160 1b112382152731768b655279145c7caa31d1094f SHA1 808fdab3b1d1664fc20c67dce008e7ea48134a4e SHA256 776366c3cc67c7d66883846acee8cc1b795c25f6e35e927793be8c54162491e2 +AUX python-config-2.4-r1 1624 RMD160 e4e6893c9e8414289c0c70c0f4be58835911e376 SHA1 addf9a6eb81e636364264a6abb3d96f01ea0cf90 SHA256 923a9e896f99cca5aa4ccbb02f981c6e26a2b1aa42326de2359d3c884bde2a9f +DIST Python-2.6.7.tar.bz2 11084667 RMD160 513e84a7cb76ca876e3803bb03ed558bd0378063 SHA1 5d35eb746e85fb3deaff8518448137c9b9fb6daa SHA256 4502c1a064ce68416188005662c0269d31175b855502f64c6dfa8f51226a0e5c +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.2.tar.xz 8877208 RMD160 25e958dbb17223d6c2060520e0921e6d9c9f7906 SHA1 55a3a9d39f31563370d0c494373bb6d38e4d1a00 SHA256 38a3de4ed38e92e1c3dd81e230caf6569d41bf8df6537d099541a6d3dca1b132 +DIST python-gentoo-patches-2.6.7.tar.bz2 15173 RMD160 0ffb5eb49d463f54e3398973603dd9ead0ab2f9a SHA1 7590bc2dc31ee2c1f6cd04968393137fa43c59f4 SHA256 dcaca7d0a5f266c41c72a3047db24d23e675ce4a0ac9196dae42d7892d5edb33 +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.2.tar.bz2 11826 RMD160 8d450939f3f2f7f5c779b8701097fcf92909c36b SHA1 bdc922a4b94bbb616dbf702e913f74984ad8bda5 SHA256 43799206ed8c81936e3b3e68e8c562334b346652d30383c5b7b93fe9741ad0db +EBUILD python-2.6.7-r2.ebuild 12223 RMD160 f776f05e85c27dfdc52dfeaa7b8fb72dcbf29fe5 SHA1 d4e6013a99ec0c2d5b943fb54612106ca64cda49 SHA256 3d3803a7a8e8827f3199e051af5e4e167e8d127232da01a488dc4617ab0b79fe +EBUILD python-2.7.2-r2.ebuild 12513 RMD160 def7d41701027b7e12bc85256c1a9a2d46231805 SHA1 e9630c8d987ba195f4c46084ce12dbe9ae6b89b6 SHA256 f4ba67c58886343ae5e961fc670f8c81de2f7814dcddb104301c1d45e39f827a +EBUILD python-3.1.3-r1.ebuild 10012 RMD160 6ccf9b6a9c097091bdcbc09bb5eaa0960e32da38 SHA1 bbe18e01a99a52d185e9c681c776c788882011de SHA256 4eb268a192f5f32ef553cce2b0f1b4b95b130bb65d27ec13657d98e0c715f1fb +EBUILD python-3.2-r2.ebuild 11125 RMD160 6332d92a8029acda3254b76a931a3edf2c1a5150 SHA1 fedbaf9903d105e33fbd9bd369751e532d27b70a SHA256 8e86fa8fe23136fa0f97e3c5732e39d31959b96a19e74eee99851a71c55b4e4e +MISC metadata.xml 661 RMD160 54831d16b8807086bfabdbb3df9d33336b5d42a0 SHA1 9867c337fe9e6f4e967004fc9409763e0fedf43b SHA256 2c6c3407251f7ccd6501dee49494e539a9544f2fbae99a4373eefdf4e83e8908 diff --git a/dev-lang/python/files/linux2.patch b/dev-lang/python/files/linux2.patch new file mode 100644 index 0000000..c341423 --- /dev/null +++ b/dev-lang/python/files/linux2.patch @@ -0,0 +1,24 @@ +http://hg.python.org/cpython/rev/c816479f6aaf/ +diff --git a/configure b/configure +--- a/configure ++++ b/configure +@@ -2995,6 +2995,7 @@ then + MACHDEP="$ac_md_system$ac_md_release" + + case $MACHDEP in ++ linux*) MACHDEP="linux2";; + cygwin*) MACHDEP="cygwin";; + darwin*) MACHDEP="darwin";; + atheos*) MACHDEP="atheos";; +diff --git a/configure.in b/configure.in +--- a/configure.in ++++ b/configure.in +@@ -293,6 +293,7 @@ then + MACHDEP="$ac_md_system$ac_md_release" + + case $MACHDEP in ++ linux*) MACHDEP="linux2";; + cygwin*) MACHDEP="cygwin";; + darwin*) MACHDEP="darwin";; + atheos*) MACHDEP="atheos";; + diff --git a/dev-lang/python/files/pydoc.conf b/dev-lang/python/files/pydoc.conf new file mode 100644 index 0000000..20e3628 --- /dev/null +++ b/dev-lang/python/files/pydoc.conf @@ -0,0 +1,7 @@ +# /etc/init.d/pydoc.conf +# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/files/pydoc.conf,v 1.3 2011/10/27 13:56:55 neurogeek Exp $ + +# This file contains the configuration for pydoc's internal webserver. + +# Default port for Python's pydoc server. +@PYDOC_PORT_VARIABLE@="7464" diff --git a/dev-lang/python/files/pydoc.init b/dev-lang/python/files/pydoc.init new file mode 100755 index 0000000..0d62dfc --- /dev/null +++ b/dev-lang/python/files/pydoc.init @@ -0,0 +1,29 @@ +#!/sbin/runscript +# Copyright 1999-2011 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public Licence v2 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/files/pydoc.init,v 1.4 2011/10/27 13:56:55 neurogeek Exp $ + +depend() { + need net +} + +start() { + local pydoc_port="${@PYDOC_PORT_VARIABLE@-${PYDOC_PORT}}" + + if [ -z "${pydoc_port}" ]; then + eerror "Port not set" + return 1 + fi + + ebegin "Starting pydoc server on port ${pydoc_port}" + start-stop-daemon --start --background --make-pidfile \ + --pidfile /var/run/@PYDOC@.pid \ + --exec /usr/bin/@PYDOC@ -- -p "${pydoc_port}" + eend $? +} + +stop() { + ebegin "Stopping pydoc server" + start-stop-daemon --stop --quiet --pidfile /var/run/@PYDOC@.pid + eend $? +} diff --git a/dev-lang/python/files/python-2.4.4-test-cross.patch b/dev-lang/python/files/python-2.4.4-test-cross.patch new file mode 100644 index 0000000..d32cb3f --- /dev/null +++ b/dev-lang/python/files/python-2.4.4-test-cross.patch @@ -0,0 +1,19 @@ +--- Python-2.4.4/Lib/test/test_multibytecodec.py.orig 2007-09-10 14:52:34.424592960 -0400 ++++ Python-2.4.4/Lib/test/test_multibytecodec.py 2007-09-10 14:53:30.646201491 -0400 +@@ -81,11 +81,11 @@ class Test_ISO2022(unittest.TestCase): + uni = u':hu4:unit\xe9 de famille' + self.assertEqual(iso2022jp2.decode('iso2022-jp-2'), uni) + +- def test_iso2022_jp_g0(self): +- self.failIf('\x0e' in u'\N{SOFT HYPHEN}'.encode('iso-2022-jp-2')) +- for encoding in ('iso-2022-jp-2004', 'iso-2022-jp-3'): +- e = u'\u3406'.encode(encoding) +- self.failIf(filter(lambda x: x >= '\x80', e)) ++# def test_iso2022_jp_g0(self): ++# self.failIf('\x0e' in u'\N{SOFT HYPHEN}'.encode('iso-2022-jp-2')) ++# for encoding in ('iso-2022-jp-2004', 'iso-2022-jp-3'): ++# e = u'\u3406'.encode(encoding) ++# self.failIf(filter(lambda x: x >= '\x80', e)) + + def test_bug1572832(self): + if sys.maxunicode >= 0x10000: diff --git a/dev-lang/python/files/python-2.5-cross-printf.patch b/dev-lang/python/files/python-2.5-cross-printf.patch new file mode 100644 index 0000000..9a3eaf7 --- /dev/null +++ b/dev-lang/python/files/python-2.5-cross-printf.patch @@ -0,0 +1,34 @@ +http://bugs.gentoo.org/239110 + +assume %zd is supported when cross-compiling. any target we care about +supports it, so ... + +--- configure.in ++++ configure.in +@@ -3417,7 +3417,7 @@ + + + +-AC_MSG_CHECKING(for %zd printf() format support) ++AC_CACHE_CHECK([for %zd printf() format support], [py_cv_has_zd_printf], [dnl + AC_TRY_RUN([#include <stdio.h> + #include <stddef.h> + #include <string.h> +@@ -3451,10 +3451,13 @@ + return 1; + + return 0; +-}], +-[AC_MSG_RESULT(yes) +- AC_DEFINE(PY_FORMAT_SIZE_T, "z", [Define to printf format modifier for Py_ssize_t])], +- AC_MSG_RESULT(no)) ++}], [py_cv_has_zd_printf="yes"], ++ [py_cv_has_zd_printf="no"], ++ [py_cv_has_zd_printf="cross -- assuming yes"] ++)]) ++if test "$py_cv_has_zd_printf" != "no" ; then ++ AC_DEFINE(PY_FORMAT_SIZE_T, "z", [Define to printf format modifier for Py_ssize_t]) ++fi + + AC_CHECK_TYPE(socklen_t,, + AC_DEFINE(socklen_t,int, diff --git a/dev-lang/python/files/python-2.6-chflags-cross.patch b/dev-lang/python/files/python-2.6-chflags-cross.patch new file mode 100644 index 0000000..9c4b6d2 --- /dev/null +++ b/dev-lang/python/files/python-2.6-chflags-cross.patch @@ -0,0 +1,59 @@ +if we're cross-compiling, fall back to a link-only test rather than trying +to run a program for the chflags functions + +--- python-2.6/configure.in ++++ python-2.6/configure.in +@@ -2565,7 +2565,7 @@ + + # On Tru64, chflags seems to be present, but calling it will + # exit Python +-AC_MSG_CHECKING(for chflags) ++AC_CACHE_CHECK([for chflags], [py_cv_has_chflags], [dnl + AC_TRY_RUN([ + #include <sys/stat.h> + #include <unistd.h> +@@ -2575,12 +2575,18 @@ + return 1; + return 0; + } +-],AC_DEFINE(HAVE_CHFLAGS, 1, Define to 1 if you have the `chflags' function.) +- AC_MSG_RESULT(yes), +- AC_MSG_RESULT(no) +-) ++], [py_cv_has_chflags="yes"], ++ [py_cv_has_chflags="no"], ++ [py_cv_has_chflags="cross"]) ++]) ++if test "$py_cv_has_chflags" = "cross" ; then ++ AC_CHECK_FUNC([chflags], [py_cv_has_chflags="yes"], [py_cv_has_chflags="no"]) ++fi ++if test "$py_cv_has_chflags" = "yes" ; then ++ AC_DEFINE(HAVE_CHFLAGS, 1, Define to 1 if you have the `chflags' function.) ++fi + +-AC_MSG_CHECKING(for lchflags) ++AC_CACHE_CHECK([for lchflags], [py_cv_has_lchflags], [dnl + AC_TRY_RUN([ + #include <sys/stat.h> + #include <unistd.h> +@@ -2590,10 +2596,16 @@ + return 1; + return 0; + } +-],AC_DEFINE(HAVE_LCHFLAGS, 1, Define to 1 if you have the `lchflags' function.) +- AC_MSG_RESULT(yes), +- AC_MSG_RESULT(no) +-) ++], [py_cv_has_lchflags="yes"], ++ [py_cv_has_lchflags="no"], ++ [py_cv_has_lchflags="cross"]) ++]) ++if test "$py_cv_has_lchflags" = "cross" ; then ++ AC_CHECK_FUNC([lchflags], [py_cv_has_lchflags="yes"], [py_cv_has_lchflags="no"]) ++fi ++if test "$py_cv_has_lchflags" = "yes" ; then ++ AC_DEFINE(HAVE_LCHFLAGS, 1, Define to 1 if you have the `lchflags' function.) ++fi + + dnl Check if system zlib has *Copy() functions + dnl diff --git a/dev-lang/python/files/python-2.6-test-cross.patch b/dev-lang/python/files/python-2.6-test-cross.patch new file mode 100644 index 0000000..0ff4193 --- /dev/null +++ b/dev-lang/python/files/python-2.6-test-cross.patch @@ -0,0 +1,19 @@ +--- Lib/test/test_multibytecodec.py.orig 2008-04-19 18:48:59.000000000 +0300 ++++ Lib/test/test_multibytecodec.py 2008-04-19 18:49:44.000000000 +0300 +@@ -212,11 +212,11 @@ + uni = u':hu4:unit\xe9 de famille' + self.assertEqual(iso2022jp2.decode('iso2022-jp-2'), uni) + +- def test_iso2022_jp_g0(self): +- self.failIf('\x0e' in u'\N{SOFT HYPHEN}'.encode('iso-2022-jp-2')) +- for encoding in ('iso-2022-jp-2004', 'iso-2022-jp-3'): +- e = u'\u3406'.encode(encoding) +- self.failIf(filter(lambda x: x >= '\x80', e)) ++ #def test_iso2022_jp_g0(self): ++ # self.failIf('\x0e' in u'\N{SOFT HYPHEN}'.encode('iso-2022-jp-2')) ++ # for encoding in ('iso-2022-jp-2004', 'iso-2022-jp-3'): ++ # e = u'\u3406'.encode(encoding) ++ # self.failIf(filter(lambda x: x >= '\x80', e)) + + def test_bug1572832(self): + if sys.maxunicode >= 0x10000: diff --git a/dev-lang/python/files/python-3.2-argparse.patch b/dev-lang/python/files/python-3.2-argparse.patch new file mode 100644 index 0000000..12ea03c --- /dev/null +++ b/dev-lang/python/files/python-3.2-argparse.patch @@ -0,0 +1,23 @@ +diff -ur Python-2.7.2.orig/Lib/test/test_import.py Python-2,7,2/Lib/test/test_import.py +--- Lib/test/test_import.py 2010-12-15 07:06:25.000000000 +0800 ++++ Lib/test/test_import.py 2011-11-11 13:18:42.290846014 +0800 +@@ -4,6 +4,7 @@ + from importlib.test.import_ import util as importlib_util + import marshal + import os ++import platform + import py_compile + import random + import stat +@@ -534,7 +535,9 @@ + + @unittest.skipUnless(os.name == 'posix', + "test meaningful only on posix systems") +- def test_unwritable_directory(self): ++ @unittest.skipIf(platform.system() == 'FreeBSD' and os.geteuid() == 0, ++ "due to non-standard filesystem permission semantics (issue #11956)") ++ def test_unwritable_directory(self): + # When the umask causes the new __pycache__ directory to be + # unwritable, the import still succeeds but no .pyc file is written. + with temp_umask(0o222): + diff --git a/dev-lang/python/files/python-3.2-soname_typo.patch b/dev-lang/python/files/python-3.2-soname_typo.patch new file mode 100644 index 0000000..357274c --- /dev/null +++ b/dev-lang/python/files/python-3.2-soname_typo.patch @@ -0,0 +1,51 @@ +# HG changeset patch +# User Martin v. Löwis <martin@v.loewis.de> +# Date 1304919465 -7200 +# Node ID 749686064642118c5ccc8ad28105472321931353 +# Parent 4f3f67a595fb05f04d89ed906df911b743e47463 +Use --as-needed when linking libpython3.so. Closes #11347. +Patch by Arfrever Frehtes Taifersar Arahesis. + +diff --git a/Makefile.pre.in b/Makefile.pre.in +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -76,6 +76,7 @@ PY_CFLAGS= $(BASECFLAGS) $(OPT) $(CONFIG + # environment variables + PY_CPPFLAGS= -I. -IInclude -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) $(CPPFLAGS) + PY_LDFLAGS= $(CONFIGURE_LDFLAGS) $(LDFLAGS) ++NO_AS_NEEDED= @NO_AS_NEEDED@ + LDLAST= @LDLAST@ + SGI_ABI= @SGI_ABI@ + CCSHARED= @CCSHARED@ +@@ -459,7 +460,7 @@ libpython$(LDVERSION).so: $(LIBRARY_OBJS + fi + + libpython3.so: libpython$(LDVERSION).so +- $(BLDSHARED) -o $@ -Wl,-hl$@ $^ ++ $(BLDSHARED) $(NO_AS_NEEDED) -o $@ -Wl,-h$@ $^ + + libpython$(LDVERSION).dylib: $(LIBRARY_OBJS) + $(CC) -dynamiclib -Wl,-single_module $(PY_LDFLAGS) -undefined dynamic_lookup -Wl,-install_name,$(prefix)/lib/libpython$(LDVERSION).dylib -Wl,-compatibility_version,$(VERSION) -Wl,-current_version,$(VERSION) -o $@ $(LIBRARY_OBJS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \ +diff --git a/configure.in b/configure.in +--- a/configure.in ++++ b/configure.in +@@ -525,6 +525,18 @@ then + fi + + ++AC_MSG_CHECKING([for -Wl,--no-as-needed]) ++save_LDFLAGS="$LDFLAGS" ++LDFLAGS="$LDFLAGS -Wl,--no-as-needed" ++AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], ++ [NO_AS_NEEDED="-Wl,--no-as-needed" ++ AC_MSG_RESULT([yes])], ++ [NO_AS_NEEDED="" ++ AC_MSG_RESULT([no])]) ++LDFLAGS="$save_LDFLAGS" ++AC_SUBST(NO_AS_NEEDED) ++ ++ + # checks for UNIX variants that set C preprocessor variables + AC_USE_SYSTEM_EXTENSIONS + + diff --git a/dev-lang/python/files/python-config-2.4-r1 b/dev-lang/python/files/python-config-2.4-r1 new file mode 100644 index 0000000..af45113 --- /dev/null +++ b/dev-lang/python/files/python-config-2.4-r1 @@ -0,0 +1,58 @@ +#! /usr/bin/python2.4 + +import sys +import os +import getopt +from distutils import sysconfig + +valid_opts = ['prefix', 'exec-prefix', 'includes', 'libs', 'cflags', + 'ldflags', 'help'] + +def exit_with_usage(code=1): + print >>sys.stderr, "Usage: %s [%s]" % (sys.argv[0], + '|'.join('--'+opt for opt in valid_opts)) + sys.exit(code) + +try: + opts, args = getopt.getopt(sys.argv[1:], '', valid_opts) +except getopt.error: + exit_with_usage() + +if not opts: + #exit_with_usage() + #be compatible with our old python-config-2.4 + import string + print "-lpython2.4 -lm -L/usr/lib/python2.4/config",string.join(string.split(sysconfig.get_config_var("MODLIBS"))) + sys.exit(0) + +opt = opts[0][0] + +pyver = sysconfig.get_config_var('VERSION') +getvar = sysconfig.get_config_var + +if opt == '--help': + exit_with_usage(0) + +elif opt == '--prefix': + print sysconfig.PREFIX + +elif opt == '--exec-prefix': + print sysconfig.EXEC_PREFIX + +elif opt in ('--includes', '--cflags'): + flags = ['-I' + sysconfig.get_python_inc(), + '-I' + sysconfig.get_python_inc(plat_specific=True)] + if opt == '--cflags': + flags.extend(getvar('CFLAGS').split()) + print ' '.join(flags) + +elif opt in ('--libs', '--ldflags'): + libs = getvar('LIBS').split() + getvar('SYSLIBS').split() + libs.append('-lpython'+pyver) + # add the prefix/lib/pythonX.Y/config dir, but only if there is no + # shared library in prefix/lib/. + if opt == '--ldflags' and not getvar('Py_ENABLE_SHARED'): + libs.insert(0, '-L' + getvar('LIBPL')) + print ' '.join(libs) + + diff --git a/dev-lang/python/files/xml-use_pyxml.patch b/dev-lang/python/files/xml-use_pyxml.patch new file mode 100644 index 0000000..133967b --- /dev/null +++ b/dev-lang/python/files/xml-use_pyxml.patch @@ -0,0 +1,42 @@ +diff -ur Python-2.7.1.orig//Lib/xml/__init__.py Python-2.7.1/Lib/xml/__init__.py +--- Python-2.7.1.orig//Lib/xml/__init__.py 2009-10-09 11:11:36.000000000 +0800 ++++ Python-2.7.1/Lib/xml/__init__.py 2011-11-14 23:36:08.006937770 +0800 +@@ -22,20 +22,22 @@ + _MINIMUM_XMLPLUS_VERSION = (0, 8, 4) + + +-try: ++def use_pyxml(): + import _xmlplus +-except ImportError: +- pass +-else: +- try: +- v = _xmlplus.version_info +- except AttributeError: +- # _xmlplus is too old; ignore it +- pass +- else: +- if v >= _MINIMUM_XMLPLUS_VERSION: +- import sys +- _xmlplus.__path__.extend(__path__) +- sys.modules[__name__] = _xmlplus +- else: +- del v ++ v = _xmlplus.version_info ++ if v >= _MINIMUM_XMLPLUS_VERSION: ++ import sys ++ _xmlplus.__path__.extend(__path__) ++ sys.modules[__name__] = _xmlplus ++ cleared_modules = [] ++ redefined_modules = [] ++ for module in sys.modules: ++ if module.startswith("xml.") and not module.startswith(("xml.marshal", "xml.schema", "xml.utils", "xml.xpath", "xml.xslt")): ++ cleared_modules.append(module) ++ if module.startswith(("xml.__init__", "xml.dom", "xml.parsers", "xml.sax")) and sys.modules[module] is not None: ++ redefined_modules.append(module) ++ for module in cleared_modules: ++ del sys.modules[module] ++ for module in sorted(redefined_modules): ++ __import__(module) ++ raise ImportError("PyXML too old: %s" % ".".join(str(x) for x in v)) diff --git a/dev-lang/python/metadata.xml b/dev-lang/python/metadata.xml new file mode 100644 index 0000000..51a9e80 --- /dev/null +++ b/dev-lang/python/metadata.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<herd>python</herd> +<use> + <flag name="threads">Enable threading support. (DON'T DISABLE THIS UNLESS YOU KNOW WHAT YOU'RE DOING)</flag> + <flag name="wide-unicode">Enable wide Unicode implementation which uses 4-byte Unicode characters. Switching of this USE flag changes ABI of Python and requires reinstallation of many Python modules. (DON'T DISABLE THIS UNLESS YOU KNOW WHAT YOU'RE DOING)</flag> + <flag name="wininst">Install Windows executables required to create an executable installer for MS Windows.</flag> +</use> +</pkgmetadata> diff --git a/dev-lang/python/python-2.6.7-r2.ebuild b/dev-lang/python/python-2.6.7-r2.ebuild new file mode 100644 index 0000000..6a92b4c --- /dev/null +++ b/dev-lang/python/python-2.6.7-r2.ebuild @@ -0,0 +1,395 @@ +# 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-r2.ebuild,v 1.4 2011/10/31 04:02:01 vapier 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@@" + + # Linux-3 compat. Bug #374579 (upstream issue12571) + cp -r "${S}/Lib/plat-linux2" "${S}/Lib/plat-linux3" || die + + # wrt Bug 376743 + epatch "${FILESDIR}/${PN}-${PV}"-argparse.patch || die + + 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 + + # Test FEATURES settings for argparse test failure, Bug 376745 + if [ ! has usersandbox && ! has userpriv ] $FEATURES; then + einfo "Both usersandbox && userpriv are not set, test argparse will fail" \ + "to test, run the test suite as user" + 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" + + if use kernel_linux; then + if [ -d "${ED}$(python_get_libdir)/plat-linux2" ];then + cp -r "${ED}$(python_get_libdir)/plat-linux2" \ + "${ED}$(python_get_libdir)/plat-linux3" || die "copy plat-linux failed" + else + cp -r "${ED}$(python_get_libdir)/plat-linux3" \ + "${ED}$(python_get_libdir)/plat-linux2" || die "copy plat-linux failed" + fi + fi + + 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.1-r1.ebuild b/dev-lang/python/python-2.7.1-r1.ebuild new file mode 100644 index 0000000..95184a6 --- /dev/null +++ b/dev-lang/python/python-2.7.1-r1.ebuild @@ -0,0 +1,366 @@ +# 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.1-r1.ebuild,v 1.13 2011/10/27 13:56:55 neurogeek Exp $ + +EAPI="2" +WANT_AUTOMAKE="none" + +inherit autotools eutils flag-o-matic multilib python toolchain-funcs + +if [[ "${PV}" == *_pre* ]]; then + inherit subversion + + ESVN_PROJECT="python" + ESVN_REPO_URI="http://svn.python.org/projects/python/branches/release27-maint" + ESVN_REVISION="" +else + MY_PV="${PV%_p*}" + MY_P="Python-${MY_PV}" +fi + +PATCHSET_REVISION="1" + +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 + >=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 ) + 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. It has" + ewarn "been additionally removed in Python 3. You should use external, still maintained \"bsddb3\"" + ewarn "module provided by dev-python/bsddb3 which supports both Python 2 and Python 3." + 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:]]+\.[[:digit:]]+_pre ]]; then + 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@@" + + if ! use wininst; then + # Remove Microsoft Windows executables. + rm Lib/distutils/command/wininst-*.exe + fi + + # Support versions of Autoconf other than 2.65. + sed -e "/version_required(2\.65)/d" -i configure.in || die "sed failed" + + if [[ "${PV}" == *_pre* ]]; then + sed -e "s/\(-DSVNVERSION=\).*\( -o\)/\1\\\\\"${ESVN_REVISION}\\\\\"\2/" -i Makefile.pre.in || die "sed failed" + fi + + 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 skip_tests="distutils gdb minidom pyexpat sax" + + for test in ${skip_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 ${skip_tests}; do + mv "${T}/test_${test}.py" "${S}/Lib/test/test_${test}.py" + done + + elog "The following tests have been skipped:" + for test in ${skip_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,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,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" + + 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 run 'python-updater \${options}' to rebuild Python modules." + ewarn + ewarn "\e[1;31m************************************************************************\e[0m" + ewarn + ebeep 12 + fi +} + +pkg_postrm() { + eselect_python_update + + python_mod_cleanup $(python_get_libdir) +} diff --git a/dev-lang/python/python-2.7.2-r2.ebuild b/dev-lang/python/python-2.7.2-r2.ebuild new file mode 100644 index 0000000..ae96c65 --- /dev/null +++ b/dev-lang/python/python-2.7.2-r2.ebuild @@ -0,0 +1,409 @@ +# 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-r2.ebuild,v 1.5 2011/10/31 04:02:01 vapier 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" +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=">=sys-devel/autoconf-2.65 + ${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@@" + + # Linux-3 compat. Bug #374579 (upstream issue12571) + cp -r "${S}/Lib/plat-linux2" "${S}/Lib/plat-linux3" || die + + # wrt Bug 376743 + epatch "${FILESDIR}"/python-2.7.2-argparse.patch + + eautoreconf +} +#${PN}-${PV}"-argparse.patch || die + +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 + + # Test FEATURES settings for argparse test failure, Bug 376745 + if [ ! has usersandbox && ! has userpriv ] $FEATURES; then + einfo "Both usersandbox && userpriv are not set, test argparse will fail" \ + "to test, run the test suite as user" + 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" + + if use kernel_linux; then + if [ -d "${ED}$(python_get_libdir)/plat-linux2" ];then + cp -r "${ED}$(python_get_libdir)/plat-linux2" \ + "${ED}$(python_get_libdir)/plat-linux3" || die "copy plat-linux failed" + else + cp -r "${ED}$(python_get_libdir)/plat-linux3" \ + "${ED}$(python_get_libdir)/plat-linux2" || die "copy plat-linux failed" + fi + fi + + 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}: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.3-r1.ebuild b/dev-lang/python/python-3.1.3-r1.ebuild new file mode 100644 index 0000000..7d50ca8 --- /dev/null +++ b/dev-lang/python/python-3.1.3-r1.ebuild @@ -0,0 +1,340 @@ +# 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.3-r1.ebuild,v 1.10 2011/10/27 13:56:55 neurogeek Exp $ + +EAPI="3" +WANT_AUTOMAKE="none" + +inherit autotools eutils flag-o-matic multilib python toolchain-funcs + +if [[ "${PV}" == *_pre* ]]; then + inherit subversion + + ESVN_PROJECT="python" + ESVN_REPO_URI="http://svn.python.org/projects/python/branches/release31-maint" + ESVN_REVISION="" +else + MY_PV="${PV%_p*}" + MY_P="Python-${MY_PV}" +fi + +PATCHSET_REVISION="1" + +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" +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 + >=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 ) + 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:]]+\.[[:digit:]]+_pre ]]; then + 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@@" + + if ! use wininst; then + # Remove Microsoft Windows executables. + rm Lib/distutils/command/wininst-*.exe + fi + + if [[ "${PV}" == *_pre* ]]; then + sed -e "s/\(-DSVNVERSION=\).*\( -o\)/\1\\\\\"${ESVN_REVISION}\\\\\"\2/" -i Makefile.pre.in || die "sed failed" + fi + + sed -e s':^#ifndef HAVE_ADDRINFO:#ifndef HAVE_ADDRINFO\n#define HAVE_ADDRINFO 1:' \ + -i Modules/addrinfo.h || die + + 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 skip_tests="distutils" + + for test in ${skip_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 ${skip_tests}; do + mv "${T}/test_${test}.py" "${S}/Lib/test/test_${test}.py" + done + + elog "The following tests have been skipped:" + for test in ${skip_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" + + 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 run '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 +} + +pkg_postrm() { + eselect_python_update + + python_mod_cleanup $(python_get_libdir) +} diff --git a/dev-lang/python/python-3.2-r2.ebuild b/dev-lang/python/python-3.2-r2.ebuild new file mode 100644 index 0000000..f2216c2 --- /dev/null +++ b/dev-lang/python/python-3.2-r2.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-3.2-r2.ebuild,v 1.6 2011/10/31 04:02:01 vapier Exp $ + +EAPI="3" +WANT_AUTOMAKE="none" + +inherit autotools eutils flag-o-matic multilib python toolchain-funcs + +if [[ "${PV}" == *_pre* ]]; then + inherit subversion + + ESVN_PROJECT="python" + ESVN_REPO_URI="http://svn.python.org/projects/python/branches/release32-maint" + ESVN_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" +SLOT="3.2" +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 + >=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.8:3[extensions] ) + ssl? ( dev-libs/openssl ) + tk? ( + >=dev-lang/tk-8.0 + dev-tcltk/blt + ) + xml? ( >=dev-libs/expat-2 ) + )" +DEPEND=">=sys-devel/autoconf-2.65 + ${RDEPEND} + $([[ "${PV}" == *_pre* ]] && echo "=${CATEGORY}/${PN}-${PV%%.*}*") + $([[ "${PV}" != *_pre* ]] && echo "app-arch/xz-utils") + 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:]]+\.[[:digit:]]+_pre ]]; then + 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}" + + # Linux-3 compat. Bug #374579 (upstream issue12571) + cp -r "${S}/Lib/plat-linux2" "${S}/Lib/plat-linux3" || die + + 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@@" + + if ! use wininst; then + # Remove Microsoft Windows executables. + rm Lib/distutils/command/wininst-*.exe + fi + + # Support versions of Autoconf other than 2.65. + sed -e "/version_required(2\.65)/d" -i configure.in || die "sed failed" + + # Disable ABI flags. + sed -e "s/ABIFLAGS=\"\${ABIFLAGS}.*\"/:/" -i configure.in || die "sed failed" + + if [[ "${PV}" == *_pre* ]]; then + sed -e "s/\(-DSVNVERSION=\).*\( -o\)/\1\\\\\"${ESVN_REVISION}\\\\\"\2/" -i Makefile.pre.in || die "sed failed" + fi + + #WRT bug #376303 + epatch "${FILESDIR}/${P}-soname_typo.patch" || die "soname patch failed" + + eautoreconf + + # wrt Bug 376745 + epatch "${FILESDIR}/${PN}-${PV}"-argparse.patch +} + +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 + + # Test FEATURES settings for arparse test failure, Bug 376745 + if [ ! has usersandbox && ! has userpriv ] $FEATURES; then + einfo "Both usersandbox && userpriv are not set, test argparse will fail" \ + "to test, run the test suite as user" + 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.2 correctly. + # Needed on FreeBSD unless Python 3.2 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="" \ + --enable-loadable-sqlite-extensions \ + --with-system-expat \ + --with-system-ffi +} + +src_compile() { + emake EPYTHON="python${PV%%.*}" CPPFLAGS="" CFLAGS="" LDFLAGS="" || 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 skip_tests="distutils gdb" + + for test in ${skip_tests}; do + mv "${S}/Lib/test/test_${test}.py" "${T}" + done + + # Rerun failed tests in verbose mode (regrtest -w). + emake test EXTRATESTOPTS="-w" CPPFLAGS="" CFLAGS="" LDFLAGS="" < /dev/tty + local result="$?" + + for test in ${skip_tests}; do + mv "${T}/test_${test}.py" "${S}/Lib/test/test_${test}.py" + done + + elog "The following tests have been skipped:" + for test in ${skip_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 + + sed \ + -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \ + -e "s/\(PY_LDFLAGS=\).*/\1/" \ + -i "${ED}$(python_get_libdir)/config-${SLOT}/Makefile" || die "sed failed" + + mv "${ED}usr/bin/python${SLOT}-config" "${ED}usr/bin/python-config-${SLOT}" + + 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" + + 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" + + if use kernel_linux; then + if [ -d "${ED}$(python_get_libdir)/plat-linux2" ];then + cp -r "${ED}$(python_get_libdir)/plat-linux2" \ + "${ED}$(python_get_libdir)/plat-linux3" || die "copy plat-linux failed" + else + cp -r "${ED}$(python_get_libdir)/plat-linux3" \ + "${ED}$(python_get_libdir)/plat-linux2" || die "copy plat-linux failed" + fi + fi + + 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 run '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 +} + +pkg_postrm() { + eselect_python_update + + python_mod_cleanup $(python_get_libdir) +} diff --git a/eclass/python.eclass b/eclass/python.eclass new file mode 100644 index 0000000..3db68cc --- /dev/null +++ b/eclass/python.eclass @@ -0,0 +1,3116 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.140 2011/11/18 23:37:03 vapier Exp $ + +# @ECLASS: python.eclass +# @MAINTAINER: +# Gentoo Python Project <python@gentoo.org> +# @BLURB: Eclass for Python packages +# @DESCRIPTION: +# The python eclass contains miscellaneous, useful functions for Python packages. + +inherit multilib + +if ! has "${EAPI:-0}" 0 1 2 3 4; then + die "API of python.eclass in EAPI=\"${EAPI}\" not established" +fi + +_CPYTHON2_GLOBALLY_SUPPORTED_ABIS=(2.4 2.5 2.6 2.7) +_CPYTHON3_GLOBALLY_SUPPORTED_ABIS=(3.1 3.2) +_JYTHON_GLOBALLY_SUPPORTED_ABIS=(2.5-jython) +_PYPY_GLOBALLY_SUPPORTED_ABIS=(2.7-pypy-1.5) +_PYTHON_GLOBALLY_SUPPORTED_ABIS=(${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]} ${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]} ${_JYTHON_GLOBALLY_SUPPORTED_ABIS[@]} ${_PYPY_GLOBALLY_SUPPORTED_ABIS[@]}) + +# ================================================================================================ +# ===================================== HANDLING OF METADATA ===================================== +# ================================================================================================ + +_PYTHON_ABI_PATTERN_REGEX="([[:alnum:]]|\.|-|\*|\[|\])+" + +_python_check_python_abi_matching() { + local pattern patterns patterns_list="0" PYTHON_ABI + + while (($#)); do + case "$1" in + --patterns-list) + patterns_list="1" + ;; + --) + shift + break + ;; + -*) + die "${FUNCNAME}(): Unrecognized option '$1'" + ;; + *) + break + ;; + esac + shift + done + + if [[ "$#" -ne 2 ]]; then + die "${FUNCNAME}() requires 2 arguments" + fi + + PYTHON_ABI="$1" + + if [[ "${patterns_list}" == "0" ]]; then + pattern="$2" + + if [[ "${pattern}" == *"-cpython" ]]; then + [[ "${PYTHON_ABI}" =~ ^[[:digit:]]+\.[[:digit:]]+$ && "${PYTHON_ABI}" == ${pattern%-cpython} ]] + elif [[ "${pattern}" == *"-jython" ]]; then + [[ "${PYTHON_ABI}" == ${pattern} ]] + elif [[ "${pattern}" == *"-pypy-"* ]]; then + [[ "${PYTHON_ABI}" == ${pattern} ]] + else + if [[ "${PYTHON_ABI}" =~ ^[[:digit:]]+\.[[:digit:]]+$ ]]; then + [[ "${PYTHON_ABI}" == ${pattern} ]] + elif [[ "${PYTHON_ABI}" =~ ^[[:digit:]]+\.[[:digit:]]+-jython$ ]]; then + [[ "${PYTHON_ABI%-jython}" == ${pattern} ]] + elif [[ "${PYTHON_ABI}" =~ ^[[:digit:]]+\.[[:digit:]]+-pypy-[[:digit:]]+\.[[:digit:]]+$ ]]; then + [[ "${PYTHON_ABI%-pypy-*}" == ${pattern} ]] + else + die "${FUNCNAME}(): Unrecognized Python ABI '${PYTHON_ABI}'" + fi + fi + else + patterns="${2// /$'\n'}" + + while read pattern; do + if _python_check_python_abi_matching "${PYTHON_ABI}" "${pattern}"; then + return 0 + fi + done <<< "${patterns}" + + return 1 + fi +} + +_python_package_supporting_installation_for_multiple_python_abis() { + if has "${EAPI:-0}" 0 1 2 3 4; then + if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then + return 0 + else + return 1 + fi + else + die "${FUNCNAME}(): Support for EAPI=\"${EAPI}\" not implemented" + fi +} + +# @ECLASS-VARIABLE: PYTHON_DEPEND +# @DESCRIPTION: +# Specification of dependency on dev-lang/python. +# Syntax: +# PYTHON_DEPEND: [[!]USE_flag? ]<version_components_group>[ version_components_group] +# version_components_group: <major_version[:[minimal_version][:maximal_version]]> +# major_version: <2|3|*> +# minimal_version: <minimal_major_version.minimal_minor_version> +# maximal_version: <maximal_major_version.maximal_minor_version> + +_python_parse_PYTHON_DEPEND() { + local major_version maximal_version minimal_version python_all="0" python_maximal_version python_minimal_version python_versions=() python2="0" python2_maximal_version python2_minimal_version python3="0" python3_maximal_version python3_minimal_version USE_flag= version_components_group version_components_group_regex version_components_groups + + version_components_group_regex="(2|3|\*)(:([[:digit:]]+\.[[:digit:]]+)?(:([[:digit:]]+\.[[:digit:]]+)?)?)?" + version_components_groups="${PYTHON_DEPEND}" + + if [[ "${version_components_groups}" =~ ^((\!)?[[:alnum:]_-]+\?\ )?${version_components_group_regex}(\ ${version_components_group_regex})?$ ]]; then + if [[ "${version_components_groups}" =~ ^(\!)?[[:alnum:]_-]+\? ]]; then + USE_flag="${version_components_groups%\? *}" + version_components_groups="${version_components_groups#* }" + fi + if [[ "${version_components_groups}" =~ ("*".*" "|" *"|^2.*\ (2|\*)|^3.*\ (3|\*)) ]]; then + die "Invalid syntax of PYTHON_DEPEND: Incorrectly specified groups of versions" + fi + + version_components_groups="${version_components_groups// /$'\n'}" + while read version_components_group; do + major_version="${version_components_group:0:1}" + minimal_version="${version_components_group:2}" + minimal_version="${minimal_version%:*}" + maximal_version="${version_components_group:$((3 + ${#minimal_version}))}" + + if [[ "${major_version}" =~ ^(2|3)$ ]]; then + if [[ -n "${minimal_version}" && "${major_version}" != "${minimal_version:0:1}" ]]; then + die "Invalid syntax of PYTHON_DEPEND: Minimal version '${minimal_version}' not in specified group of versions" + fi + if [[ -n "${maximal_version}" && "${major_version}" != "${maximal_version:0:1}" ]]; then + die "Invalid syntax of PYTHON_DEPEND: Maximal version '${maximal_version}' not in specified group of versions" + fi + fi + + if [[ "${major_version}" == "2" ]]; then + python2="1" + python_versions=("${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}") + python2_minimal_version="${minimal_version}" + python2_maximal_version="${maximal_version}" + elif [[ "${major_version}" == "3" ]]; then + python3="1" + python_versions=("${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}") + python3_minimal_version="${minimal_version}" + python3_maximal_version="${maximal_version}" + else + python_all="1" + python_versions=("${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}" "${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}") + python_minimal_version="${minimal_version}" + python_maximal_version="${maximal_version}" + fi + + if [[ -n "${minimal_version}" ]] && ! has "${minimal_version}" "${python_versions[@]}"; then + die "Invalid syntax of PYTHON_DEPEND: Unrecognized minimal version '${minimal_version}'" + fi + if [[ -n "${maximal_version}" ]] && ! has "${maximal_version}" "${python_versions[@]}"; then + die "Invalid syntax of PYTHON_DEPEND: Unrecognized maximal version '${maximal_version}'" + fi + + if [[ -n "${minimal_version}" && -n "${maximal_version}" && "${minimal_version}" > "${maximal_version}" ]]; then + die "Invalid syntax of PYTHON_DEPEND: Minimal version '${minimal_version}' greater than maximal version '${maximal_version}'" + fi + done <<< "${version_components_groups}" + + _PYTHON_ATOMS=() + + _append_accepted_versions_range() { + local accepted_version="0" i + for ((i = "${#python_versions[@]}"; i >= 0; i--)); do + if [[ "${python_versions[${i}]}" == "${python_maximal_version}" ]]; then + accepted_version="1" + fi + if [[ "${accepted_version}" == "1" ]]; then + _PYTHON_ATOMS+=("=dev-lang/python-${python_versions[${i}]}*") + fi + if [[ "${python_versions[${i}]}" == "${python_minimal_version}" ]]; then + accepted_version="0" + fi + done + } + + if [[ "${python_all}" == "1" ]]; then + if [[ -z "${python_minimal_version}" && -z "${python_maximal_version}" ]]; then + _PYTHON_ATOMS+=("dev-lang/python") + else + python_versions=("${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}" "${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}") + python_minimal_version="${python_minimal_version:-${python_versions[0]}}" + python_maximal_version="${python_maximal_version:-${python_versions[${#python_versions[@]}-1]}}" + _append_accepted_versions_range + fi + else + if [[ "${python3}" == "1" ]]; then + if [[ -z "${python3_minimal_version}" && -z "${python3_maximal_version}" ]]; then + _PYTHON_ATOMS+=("=dev-lang/python-3*") + else + python_versions=("${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}") + python_minimal_version="${python3_minimal_version:-${python_versions[0]}}" + python_maximal_version="${python3_maximal_version:-${python_versions[${#python_versions[@]}-1]}}" + _append_accepted_versions_range + fi + fi + if [[ "${python2}" == "1" ]]; then + if [[ -z "${python2_minimal_version}" && -z "${python2_maximal_version}" ]]; then + _PYTHON_ATOMS+=("=dev-lang/python-2*") + else + python_versions=("${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}") + python_minimal_version="${python2_minimal_version:-${python_versions[0]}}" + python_maximal_version="${python2_maximal_version:-${python_versions[${#python_versions[@]}-1]}}" + _append_accepted_versions_range + fi + fi + fi + + unset -f _append_accepted_versions_range + + if [[ "${#_PYTHON_ATOMS[@]}" -gt 1 ]]; then + DEPEND+="${DEPEND:+ }${USE_flag}${USE_flag:+? ( }|| ( ${_PYTHON_ATOMS[@]} )${USE_flag:+ )}" + RDEPEND+="${RDEPEND:+ }${USE_flag}${USE_flag:+? ( }|| ( ${_PYTHON_ATOMS[@]} )${USE_flag:+ )}" + else + DEPEND+="${DEPEND:+ }${USE_flag}${USE_flag:+? ( }${_PYTHON_ATOMS[@]}${USE_flag:+ )}" + RDEPEND+="${RDEPEND:+ }${USE_flag}${USE_flag:+? ( }${_PYTHON_ATOMS[@]}${USE_flag:+ )}" + fi + else + die "Invalid syntax of PYTHON_DEPEND" + fi +} + +DEPEND=">=app-admin/eselect-python-20091230" +RDEPEND="${DEPEND}" + +if [[ -n "${PYTHON_DEPEND}" ]]; then + _python_parse_PYTHON_DEPEND +else + _PYTHON_ATOMS=("dev-lang/python") +fi +unset -f _python_parse_PYTHON_DEPEND + +if [[ -n "${NEED_PYTHON}" ]]; then + eerror "Use PYTHON_DEPEND variable instead of NEED_PYTHON variable." + die "NEED_PYTHON variable is banned" +fi + +# @ECLASS-VARIABLE: PYTHON_USE_WITH +# @DESCRIPTION: +# Set this to a space separated list of USE flags the Python slot in use must be built with. + +# @ECLASS-VARIABLE: PYTHON_USE_WITH_OR +# @DESCRIPTION: +# Set this to a space separated list of USE flags of which one must be turned on for the slot in use. + +# @ECLASS-VARIABLE: PYTHON_USE_WITH_OPT +# @DESCRIPTION: +# Set this to a name of a USE flag if you need to make either PYTHON_USE_WITH or +# PYTHON_USE_WITH_OR atoms conditional under a USE flag. + +if ! has "${EAPI:-0}" 0 1 && [[ -n ${PYTHON_USE_WITH} || -n ${PYTHON_USE_WITH_OR} ]]; then + _PYTHON_USE_WITH_ATOMS_ARRAY=() + if [[ -n "${PYTHON_USE_WITH}" ]]; then + for _PYTHON_ATOM in "${_PYTHON_ATOMS[@]}"; do + _PYTHON_USE_WITH_ATOMS_ARRAY+=("${_PYTHON_ATOM}[${PYTHON_USE_WITH// /,}]") + done + elif [[ -n "${PYTHON_USE_WITH_OR}" ]]; then + for _USE_flag in ${PYTHON_USE_WITH_OR}; do + for _PYTHON_ATOM in "${_PYTHON_ATOMS[@]}"; do + _PYTHON_USE_WITH_ATOMS_ARRAY+=("${_PYTHON_ATOM}[${_USE_flag}]") + done + done + unset _USE_flag + fi + if [[ "${#_PYTHON_USE_WITH_ATOMS_ARRAY[@]}" -gt 1 ]]; then + _PYTHON_USE_WITH_ATOMS="|| ( ${_PYTHON_USE_WITH_ATOMS_ARRAY[@]} )" + else + _PYTHON_USE_WITH_ATOMS="${_PYTHON_USE_WITH_ATOMS_ARRAY[@]}" + fi + if [[ -n "${PYTHON_USE_WITH_OPT}" ]]; then + _PYTHON_USE_WITH_ATOMS="${PYTHON_USE_WITH_OPT}? ( ${_PYTHON_USE_WITH_ATOMS} )" + fi + DEPEND+=" ${_PYTHON_USE_WITH_ATOMS}" + RDEPEND+=" ${_PYTHON_USE_WITH_ATOMS}" + unset _PYTHON_ATOM _PYTHON_USE_WITH_ATOMS _PYTHON_USE_WITH_ATOMS_ARRAY +fi + +unset _PYTHON_ATOMS + +# ================================================================================================ +# =================================== MISCELLANEOUS FUNCTIONS ==================================== +# ================================================================================================ + +_python_implementation() { + if [[ "${CATEGORY}/${PN}" == "dev-lang/python" ]]; then + return 0 + elif [[ "${CATEGORY}/${PN}" == "dev-java/jython" ]]; then + return 0 + elif [[ "${CATEGORY}/${PN}" == "dev-python/pypy" ]]; then + return 0 + else + return 1 + fi +} + +_python_abi-specific_local_scope() { + [[ " ${FUNCNAME[@]:2} " =~ " "(_python_final_sanity_checks|python_execute_function|python_mod_optimize|python_mod_cleanup)" " ]] +} + +_python_initialize_prefix_variables() { + if has "${EAPI:-0}" 0 1 2; then + if [[ -n "${ROOT}" && -z "${EROOT}" ]]; then + EROOT="${ROOT%/}${EPREFIX}/" + fi + if [[ -n "${D}" && -z "${ED}" ]]; then + ED="${D%/}${EPREFIX}/" + fi + fi +} + +unset PYTHON_SANITY_CHECKS_EXECUTED PYTHON_SKIP_SANITY_CHECKS + +_python_initial_sanity_checks() { + if [[ "$(declare -p PYTHON_SANITY_CHECKS_EXECUTED 2> /dev/null)" != "declare -- PYTHON_SANITY_CHECKS_EXECUTED="* || " ${FUNCNAME[@]:1} " =~ " "(python_set_active_version|python_pkg_setup)" " && -z "${PYTHON_SKIP_SANITY_CHECKS}" ]]; then + # Ensure that /usr/bin/python and /usr/bin/python-config are valid. + if [[ "$(readlink "${EPREFIX}/usr/bin/python")" != "python-wrapper" ]]; then + eerror "'${EPREFIX}/usr/bin/python' is not valid symlink." + eerror "Use \`eselect python set \${python_interpreter}\` to fix this problem." + die "'${EPREFIX}/usr/bin/python' is not valid symlink" + fi + if [[ "$(<"${EPREFIX}/usr/bin/python-config")" != *"Gentoo python-config wrapper script"* ]]; then + eerror "'${EPREFIX}/usr/bin/python-config' is not valid script" + eerror "Use \`eselect python set \${python_interpreter}\` to fix this problem." + die "'${EPREFIX}/usr/bin/python-config' is not valid script" + fi + fi +} + +_python_final_sanity_checks() { + if ! _python_implementation && [[ "$(declare -p PYTHON_SANITY_CHECKS_EXECUTED 2> /dev/null)" != "declare -- PYTHON_SANITY_CHECKS_EXECUTED="* || " ${FUNCNAME[@]:1} " =~ " "(python_set_active_version|python_pkg_setup)" " && -z "${PYTHON_SKIP_SANITY_CHECKS}" ]]; then + local PYTHON_ABI="${PYTHON_ABI}" + for PYTHON_ABI in ${PYTHON_ABIS-${PYTHON_ABI}}; do + # Ensure that appropriate version of Python is installed. + if ! has_version "$(python_get_implementational_package)"; then + die "$(python_get_implementational_package) is not installed" + fi + + # Ensure that EPYTHON variable is respected. + if [[ "$(EPYTHON="$(PYTHON)" python -c "${_PYTHON_ABI_EXTRACTION_COMMAND}")" != "${PYTHON_ABI}" ]]; then + eerror "Path to 'python': '$(type -p python)'" + eerror "ABI: '${ABI}'" + eerror "DEFAULT_ABI: '${DEFAULT_ABI}'" + eerror "EPYTHON: '$(PYTHON)'" + eerror "PYTHON_ABI: '${PYTHON_ABI}'" + eerror "Locally active version of Python: '$(EPYTHON="$(PYTHON)" python -c "${_PYTHON_ABI_EXTRACTION_COMMAND}")'" + die "'python' does not respect EPYTHON variable" + fi + done + fi + PYTHON_SANITY_CHECKS_EXECUTED="1" +} + +# @ECLASS-VARIABLE: PYTHON_COLORS +# @DESCRIPTION: +# User-configurable colored output. +PYTHON_COLORS="${PYTHON_COLORS:-0}" + +_python_set_color_variables() { + if [[ "${PYTHON_COLORS}" != "0" && "${NOCOLOR:-false}" =~ ^(false|no)$ ]]; then + _BOLD=$'\e[1m' + _RED=$'\e[1;31m' + _GREEN=$'\e[1;32m' + _BLUE=$'\e[1;34m' + _CYAN=$'\e[1;36m' + _NORMAL=$'\e[0m' + else + _BOLD= + _RED= + _GREEN= + _BLUE= + _CYAN= + _NORMAL= + fi +} + +_python_check_python_pkg_setup_execution() { + [[ " ${FUNCNAME[@]:1} " =~ " "(python_set_active_version|python_pkg_setup)" " ]] && return + + if ! has "${EAPI:-0}" 0 1 2 3 && [[ -z "${PYTHON_PKG_SETUP_EXECUTED}" ]]; then + die "python_pkg_setup() not called" + fi +} + +# @FUNCTION: python_pkg_setup +# @DESCRIPTION: +# Perform sanity checks and initialize environment. +# +# This function is exported in EAPI 2 and 3 when PYTHON_USE_WITH or PYTHON_USE_WITH_OR variable +# is set and always in EAPI >=4. Calling of this function is mandatory in EAPI >=4. +python_pkg_setup() { + if [[ "${EBUILD_PHASE}" != "setup" ]]; then + die "${FUNCNAME}() can be used only in pkg_setup() phase" + fi + + if [[ "$#" -ne 0 ]]; then + die "${FUNCNAME}() does not accept arguments" + fi + + export JYTHON_SYSTEM_CACHEDIR="1" + addwrite "${EPREFIX}/var/cache/jython" + + if _python_package_supporting_installation_for_multiple_python_abis; then + _python_calculate_PYTHON_ABIS + export EPYTHON="$(PYTHON -f)" + else + PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}" + fi + + if ! has "${EAPI:-0}" 0 1 && [[ -n "${PYTHON_USE_WITH}" || -n "${PYTHON_USE_WITH_OR}" ]]; then + if [[ "${PYTHON_USE_WITH_OPT}" ]]; then + if [[ "${PYTHON_USE_WITH_OPT}" == !* ]]; then + use ${PYTHON_USE_WITH_OPT#!} && return + else + use !${PYTHON_USE_WITH_OPT} && return + fi + fi + + python_pkg_setup_check_USE_flags() { + local python_atom USE_flag + python_atom="$(python_get_implementational_package)" + + for USE_flag in ${PYTHON_USE_WITH}; do + if ! has_version "${python_atom}[${USE_flag}]"; then + eerror "Please rebuild ${python_atom} with the following USE flags enabled: ${PYTHON_USE_WITH}" + die "Please rebuild ${python_atom} with the following USE flags enabled: ${PYTHON_USE_WITH}" + fi + done + + for USE_flag in ${PYTHON_USE_WITH_OR}; do + if has_version "${python_atom}[${USE_flag}]"; then + return + fi + done + + if [[ ${PYTHON_USE_WITH_OR} ]]; then + eerror "Please rebuild ${python_atom} with at least one of the following USE flags enabled: ${PYTHON_USE_WITH_OR}" + die "Please rebuild ${python_atom} with at least one of the following USE flags enabled: ${PYTHON_USE_WITH_OR}" + fi + } + + if _python_package_supporting_installation_for_multiple_python_abis; then + PYTHON_SKIP_SANITY_CHECKS="1" python_execute_function -q python_pkg_setup_check_USE_flags + else + python_pkg_setup_check_USE_flags + fi + + unset -f python_pkg_setup_check_USE_flags + fi + + PYTHON_PKG_SETUP_EXECUTED="1" +} + +if ! has "${EAPI:-0}" 0 1 2 3 || { has "${EAPI:-0}" 2 3 && [[ -n "${PYTHON_USE_WITH}" || -n "${PYTHON_USE_WITH_OR}" ]]; }; then + EXPORT_FUNCTIONS pkg_setup +fi + +_PYTHON_SHEBANG_BASE_PART_REGEX='^#![[:space:]]*([^[:space:]]*/usr/bin/env[[:space:]]+)?([^[:space:]]*/)?(jython|pypy-c|python)' + +# @FUNCTION: python_convert_shebangs +# @USAGE: [-q|--quiet] [-r|--recursive] [-x|--only-executables] [--] <Python_ABI|Python_version> <file|directory> [files|directories] +# @DESCRIPTION: +# Convert shebangs in specified files. Directories can be specified only with --recursive option. +python_convert_shebangs() { + _python_check_python_pkg_setup_execution + + local argument file files=() only_executables="0" python_interpreter quiet="0" recursive="0" shebangs_converted="0" + + while (($#)); do + case "$1" in + -r|--recursive) + recursive="1" + ;; + -q|--quiet) + quiet="1" + ;; + -x|--only-executables) + only_executables="1" + ;; + --) + shift + break + ;; + -*) + die "${FUNCNAME}(): Unrecognized option '$1'" + ;; + *) + break + ;; + esac + shift + done + + if [[ "$#" -eq 0 ]]; then + die "${FUNCNAME}(): Missing Python version and files or directories" + elif [[ "$#" -eq 1 ]]; then + die "${FUNCNAME}(): Missing files or directories" + fi + + if [[ -n "$(_python_get_implementation --ignore-invalid "$1")" ]]; then + python_interpreter="$(PYTHON "$1")" + else + python_interpreter="python$1" + fi + shift + + for argument in "$@"; do + if [[ ! -e "${argument}" ]]; then + die "${FUNCNAME}(): '${argument}' does not exist" + elif [[ -f "${argument}" ]]; then + files+=("${argument}") + elif [[ -d "${argument}" ]]; then + if [[ "${recursive}" == "1" ]]; then + while read -d $'\0' -r file; do + files+=("${file}") + done < <(find "${argument}" $([[ "${only_executables}" == "1" ]] && echo -perm /111) -type f -print0) + else + die "${FUNCNAME}(): '${argument}' is not a regular file" + fi + else + die "${FUNCNAME}(): '${argument}' is not a regular file or a directory" + fi + done + + for file in "${files[@]}"; do + file="${file#./}" + [[ "${only_executables}" == "1" && ! -x "${file}" ]] && continue + + if [[ "$(head -n1 "${file}")" =~ ${_PYTHON_SHEBANG_BASE_PART_REGEX} ]]; then + [[ "$(sed -ne "2p" "${file}")" =~ ^"# Gentoo '".*"' wrapper script generated by python_generate_wrapper_scripts()"$ ]] && continue + + shebangs_converted="1" + + if [[ "${quiet}" == "0" ]]; then + einfo "Converting shebang in '${file}'" + fi + + sed -e "1s:^#![[:space:]]*\([^[:space:]]*/usr/bin/env[[:space:]]\)\?[[:space:]]*\([^[:space:]]*/\)\?\(jython\|pypy-c\|python\)\([[:digit:]]\+\(\.[[:digit:]]\+\)\?\)\?\(\$\|[[:space:]].*\):#!\1\2${python_interpreter}\6:" -i "${file}" || die "Conversion of shebang in '${file}' failed" + fi + done + + if [[ "${shebangs_converted}" == "0" ]]; then + die "${FUNCNAME}(): Python scripts not found" + fi +} + +# @FUNCTION: python_clean_installation_image +# @USAGE: [-q|--quiet] +# @DESCRIPTION: +# Delete needless files in installation image. +# +# This function can be used only in src_install() phase. +python_clean_installation_image() { + if [[ "${EBUILD_PHASE}" != "install" ]]; then + die "${FUNCNAME}() can be used only in src_install() phase" + fi + + _python_check_python_pkg_setup_execution + _python_initialize_prefix_variables + + local file files=() quiet="0" + + while (($#)); do + case "$1" in + -q|--quiet) + quiet="1" + ;; + -*) + die "${FUNCNAME}(): Unrecognized option '$1'" + ;; + *) + die "${FUNCNAME}(): Invalid usage" + ;; + esac + shift + done + + while read -d $'\0' -r file; do + files+=("${file}") + done < <(find "${ED}" "(" -name "*.py[co]" -o -name "*\$py.class" ")" -type f -print0) + + if [[ "${#files[@]}" -gt 0 ]]; then + if [[ "${quiet}" == "0" ]]; then + ewarn "Deleting byte-compiled Python modules needlessly generated by build system:" + fi + for file in "${files[@]}"; do + if [[ "${quiet}" == "0" ]]; then + ewarn " ${file}" + fi + rm -f "${file}" + + # Delete empty __pycache__ directories. + if [[ "${file%/*}" == *"/__pycache__" ]]; then + rmdir "${file%/*}" 2> /dev/null + fi + done + fi + + python_clean_sitedirs() { + if [[ -d "${ED}$(python_get_sitedir)" ]]; then + find "${ED}$(python_get_sitedir)" "(" -name "*.c" -o -name "*.h" -o -name "*.la" ")" -type f -print0 | xargs -0 rm -f + fi + } + if _python_package_supporting_installation_for_multiple_python_abis; then + python_execute_function -q python_clean_sitedirs + else + python_clean_sitedirs + fi + + unset -f python_clean_sitedirs +} + +# ================================================================================================ +# =========== FUNCTIONS FOR PACKAGES SUPPORTING INSTALLATION FOR MULTIPLE PYTHON ABIS ============ +# ================================================================================================ + +# @ECLASS-VARIABLE: SUPPORT_PYTHON_ABIS +# @DESCRIPTION: +# Set this in EAPI <= 4 to indicate that current package supports installation for +# multiple Python ABIs. + +# @ECLASS-VARIABLE: PYTHON_TESTS_RESTRICTED_ABIS +# @DESCRIPTION: +# Space-separated list of Python ABI patterns. Testing in Python ABIs matching any Python ABI +# patterns specified in this list is skipped. + +# @ECLASS-VARIABLE: PYTHON_EXPORT_PHASE_FUNCTIONS +# @DESCRIPTION: +# Set this to export phase functions for the following ebuild phases: +# src_prepare(), src_configure(), src_compile(), src_test(), src_install(). +if ! has "${EAPI:-0}" 0 1; then + python_src_prepare() { + if [[ "${EBUILD_PHASE}" != "prepare" ]]; then + die "${FUNCNAME}() can be used only in src_prepare() phase" + fi + + if ! _python_package_supporting_installation_for_multiple_python_abis; then + die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs" + fi + + _python_check_python_pkg_setup_execution + + if [[ "$#" -ne 0 ]]; then + die "${FUNCNAME}() does not accept arguments" + fi + + python_copy_sources + } + + for python_default_function in src_configure src_compile src_test; do + eval "python_${python_default_function}() { + if [[ \"\${EBUILD_PHASE}\" != \"${python_default_function#src_}\" ]]; then + die \"\${FUNCNAME}() can be used only in ${python_default_function}() phase\" + fi + + if ! _python_package_supporting_installation_for_multiple_python_abis; then + die \"\${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs\" + fi + + _python_check_python_pkg_setup_execution + + python_execute_function -d -s -- \"\$@\" + }" + done + unset python_default_function + + python_src_install() { + if [[ "${EBUILD_PHASE}" != "install" ]]; then + die "${FUNCNAME}() can be used only in src_install() phase" + fi + + if ! _python_package_supporting_installation_for_multiple_python_abis; then + die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs" + fi + + _python_check_python_pkg_setup_execution + + if has "${EAPI:-0}" 0 1 2 3; then + python_execute_function -d -s -- "$@" + else + python_installation() { + emake DESTDIR="${T}/images/${PYTHON_ABI}" install "$@" + } + python_execute_function -s python_installation "$@" + unset python_installation + + python_merge_intermediate_installation_images "${T}/images" + fi + } + + if [[ -n "${PYTHON_EXPORT_PHASE_FUNCTIONS}" ]]; then + EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install + fi +fi + +if has "${EAPI:-0}" 0 1 2 3 4; then + unset PYTHON_ABIS +fi + +_python_calculate_PYTHON_ABIS() { + if ! _python_package_supporting_installation_for_multiple_python_abis; then + die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs" + fi + + _python_initial_sanity_checks + + if [[ "$(declare -p PYTHON_ABIS 2> /dev/null)" != "declare -x PYTHON_ABIS="* ]] && has "${EAPI:-0}" 0 1 2 3 4; then + local PYTHON_ABI + + if [[ "$(declare -p USE_PYTHON 2> /dev/null)" == "declare -x USE_PYTHON="* ]]; then + local cpython_enabled="0" + + if [[ -z "${USE_PYTHON}" ]]; then + die "USE_PYTHON variable is empty" + fi + + for PYTHON_ABI in ${USE_PYTHON}; do + if ! has "${PYTHON_ABI}" "${_PYTHON_GLOBALLY_SUPPORTED_ABIS[@]}"; then + die "USE_PYTHON variable contains invalid value '${PYTHON_ABI}'" + fi + + if has "${PYTHON_ABI}" "${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}" "${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}"; then + cpython_enabled="1" + fi + + if ! _python_check_python_abi_matching --patterns-list "${PYTHON_ABI}" "${RESTRICT_PYTHON_ABIS}"; then + export PYTHON_ABIS+="${PYTHON_ABIS:+ }${PYTHON_ABI}" + fi + done + + if [[ -z "${PYTHON_ABIS//[${IFS}]/}" ]]; then + die "USE_PYTHON variable does not enable any Python ABI supported by ${CATEGORY}/${PF}" + fi + + if [[ "${cpython_enabled}" == "0" ]]; then + die "USE_PYTHON variable does not enable any CPython ABI" + fi + else + local python_version python2_version python3_version support_python_major_version + + if ! has_version "dev-lang/python"; then + die "${FUNCNAME}(): 'dev-lang/python' is not installed" + fi + + python_version="$("${EPREFIX}/usr/bin/python" -c 'from sys import version_info; print(".".join(str(x) for x in version_info[:2]))')" + + if has_version "=dev-lang/python-2*"; then + if [[ "$(readlink "${EPREFIX}/usr/bin/python2")" != "python2."* ]]; then + die "'${EPREFIX}/usr/bin/python2' is not valid symlink" + fi + + python2_version="$("${EPREFIX}/usr/bin/python2" -c 'from sys import version_info; print(".".join(str(x) for x in version_info[:2]))')" + + support_python_major_version="0" + for PYTHON_ABI in "${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}"; do + if ! _python_check_python_abi_matching --patterns-list "${PYTHON_ABI}" "${RESTRICT_PYTHON_ABIS}"; then + support_python_major_version="1" + break + fi + done + if [[ "${support_python_major_version}" == "1" ]]; then + if _python_check_python_abi_matching --patterns-list "${python2_version}" "${RESTRICT_PYTHON_ABIS}"; then + die "Active version of CPython 2 is not supported by ${CATEGORY}/${PF}" + fi + else + python2_version="" + fi + fi + + if has_version "=dev-lang/python-3*"; then + if [[ "$(readlink "${EPREFIX}/usr/bin/python3")" != "python3."* ]]; then + die "'${EPREFIX}/usr/bin/python3' is not valid symlink" + fi + + python3_version="$("${EPREFIX}/usr/bin/python3" -c 'from sys import version_info; print(".".join(str(x) for x in version_info[:2]))')" + + support_python_major_version="0" + for PYTHON_ABI in "${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}"; do + if ! _python_check_python_abi_matching --patterns-list "${PYTHON_ABI}" "${RESTRICT_PYTHON_ABIS}"; then + support_python_major_version="1" + break + fi + done + if [[ "${support_python_major_version}" == "1" ]]; then + if _python_check_python_abi_matching --patterns-list "${python3_version}" "${RESTRICT_PYTHON_ABIS}"; then + die "Active version of CPython 3 is not supported by ${CATEGORY}/${PF}" + fi + else + python3_version="" + fi + fi + + if [[ -n "${python2_version}" && "${python_version}" == "2."* && "${python_version}" != "${python2_version}" ]]; then + eerror "Python wrapper is configured incorrectly or '${EPREFIX}/usr/bin/python2' symlink" + eerror "is set incorrectly. Use \`eselect python\` to fix configuration." + die "Incorrect configuration of Python" + fi + if [[ -n "${python3_version}" && "${python_version}" == "3."* && "${python_version}" != "${python3_version}" ]]; then + eerror "Python wrapper is configured incorrectly or '${EPREFIX}/usr/bin/python3' symlink" + eerror "is set incorrectly. Use \`eselect python\` to fix configuration." + die "Incorrect configuration of Python" + fi + + PYTHON_ABIS="${python2_version} ${python3_version}" + PYTHON_ABIS="${PYTHON_ABIS# }" + export PYTHON_ABIS="${PYTHON_ABIS% }" + fi + fi + + _python_final_sanity_checks +} + +_python_prepare_flags() { + local array=() deleted_flag element flags new_value old_flag old_value operator pattern prefix variable + + for variable in CPPFLAGS CFLAGS CXXFLAGS LDFLAGS; do + eval "_PYTHON_SAVED_${variable}=\"\${!variable}\"" + for prefix in PYTHON_USER_ PYTHON_; do + if [[ "$(declare -p ${prefix}${variable} 2> /dev/null)" == "declare -a ${prefix}${variable}="* ]]; then + eval "array=(\"\${${prefix}${variable}[@]}\")" + for element in "${array[@]}"; do + if [[ "${element}" =~ ^${_PYTHON_ABI_PATTERN_REGEX}\ (\+|-)\ .+ ]]; then + pattern="${element%% *}" + element="${element#* }" + operator="${element%% *}" + flags="${element#* }" + if _python_check_python_abi_matching "${PYTHON_ABI}" "${pattern}"; then + if [[ "${operator}" == "+" ]]; then + eval "export ${variable}+=\"\${variable:+ }${flags}\"" + elif [[ "${operator}" == "-" ]]; then + flags="${flags// /$'\n'}" + old_value="${!variable// /$'\n'}" + new_value="" + while read old_flag; do + while read deleted_flag; do + if [[ "${old_flag}" == ${deleted_flag} ]]; then + continue 2 + fi + done <<< "${flags}" + new_value+="${new_value:+ }${old_flag}" + done <<< "${old_value}" + eval "export ${variable}=\"\${new_value}\"" + fi + fi + else + die "Element '${element}' of ${prefix}${variable} array has invalid syntax" + fi + done + elif [[ -n "$(declare -p ${prefix}${variable} 2> /dev/null)" ]]; then + die "${prefix}${variable} should be indexed array" + fi + done + done +} + +_python_restore_flags() { + local variable + + for variable in CPPFLAGS CFLAGS CXXFLAGS LDFLAGS; do + eval "${variable}=\"\${_PYTHON_SAVED_${variable}}\"" + unset _PYTHON_SAVED_${variable} + done +} + +# @FUNCTION: python_execute_function +# @USAGE: [--action-message message] [-d|--default-function] [--failure-message message] [-f|--final-ABI] [--nonfatal] [-q|--quiet] [-s|--separate-build-dirs] [--source-dir source_directory] [--] <function> [arguments] +# @DESCRIPTION: +# Execute specified function for each value of PYTHON_ABIS, optionally passing additional +# arguments. The specified function can use PYTHON_ABI and BUILDDIR variables. +python_execute_function() { + if ! _python_package_supporting_installation_for_multiple_python_abis; then + die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs" + fi + + _python_check_python_pkg_setup_execution + _python_set_color_variables + + local action action_message action_message_template default_function="0" failure_message failure_message_template final_ABI="0" function iterated_PYTHON_ABIS nonfatal="0" previous_directory previous_directory_stack previous_directory_stack_length PYTHON_ABI quiet="0" return_code separate_build_dirs="0" source_dir + + while (($#)); do + case "$1" in + --action-message) + action_message_template="$2" + shift + ;; + -d|--default-function) + default_function="1" + ;; + --failure-message) + failure_message_template="$2" + shift + ;; + -f|--final-ABI) + final_ABI="1" + ;; + --nonfatal) + nonfatal="1" + ;; + -q|--quiet) + quiet="1" + ;; + -s|--separate-build-dirs) + separate_build_dirs="1" + ;; + --source-dir) + source_dir="$2" + shift + ;; + --) + shift + break + ;; + -*) + die "${FUNCNAME}(): Unrecognized option '$1'" + ;; + *) + break + ;; + esac + shift + done + + if [[ -n "${source_dir}" && "${separate_build_dirs}" == 0 ]]; then + die "${FUNCNAME}(): '--source-dir' option can be specified only with '--separate-build-dirs' option" + fi + + if [[ "${default_function}" == "0" ]]; then + if [[ "$#" -eq 0 ]]; then + die "${FUNCNAME}(): Missing function name" + fi + function="$1" + shift + + if [[ -z "$(type -t "${function}")" ]]; then + die "${FUNCNAME}(): '${function}' function is not defined" + fi + else + if has "${EAPI:-0}" 0 1; then + die "${FUNCNAME}(): '--default-function' option cannot be used in this EAPI" + fi + + if [[ "${EBUILD_PHASE}" == "configure" ]]; then + if has "${EAPI}" 2 3; then + python_default_function() { + econf "$@" + } + else + python_default_function() { + nonfatal econf "$@" + } + fi + elif [[ "${EBUILD_PHASE}" == "compile" ]]; then + python_default_function() { + emake "$@" + } + elif [[ "${EBUILD_PHASE}" == "test" ]]; then + python_default_function() { + if emake -j1 -n check &> /dev/null; then + emake -j1 check "$@" + elif emake -j1 -n test &> /dev/null; then + emake -j1 test "$@" + fi + } + elif [[ "${EBUILD_PHASE}" == "install" ]]; then + python_default_function() { + emake DESTDIR="${D}" install "$@" + } + else + die "${FUNCNAME}(): '--default-function' option cannot be used in this ebuild phase" + fi + function="python_default_function" + fi + + # Ensure that python_execute_function() cannot be directly or indirectly called by python_execute_function(). + if _python_abi-specific_local_scope; then + die "${FUNCNAME}(): Invalid call stack" + fi + + if [[ "${quiet}" == "0" ]]; then + [[ "${EBUILD_PHASE}" == "setup" ]] && action="Setting up" + [[ "${EBUILD_PHASE}" == "unpack" ]] && action="Unpacking" + [[ "${EBUILD_PHASE}" == "prepare" ]] && action="Preparation" + [[ "${EBUILD_PHASE}" == "configure" ]] && action="Configuration" + [[ "${EBUILD_PHASE}" == "compile" ]] && action="Building" + [[ "${EBUILD_PHASE}" == "test" ]] && action="Testing" + [[ "${EBUILD_PHASE}" == "install" ]] && action="Installation" + [[ "${EBUILD_PHASE}" == "preinst" ]] && action="Preinstallation" + [[ "${EBUILD_PHASE}" == "postinst" ]] && action="Postinstallation" + [[ "${EBUILD_PHASE}" == "prerm" ]] && action="Preuninstallation" + [[ "${EBUILD_PHASE}" == "postrm" ]] && action="Postuninstallation" + fi + + _python_calculate_PYTHON_ABIS + if [[ "${final_ABI}" == "1" ]]; then + iterated_PYTHON_ABIS="$(PYTHON -f --ABI)" + else + iterated_PYTHON_ABIS="${PYTHON_ABIS}" + fi + for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do + if [[ "${EBUILD_PHASE}" == "test" ]] && _python_check_python_abi_matching --patterns-list "${PYTHON_ABI}" "${PYTHON_TESTS_RESTRICTED_ABIS}"; then + if [[ "${quiet}" == "0" ]]; then + echo " ${_GREEN}*${_NORMAL} ${_BLUE}Testing of ${CATEGORY}/${PF} with $(python_get_implementation_and_version) skipped${_NORMAL}" + fi + continue + fi + + _python_prepare_flags + + if [[ "${quiet}" == "0" ]]; then + if [[ -n "${action_message_template}" ]]; then + eval "action_message=\"${action_message_template}\"" + else + action_message="${action} of ${CATEGORY}/${PF} with $(python_get_implementation_and_version)..." + fi + echo " ${_GREEN}*${_NORMAL} ${_BLUE}${action_message}${_NORMAL}" + fi + + if [[ "${separate_build_dirs}" == "1" ]]; then + if [[ -n "${source_dir}" ]]; then + export BUILDDIR="${S}/${source_dir}-${PYTHON_ABI}" + else + export BUILDDIR="${S}-${PYTHON_ABI}" + fi + pushd "${BUILDDIR}" > /dev/null || die "pushd failed" + else + export BUILDDIR="${S}" + fi + + previous_directory="$(pwd)" + previous_directory_stack="$(dirs -p)" + previous_directory_stack_length="$(dirs -p | wc -l)" + + if ! has "${EAPI}" 0 1 2 3 && has "${PYTHON_ABI}" ${FAILURE_TOLERANT_PYTHON_ABIS}; then + EPYTHON="$(PYTHON)" nonfatal "${function}" "$@" + else + EPYTHON="$(PYTHON)" "${function}" "$@" + fi + + return_code="$?" + + _python_restore_flags + + if [[ "${return_code}" -ne 0 ]]; then + if [[ -n "${failure_message_template}" ]]; then + eval "failure_message=\"${failure_message_template}\"" + else + failure_message="${action} failed with $(python_get_implementation_and_version) in ${function}() function" + fi + + if [[ "${nonfatal}" == "1" ]]; then + if [[ "${quiet}" == "0" ]]; then + ewarn "${failure_message}" + fi + elif [[ "${final_ABI}" == "0" ]] && has "${PYTHON_ABI}" ${FAILURE_TOLERANT_PYTHON_ABIS}; then + if [[ "${EBUILD_PHASE}" != "test" ]] || ! has test-fail-continue ${FEATURES}; then + local enabled_PYTHON_ABIS= other_PYTHON_ABI + for other_PYTHON_ABI in ${PYTHON_ABIS}; do + [[ "${other_PYTHON_ABI}" != "${PYTHON_ABI}" ]] && enabled_PYTHON_ABIS+="${enabled_PYTHON_ABIS:+ }${other_PYTHON_ABI}" + done + export PYTHON_ABIS="${enabled_PYTHON_ABIS}" + fi + if [[ "${quiet}" == "0" ]]; then + ewarn "${failure_message}" + fi + if [[ -z "${PYTHON_ABIS}" ]]; then + die "${function}() function failed with all enabled Python ABIs" + fi + else + die "${failure_message}" + fi + fi + + # Ensure that directory stack has not been decreased. + if [[ "$(dirs -p | wc -l)" -lt "${previous_directory_stack_length}" ]]; then + die "Directory stack decreased illegally" + fi + + # Avoid side effects of earlier returning from the specified function. + while [[ "$(dirs -p | wc -l)" -gt "${previous_directory_stack_length}" ]]; do + popd > /dev/null || die "popd failed" + done + + # Ensure that the bottom part of directory stack has not been changed. Restore + # previous directory (from before running of the specified function) before + # comparison of directory stacks to avoid mismatch of directory stacks after + # potential using of 'cd' to change current directory. Restoration of previous + # directory allows to safely use 'cd' to change current directory in the + # specified function without changing it back to original directory. + cd "${previous_directory}" + if [[ "$(dirs -p)" != "${previous_directory_stack}" ]]; then + die "Directory stack changed illegally" + fi + + if [[ "${separate_build_dirs}" == "1" ]]; then + popd > /dev/null || die "popd failed" + fi + unset BUILDDIR + done + + if [[ "${default_function}" == "1" ]]; then + unset -f python_default_function + fi +} + +# @FUNCTION: python_copy_sources +# @USAGE: <directory="${S}"> [directory] +# @DESCRIPTION: +# Copy unpacked sources of current package to separate build directory for each Python ABI. +python_copy_sources() { + if ! _python_package_supporting_installation_for_multiple_python_abis; then + die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs" + fi + + _python_check_python_pkg_setup_execution + + local dir dirs=() PYTHON_ABI + + if [[ "$#" -eq 0 ]]; then + if [[ "${WORKDIR}" == "${S}" ]]; then + die "${FUNCNAME}() cannot be used with current value of S variable" + fi + dirs=("${S%/}") + else + dirs=("$@") + fi + + _python_calculate_PYTHON_ABIS + for PYTHON_ABI in ${PYTHON_ABIS}; do + for dir in "${dirs[@]}"; do + cp -pr "${dir}" "${dir}-${PYTHON_ABI}" > /dev/null || die "Copying of sources failed" + done + done +} + +# @FUNCTION: python_generate_wrapper_scripts +# @USAGE: [-E|--respect-EPYTHON] [-f|--force] [-q|--quiet] [--] <file> [files] +# @DESCRIPTION: +# Generate wrapper scripts. Existing files are overwritten only with --force option. +# If --respect-EPYTHON option is specified, then generated wrapper scripts will +# respect EPYTHON variable at run time. +# +# This function can be used only in src_install() phase. +python_generate_wrapper_scripts() { + if [[ "${EBUILD_PHASE}" != "install" ]]; then + die "${FUNCNAME}() can be used only in src_install() phase" + fi + + if ! _python_package_supporting_installation_for_multiple_python_abis; then + die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs" + fi + + _python_check_python_pkg_setup_execution + _python_initialize_prefix_variables + + local eselect_python_option file force="0" quiet="0" PYTHON_ABI PYTHON_ABIS_list python2_enabled="0" python3_enabled="0" respect_EPYTHON="0" + + while (($#)); do + case "$1" in + -E|--respect-EPYTHON) + respect_EPYTHON="1" + ;; + -f|--force) + force="1" + ;; + -q|--quiet) + quiet="1" + ;; + --) + shift + break + ;; + -*) + die "${FUNCNAME}(): Unrecognized option '$1'" + ;; + *) + break + ;; + esac + shift + done + + if [[ "$#" -eq 0 ]]; then + die "${FUNCNAME}(): Missing arguments" + fi + + _python_calculate_PYTHON_ABIS + for PYTHON_ABI in "${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}"; do + if has "${PYTHON_ABI}" ${PYTHON_ABIS}; then + python2_enabled="1" + fi + done + for PYTHON_ABI in "${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}"; do + if has "${PYTHON_ABI}" ${PYTHON_ABIS}; then + python3_enabled="1" + fi + done + + if [[ "${python2_enabled}" == "1" && "${python3_enabled}" == "1" ]]; then + eselect_python_option= + elif [[ "${python2_enabled}" == "1" && "${python3_enabled}" == "0" ]]; then + eselect_python_option="--python2" + elif [[ "${python2_enabled}" == "0" && "${python3_enabled}" == "1" ]]; then + eselect_python_option="--python3" + else + die "${FUNCNAME}(): Unsupported environment" + fi + + PYTHON_ABIS_list="$("$(PYTHON -f)" -c "print(', '.join('\"%s\"' % x for x in reversed('${PYTHON_ABIS}'.split())))")" + + for file in "$@"; do + if [[ -f "${file}" && "${force}" == "0" ]]; then + die "${FUNCNAME}(): '${file}' already exists" + fi + + if [[ "${quiet}" == "0" ]]; then + einfo "Generating '${file#${ED%/}}' wrapper script" + fi + + cat << EOF > "${file}" +#!/usr/bin/env python +# Gentoo '${file##*/}' wrapper script generated by python_generate_wrapper_scripts() + +import os +import re +import subprocess +import sys + +cpython_ABI_re = re.compile(r"^(\d+\.\d+)$") +jython_ABI_re = re.compile(r"^(\d+\.\d+)-jython$") +pypy_ABI_re = re.compile(r"^\d+\.\d+-pypy-(\d+\.\d+)$") +cpython_interpreter_re = re.compile(r"^python(\d+\.\d+)$") +jython_interpreter_re = re.compile(r"^jython(\d+\.\d+)$") +pypy_interpreter_re = re.compile(r"^pypy-c(\d+\.\d+)$") +cpython_shebang_re = re.compile(r"^#![ \t]*(?:${EPREFIX}/usr/bin/python|(?:${EPREFIX})?/usr/bin/env[ \t]+(?:${EPREFIX}/usr/bin/)?python)") +python_shebang_options_re = re.compile(r"^#![ \t]*${EPREFIX}/usr/bin/(?:jython|pypy-c|python)(?:\d+(?:\.\d+)?)?[ \t]+(-\S)") +python_verification_output_re = re.compile("^GENTOO_PYTHON_TARGET_SCRIPT_PATH supported\n$") + +pypy_versions_mapping = { + "1.5": "2.7" +} + +def get_PYTHON_ABI(python_interpreter): + cpython_matched = cpython_interpreter_re.match(python_interpreter) + jython_matched = jython_interpreter_re.match(python_interpreter) + pypy_matched = pypy_interpreter_re.match(python_interpreter) + if cpython_matched is not None: + PYTHON_ABI = cpython_matched.group(1) + elif jython_matched is not None: + PYTHON_ABI = jython_matched.group(1) + "-jython" + elif pypy_matched is not None: + PYTHON_ABI = pypy_versions_mapping[pypy_matched.group(1)] + "-pypy-" + pypy_matched.group(1) + else: + PYTHON_ABI = None + return PYTHON_ABI + +def get_python_interpreter(PYTHON_ABI): + cpython_matched = cpython_ABI_re.match(PYTHON_ABI) + jython_matched = jython_ABI_re.match(PYTHON_ABI) + pypy_matched = pypy_ABI_re.match(PYTHON_ABI) + if cpython_matched is not None: + python_interpreter = "python" + cpython_matched.group(1) + elif jython_matched is not None: + python_interpreter = "jython" + jython_matched.group(1) + elif pypy_matched is not None: + python_interpreter = "pypy-c" + pypy_matched.group(1) + else: + python_interpreter = None + return python_interpreter + +EOF + if [[ "$?" != "0" ]]; then + die "${FUNCNAME}(): Generation of '$1' failed" + fi + if [[ "${respect_EPYTHON}" == "1" ]]; then + cat << EOF >> "${file}" +python_interpreter = os.environ.get("EPYTHON") +if python_interpreter: + PYTHON_ABI = get_PYTHON_ABI(python_interpreter) + if PYTHON_ABI is None: + sys.stderr.write("%s: EPYTHON variable has unrecognized value '%s'\n" % (sys.argv[0], python_interpreter)) + sys.exit(1) +else: + try: + environment = os.environ.copy() + environment["ROOT"] = "/" + eselect_process = subprocess.Popen(["${EPREFIX}/usr/bin/eselect", "python", "show"${eselect_python_option:+, $(echo "\"")}${eselect_python_option}${eselect_python_option:+$(echo "\"")}], env=environment, stdout=subprocess.PIPE) + if eselect_process.wait() != 0: + raise ValueError + except (OSError, ValueError): + sys.stderr.write("%s: Execution of 'eselect python show${eselect_python_option:+ }${eselect_python_option}' failed\n" % sys.argv[0]) + sys.exit(1) + + python_interpreter = eselect_process.stdout.read() + if not isinstance(python_interpreter, str): + # Python 3 + python_interpreter = python_interpreter.decode() + python_interpreter = python_interpreter.rstrip("\n") + + PYTHON_ABI = get_PYTHON_ABI(python_interpreter) + if PYTHON_ABI is None: + sys.stderr.write("%s: 'eselect python show${eselect_python_option:+ }${eselect_python_option}' printed unrecognized value '%s'\n" % (sys.argv[0], python_interpreter)) + sys.exit(1) + +wrapper_script_path = os.path.realpath(sys.argv[0]) +target_executable_path = "%s-%s" % (wrapper_script_path, PYTHON_ABI) +if not os.path.exists(target_executable_path): + sys.stderr.write("%s: '%s' does not exist\n" % (sys.argv[0], target_executable_path)) + sys.exit(1) +EOF + if [[ "$?" != "0" ]]; then + die "${FUNCNAME}(): Generation of '$1' failed" + fi + else + cat << EOF >> "${file}" +try: + environment = os.environ.copy() + environment["ROOT"] = "/" + eselect_process = subprocess.Popen(["${EPREFIX}/usr/bin/eselect", "python", "show"${eselect_python_option:+, $(echo "\"")}${eselect_python_option}${eselect_python_option:+$(echo "\"")}], env=environment, stdout=subprocess.PIPE) + if eselect_process.wait() != 0: + raise ValueError +except (OSError, ValueError): + sys.stderr.write("%s: Execution of 'eselect python show${eselect_python_option:+ }${eselect_python_option}' failed\n" % sys.argv[0]) + sys.exit(1) + +python_interpreter = eselect_process.stdout.read() +if not isinstance(python_interpreter, str): + # Python 3 + python_interpreter = python_interpreter.decode() +python_interpreter = python_interpreter.rstrip("\n") + +PYTHON_ABI = get_PYTHON_ABI(python_interpreter) +if PYTHON_ABI is None: + sys.stderr.write("%s: 'eselect python show${eselect_python_option:+ }${eselect_python_option}' printed unrecognized value '%s'\n" % (sys.argv[0], python_interpreter)) + sys.exit(1) + +wrapper_script_path = os.path.realpath(sys.argv[0]) +for PYTHON_ABI in [PYTHON_ABI, ${PYTHON_ABIS_list}]: + target_executable_path = "%s-%s" % (wrapper_script_path, PYTHON_ABI) + if os.path.exists(target_executable_path): + break +else: + sys.stderr.write("%s: No target script exists for '%s'\n" % (sys.argv[0], wrapper_script_path)) + sys.exit(1) + +python_interpreter = get_python_interpreter(PYTHON_ABI) +if python_interpreter is None: + sys.stderr.write("%s: Unrecognized Python ABI '%s'\n" % (sys.argv[0], PYTHON_ABI)) + sys.exit(1) +EOF + if [[ "$?" != "0" ]]; then + die "${FUNCNAME}(): Generation of '$1' failed" + fi + fi + cat << EOF >> "${file}" + +target_executable = open(target_executable_path, "rb") +target_executable_first_line = target_executable.readline() +target_executable.close() +if not isinstance(target_executable_first_line, str): + # Python 3 + target_executable_first_line = target_executable_first_line.decode("utf_8", "replace") + +options = [] +python_shebang_options_matched = python_shebang_options_re.match(target_executable_first_line) +if python_shebang_options_matched is not None: + options = [python_shebang_options_matched.group(1)] + +cpython_shebang_matched = cpython_shebang_re.match(target_executable_first_line) + +if cpython_shebang_matched is not None: + try: + python_interpreter_path = "${EPREFIX}/usr/bin/%s" % python_interpreter + os.environ["GENTOO_PYTHON_TARGET_SCRIPT_PATH_VERIFICATION"] = "1" + python_verification_process = subprocess.Popen([python_interpreter_path, "-c", "pass"], stdout=subprocess.PIPE) + del os.environ["GENTOO_PYTHON_TARGET_SCRIPT_PATH_VERIFICATION"] + if python_verification_process.wait() != 0: + raise ValueError + + python_verification_output = python_verification_process.stdout.read() + if not isinstance(python_verification_output, str): + # Python 3 + python_verification_output = python_verification_output.decode() + + if not python_verification_output_re.match(python_verification_output): + raise ValueError + + if cpython_interpreter_re.match(python_interpreter) is not None: + os.environ["GENTOO_PYTHON_PROCESS_NAME"] = os.path.basename(sys.argv[0]) + os.environ["GENTOO_PYTHON_WRAPPER_SCRIPT_PATH"] = sys.argv[0] + os.environ["GENTOO_PYTHON_TARGET_SCRIPT_PATH"] = target_executable_path + + if hasattr(os, "execv"): + os.execv(python_interpreter_path, [python_interpreter_path] + options + sys.argv) + else: + sys.exit(subprocess.Popen([python_interpreter_path] + options + sys.argv).wait()) + except (KeyboardInterrupt, SystemExit): + raise + except: + pass + for variable in ("GENTOO_PYTHON_PROCESS_NAME", "GENTOO_PYTHON_WRAPPER_SCRIPT_PATH", "GENTOO_PYTHON_TARGET_SCRIPT_PATH", "GENTOO_PYTHON_TARGET_SCRIPT_PATH_VERIFICATION"): + if variable in os.environ: + del os.environ[variable] + +if hasattr(os, "execv"): + os.execv(target_executable_path, sys.argv) +else: + sys.exit(subprocess.Popen([target_executable_path] + sys.argv[1:]).wait()) +EOF + if [[ "$?" != "0" ]]; then + die "${FUNCNAME}(): Generation of '$1' failed" + fi + fperms +x "${file#${ED%/}}" || die "fperms '${file}' failed" + done +} + +# @ECLASS-VARIABLE: PYTHON_VERSIONED_SCRIPTS +# @DESCRIPTION: +# Array of regular expressions of paths to versioned Python scripts. +# Python scripts in /usr/bin and /usr/sbin are versioned by default. + +# @ECLASS-VARIABLE: PYTHON_VERSIONED_EXECUTABLES +# @DESCRIPTION: +# Array of regular expressions of paths to versioned executables (including Python scripts). + +# @ECLASS-VARIABLE: PYTHON_NONVERSIONED_EXECUTABLES +# @DESCRIPTION: +# Array of regular expressions of paths to nonversioned executables (including Python scripts). + +# @FUNCTION: python_merge_intermediate_installation_images +# @USAGE: [-q|--quiet] [--] <intermediate_installation_images_directory> +# @DESCRIPTION: +# Merge intermediate installation images into installation image. +# +# This function can be used only in src_install() phase. +python_merge_intermediate_installation_images() { + if [[ "${EBUILD_PHASE}" != "install" ]]; then + die "${FUNCNAME}() can be used only in src_install() phase" + fi + + if ! _python_package_supporting_installation_for_multiple_python_abis; then + die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs" + fi + + _python_check_python_pkg_setup_execution + _python_initialize_prefix_variables + + local absolute_file b file files=() intermediate_installation_images_directory PYTHON_ABI quiet="0" regex shebang version_executable wrapper_scripts=() wrapper_scripts_set=() + + while (($#)); do + case "$1" in + -q|--quiet) + quiet="1" + ;; + --) + shift + break + ;; + -*) + die "${FUNCNAME}(): Unrecognized option '$1'" + ;; + *) + break + ;; + esac + shift + done + + if [[ "$#" -ne 1 ]]; then + die "${FUNCNAME}() requires 1 argument" + fi + + intermediate_installation_images_directory="$1" + + if [[ ! -d "${intermediate_installation_images_directory}" ]]; then + die "${FUNCNAME}(): Intermediate installation images directory '${intermediate_installation_images_directory}' does not exist" + fi + + _python_calculate_PYTHON_ABIS + if [[ "$(PYTHON -f --ABI)" == 3.* ]]; then + b="b" + fi + + while read -d $'\0' -r file; do + files+=("${file}") + done < <("$(PYTHON -f)" -c \ +"import os +import sys + +if hasattr(sys.stdout, 'buffer'): + # Python 3 + stdout = sys.stdout.buffer +else: + # Python 2 + stdout = sys.stdout + +files_set = set() + +os.chdir(${b}'${intermediate_installation_images_directory}') + +for PYTHON_ABI in ${b}'${PYTHON_ABIS}'.split(): + for root, dirs, files in os.walk(PYTHON_ABI + ${b}'${EPREFIX}'): + root = root[len(PYTHON_ABI + ${b}'${EPREFIX}')+1:] + files_set.update(root + ${b}'/' + file for file in files) + +for file in sorted(files_set): + stdout.write(file) + stdout.write(${b}'\x00')" || die "${FUNCNAME}(): Failure of extraction of files in intermediate installation images") + + for PYTHON_ABI in ${PYTHON_ABIS}; do + if [[ ! -d "${intermediate_installation_images_directory}/${PYTHON_ABI}" ]]; then + die "${FUNCNAME}(): Intermediate installation image for Python ABI '${PYTHON_ABI}' does not exist" + fi + + pushd "${intermediate_installation_images_directory}/${PYTHON_ABI}${EPREFIX}" > /dev/null || die "pushd failed" + + for file in "${files[@]}"; do + version_executable="0" + for regex in "/usr/bin/.*" "/usr/sbin/.*" "${PYTHON_VERSIONED_SCRIPTS[@]}"; do + if [[ "/${file}" =~ ^${regex}$ ]]; then + version_executable="1" + break + fi + done + for regex in "${PYTHON_VERSIONED_EXECUTABLES[@]}"; do + if [[ "/${file}" =~ ^${regex}$ ]]; then + version_executable="2" + break + fi + done + if [[ "${version_executable}" != "0" ]]; then + for regex in "${PYTHON_NONVERSIONED_EXECUTABLES[@]}"; do + if [[ "/${file}" =~ ^${regex}$ ]]; then + version_executable="0" + break + fi + done + fi + + [[ "${version_executable}" == "0" ]] && continue + + if [[ -L "${file}" ]]; then + absolute_file="$(readlink "${file}")" + if [[ "${absolute_file}" == /* ]]; then + absolute_file="${intermediate_installation_images_directory}/${PYTHON_ABI}${EPREFIX}/${absolute_file##/}" + else + if [[ "${file}" == */* ]]; then + absolute_file="${intermediate_installation_images_directory}/${PYTHON_ABI}${EPREFIX}/${file%/*}/${absolute_file}" + else + absolute_file="${intermediate_installation_images_directory}/${PYTHON_ABI}${EPREFIX}/${absolute_file}" + fi + fi + else + absolute_file="${intermediate_installation_images_directory}/${PYTHON_ABI}${EPREFIX}/${file}" + fi + + [[ ! -x "${absolute_file}" ]] && continue + + shebang="$(head -n1 "${absolute_file}")" || die "Extraction of shebang from '${absolute_file}' failed" + + if [[ "${version_executable}" == "2" ]]; then + wrapper_scripts+=("${ED}${file}") + elif [[ "${version_executable}" == "1" ]]; then + if [[ "${shebang}" =~ ${_PYTHON_SHEBANG_BASE_PART_REGEX}([[:digit:]]+(\.[[:digit:]]+)?)?($|[[:space:]]+) ]]; then + wrapper_scripts+=("${ED}${file}") + else + version_executable="0" + fi + fi + + [[ "${version_executable}" == "0" ]] && continue + + if [[ -e "${file}-${PYTHON_ABI}" ]]; then + die "${FUNCNAME}(): '${EPREFIX}/${file}-${PYTHON_ABI}' already exists" + fi + + mv "${file}" "${file}-${PYTHON_ABI}" || die "Renaming of '${file}' failed" + + if [[ "${shebang}" =~ ${_PYTHON_SHEBANG_BASE_PART_REGEX}[[:digit:]]*($|[[:space:]]+) ]]; then + if [[ -L "${file}-${PYTHON_ABI}" ]]; then + python_convert_shebangs $([[ "${quiet}" == "1" ]] && echo --quiet) "${PYTHON_ABI}" "${absolute_file}" + else + python_convert_shebangs $([[ "${quiet}" == "1" ]] && echo --quiet) "${PYTHON_ABI}" "${file}-${PYTHON_ABI}" + fi + fi + done + + popd > /dev/null || die "popd failed" + + if ROOT="/" has_version sys-apps/coreutils; then + cp -fr --preserve=all --no-preserve=context "${intermediate_installation_images_directory}/${PYTHON_ABI}/"* "${D}" || die "Merging of intermediate installation image for Python ABI '${PYTHON_ABI} into installation image failed" + else + cp -fpr "${intermediate_installation_images_directory}/${PYTHON_ABI}/"* "${D}" || die "Merging of intermediate installation image for Python ABI '${PYTHON_ABI} into installation image failed" + fi + done + + rm -fr "${intermediate_installation_images_directory}" + + if [[ "${#wrapper_scripts[@]}" -ge 1 ]]; then + rm -f "${T}/python_wrapper_scripts" + + for file in "${wrapper_scripts[@]}"; do + echo -n "${file}" >> "${T}/python_wrapper_scripts" + echo -en "\x00" >> "${T}/python_wrapper_scripts" + done + + while read -d $'\0' -r file; do + wrapper_scripts_set+=("${file}") + done < <("$(PYTHON -f)" -c \ +"import sys + +if hasattr(sys.stdout, 'buffer'): + # Python 3 + stdout = sys.stdout.buffer +else: + # Python 2 + stdout = sys.stdout + +python_wrapper_scripts_file = open('${T}/python_wrapper_scripts', 'rb') +files = set(python_wrapper_scripts_file.read().rstrip(${b}'\x00').split(${b}'\x00')) +python_wrapper_scripts_file.close() + +for file in sorted(files): + stdout.write(file) + stdout.write(${b}'\x00')" || die "${FUNCNAME}(): Failure of extraction of set of wrapper scripts") + + python_generate_wrapper_scripts $([[ "${quiet}" == "1" ]] && echo --quiet) "${wrapper_scripts_set[@]}" + fi +} + +# ================================================================================================ +# ========= FUNCTIONS FOR PACKAGES NOT SUPPORTING INSTALLATION FOR MULTIPLE PYTHON ABIS ========== +# ================================================================================================ + +unset EPYTHON PYTHON_ABI + +# @FUNCTION: python_set_active_version +# @USAGE: <Python_ABI|2|3> +# @DESCRIPTION: +# Set locally active version of Python. +# If Python_ABI argument is specified, then version of Python corresponding to Python_ABI is used. +# If 2 argument is specified, then active version of CPython 2 is used. +# If 3 argument is specified, then active version of CPython 3 is used. +# +# This function can be used only in pkg_setup() phase. +python_set_active_version() { + if [[ "${EBUILD_PHASE}" != "setup" ]]; then + die "${FUNCNAME}() can be used only in pkg_setup() phase" + fi + + if _python_package_supporting_installation_for_multiple_python_abis; then + die "${FUNCNAME}() cannot be used in ebuilds of packages supporting installation for multiple Python ABIs" + fi + + if [[ "$#" -ne 1 ]]; then + die "${FUNCNAME}() requires 1 argument" + fi + + _python_initial_sanity_checks + + if [[ -z "${PYTHON_ABI}" ]]; then + if [[ -n "$(_python_get_implementation --ignore-invalid "$1")" ]]; then + # PYTHON_ABI variable is intended to be used only in ebuilds/eclasses, + # so it does not need to be exported to subprocesses. + PYTHON_ABI="$1" + if ! _python_implementation && ! has_version "$(python_get_implementational_package)"; then + die "${FUNCNAME}(): '$(python_get_implementational_package)' is not installed" + fi + export EPYTHON="$(PYTHON "$1")" + elif [[ "$1" == "2" ]]; then + if ! _python_implementation && ! has_version "=dev-lang/python-2*"; then + die "${FUNCNAME}(): '=dev-lang/python-2*' is not installed" + fi + export EPYTHON="$(PYTHON -2)" + PYTHON_ABI="${EPYTHON#python}" + PYTHON_ABI="${PYTHON_ABI%%-*}" + elif [[ "$1" == "3" ]]; then + if ! _python_implementation && ! has_version "=dev-lang/python-3*"; then + die "${FUNCNAME}(): '=dev-lang/python-3*' is not installed" + fi + export EPYTHON="$(PYTHON -3)" + PYTHON_ABI="${EPYTHON#python}" + PYTHON_ABI="${PYTHON_ABI%%-*}" + else + die "${FUNCNAME}(): Unrecognized argument '$1'" + fi + fi + + _python_final_sanity_checks + + # python-updater checks PYTHON_REQUESTED_ACTIVE_VERSION variable. + PYTHON_REQUESTED_ACTIVE_VERSION="$1" +} + +# @FUNCTION: python_need_rebuild +# @DESCRIPTION: +# Mark current package for rebuilding by python-updater after +# switching of active version of Python. +python_need_rebuild() { + if _python_package_supporting_installation_for_multiple_python_abis; then + die "${FUNCNAME}() cannot be used in ebuilds of packages supporting installation for multiple Python ABIs" + fi + + _python_check_python_pkg_setup_execution + + if [[ "$#" -ne 0 ]]; then + die "${FUNCNAME}() does not accept arguments" + fi + + export PYTHON_NEED_REBUILD="$(PYTHON --ABI)" +} + +# ================================================================================================ +# ======================================= GETTER FUNCTIONS ======================================= +# ================================================================================================ + +_PYTHON_ABI_EXTRACTION_COMMAND=\ +'import platform +import sys +sys.stdout.write(".".join(str(x) for x in sys.version_info[:2])) +if platform.system()[:4] == "Java": + sys.stdout.write("-jython") +elif hasattr(platform, "python_implementation") and platform.python_implementation() == "PyPy": + sys.stdout.write("-pypy-" + ".".join(str(x) for x in sys.pypy_version_info[:2]))' + +_python_get_implementation() { + local ignore_invalid="0" + + while (($#)); do + case "$1" in + --ignore-invalid) + ignore_invalid="1" + ;; + --) + shift + break + ;; + -*) + die "${FUNCNAME}(): Unrecognized option '$1'" + ;; + *) + break + ;; + esac + shift + done + + if [[ "$#" -ne 1 ]]; then + die "${FUNCNAME}() requires 1 argument" + fi + + if [[ "$1" =~ ^[[:digit:]]+\.[[:digit:]]+$ ]]; then + echo "CPython" + elif [[ "$1" =~ ^[[:digit:]]+\.[[:digit:]]+-jython$ ]]; then + echo "Jython" + elif [[ "$1" =~ ^[[:digit:]]+\.[[:digit:]]+-pypy-[[:digit:]]+\.[[:digit:]]+$ ]]; then + echo "PyPy" + else + if [[ "${ignore_invalid}" == "0" ]]; then + die "${FUNCNAME}(): Unrecognized Python ABI '$1'" + fi + fi +} + +# @FUNCTION: PYTHON +# @USAGE: [-2] [-3] [--ABI] [-a|--absolute-path] [-f|--final-ABI] [--] <Python_ABI="${PYTHON_ABI}"> +# @DESCRIPTION: +# Print filename of Python interpreter for specified Python ABI. If Python_ABI argument +# is ommitted, then PYTHON_ABI environment variable must be set and is used. +# If -2 option is specified, then active version of CPython 2 is used. +# If -3 option is specified, then active version of CPython 3 is used. +# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used. +# -2, -3 and --final-ABI options and Python_ABI argument cannot be specified simultaneously. +# If --ABI option is specified, then only specified Python ABI is printed instead of +# filename of Python interpreter. +# If --absolute-path option is specified, then absolute path to Python interpreter is printed. +# --ABI and --absolute-path options cannot be specified simultaneously. +PYTHON() { + _python_check_python_pkg_setup_execution + + local ABI_output="0" absolute_path_output="0" final_ABI="0" PYTHON_ABI="${PYTHON_ABI}" python_interpreter python2="0" python3="0" + + while (($#)); do + case "$1" in + -2) + python2="1" + ;; + -3) + python3="1" + ;; + --ABI) + ABI_output="1" + ;; + -a|--absolute-path) + absolute_path_output="1" + ;; + -f|--final-ABI) + final_ABI="1" + ;; + --) + shift + break + ;; + -*) + die "${FUNCNAME}(): Unrecognized option '$1'" + ;; + *) + break + ;; + esac + shift + done + + if [[ "${ABI_output}" == "1" && "${absolute_path_output}" == "1" ]]; then + die "${FUNCNAME}(): '--ABI' and '--absolute-path' options cannot be specified simultaneously" + fi + + if [[ "$((${python2} + ${python3} + ${final_ABI}))" -gt 1 ]]; then + die "${FUNCNAME}(): '-2', '-3' or '--final-ABI' options cannot be specified simultaneously" + fi + + if [[ "$#" -eq 0 ]]; then + if [[ "${final_ABI}" == "1" ]]; then + if ! _python_package_supporting_installation_for_multiple_python_abis; then + die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs" + fi + _python_calculate_PYTHON_ABIS + PYTHON_ABI="${PYTHON_ABIS##* }" + elif [[ "${python2}" == "1" ]]; then + PYTHON_ABI="$(ROOT="/" eselect python show --python2 --ABI)" + if [[ -z "${PYTHON_ABI}" ]]; then + die "${FUNCNAME}(): Active version of CPython 2 not set" + elif [[ "${PYTHON_ABI}" != "2."* ]]; then + die "${FUNCNAME}(): Internal error in \`eselect python show --python2\`" + fi + elif [[ "${python3}" == "1" ]]; then + PYTHON_ABI="$(ROOT="/" eselect python show --python3 --ABI)" + if [[ -z "${PYTHON_ABI}" ]]; then + die "${FUNCNAME}(): Active version of CPython 3 not set" + elif [[ "${PYTHON_ABI}" != "3."* ]]; then + die "${FUNCNAME}(): Internal error in \`eselect python show --python3\`" + fi + elif _python_package_supporting_installation_for_multiple_python_abis; then + if ! _python_abi-specific_local_scope; then + die "${FUNCNAME}() should be used in ABI-specific local scope" + fi + else + PYTHON_ABI="$("${EPREFIX}/usr/bin/python" -c "${_PYTHON_ABI_EXTRACTION_COMMAND}")" + if [[ -z "${PYTHON_ABI}" ]]; then + die "${FUNCNAME}(): Failure of extraction of locally active version of Python" + fi + fi + elif [[ "$#" -eq 1 ]]; then + if [[ "${final_ABI}" == "1" ]]; then + die "${FUNCNAME}(): '--final-ABI' option and Python ABI cannot be specified simultaneously" + fi + if [[ "${python2}" == "1" ]]; then + die "${FUNCNAME}(): '-2' option and Python ABI cannot be specified simultaneously" + fi + if [[ "${python3}" == "1" ]]; then + die "${FUNCNAME}(): '-3' option and Python ABI cannot be specified simultaneously" + fi + PYTHON_ABI="$1" + else + die "${FUNCNAME}(): Invalid usage" + fi + + if [[ "${ABI_output}" == "1" ]]; then + echo -n "${PYTHON_ABI}" + return + else + if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then + python_interpreter="python${PYTHON_ABI}" + elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then + python_interpreter="jython${PYTHON_ABI%-jython}" + elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "PyPy" ]]; then + python_interpreter="pypy-c${PYTHON_ABI#*-pypy-}" + fi + + if [[ "${absolute_path_output}" == "1" ]]; then + echo -n "${EPREFIX}/usr/bin/${python_interpreter}" + else + echo -n "${python_interpreter}" + fi + fi + + if [[ -n "${ABI}" && "${ABI}" != "${DEFAULT_ABI}" && "${DEFAULT_ABI}" != "default" ]]; then + echo -n "-${ABI}" + fi +} + +# @FUNCTION: python_get_implementation +# @USAGE: [-f|--final-ABI] +# @DESCRIPTION: +# Print name of Python implementation. +# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used. +python_get_implementation() { + _python_check_python_pkg_setup_execution + + local final_ABI="0" PYTHON_ABI="${PYTHON_ABI}" + + while (($#)); do + case "$1" in + -f|--final-ABI) + final_ABI="1" + ;; + -*) + die "${FUNCNAME}(): Unrecognized option '$1'" + ;; + *) + die "${FUNCNAME}(): Invalid usage" + ;; + esac + shift + done + + if [[ "${final_ABI}" == "1" ]]; then + if ! _python_package_supporting_installation_for_multiple_python_abis; then + die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs" + fi + PYTHON_ABI="$(PYTHON -f --ABI)" + else + if _python_package_supporting_installation_for_multiple_python_abis; then + if ! _python_abi-specific_local_scope; then + die "${FUNCNAME}() should be used in ABI-specific local scope" + fi + else + PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}" + fi + fi + + echo "$(_python_get_implementation "${PYTHON_ABI}")" +} + +# @FUNCTION: python_get_implementational_package +# @USAGE: [-f|--final-ABI] +# @DESCRIPTION: +# Print category, name and slot of package providing Python implementation. +# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used. +python_get_implementational_package() { + _python_check_python_pkg_setup_execution + + local final_ABI="0" PYTHON_ABI="${PYTHON_ABI}" + + while (($#)); do + case "$1" in + -f|--final-ABI) + final_ABI="1" + ;; + -*) + die "${FUNCNAME}(): Unrecognized option '$1'" + ;; + *) + die "${FUNCNAME}(): Invalid usage" + ;; + esac + shift + done + + if [[ "${final_ABI}" == "1" ]]; then + if ! _python_package_supporting_installation_for_multiple_python_abis; then + die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs" + fi + PYTHON_ABI="$(PYTHON -f --ABI)" + else + if _python_package_supporting_installation_for_multiple_python_abis; then + if ! _python_abi-specific_local_scope; then + die "${FUNCNAME}() should be used in ABI-specific local scope" + fi + else + PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}" + fi + fi + + if [[ "${EAPI:-0}" == "0" ]]; then + if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then + echo "=dev-lang/python-${PYTHON_ABI}*" + elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then + echo "=dev-java/jython-${PYTHON_ABI%-jython}*" + elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "PyPy" ]]; then + echo "=dev-python/pypy-${PYTHON_ABI#*-pypy-}*" + fi + else + if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then + echo "dev-lang/python:${PYTHON_ABI}" + elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then + echo "dev-java/jython:${PYTHON_ABI%-jython}" + elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "PyPy" ]]; then + echo "dev-python/pypy:${PYTHON_ABI#*-pypy-}" + fi + fi +} + +# @FUNCTION: python_get_includedir +# @USAGE: [-b|--base-path] [-f|--final-ABI] +# @DESCRIPTION: +# Print path to Python include directory. +# If --base-path option is specified, then path not prefixed with "/" is printed. +# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used. +python_get_includedir() { + _python_check_python_pkg_setup_execution + + local base_path="0" final_ABI="0" prefix PYTHON_ABI="${PYTHON_ABI}" + + while (($#)); do + case "$1" in + -b|--base-path) + base_path="1" + ;; + -f|--final-ABI) + final_ABI="1" + ;; + -*) + die "${FUNCNAME}(): Unrecognized option '$1'" + ;; + *) + die "${FUNCNAME}(): Invalid usage" + ;; + esac + shift + done + + if [[ "${base_path}" == "0" ]]; then + prefix="/" + fi + + if [[ "${final_ABI}" == "1" ]]; then + if ! _python_package_supporting_installation_for_multiple_python_abis; then + die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs" + fi + PYTHON_ABI="$(PYTHON -f --ABI)" + else + if _python_package_supporting_installation_for_multiple_python_abis; then + if ! _python_abi-specific_local_scope; then + die "${FUNCNAME}() should be used in ABI-specific local scope" + fi + else + PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}" + fi + fi + + if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then + echo "${prefix}usr/include/python${PYTHON_ABI}" + elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then + echo "${prefix}usr/share/jython-${PYTHON_ABI%-jython}/Include" + elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "PyPy" ]]; then + echo "${prefix}usr/$(get_libdir)/pypy${PYTHON_ABI#*-pypy-}/include" + fi +} + +# @FUNCTION: python_get_libdir +# @USAGE: [-b|--base-path] [-f|--final-ABI] +# @DESCRIPTION: +# Print path to Python standard library directory. +# If --base-path option is specified, then path not prefixed with "/" is printed. +# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used. +python_get_libdir() { + _python_check_python_pkg_setup_execution + + local base_path="0" final_ABI="0" prefix PYTHON_ABI="${PYTHON_ABI}" + + while (($#)); do + case "$1" in + -b|--base-path) + base_path="1" + ;; + -f|--final-ABI) + final_ABI="1" + ;; + -*) + die "${FUNCNAME}(): Unrecognized option '$1'" + ;; + *) + die "${FUNCNAME}(): Invalid usage" + ;; + esac + shift + done + + if [[ "${base_path}" == "0" ]]; then + prefix="/" + fi + + if [[ "${final_ABI}" == "1" ]]; then + if ! _python_package_supporting_installation_for_multiple_python_abis; then + die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs" + fi + PYTHON_ABI="$(PYTHON -f --ABI)" + else + if _python_package_supporting_installation_for_multiple_python_abis; then + if ! _python_abi-specific_local_scope; then + die "${FUNCNAME}() should be used in ABI-specific local scope" + fi + else + PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}" + fi + fi + + if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then + echo "${prefix}usr/$(get_libdir)/python${PYTHON_ABI}" + elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then + echo "${prefix}usr/share/jython-${PYTHON_ABI%-jython}/Lib" + elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "PyPy" ]]; then + die "${FUNCNAME}(): PyPy has multiple standard library directories" + fi +} + +# @FUNCTION: python_get_sitedir +# @USAGE: [-b|--base-path] [-f|--final-ABI] +# @DESCRIPTION: +# Print path to Python site-packages directory. +# If --base-path option is specified, then path not prefixed with "/" is printed. +# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used. +python_get_sitedir() { + _python_check_python_pkg_setup_execution + + local base_path="0" final_ABI="0" prefix PYTHON_ABI="${PYTHON_ABI}" + + while (($#)); do + case "$1" in + -b|--base-path) + base_path="1" + ;; + -f|--final-ABI) + final_ABI="1" + ;; + -*) + die "${FUNCNAME}(): Unrecognized option '$1'" + ;; + *) + die "${FUNCNAME}(): Invalid usage" + ;; + esac + shift + done + + if [[ "${base_path}" == "0" ]]; then + prefix="/" + fi + + if [[ "${final_ABI}" == "1" ]]; then + if ! _python_package_supporting_installation_for_multiple_python_abis; then + die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs" + fi + PYTHON_ABI="$(PYTHON -f --ABI)" + else + if _python_package_supporting_installation_for_multiple_python_abis; then + if ! _python_abi-specific_local_scope; then + die "${FUNCNAME}() should be used in ABI-specific local scope" + fi + else + PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}" + fi + fi + + if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then + echo "${prefix}usr/$(get_libdir)/python${PYTHON_ABI}/site-packages" + elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then + echo "${prefix}usr/share/jython-${PYTHON_ABI%-jython}/Lib/site-packages" + elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "PyPy" ]]; then + echo "${prefix}usr/$(get_libdir)/pypy${PYTHON_ABI#*-pypy-}/site-packages" + fi +} + +# @FUNCTION: python_get_library +# @USAGE: [-b|--base-path] [-f|--final-ABI] [-l|--linker-option] +# @DESCRIPTION: +# Print path to Python library. +# If --base-path option is specified, then path not prefixed with "/" is printed. +# If --linker-option is specified, then "-l${library}" linker option is printed. +# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used. +python_get_library() { + _python_check_python_pkg_setup_execution + + local base_path="0" final_ABI="0" linker_option="0" prefix PYTHON_ABI="${PYTHON_ABI}" + + while (($#)); do + case "$1" in + -b|--base-path) + base_path="1" + ;; + -f|--final-ABI) + final_ABI="1" + ;; + -l|--linker-option) + linker_option="1" + ;; + -*) + die "${FUNCNAME}(): Unrecognized option '$1'" + ;; + *) + die "${FUNCNAME}(): Invalid usage" + ;; + esac + shift + done + + if [[ "${base_path}" == "0" ]]; then + prefix="/" + fi + + if [[ "${base_path}" == "1" && "${linker_option}" == "1" ]]; then + die "${FUNCNAME}(): '--base-path' and '--linker-option' options cannot be specified simultaneously" + fi + + if [[ "${final_ABI}" == "1" ]]; then + if ! _python_package_supporting_installation_for_multiple_python_abis; then + die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs" + fi + PYTHON_ABI="$(PYTHON -f --ABI)" + else + if _python_package_supporting_installation_for_multiple_python_abis; then + if ! _python_abi-specific_local_scope; then + die "${FUNCNAME}() should be used in ABI-specific local scope" + fi + else + PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}" + fi + fi + + if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then + if [[ "${linker_option}" == "1" ]]; then + echo "-lpython${PYTHON_ABI}" + else + echo "${prefix}usr/$(get_libdir)/libpython${PYTHON_ABI}$(get_libname)" + fi + elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then + die "${FUNCNAME}(): Jython does not have shared library" + elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "PyPy" ]]; then + die "${FUNCNAME}(): PyPy does not have shared library" + fi +} + +# @FUNCTION: python_get_version +# @USAGE: [-f|--final-ABI] [-l|--language] [--full] [--major] [--minor] [--micro] +# @DESCRIPTION: +# Print version of Python implementation. +# --full, --major, --minor and --micro options cannot be specified simultaneously. +# If --full, --major, --minor and --micro options are not specified, then "${major_version}.${minor_version}" is printed. +# If --language option is specified, then version of Python language is printed. +# --language and --full options cannot be specified simultaneously. +# --language and --micro options cannot be specified simultaneously. +# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used. +python_get_version() { + _python_check_python_pkg_setup_execution + + local final_ABI="0" language="0" language_version full="0" major="0" minor="0" micro="0" PYTHON_ABI="${PYTHON_ABI}" python_command + + while (($#)); do + case "$1" in + -f|--final-ABI) + final_ABI="1" + ;; + -l|--language) + language="1" + ;; + --full) + full="1" + ;; + --major) + major="1" + ;; + --minor) + minor="1" + ;; + --micro) + micro="1" + ;; + -*) + die "${FUNCNAME}(): Unrecognized option '$1'" + ;; + *) + die "${FUNCNAME}(): Invalid usage" + ;; + esac + shift + done + + if [[ "${final_ABI}" == "1" ]]; then + if ! _python_package_supporting_installation_for_multiple_python_abis; then + die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs" + fi + else + if _python_package_supporting_installation_for_multiple_python_abis && ! _python_abi-specific_local_scope; then + die "${FUNCNAME}() should be used in ABI-specific local scope" + fi + fi + + if [[ "$((${full} + ${major} + ${minor} + ${micro}))" -gt 1 ]]; then + die "${FUNCNAME}(): '--full', '--major', '--minor' or '--micro' options cannot be specified simultaneously" + fi + + if [[ "${language}" == "1" ]]; then + if [[ "${final_ABI}" == "1" ]]; then + PYTHON_ABI="$(PYTHON -f --ABI)" + elif [[ -z "${PYTHON_ABI}" ]]; then + PYTHON_ABI="$(PYTHON --ABI)" + fi + language_version="${PYTHON_ABI%%-*}" + if [[ "${full}" == "1" ]]; then + die "${FUNCNAME}(): '--language' and '--full' options cannot be specified simultaneously" + elif [[ "${major}" == "1" ]]; then + echo "${language_version%.*}" + elif [[ "${minor}" == "1" ]]; then + echo "${language_version#*.}" + elif [[ "${micro}" == "1" ]]; then + die "${FUNCNAME}(): '--language' and '--micro' options cannot be specified simultaneously" + else + echo "${language_version}" + fi + else + if [[ "${full}" == "1" ]]; then + python_command="import sys; print('.'.join(str(x) for x in getattr(sys, 'pypy_version_info', sys.version_info)[:3]))" + elif [[ "${major}" == "1" ]]; then + python_command="import sys; print(getattr(sys, 'pypy_version_info', sys.version_info)[0])" + elif [[ "${minor}" == "1" ]]; then + python_command="import sys; print(getattr(sys, 'pypy_version_info', sys.version_info)[1])" + elif [[ "${micro}" == "1" ]]; then + python_command="import sys; print(getattr(sys, 'pypy_version_info', sys.version_info)[2])" + else + if [[ -n "${PYTHON_ABI}" && "${final_ABI}" == "0" ]]; then + if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then + echo "${PYTHON_ABI}" + elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then + echo "${PYTHON_ABI%-jython}" + elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "PyPy" ]]; then + echo "${PYTHON_ABI#*-pypy-}" + fi + return + fi + python_command="from sys import version_info; print('.'.join(str(x) for x in version_info[:2]))" + fi + + if [[ "${final_ABI}" == "1" ]]; then + "$(PYTHON -f)" -c "${python_command}" + else + "$(PYTHON ${PYTHON_ABI})" -c "${python_command}" + fi + fi +} + +# @FUNCTION: python_get_implementation_and_version +# @USAGE: [-f|--final-ABI] +# @DESCRIPTION: +# Print name and version of Python implementation. +# If version of Python implementation is not bound to version of Python language, then +# version of Python language is additionally printed. +# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used. +python_get_implementation_and_version() { + _python_check_python_pkg_setup_execution + + local final_ABI="0" PYTHON_ABI="${PYTHON_ABI}" + + while (($#)); do + case "$1" in + -f|--final-ABI) + final_ABI="1" + ;; + -*) + die "${FUNCNAME}(): Unrecognized option '$1'" + ;; + *) + die "${FUNCNAME}(): Invalid usage" + ;; + esac + shift + done + + if [[ "${final_ABI}" == "1" ]]; then + if ! _python_package_supporting_installation_for_multiple_python_abis; then + die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs" + fi + PYTHON_ABI="$(PYTHON -f --ABI)" + else + if _python_package_supporting_installation_for_multiple_python_abis; then + if ! _python_abi-specific_local_scope; then + die "${FUNCNAME}() should be used in ABI-specific local scope" + fi + else + PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}" + fi + fi + + if [[ "${PYTHON_ABI}" =~ ^[[:digit:]]+\.[[:digit:]]+-[[:alnum:]]+-[[:digit:]]+\.[[:digit:]]+$ ]]; then + echo "$(_python_get_implementation "${PYTHON_ABI}") ${PYTHON_ABI##*-} (Python ${PYTHON_ABI%%-*})" + else + echo "$(_python_get_implementation "${PYTHON_ABI}") ${PYTHON_ABI%%-*}" + fi +} + +# ================================================================================================ +# ================================ FUNCTIONS FOR RUNNING OF TESTS ================================ +# ================================================================================================ + +# @ECLASS-VARIABLE: PYTHON_TEST_VERBOSITY +# @DESCRIPTION: +# User-configurable verbosity of tests of Python modules. +# Supported values: 0, 1, 2, 3, 4. +PYTHON_TEST_VERBOSITY="${PYTHON_TEST_VERBOSITY:-1}" + +_python_test_hook() { + if [[ "$#" -ne 1 ]]; then + die "${FUNCNAME}() requires 1 argument" + fi + + if _python_package_supporting_installation_for_multiple_python_abis && [[ "$(type -t "${_PYTHON_TEST_FUNCTION}_$1_hook")" == "function" ]]; then + "${_PYTHON_TEST_FUNCTION}_$1_hook" + fi +} + +# @FUNCTION: python_execute_nosetests +# @USAGE: [-P|--PYTHONPATH PYTHONPATH] [-s|--separate-build-dirs] [--] [arguments] +# @DESCRIPTION: +# Execute nosetests for all enabled Python ABIs. +# In ebuilds of packages supporting installation for multiple Python ABIs, this function calls +# python_execute_nosetests_pre_hook() and python_execute_nosetests_post_hook(), if they are defined. +python_execute_nosetests() { + _python_check_python_pkg_setup_execution + _python_set_color_variables + + local PYTHONPATH_template separate_build_dirs + + while (($#)); do + case "$1" in + -P|--PYTHONPATH) + PYTHONPATH_template="$2" + shift + ;; + -s|--separate-build-dirs) + separate_build_dirs="1" + ;; + --) + shift + break + ;; + -*) + die "${FUNCNAME}(): Unrecognized option '$1'" + ;; + *) + break + ;; + esac + shift + done + + python_test_function() { + local evaluated_PYTHONPATH + + eval "evaluated_PYTHONPATH=\"${PYTHONPATH_template}\"" + + _PYTHON_TEST_FUNCTION="python_execute_nosetests" _python_test_hook pre + + if [[ -n "${evaluated_PYTHONPATH}" ]]; then + echo ${_BOLD}PYTHONPATH="${evaluated_PYTHONPATH}" nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@"${_NORMAL} + PYTHONPATH="${evaluated_PYTHONPATH}" nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@" || return "$?" + else + echo ${_BOLD}nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@"${_NORMAL} + nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@" || return "$?" + fi + + _PYTHON_TEST_FUNCTION="python_execute_nosetests" _python_test_hook post + } + if _python_package_supporting_installation_for_multiple_python_abis; then + python_execute_function ${separate_build_dirs:+-s} python_test_function "$@" + else + if [[ -n "${separate_build_dirs}" ]]; then + die "${FUNCNAME}(): Invalid usage" + fi + python_test_function "$@" || die "Testing failed" + fi + + unset -f python_test_function +} + +# @FUNCTION: python_execute_py.test +# @USAGE: [-P|--PYTHONPATH PYTHONPATH] [-s|--separate-build-dirs] [--] [arguments] +# @DESCRIPTION: +# Execute py.test for all enabled Python ABIs. +# In ebuilds of packages supporting installation for multiple Python ABIs, this function calls +# python_execute_py.test_pre_hook() and python_execute_py.test_post_hook(), if they are defined. +python_execute_py.test() { + _python_check_python_pkg_setup_execution + _python_set_color_variables + + local PYTHONPATH_template separate_build_dirs + + while (($#)); do + case "$1" in + -P|--PYTHONPATH) + PYTHONPATH_template="$2" + shift + ;; + -s|--separate-build-dirs) + separate_build_dirs="1" + ;; + --) + shift + break + ;; + -*) + die "${FUNCNAME}(): Unrecognized option '$1'" + ;; + *) + break + ;; + esac + shift + done + + python_test_function() { + local evaluated_PYTHONPATH + + eval "evaluated_PYTHONPATH=\"${PYTHONPATH_template}\"" + + _PYTHON_TEST_FUNCTION="python_execute_py.test" _python_test_hook pre + + if [[ -n "${evaluated_PYTHONPATH}" ]]; then + echo ${_BOLD}PYTHONPATH="${evaluated_PYTHONPATH}" py.test $([[ "${PYTHON_TEST_VERBOSITY}" -ge 2 ]] && echo -v) "$@"${_NORMAL} + PYTHONPATH="${evaluated_PYTHONPATH}" py.test $([[ "${PYTHON_TEST_VERBOSITY}" -ge 2 ]] && echo -v) "$@" || return "$?" + else + echo ${_BOLD}py.test $([[ "${PYTHON_TEST_VERBOSITY}" -gt 1 ]] && echo -v) "$@"${_NORMAL} + py.test $([[ "${PYTHON_TEST_VERBOSITY}" -gt 1 ]] && echo -v) "$@" || return "$?" + fi + + _PYTHON_TEST_FUNCTION="python_execute_py.test" _python_test_hook post + } + if _python_package_supporting_installation_for_multiple_python_abis; then + python_execute_function ${separate_build_dirs:+-s} python_test_function "$@" + else + if [[ -n "${separate_build_dirs}" ]]; then + die "${FUNCNAME}(): Invalid usage" + fi + python_test_function "$@" || die "Testing failed" + fi + + unset -f python_test_function +} + +# @FUNCTION: python_execute_trial +# @USAGE: [-P|--PYTHONPATH PYTHONPATH] [-s|--separate-build-dirs] [--] [arguments] +# @DESCRIPTION: +# Execute trial for all enabled Python ABIs. +# In ebuilds of packages supporting installation for multiple Python ABIs, this function +# calls python_execute_trial_pre_hook() and python_execute_trial_post_hook(), if they are defined. +python_execute_trial() { + _python_check_python_pkg_setup_execution + _python_set_color_variables + + local PYTHONPATH_template separate_build_dirs + + while (($#)); do + case "$1" in + -P|--PYTHONPATH) + PYTHONPATH_template="$2" + shift + ;; + -s|--separate-build-dirs) + separate_build_dirs="1" + ;; + --) + shift + break + ;; + -*) + die "${FUNCNAME}(): Unrecognized option '$1'" + ;; + *) + break + ;; + esac + shift + done + + python_test_function() { + local evaluated_PYTHONPATH + + eval "evaluated_PYTHONPATH=\"${PYTHONPATH_template}\"" + + _PYTHON_TEST_FUNCTION="python_execute_trial" _python_test_hook pre + + if [[ -n "${evaluated_PYTHONPATH}" ]]; then + echo ${_BOLD}PYTHONPATH="${evaluated_PYTHONPATH}" trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@"${_NORMAL} + PYTHONPATH="${evaluated_PYTHONPATH}" trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@" || return "$?" + else + echo ${_BOLD}trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@"${_NORMAL} + trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@" || return "$?" + fi + + _PYTHON_TEST_FUNCTION="python_execute_trial" _python_test_hook post + } + if _python_package_supporting_installation_for_multiple_python_abis; then + python_execute_function ${separate_build_dirs:+-s} python_test_function "$@" + else + if [[ -n "${separate_build_dirs}" ]]; then + die "${FUNCNAME}(): Invalid usage" + fi + python_test_function "$@" || die "Testing failed" + fi + + unset -f python_test_function +} + +# ================================================================================================ +# ======================= FUNCTIONS FOR HANDLING OF BYTE-COMPILED MODULES ======================== +# ================================================================================================ + +# @FUNCTION: python_enable_pyc +# @DESCRIPTION: +# Tell Python to automatically recompile modules to .pyc/.pyo if the +# timestamps/version stamps have changed. +python_enable_pyc() { + _python_check_python_pkg_setup_execution + + if [[ "$#" -ne 0 ]]; then + die "${FUNCNAME}() does not accept arguments" + fi + + unset PYTHONDONTWRITEBYTECODE +} + +# @FUNCTION: python_disable_pyc +# @DESCRIPTION: +# Tell Python not to automatically recompile modules to .pyc/.pyo +# even if the timestamps/version stamps do not match. This is done +# to protect sandbox. +python_disable_pyc() { + _python_check_python_pkg_setup_execution + + if [[ "$#" -ne 0 ]]; then + die "${FUNCNAME}() does not accept arguments" + fi + + export PYTHONDONTWRITEBYTECODE="1" +} + +_python_clean_compiled_modules() { + _python_initialize_prefix_variables + _python_set_color_variables + + [[ "${FUNCNAME[1]}" =~ ^(python_mod_optimize|python_mod_cleanup)$ ]] || die "${FUNCNAME}(): Invalid usage" + + local base_module_name compiled_file compiled_files=() dir path py_file root + + # Strip trailing slash from EROOT. + root="${EROOT%/}" + + for path in "$@"; do + compiled_files=() + if [[ -d "${path}" ]]; then + while read -d $'\0' -r compiled_file; do + compiled_files+=("${compiled_file}") + done < <(find "${path}" "(" -name "*.py[co]" -o -name "*\$py.class" ")" -print0) + + if [[ "${EBUILD_PHASE}" == "postrm" ]]; then + # Delete empty child directories. + find "${path}" -type d | sort -r | while read -r dir; do + if rmdir "${dir}" 2> /dev/null; then + echo "${_CYAN}<<< ${dir}${_NORMAL}" + fi + done + fi + elif [[ "${path}" == *.py ]]; then + base_module_name="${path##*/}" + base_module_name="${base_module_name%.py}" + if [[ -d "${path%/*}/__pycache__" ]]; then + while read -d $'\0' -r compiled_file; do + compiled_files+=("${compiled_file}") + done < <(find "${path%/*}/__pycache__" "(" -name "${base_module_name}.*.py[co]" -o -name "${base_module_name}\$py.class" ")" -print0) + fi + compiled_files+=("${path}c" "${path}o" "${path%.py}\$py.class") + fi + + for compiled_file in "${compiled_files[@]}"; do + [[ ! -f "${compiled_file}" ]] && continue + dir="${compiled_file%/*}" + dir="${dir##*/}" + if [[ "${compiled_file}" == *.py[co] ]]; then + if [[ "${dir}" == "__pycache__" ]]; then + base_module_name="${compiled_file##*/}" + base_module_name="${base_module_name%.*py[co]}" + base_module_name="${base_module_name%.*}" + py_file="${compiled_file%__pycache__/*}${base_module_name}.py" + else + py_file="${compiled_file%[co]}" + fi + if [[ "${EBUILD_PHASE}" == "postinst" ]]; then + [[ -f "${py_file}" && "${compiled_file}" -nt "${py_file}" ]] && continue + else + [[ -f "${py_file}" ]] && continue + fi + echo "${_BLUE}<<< ${compiled_file%[co]}[co]${_NORMAL}" + rm -f "${compiled_file%[co]}"[co] + elif [[ "${compiled_file}" == *\$py.class ]]; then + if [[ "${dir}" == "__pycache__" ]]; then + base_module_name="${compiled_file##*/}" + base_module_name="${base_module_name%\$py.class}" + py_file="${compiled_file%__pycache__/*}${base_module_name}.py" + else + py_file="${compiled_file%\$py.class}.py" + fi + if [[ "${EBUILD_PHASE}" == "postinst" ]]; then + [[ -f "${py_file}" && "${compiled_file}" -nt "${py_file}" ]] && continue + else + [[ -f "${py_file}" ]] && continue + fi + echo "${_BLUE}<<< ${compiled_file}${_NORMAL}" + rm -f "${compiled_file}" + else + die "${FUNCNAME}(): Unrecognized file type: '${compiled_file}'" + fi + + # Delete empty parent directories. + dir="${compiled_file%/*}" + while [[ "${dir}" != "${root}" ]]; do + if rmdir "${dir}" 2> /dev/null; then + echo "${_CYAN}<<< ${dir}${_NORMAL}" + else + break + fi + dir="${dir%/*}" + done + done + done +} + +# @FUNCTION: python_mod_optimize +# @USAGE: [--allow-evaluated-non-sitedir-paths] [-d directory] [-f] [-l] [-q] [-x regular_expression] [--] <file|directory> [files|directories] +# @DESCRIPTION: +# Byte-compile specified Python modules. +# -d, -f, -l, -q and -x options passed to this function are passed to compileall.py. +# +# This function can be used only in pkg_postinst() phase. +python_mod_optimize() { + if [[ "${EBUILD_PHASE}" != "postinst" ]]; then + die "${FUNCNAME}() can be used only in pkg_postinst() phase" + fi + + _python_check_python_pkg_setup_execution + _python_initialize_prefix_variables + + if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis || _python_implementation || [[ "${CATEGORY}/${PN}" == "sys-apps/portage" ]]; then + # PYTHON_ABI variable cannot be local in packages not supporting installation for multiple Python ABIs. + local allow_evaluated_non_sitedir_paths="0" dir dirs=() evaluated_dirs=() evaluated_files=() file files=() iterated_PYTHON_ABIS options=() other_dirs=() other_files=() previous_PYTHON_ABI="${PYTHON_ABI}" return_code root site_packages_dirs=() site_packages_files=() stderr stderr_line + + if _python_package_supporting_installation_for_multiple_python_abis; then + if has "${EAPI:-0}" 0 1 2 3 && [[ -z "${PYTHON_ABIS}" ]]; then + die "${FUNCNAME}(): python_pkg_setup() or python_execute_function() not called" + fi + iterated_PYTHON_ABIS="${PYTHON_ABIS}" + else + if has "${EAPI:-0}" 0 1 2 3; then + iterated_PYTHON_ABIS="${PYTHON_ABI:=$(PYTHON --ABI)}" + else + iterated_PYTHON_ABIS="${PYTHON_ABI}" + fi + fi + + # Strip trailing slash from EROOT. + root="${EROOT%/}" + + while (($#)); do + case "$1" in + --allow-evaluated-non-sitedir-paths) + allow_evaluated_non_sitedir_paths="1" + ;; + -l|-f|-q) + options+=("$1") + ;; + -d|-x) + options+=("$1" "$2") + shift + ;; + --) + shift + break + ;; + -*) + die "${FUNCNAME}(): Unrecognized option '$1'" + ;; + *) + break + ;; + esac + shift + done + + if [[ "${allow_evaluated_non_sitedir_paths}" == "1" ]] && ! _python_package_supporting_installation_for_multiple_python_abis; then + die "${FUNCNAME}(): '--allow-evaluated-non-sitedir-paths' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs" + fi + + if [[ "$#" -eq 0 ]]; then + die "${FUNCNAME}(): Missing files or directories" + fi + + while (($#)); do + if [[ "$1" =~ ^($|(\.|\.\.|/)($|/)) ]]; then + die "${FUNCNAME}(): Invalid argument '$1'" + elif ! _python_implementation && [[ "$1" =~ ^/usr/lib(32|64)?/python[[:digit:]]+\.[[:digit:]]+ ]]; then + die "${FUNCNAME}(): Paths of directories / files in site-packages directories must be relative to site-packages directories" + elif [[ "$1" =~ ^/ ]]; then + if _python_package_supporting_installation_for_multiple_python_abis; then + if [[ "${allow_evaluated_non_sitedir_paths}" != "1" ]]; then + die "${FUNCNAME}(): Absolute paths cannot be used in ebuilds of packages supporting installation for multiple Python ABIs" + fi + if [[ "$1" != *\$* ]]; then + die "${FUNCNAME}(): '$1' has invalid syntax" + fi + if [[ "$1" == *.py ]]; then + evaluated_files+=("$1") + else + evaluated_dirs+=("$1") + fi + else + if [[ -d "${root}$1" ]]; then + other_dirs+=("${root}$1") + elif [[ -f "${root}$1" ]]; then + other_files+=("${root}$1") + elif [[ -e "${root}$1" ]]; then + eerror "${FUNCNAME}(): '${root}$1' is not a regular file or a directory" + else + eerror "${FUNCNAME}(): '${root}$1' does not exist" + fi + fi + else + for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do + if [[ -d "${root}$(python_get_sitedir)/$1" ]]; then + site_packages_dirs+=("$1") + break + elif [[ -f "${root}$(python_get_sitedir)/$1" ]]; then + site_packages_files+=("$1") + break + elif [[ -e "${root}$(python_get_sitedir)/$1" ]]; then + eerror "${FUNCNAME}(): '$1' is not a regular file or a directory" + else + eerror "${FUNCNAME}(): '$1' does not exist" + fi + done + fi + shift + done + + # Set additional options. + options+=("-q") + + for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do + if ((${#site_packages_dirs[@]})) || ((${#site_packages_files[@]})) || ((${#evaluated_dirs[@]})) || ((${#evaluated_files[@]})); then + return_code="0" + stderr="" + ebegin "Compilation and optimization of Python modules for $(python_get_implementation_and_version)" + if ((${#site_packages_dirs[@]})) || ((${#evaluated_dirs[@]})); then + for dir in "${site_packages_dirs[@]}"; do + dirs+=("${root}$(python_get_sitedir)/${dir}") + done + for dir in "${evaluated_dirs[@]}"; do + eval "dirs+=(\"\${root}${dir}\")" + done + stderr+="${stderr:+$'\n'}$("$(PYTHON)" -m compileall "${options[@]}" "${dirs[@]}" 2>&1)" || return_code="1" + if ! has "$(_python_get_implementation "${PYTHON_ABI}")" Jython PyPy; then + "$(PYTHON)" -O -m compileall "${options[@]}" "${dirs[@]}" &> /dev/null || return_code="1" + fi + _python_clean_compiled_modules "${dirs[@]}" + fi + if ((${#site_packages_files[@]})) || ((${#evaluated_files[@]})); then + for file in "${site_packages_files[@]}"; do + files+=("${root}$(python_get_sitedir)/${file}") + done + for file in "${evaluated_files[@]}"; do + eval "files+=(\"\${root}${file}\")" + done + stderr+="${stderr:+$'\n'}$("$(PYTHON)" -m py_compile "${files[@]}" 2>&1)" || return_code="1" + if ! has "$(_python_get_implementation "${PYTHON_ABI}")" Jython PyPy; then + "$(PYTHON)" -O -m py_compile "${files[@]}" &> /dev/null || return_code="1" + fi + _python_clean_compiled_modules "${files[@]}" + fi + eend "${return_code}" + if [[ -n "${stderr}" ]]; then + eerror "Syntax errors / warnings in Python modules for $(python_get_implementation_and_version):" &> /dev/null + while read stderr_line; do + eerror " ${stderr_line}" + done <<< "${stderr}" + fi + fi + unset dirs files + done + + if _python_package_supporting_installation_for_multiple_python_abis; then + # Restore previous value of PYTHON_ABI. + if [[ -n "${previous_PYTHON_ABI}" ]]; then + PYTHON_ABI="${previous_PYTHON_ABI}" + else + unset PYTHON_ABI + fi + fi + + if ((${#other_dirs[@]})) || ((${#other_files[@]})); then + return_code="0" + stderr="" + ebegin "Compilation and optimization of Python modules placed outside of site-packages directories for $(python_get_implementation_and_version)" + if ((${#other_dirs[@]})); then + stderr+="${stderr:+$'\n'}$("$(PYTHON ${PYTHON_ABI})" -m compileall "${options[@]}" "${other_dirs[@]}" 2>&1)" || return_code="1" + if ! has "$(_python_get_implementation "${PYTHON_ABI}")" Jython PyPy; then + "$(PYTHON ${PYTHON_ABI})" -O -m compileall "${options[@]}" "${other_dirs[@]}" &> /dev/null || return_code="1" + fi + _python_clean_compiled_modules "${other_dirs[@]}" + fi + if ((${#other_files[@]})); then + stderr+="${stderr:+$'\n'}$("$(PYTHON ${PYTHON_ABI})" -m py_compile "${other_files[@]}" 2>&1)" || return_code="1" + if ! has "$(_python_get_implementation "${PYTHON_ABI}")" Jython PyPy; then + "$(PYTHON ${PYTHON_ABI})" -O -m py_compile "${other_files[@]}" &> /dev/null || return_code="1" + fi + _python_clean_compiled_modules "${other_files[@]}" + fi + eend "${return_code}" + if [[ -n "${stderr}" ]]; then + eerror "Syntax errors / warnings in Python modules placed outside of site-packages directories for $(python_get_implementation_and_version):" &> /dev/null + while read stderr_line; do + eerror " ${stderr_line}" + done <<< "${stderr}" + fi + fi + else + # Deprecated part of python_mod_optimize() + ewarn + ewarn "Deprecation Warning: Usage of ${FUNCNAME}() in packages not supporting installation" + ewarn "for multiple Python ABIs in EAPI <=2 is deprecated and will be disallowed on 2011-08-01." + ewarn "Use EAPI >=3 and call ${FUNCNAME}() with paths having appropriate syntax." + ewarn "The ebuild needs to be fixed. Please report a bug, if it has not been already reported." + ewarn + + local myroot mydirs=() myfiles=() myopts=() return_code="0" + + # strip trailing slash + myroot="${EROOT%/}" + + # respect EROOT and options passed to compileall.py + while (($#)); do + case "$1" in + -l|-f|-q) + myopts+=("$1") + ;; + -d|-x) + myopts+=("$1" "$2") + shift + ;; + --) + shift + break + ;; + -*) + die "${FUNCNAME}(): Unrecognized option '$1'" + ;; + *) + break + ;; + esac + shift + done + + if [[ "$#" -eq 0 ]]; then + die "${FUNCNAME}(): Missing files or directories" + fi + + while (($#)); do + if [[ "$1" =~ ^($|(\.|\.\.|/)($|/)) ]]; then + die "${FUNCNAME}(): Invalid argument '$1'" + elif [[ -d "${myroot}/${1#/}" ]]; then + mydirs+=("${myroot}/${1#/}") + elif [[ -f "${myroot}/${1#/}" ]]; then + myfiles+=("${myroot}/${1#/}") + elif [[ -e "${myroot}/${1#/}" ]]; then + eerror "${FUNCNAME}(): ${myroot}/${1#/} is not a regular file or directory" + else + eerror "${FUNCNAME}(): ${myroot}/${1#/} does not exist" + fi + shift + done + + # set additional opts + myopts+=(-q) + + PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}" + + ebegin "Compilation and optimization of Python modules for $(python_get_implementation) $(python_get_version)" + if ((${#mydirs[@]})); then + "$(PYTHON ${PYTHON_ABI})" "${myroot}$(python_get_libdir)/compileall.py" "${myopts[@]}" "${mydirs[@]}" || return_code="1" + "$(PYTHON ${PYTHON_ABI})" -O "${myroot}$(python_get_libdir)/compileall.py" "${myopts[@]}" "${mydirs[@]}" &> /dev/null || return_code="1" + _python_clean_compiled_modules "${mydirs[@]}" + fi + + if ((${#myfiles[@]})); then + "$(PYTHON ${PYTHON_ABI})" "${myroot}$(python_get_libdir)/py_compile.py" "${myfiles[@]}" || return_code="1" + "$(PYTHON ${PYTHON_ABI})" -O "${myroot}$(python_get_libdir)/py_compile.py" "${myfiles[@]}" &> /dev/null || return_code="1" + _python_clean_compiled_modules "${myfiles[@]}" + fi + + eend "${return_code}" + fi +} + +# @FUNCTION: python_mod_cleanup +# @USAGE: [--allow-evaluated-non-sitedir-paths] [--] <file|directory> [files|directories] +# @DESCRIPTION: +# Delete orphaned byte-compiled Python modules corresponding to specified Python modules. +# +# This function can be used only in pkg_postrm() phase. +python_mod_cleanup() { + if [[ "${EBUILD_PHASE}" != "postrm" ]]; then + die "${FUNCNAME}() can be used only in pkg_postrm() phase" + fi + + _python_check_python_pkg_setup_execution + _python_initialize_prefix_variables + + local allow_evaluated_non_sitedir_paths="0" dir iterated_PYTHON_ABIS PYTHON_ABI="${PYTHON_ABI}" root search_paths=() sitedir + + if _python_package_supporting_installation_for_multiple_python_abis; then + if has "${EAPI:-0}" 0 1 2 3 && [[ -z "${PYTHON_ABIS}" ]]; then + die "${FUNCNAME}(): python_pkg_setup() or python_execute_function() not called" + fi + iterated_PYTHON_ABIS="${PYTHON_ABIS}" + else + if has "${EAPI:-0}" 0 1 2 3; then + iterated_PYTHON_ABIS="${PYTHON_ABI:-$(PYTHON --ABI)}" + else + iterated_PYTHON_ABIS="${PYTHON_ABI}" + fi + fi + + # Strip trailing slash from EROOT. + root="${EROOT%/}" + + while (($#)); do + case "$1" in + --allow-evaluated-non-sitedir-paths) + allow_evaluated_non_sitedir_paths="1" + ;; + --) + shift + break + ;; + -*) + die "${FUNCNAME}(): Unrecognized option '$1'" + ;; + *) + break + ;; + esac + shift + done + + if [[ "${allow_evaluated_non_sitedir_paths}" == "1" ]] && ! _python_package_supporting_installation_for_multiple_python_abis; then + die "${FUNCNAME}(): '--allow-evaluated-non-sitedir-paths' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs" + fi + + if [[ "$#" -eq 0 ]]; then + die "${FUNCNAME}(): Missing files or directories" + fi + + if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis || _python_implementation || [[ "${CATEGORY}/${PN}" == "sys-apps/portage" ]]; then + while (($#)); do + if [[ "$1" =~ ^($|(\.|\.\.|/)($|/)) ]]; then + die "${FUNCNAME}(): Invalid argument '$1'" + elif ! _python_implementation && [[ "$1" =~ ^/usr/lib(32|64)?/python[[:digit:]]+\.[[:digit:]]+ ]]; then + die "${FUNCNAME}(): Paths of directories / files in site-packages directories must be relative to site-packages directories" + elif [[ "$1" =~ ^/ ]]; then + if _python_package_supporting_installation_for_multiple_python_abis; then + if [[ "${allow_evaluated_non_sitedir_paths}" != "1" ]]; then + die "${FUNCNAME}(): Absolute paths cannot be used in ebuilds of packages supporting installation for multiple Python ABIs" + fi + if [[ "$1" != *\$* ]]; then + die "${FUNCNAME}(): '$1' has invalid syntax" + fi + for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do + eval "search_paths+=(\"\${root}$1\")" + done + else + search_paths+=("${root}$1") + fi + else + for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do + search_paths+=("${root}$(python_get_sitedir)/$1") + done + fi + shift + done + else + # Deprecated part of python_mod_cleanup() + ewarn + ewarn "Deprecation Warning: Usage of ${FUNCNAME}() in packages not supporting installation" + ewarn "for multiple Python ABIs in EAPI <=2 is deprecated and will be disallowed on 2011-08-01." + ewarn "Use EAPI >=3 and call ${FUNCNAME}() with paths having appropriate syntax." + ewarn "The ebuild needs to be fixed. Please report a bug, if it has not been already reported." + ewarn + + search_paths=("${@#/}") + search_paths=("${search_paths[@]/#/${root}/}") + fi + + _python_clean_compiled_modules "${search_paths[@]}" +} + +# ================================================================================================ +# ===================================== DEPRECATED FUNCTIONS ===================================== +# ================================================================================================ diff --git a/metadata/layout.conf b/metadata/layout.conf new file mode 100644 index 0000000..ce368fa --- /dev/null +++ b/metadata/layout.conf @@ -0,0 +1,3 @@ +sign-manifests = false +thin-manifests = true +manifest-hashes = SHA256 SHA512 WHIRLPOOL diff --git a/profiles/eapi b/profiles/eapi new file mode 100644 index 0000000..b8626c4 --- /dev/null +++ b/profiles/eapi @@ -0,0 +1 @@ +4 diff --git a/profiles/repo_name b/profiles/repo_name new file mode 100644 index 0000000..a8b3fd2 --- /dev/null +++ b/profiles/repo_name @@ -0,0 +1 @@ +improvise |