aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Shelton <stuart@shelton.me>2018-04-27 21:17:15 +0100
committerStuart Shelton <stuart@shelton.me>2018-04-27 21:26:47 +0100
commitdd1a1769cee072593104b673daee42cffe9ddd79 (patch)
tree393b2ac1ca2ace3cfdd3b58b72d1061a14eb892a /dev-lang
parentRemove obsolete colordiff ebuilds with no remaining upstream downloads (diff)
downloadsrcshelton-dd1a1769cee072593104b673daee42cffe9ddd79.tar.gz
srcshelton-dd1a1769cee072593104b673daee42cffe9ddd79.tar.bz2
srcshelton-dd1a1769cee072593104b673daee42cffe9ddd79.zip
Remove obsolete python ebuilds with no remaining upstream downloads
Diffstat (limited to 'dev-lang')
-rw-r--r--dev-lang/python/files/CVE-2013-4238_py27.patch247
-rw-r--r--dev-lang/python/files/python-2.7-issue16248.patch19
-rw-r--r--dev-lang/python/files/python-2.7-issue17919.patch54
-rw-r--r--dev-lang/python/files/python-2.7-issue18851.patch287
-rw-r--r--dev-lang/python/files/python-2.7.5-library-path.patch25
-rw-r--r--dev-lang/python/files/python-2.7.5-re_unsigned_ptrdiff.patch23
-rw-r--r--dev-lang/python/files/python-2.7.6-recvfrom_into_buffer_overflow.patch17
-rw-r--r--dev-lang/python/python-2.7.5-r4.ebuild568
-rw-r--r--dev-lang/python/python-2.7.6-r1.ebuild581
-rw-r--r--dev-lang/python/python-2.7.8.ebuild587
10 files changed, 0 insertions, 2408 deletions
diff --git a/dev-lang/python/files/CVE-2013-4238_py27.patch b/dev-lang/python/files/CVE-2013-4238_py27.patch
deleted file mode 100644
index e215589d..00000000
--- a/dev-lang/python/files/CVE-2013-4238_py27.patch
+++ /dev/null
@@ -1,247 +0,0 @@
-diff -r 9ddc63c039ba Lib/test/nullbytecert.pem
---- /dev/null Thu Jan 01 00:00:00 1970 +0000
-+++ b/Lib/test/nullbytecert.pem Sun Aug 11 18:13:17 2013 +0200
-@@ -0,0 +1,90 @@
-+Certificate:
-+ Data:
-+ Version: 3 (0x2)
-+ Serial Number: 0 (0x0)
-+ Signature Algorithm: sha1WithRSAEncryption
-+ Issuer: C=US, ST=Oregon, L=Beaverton, O=Python Software Foundation, OU=Python Core Development, CN=null.python.org\x00example.org/emailAddress=python-dev@python.org
-+ Validity
-+ Not Before: Aug 7 13:11:52 2013 GMT
-+ Not After : Aug 7 13:12:52 2013 GMT
-+ Subject: C=US, ST=Oregon, L=Beaverton, O=Python Software Foundation, OU=Python Core Development, CN=null.python.org\x00example.org/emailAddress=python-dev@python.org
-+ Subject Public Key Info:
-+ Public Key Algorithm: rsaEncryption
-+ Public-Key: (2048 bit)
-+ Modulus:
-+ 00:b5:ea:ed:c9:fb:46:7d:6f:3b:76:80:dd:3a:f3:
-+ 03:94:0b:a7:a6:db:ec:1d:df:ff:23:74:08:9d:97:
-+ 16:3f:a3:a4:7b:3e:1b:0e:96:59:25:03:a7:26:e2:
-+ 88:a9:cf:79:cd:f7:04:56:b0:ab:79:32:6e:59:c1:
-+ 32:30:54:eb:58:a8:cb:91:f0:42:a5:64:27:cb:d4:
-+ 56:31:88:52:ad:cf:bd:7f:f0:06:64:1f:cc:27:b8:
-+ a3:8b:8c:f3:d8:29:1f:25:0b:f5:46:06:1b:ca:02:
-+ 45:ad:7b:76:0a:9c:bf:bb:b9:ae:0d:16:ab:60:75:
-+ ae:06:3e:9c:7c:31:dc:92:2f:29:1a:e0:4b:0c:91:
-+ 90:6c:e9:37:c5:90:d7:2a:d7:97:15:a3:80:8f:5d:
-+ 7b:49:8f:54:30:d4:97:2c:1c:5b:37:b5:ab:69:30:
-+ 68:43:d3:33:78:4b:02:60:f5:3c:44:80:a1:8f:e7:
-+ f0:0f:d1:5e:87:9e:46:cf:62:fc:f9:bf:0c:65:12:
-+ f1:93:c8:35:79:3f:c8:ec:ec:47:f5:ef:be:44:d5:
-+ ae:82:1e:2d:9a:9f:98:5a:67:65:e1:74:70:7c:cb:
-+ d3:c2:ce:0e:45:49:27:dc:e3:2d:d4:fb:48:0e:2f:
-+ 9e:77:b8:14:46:c0:c4:36:ca:02:ae:6a:91:8c:da:
-+ 2f:85
-+ Exponent: 65537 (0x10001)
-+ X509v3 extensions:
-+ X509v3 Basic Constraints: critical
-+ CA:FALSE
-+ X509v3 Subject Key Identifier:
-+ 88:5A:55:C0:52:FF:61:CD:52:A3:35:0F:EA:5A:9C:24:38:22:F7:5C
-+ X509v3 Key Usage:
-+ Digital Signature, Non Repudiation, Key Encipherment
-+ X509v3 Subject Alternative Name:
-+ *************************************************************
-+ WARNING: The values for DNS, email and URI are WRONG. OpenSSL
-+ doesn't print the text after a NULL byte.
-+ *************************************************************
-+ DNS:altnull.python.org, email:null@python.org, URI:http://null.python.org, IP Address:192.0.2.1, IP Address:2001:DB8:0:0:0:0:0:1
-+ Signature Algorithm: sha1WithRSAEncryption
-+ ac:4f:45:ef:7d:49:a8:21:70:8e:88:59:3e:d4:36:42:70:f5:
-+ a3:bd:8b:d7:a8:d0:58:f6:31:4a:b1:a4:a6:dd:6f:d9:e8:44:
-+ 3c:b6:0a:71:d6:7f:b1:08:61:9d:60:ce:75:cf:77:0c:d2:37:
-+ 86:02:8d:5e:5d:f9:0f:71:b4:16:a8:c1:3d:23:1c:f1:11:b3:
-+ 56:6e:ca:d0:8d:34:94:e6:87:2a:99:f2:ae:ae:cc:c2:e8:86:
-+ de:08:a8:7f:c5:05:fa:6f:81:a7:82:e6:d0:53:9d:34:f4:ac:
-+ 3e:40:fe:89:57:7a:29:a4:91:7e:0b:c6:51:31:e5:10:2f:a4:
-+ 60:76:cd:95:51:1a:be:8b:a1:b0:fd:ad:52:bd:d7:1b:87:60:
-+ d2:31:c7:17:c4:18:4f:2d:08:25:a3:a7:4f:b7:92:ca:e2:f5:
-+ 25:f1:54:75:81:9d:b3:3d:61:a2:f7:da:ed:e1:c6:6f:2c:60:
-+ 1f:d8:6f:c5:92:05:ab:c9:09:62:49:a9:14:ad:55:11:cc:d6:
-+ 4a:19:94:99:97:37:1d:81:5f:8b:cf:a3:a8:96:44:51:08:3d:
-+ 0b:05:65:12:eb:b6:70:80:88:48:72:4f:c6:c2:da:cf:cd:8e:
-+ 5b:ba:97:2f:60:b4:96:56:49:5e:3a:43:76:63:04:be:2a:f6:
-+ c1:ca:a9:94
-+-----BEGIN CERTIFICATE-----
-+MIIE2DCCA8CgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBxTELMAkGA1UEBhMCVVMx
-+DzANBgNVBAgMBk9yZWdvbjESMBAGA1UEBwwJQmVhdmVydG9uMSMwIQYDVQQKDBpQ
-+eXRob24gU29mdHdhcmUgRm91bmRhdGlvbjEgMB4GA1UECwwXUHl0aG9uIENvcmUg
-+RGV2ZWxvcG1lbnQxJDAiBgNVBAMMG251bGwucHl0aG9uLm9yZwBleGFtcGxlLm9y
-+ZzEkMCIGCSqGSIb3DQEJARYVcHl0aG9uLWRldkBweXRob24ub3JnMB4XDTEzMDgw
-+NzEzMTE1MloXDTEzMDgwNzEzMTI1MlowgcUxCzAJBgNVBAYTAlVTMQ8wDQYDVQQI
-+DAZPcmVnb24xEjAQBgNVBAcMCUJlYXZlcnRvbjEjMCEGA1UECgwaUHl0aG9uIFNv
-+ZnR3YXJlIEZvdW5kYXRpb24xIDAeBgNVBAsMF1B5dGhvbiBDb3JlIERldmVsb3Bt
-+ZW50MSQwIgYDVQQDDBtudWxsLnB5dGhvbi5vcmcAZXhhbXBsZS5vcmcxJDAiBgkq
-+hkiG9w0BCQEWFXB5dGhvbi1kZXZAcHl0aG9uLm9yZzCCASIwDQYJKoZIhvcNAQEB
-+BQADggEPADCCAQoCggEBALXq7cn7Rn1vO3aA3TrzA5QLp6bb7B3f/yN0CJ2XFj+j
-+pHs+Gw6WWSUDpybiiKnPec33BFawq3kyblnBMjBU61ioy5HwQqVkJ8vUVjGIUq3P
-+vX/wBmQfzCe4o4uM89gpHyUL9UYGG8oCRa17dgqcv7u5rg0Wq2B1rgY+nHwx3JIv
-+KRrgSwyRkGzpN8WQ1yrXlxWjgI9de0mPVDDUlywcWze1q2kwaEPTM3hLAmD1PESA
-+oY/n8A/RXoeeRs9i/Pm/DGUS8ZPINXk/yOzsR/XvvkTVroIeLZqfmFpnZeF0cHzL
-+08LODkVJJ9zjLdT7SA4vnne4FEbAxDbKAq5qkYzaL4UCAwEAAaOB0DCBzTAMBgNV
-+HRMBAf8EAjAAMB0GA1UdDgQWBBSIWlXAUv9hzVKjNQ/qWpwkOCL3XDALBgNVHQ8E
-+BAMCBeAwgZAGA1UdEQSBiDCBhYIeYWx0bnVsbC5weXRob24ub3JnAGV4YW1wbGUu
-+Y29tgSBudWxsQHB5dGhvbi5vcmcAdXNlckBleGFtcGxlLm9yZ4YpaHR0cDovL251
-+bGwucHl0aG9uLm9yZwBodHRwOi8vZXhhbXBsZS5vcmeHBMAAAgGHECABDbgAAAAA
-+AAAAAAAAAAEwDQYJKoZIhvcNAQEFBQADggEBAKxPRe99SaghcI6IWT7UNkJw9aO9
-+i9eo0Fj2MUqxpKbdb9noRDy2CnHWf7EIYZ1gznXPdwzSN4YCjV5d+Q9xtBaowT0j
-+HPERs1ZuytCNNJTmhyqZ8q6uzMLoht4IqH/FBfpvgaeC5tBTnTT0rD5A/olXeimk
-+kX4LxlEx5RAvpGB2zZVRGr6LobD9rVK91xuHYNIxxxfEGE8tCCWjp0+3ksri9SXx
-+VHWBnbM9YaL32u3hxm8sYB/Yb8WSBavJCWJJqRStVRHM1koZlJmXNx2BX4vPo6iW
-+RFEIPQsFZRLrtnCAiEhyT8bC2s/Njlu6ly9gtJZWSV46Q3ZjBL4q9sHKqZQ=
-+-----END CERTIFICATE-----
-diff -r 9ddc63c039ba Lib/test/test_ssl.py
---- a/Lib/test/test_ssl.py Sun Aug 11 13:04:50 2013 +0300
-+++ b/Lib/test/test_ssl.py Sun Aug 11 18:13:17 2013 +0200
-@@ -25,6 +25,7 @@
- HOST = test_support.HOST
- CERTFILE = None
- SVN_PYTHON_ORG_ROOT_CERT = None
-+NULLBYTECERT = None
-
- def handle_error(prefix):
- exc_format = ' '.join(traceback.format_exception(*sys.exc_info()))
-@@ -123,6 +124,27 @@
- ('DNS', 'projects.forum.nokia.com'))
- )
-
-+ def test_parse_cert_CVE_2013_4073(self):
-+ p = ssl._ssl._test_decode_cert(NULLBYTECERT)
-+ if test_support.verbose:
-+ sys.stdout.write("\n" + pprint.pformat(p) + "\n")
-+ subject = ((('countryName', 'US'),),
-+ (('stateOrProvinceName', 'Oregon'),),
-+ (('localityName', 'Beaverton'),),
-+ (('organizationName', 'Python Software Foundation'),),
-+ (('organizationalUnitName', 'Python Core Development'),),
-+ (('commonName', 'null.python.org\x00example.org'),),
-+ (('emailAddress', 'python-dev@python.org'),))
-+ self.assertEqual(p['subject'], subject)
-+ self.assertEqual(p['issuer'], subject)
-+ self.assertEqual(p['subjectAltName'],
-+ (('DNS', 'altnull.python.org\x00example.com'),
-+ ('email', 'null@python.org\x00user@example.org'),
-+ ('URI', 'http://null.python.org\x00http://example.org'),
-+ ('IP Address', '192.0.2.1'),
-+ ('IP Address', '2001:DB8:0:0:0:0:0:1\n'))
-+ )
-+
- def test_DER_to_PEM(self):
- with open(SVN_PYTHON_ORG_ROOT_CERT, 'r') as f:
- pem = f.read()
-@@ -1360,7 +1382,7 @@
-
-
- def test_main(verbose=False):
-- global CERTFILE, SVN_PYTHON_ORG_ROOT_CERT, NOKIACERT
-+ global CERTFILE, SVN_PYTHON_ORG_ROOT_CERT, NOKIACERT, NULLBYTECERT
- CERTFILE = os.path.join(os.path.dirname(__file__) or os.curdir,
- "keycert.pem")
- SVN_PYTHON_ORG_ROOT_CERT = os.path.join(
-@@ -1368,10 +1390,13 @@
- "https_svn_python_org_root.pem")
- NOKIACERT = os.path.join(os.path.dirname(__file__) or os.curdir,
- "nokia.pem")
-+ NULLBYTECERT = os.path.join(os.path.dirname(__file__) or os.curdir,
-+ "nullbytecert.pem")
-
- if (not os.path.exists(CERTFILE) or
- not os.path.exists(SVN_PYTHON_ORG_ROOT_CERT) or
-- not os.path.exists(NOKIACERT)):
-+ not os.path.exists(NOKIACERT) or
-+ not os.path.exists(NULLBYTECERT)):
- raise test_support.TestFailed("Can't read certificate files!")
-
- tests = [BasicTests, BasicSocketTests]
-diff -r 9ddc63c039ba Modules/_ssl.c
---- a/Modules/_ssl.c Sun Aug 11 13:04:50 2013 +0300
-+++ b/Modules/_ssl.c Sun Aug 11 18:13:17 2013 +0200
-@@ -741,8 +741,13 @@
-
- /* get a rendering of each name in the set of names */
-
-+ int gntype;
-+ ASN1_STRING *as = NULL;
-+
- name = sk_GENERAL_NAME_value(names, j);
-- if (name->type == GEN_DIRNAME) {
-+ gntype = name-> type;
-+ switch (gntype) {
-+ case GEN_DIRNAME:
-
- /* we special-case DirName as a tuple of tuples of attributes */
-
-@@ -764,11 +769,61 @@
- goto fail;
- }
- PyTuple_SET_ITEM(t, 1, v);
-+ break;
-
-- } else {
-+ case GEN_EMAIL:
-+ case GEN_DNS:
-+ case GEN_URI:
-+ /* GENERAL_NAME_print() doesn't handle NUL bytes in ASN1_string
-+ correctly. */
-+ t = PyTuple_New(2);
-+ if (t == NULL)
-+ goto fail;
-+ switch (gntype) {
-+ case GEN_EMAIL:
-+ v = PyUnicode_FromString("email");
-+ as = name->d.rfc822Name;
-+ break;
-+ case GEN_DNS:
-+ v = PyUnicode_FromString("DNS");
-+ as = name->d.dNSName;
-+ break;
-+ case GEN_URI:
-+ v = PyUnicode_FromString("URI");
-+ as = name->d.uniformResourceIdentifier;
-+ break;
-+ }
-+ if (v == NULL) {
-+ Py_DECREF(t);
-+ goto fail;
-+ }
-+ PyTuple_SET_ITEM(t, 0, v);
-+ v = PyString_FromStringAndSize((char *)ASN1_STRING_data(as),
-+ ASN1_STRING_length(as));
-+ if (v == NULL) {
-+ Py_DECREF(t);
-+ goto fail;
-+ }
-+ PyTuple_SET_ITEM(t, 1, v);
-+ break;
-
-+ default:
- /* for everything else, we use the OpenSSL print form */
--
-+ switch (gntype) {
-+ /* check for new general name type */
-+ case GEN_OTHERNAME:
-+ case GEN_X400:
-+ case GEN_EDIPARTY:
-+ case GEN_IPADD:
-+ case GEN_RID:
-+ break;
-+ default:
-+ if (PyErr_Warn(PyExc_RuntimeWarning,
-+ "Unknown general name type") == -1) {
-+ goto fail;
-+ }
-+ break;
-+ }
- (void) BIO_reset(biobuf);
- GENERAL_NAME_print(biobuf, name);
- len = BIO_gets(biobuf, buf, sizeof(buf)-1);
-@@ -794,6 +849,7 @@
- goto fail;
- }
- PyTuple_SET_ITEM(t, 1, v);
-+ break;
- }
-
- /* and add that rendering to the list */
diff --git a/dev-lang/python/files/python-2.7-issue16248.patch b/dev-lang/python/files/python-2.7-issue16248.patch
deleted file mode 100644
index ce9c654c..00000000
--- a/dev-lang/python/files/python-2.7-issue16248.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-# HG changeset patch
-# User Antoine Pitrou <solipsis@pitrou.net>
-# Date 1375388712 -7200
-# Node ID 0f17aed78168e63ec058c219d03cea7240f83dd6
-# Parent bb546f6d8ab4f513804d7a420657963881e5b447
-Fix tkinter regression introduced by the security fix in #16248.
-
-diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py
---- a/Lib/lib-tk/Tkinter.py
-+++ b/Lib/lib-tk/Tkinter.py
-@@ -1736,7 +1736,7 @@ class Tk(Misc, Wm):
- # ensure that self.tk is always _something_.
- self.tk = None
- if baseName is None:
-- import sys, os
-+ import os
- baseName = os.path.basename(sys.argv[0])
- baseName, ext = os.path.splitext(baseName)
- if ext not in ('.py', '.pyc', '.pyo'):
diff --git a/dev-lang/python/files/python-2.7-issue17919.patch b/dev-lang/python/files/python-2.7-issue17919.patch
deleted file mode 100644
index e7568922..00000000
--- a/dev-lang/python/files/python-2.7-issue17919.patch
+++ /dev/null
@@ -1,54 +0,0 @@
---- Modules/selectmodule.c.orig 2013-11-11 17:14:37.966910450 +0100
-+++ Modules/selectmodule.c 2013-11-11 17:17:12.532891570 +0100
-@@ -346,6 +346,7 @@
- assert(i < self->ufd_len);
- /* Never overflow */
- self->ufds[i].fd = (int)PyInt_AsLong(key);
-+ /* Why does a bitfield need to be signed at all? */
- self->ufds[i].events = (short)PyInt_AsLong(value);
- i++;
- }
-@@ -366,10 +367,10 @@
- {
- PyObject *o, *key, *value;
- int fd;
-- short events = POLLIN | POLLPRI | POLLOUT;
-+ unsigned short events = POLLIN | POLLPRI | POLLOUT;
- int err;
-
-- if (!PyArg_ParseTuple(args, "O|h:register", &o, &events)) {
-+ if (!PyArg_ParseTuple(args, "O|H:register", &o, &events)) {
- return NULL;
- }
-
-@@ -409,10 +410,11 @@
- poll_modify(pollObject *self, PyObject *args)
- {
- PyObject *o, *key, *value;
-- int fd, events;
-+ int fd;
-+ unsigned short events;
- int err;
-
-- if (!PyArg_ParseTuple(args, "Oi:modify", &o, &events)) {
-+ if (!PyArg_ParseTuple(args, "OH:modify", &o, &events)) {
- return NULL;
- }
-
-@@ -552,11 +554,12 @@
- }
- PyTuple_SET_ITEM(value, 0, num);
-
-- /* The &0xffff is a workaround for AIX. 'revents'
-- is a 16-bit short, and IBM assigned POLLNVAL
-+ /* The 'unsigned' cast is necessary for AIX. 'revents'
-+ is a 16-bit signed short, but IBM assigned POLLNVAL
- to be 0x8000, so the conversion to int results
-- in a negative number. See SF bug #923315. */
-- num = PyInt_FromLong(self->ufds[i].revents & 0xffff);
-+ in a negative number. See issue17919 and issue923315.
-+ Why does a bitfield need to be signed at all? */
-+ num = PyInt_FromLong((unsigned short)self->ufds[i].revents);
- if (num == NULL) {
- Py_DECREF(value);
- goto error;
diff --git a/dev-lang/python/files/python-2.7-issue18851.patch b/dev-lang/python/files/python-2.7-issue18851.patch
deleted file mode 100644
index 35c69ae2..00000000
--- a/dev-lang/python/files/python-2.7-issue18851.patch
+++ /dev/null
@@ -1,287 +0,0 @@
-# HG changeset patch
-# User Antoine Pitrou <solipsis@pitrou.net>
-# Date 1377898693 -7200
-# Node ID 43749cb6bdbd0fdab70f76cd171c3c02a3f600dd
-# Parent ba54011aa295004ad87438211fe3bb1568dd69ab
-Issue #18851: Avoid a double close of subprocess pipes when the child process fails starting.
-
-diff --git a/Lib/subprocess.py b/Lib/subprocess.py
---- a/Lib/subprocess.py
-+++ b/Lib/subprocess.py
-@@ -698,12 +698,12 @@ class Popen(object):
-
- (p2cread, p2cwrite,
- c2pread, c2pwrite,
-- errread, errwrite) = self._get_handles(stdin, stdout, stderr)
-+ errread, errwrite), to_close = self._get_handles(stdin, stdout, stderr)
-
- try:
- self._execute_child(args, executable, preexec_fn, close_fds,
- cwd, env, universal_newlines,
-- startupinfo, creationflags, shell,
-+ startupinfo, creationflags, shell, to_close,
- p2cread, p2cwrite,
- c2pread, c2pwrite,
- errread, errwrite)
-@@ -711,18 +711,12 @@ class Popen(object):
- # Preserve original exception in case os.close raises.
- exc_type, exc_value, exc_trace = sys.exc_info()
-
-- to_close = []
-- # Only close the pipes we created.
-- if stdin == PIPE:
-- to_close.extend((p2cread, p2cwrite))
-- if stdout == PIPE:
-- to_close.extend((c2pread, c2pwrite))
-- if stderr == PIPE:
-- to_close.extend((errread, errwrite))
--
- for fd in to_close:
- try:
-- os.close(fd)
-+ if mswindows:
-+ fd.Close()
-+ else:
-+ os.close(fd)
- except EnvironmentError:
- pass
-
-@@ -816,8 +810,9 @@ class Popen(object):
- """Construct and return tuple with IO objects:
- p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite
- """
-+ to_close = set()
- if stdin is None and stdout is None and stderr is None:
-- return (None, None, None, None, None, None)
-+ return (None, None, None, None, None, None), to_close
-
- p2cread, p2cwrite = None, None
- c2pread, c2pwrite = None, None
-@@ -835,6 +830,10 @@ class Popen(object):
- # Assuming file-like object
- p2cread = msvcrt.get_osfhandle(stdin.fileno())
- p2cread = self._make_inheritable(p2cread)
-+ # We just duplicated the handle, it has to be closed at the end
-+ to_close.add(p2cread)
-+ if stdin == PIPE:
-+ to_close.add(p2cwrite)
-
- if stdout is None:
- c2pwrite = _subprocess.GetStdHandle(_subprocess.STD_OUTPUT_HANDLE)
-@@ -848,6 +847,10 @@ class Popen(object):
- # Assuming file-like object
- c2pwrite = msvcrt.get_osfhandle(stdout.fileno())
- c2pwrite = self._make_inheritable(c2pwrite)
-+ # We just duplicated the handle, it has to be closed at the end
-+ to_close.add(c2pwrite)
-+ if stdout == PIPE:
-+ to_close.add(c2pread)
-
- if stderr is None:
- errwrite = _subprocess.GetStdHandle(_subprocess.STD_ERROR_HANDLE)
-@@ -863,10 +866,14 @@ class Popen(object):
- # Assuming file-like object
- errwrite = msvcrt.get_osfhandle(stderr.fileno())
- errwrite = self._make_inheritable(errwrite)
-+ # We just duplicated the handle, it has to be closed at the end
-+ to_close.add(errwrite)
-+ if stderr == PIPE:
-+ to_close.add(errread)
-
- return (p2cread, p2cwrite,
- c2pread, c2pwrite,
-- errread, errwrite)
-+ errread, errwrite), to_close
-
-
- def _make_inheritable(self, handle):
-@@ -895,7 +902,7 @@ class Popen(object):
-
- def _execute_child(self, args, executable, preexec_fn, close_fds,
- cwd, env, universal_newlines,
-- startupinfo, creationflags, shell,
-+ startupinfo, creationflags, shell, to_close,
- p2cread, p2cwrite,
- c2pread, c2pwrite,
- errread, errwrite):
-@@ -934,6 +941,10 @@ class Popen(object):
- # kill children.
- creationflags |= _subprocess.CREATE_NEW_CONSOLE
-
-+ def _close_in_parent(fd):
-+ fd.Close()
-+ to_close.remove(fd)
-+
- # Start the process
- try:
- hp, ht, pid, tid = _subprocess.CreateProcess(executable, args,
-@@ -958,11 +969,11 @@ class Popen(object):
- # pipe will not close when the child process exits and the
- # ReadFile will hang.
- if p2cread is not None:
-- p2cread.Close()
-+ _close_in_parent(p2cread)
- if c2pwrite is not None:
-- c2pwrite.Close()
-+ _close_in_parent(c2pwrite)
- if errwrite is not None:
-- errwrite.Close()
-+ _close_in_parent(errwrite)
-
- # Retain the process handle, but close the thread handle
- self._child_created = True
-@@ -1088,6 +1099,7 @@ class Popen(object):
- """Construct and return tuple with IO objects:
- p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite
- """
-+ to_close = set()
- p2cread, p2cwrite = None, None
- c2pread, c2pwrite = None, None
- errread, errwrite = None, None
-@@ -1096,6 +1108,7 @@ class Popen(object):
- pass
- elif stdin == PIPE:
- p2cread, p2cwrite = self.pipe_cloexec()
-+ to_close.update((p2cread, p2cwrite))
- elif isinstance(stdin, int):
- p2cread = stdin
- else:
-@@ -1106,6 +1119,7 @@ class Popen(object):
- pass
- elif stdout == PIPE:
- c2pread, c2pwrite = self.pipe_cloexec()
-+ to_close.update((c2pread, c2pwrite))
- elif isinstance(stdout, int):
- c2pwrite = stdout
- else:
-@@ -1116,6 +1130,7 @@ class Popen(object):
- pass
- elif stderr == PIPE:
- errread, errwrite = self.pipe_cloexec()
-+ to_close.update((errread, errwrite))
- elif stderr == STDOUT:
- errwrite = c2pwrite
- elif isinstance(stderr, int):
-@@ -1126,7 +1141,7 @@ class Popen(object):
-
- return (p2cread, p2cwrite,
- c2pread, c2pwrite,
-- errread, errwrite)
-+ errread, errwrite), to_close
-
-
- def _set_cloexec_flag(self, fd, cloexec=True):
-@@ -1170,7 +1185,7 @@ class Popen(object):
-
- def _execute_child(self, args, executable, preexec_fn, close_fds,
- cwd, env, universal_newlines,
-- startupinfo, creationflags, shell,
-+ startupinfo, creationflags, shell, to_close,
- p2cread, p2cwrite,
- c2pread, c2pwrite,
- errread, errwrite):
-@@ -1189,6 +1204,10 @@ class Popen(object):
- if executable is None:
- executable = args[0]
-
-+ def _close_in_parent(fd):
-+ os.close(fd)
-+ to_close.remove(fd)
-+
- # For transferring possible exec failure from child to parent
- # The first char specifies the exception type: 0 means
- # OSError, 1 means some other error.
-@@ -1283,17 +1302,17 @@ class Popen(object):
- # be sure the FD is closed no matter what
- os.close(errpipe_write)
-
-- if p2cread is not None and p2cwrite is not None:
-- os.close(p2cread)
-- if c2pwrite is not None and c2pread is not None:
-- os.close(c2pwrite)
-- if errwrite is not None and errread is not None:
-- os.close(errwrite)
--
- # Wait for exec to fail or succeed; possibly raising exception
- # Exception limited to 1M
- data = _eintr_retry_call(os.read, errpipe_read, 1048576)
- finally:
-+ if p2cread is not None and p2cwrite is not None:
-+ _close_in_parent(p2cread)
-+ if c2pwrite is not None and c2pread is not None:
-+ _close_in_parent(c2pwrite)
-+ if errwrite is not None and errread is not None:
-+ _close_in_parent(errwrite)
-+
- # be sure the FD is closed no matter what
- os.close(errpipe_read)
-
-diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
---- a/Lib/test/test_subprocess.py
-+++ b/Lib/test/test_subprocess.py
-@@ -14,6 +14,10 @@ try:
- import resource
- except ImportError:
- resource = None
-+try:
-+ import threading
-+except ImportError:
-+ threading = None
-
- mswindows = (sys.platform == "win32")
-
-@@ -629,6 +633,36 @@ class ProcessTestCase(BaseTestCase):
- if c.exception.errno not in (errno.ENOENT, errno.EACCES):
- raise c.exception
-
-+ @unittest.skipIf(threading is None, "threading required")
-+ def test_double_close_on_error(self):
-+ # Issue #18851
-+ fds = []
-+ def open_fds():
-+ for i in range(20):
-+ fds.extend(os.pipe())
-+ time.sleep(0.001)
-+ t = threading.Thread(target=open_fds)
-+ t.start()
-+ try:
-+ with self.assertRaises(EnvironmentError):
-+ subprocess.Popen(['nonexisting_i_hope'],
-+ stdin=subprocess.PIPE,
-+ stdout=subprocess.PIPE,
-+ stderr=subprocess.PIPE)
-+ finally:
-+ t.join()
-+ exc = None
-+ for fd in fds:
-+ # If a double close occurred, some of those fds will
-+ # already have been closed by mistake, and os.close()
-+ # here will raise.
-+ try:
-+ os.close(fd)
-+ except OSError as e:
-+ exc = e
-+ if exc is not None:
-+ raise exc
-+
- def test_handles_closed_on_exception(self):
- # If CreateProcess exits with an error, ensure the
- # duplicate output handles are released
-@@ -783,7 +817,7 @@ class POSIXProcessTestCase(BaseTestCase)
-
- def _execute_child(
- self, args, executable, preexec_fn, close_fds, cwd, env,
-- universal_newlines, startupinfo, creationflags, shell,
-+ universal_newlines, startupinfo, creationflags, shell, to_close,
- p2cread, p2cwrite,
- c2pread, c2pwrite,
- errread, errwrite):
-@@ -791,7 +825,7 @@ class POSIXProcessTestCase(BaseTestCase)
- subprocess.Popen._execute_child(
- self, args, executable, preexec_fn, close_fds,
- cwd, env, universal_newlines,
-- startupinfo, creationflags, shell,
-+ startupinfo, creationflags, shell, to_close,
- p2cread, p2cwrite,
- c2pread, c2pwrite,
- errread, errwrite)
diff --git a/dev-lang/python/files/python-2.7.5-library-path.patch b/dev-lang/python/files/python-2.7.5-library-path.patch
deleted file mode 100644
index 6f435750..00000000
--- a/dev-lang/python/files/python-2.7.5-library-path.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-# HG changeset patch
-# User Ned Deily <nad@acm.org>
-# Date 1368666045 25200
-# Node ID cd577c3288860b0deb459443ca5c489dc0f99ef6
-# Parent 149340b3004acfcb68e5ed36b1e96b7463c756c7
-Issue #17990: Only modify include and library search paths when cross-compiling.
-
-diff --git a/setup.py b/setup.py
---- a/setup.py
-+++ b/setup.py
-@@ -437,9 +437,11 @@ class PyBuildExt(build_ext):
-
- def detect_modules(self):
- # Ensure that /usr/local is always used
-- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
-- add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
-- self.add_gcc_paths()
-+ if not cross_compiling:
-+ add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
-+ add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
-+ if cross_compiling:
-+ self.add_gcc_paths()
- self.add_multiarch_paths()
-
- # Add paths specified in the environment variables LDFLAGS and
diff --git a/dev-lang/python/files/python-2.7.5-re_unsigned_ptrdiff.patch b/dev-lang/python/files/python-2.7.5-re_unsigned_ptrdiff.patch
deleted file mode 100644
index a905839a..00000000
--- a/dev-lang/python/files/python-2.7.5-re_unsigned_ptrdiff.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-https://bugs.gentoo.org/show_bug.cgi?id=476426
-http://bugs.python.org/issue17998
-diff -r d91da96a55bf Modules/_sre.c
---- a/Modules/_sre.c Thu May 16 22:47:47 2013 +0100
-+++ b/Modules/_sre.c Fri May 17 21:02:48 2013 +0300
-@@ -1028,7 +1028,7 @@
- TRACE(("|%p|%p|REPEAT_ONE %d %d\n", ctx->pattern, ctx->ptr,
- ctx->pattern[1], ctx->pattern[2]));
-
-- if (ctx->pattern[1] > end - ctx->ptr)
-+ if ((Py_ssize_t) ctx->pattern[1] > end - ctx->ptr)
- RETURN_FAILURE; /* cannot match */
-
- state->ptr = ctx->ptr;
-@@ -1111,7 +1111,7 @@
- TRACE(("|%p|%p|MIN_REPEAT_ONE %d %d\n", ctx->pattern, ctx->ptr,
- ctx->pattern[1], ctx->pattern[2]));
-
-- if (ctx->pattern[1] > end - ctx->ptr)
-+ if ((Py_ssize_t) ctx->pattern[1] > end - ctx->ptr)
- RETURN_FAILURE; /* cannot match */
-
- state->ptr = ctx->ptr;
diff --git a/dev-lang/python/files/python-2.7.6-recvfrom_into_buffer_overflow.patch b/dev-lang/python/files/python-2.7.6-recvfrom_into_buffer_overflow.patch
deleted file mode 100644
index 37e786bd..00000000
--- a/dev-lang/python/files/python-2.7.6-recvfrom_into_buffer_overflow.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-diff -r 40fb60df4755 Modules/socketmodule.c
---- a/Modules/socketmodule.c Sun Jan 12 12:11:47 2014 +0200
-+++ b/Modules/socketmodule.c Mon Jan 13 16:36:35 2014 -0800
-@@ -2744,6 +2744,13 @@
- recvlen = buflen;
- }
-
-+ /* Check if the buffer is large enough */
-+ if (buflen < recvlen) {
-+ PyErr_SetString(PyExc_ValueError,
-+ "buffer too small for requested bytes");
-+ goto error;
-+ }
-+
- readlen = sock_recvfrom_guts(s, buf.buf, recvlen, flags, &addr);
- if (readlen < 0) {
- /* Return an error */
diff --git a/dev-lang/python/python-2.7.5-r4.ebuild b/dev-lang/python/python-2.7.5-r4.ebuild
deleted file mode 100644
index 96cca2e2..00000000
--- a/dev-lang/python/python-2.7.5-r4.ebuild
+++ /dev/null
@@ -1,568 +0,0 @@
-# Copyright 1999-2014 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-2.7.5-r4.ebuild,v 1.4 2014/01/18 11:37:42 vapier Exp $
-
-EAPI="4"
-WANT_AUTOMAKE="none"
-WANT_LIBTOOL="none"
-
-inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs multiprocessing
-
-MY_P="Python-${PV}"
-PATCHSET_REVISION="0"
-PREFIX_PATCHREV="-r3"
-
-DESCRIPTION="An interpreted, interactive, object-oriented programming language"
-HOMEPAGE="http://www.python.org/"
-SRC_URI="http://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz
- mirror://gentoo/python-gentoo-patches-${PV}-${PATCHSET_REVISION}.tar.xz
- prefix? ( https://dev.gentoo.org/~grobian/distfiles/python-prefix-${PV}-gentoo-patches${PREFIX_PATCHREV}.tar.bz2 )"
-
-LICENSE="PSF-2"
-SLOT="2.7"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-aix ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="aqua -berkdb build doc elibc_uclibc examples gdbm hardened ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
-
-# Do not add a dependency on dev-lang/python to this ebuild.
-# If you need to apply a patch which requires python for bootstrapping, please
-# run the bootstrap code on your dev box and include the results in the
-# patchset. See bug 447752.
-
-RDEPEND="app-arch/bzip2
- >=sys-libs/zlib-1.1.3
- !m68k-mint? ( virtual/libffi )
- virtual/libintl
- !build? (
- berkdb? ( || (
- sys-libs/db:5.3
- sys-libs/db:5.2
- sys-libs/db:5.1
- sys-libs/db:5.0
- 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[berkdb] )
- ncurses? (
- >=sys-libs/ncurses-5.2
- readline? ( >=sys-libs/readline-4.1 )
- )
- sqlite? ( >=dev-db/sqlite-3.3.8:3 )
- ssl? ( dev-libs/openssl )
- tk? (
- >=dev-lang/tk-8.0[-aqua]
- dev-tcltk/blt
- )
- xml? ( >=dev-libs/expat-2.1 )
- )
- !!<sys-apps/portage-2.1.9"
-DEPEND="${RDEPEND}
- virtual/pkgconfig
- >=sys-devel/autoconf-2.65
- !sys-devel/gcc[libffi]"
-RDEPEND+=" !build? ( app-misc/mime-types )
- doc? ( dev-python/python-docs:${SLOT} )"
-PDEPEND="app-admin/eselect-python
- app-admin/python-updater"
-
-S="${WORKDIR}/${MY_P}"
-
-pkg_setup() {
- if use berkdb; then
- ewarn "'bsddb' module is out-of-date and no longer maintained inside"
- ewarn "dev-lang/python. 'bsddb' and 'dbhash' modules have been additionally"
- ewarn "removed in Python 3. A maintained alternative of 'bsddb3' module"
- ewarn "is provided by dev-python/bsddb3."
- else
- if has_version "=${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"; then
- ewarn "You are migrating from =${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"
- ewarn "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 -r Modules/expat || die
- rm -r Modules/_ctypes/libffi* || die
- rm -r Modules/zlib || die
-
- if tc-is-cross-compiler; then
- local EPATCH_EXCLUDE="*_regenerate_platform-specific_modules.patch"
- fi
-
- # if building a patched source-tar, comment the rm's above, and uncomment
- # this line:
- #local EPATCH_EXCLUDE=" 01_all_prefix-no-patch-invention.patch"
-
- EPATCH_SUFFIX="patch" epatch "${WORKDIR}/${PV}-${PATCHSET_REVISION}"
-
- epatch "${FILESDIR}/${P}-library-path.patch" #474882
- epatch "${FILESDIR}/${P}-re_unsigned_ptrdiff.patch" #476426
- epatch "${FILESDIR}/CVE-2013-4238_py27.patch"
- epatch "${FILESDIR}/python-2.7-issue16248.patch"
- epatch "${FILESDIR}/python-2.7-issue18851.patch"
- epatch "${FILESDIR}/python-2.7-issue18235.patch"
- epatch "${FILESDIR}/python-2.7-issue17919.patch"
-
- # Prefix' round of patches
- # http://prefix.gentooexperimental.org:8000/python-patches-2_7
- EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" \
- epatch "${WORKDIR}"/python-prefix-${PV}-gentoo-patches${PREFIX_PATCHREV}
-
- if use aqua ; then
- # make sure we don't get a framework reference here
- sed -i -e '/-DPREFIX=/s:$(prefix):$(FRAMEWORKUNIXTOOLSPREFIX):' \
- -e '/-DEXEC_PREFIX=/s:$(exec_prefix):$(FRAMEWORKUNIXTOOLSPREFIX):' \
- Makefile.pre.in || die
- # Python upstream refuses to listen to configure arguments
- sed -i -e '/FRAMEWORKINSTALLAPPSPREFIX=/s:="[^"]*":="${prefix}/../Applications":' \
- configure.ac configure || die
- fi
- # don't try to do fancy things on Darwin
- sed -i -e 's/__APPLE__/__NO_MUCKING_AROUND__/g' Modules/readline.c || die
-
- # Fix for cross-compiling.
- epatch "${FILESDIR}/python-2.7.5-nonfatal-compileall.patch"
-
- # On AIX, we've wrapped /usr/ccs/bin/nm to work around long TMPDIR.
- sed -i -e "/^NM=.*nm$/s,^.*$,NM=$(tc-getNM)," Modules/makexp_aix || die
-
- # Make sure python doesn't use the host libffi.
- if use prefix; then
- epatch "${FILESDIR}/python-2.7-libffi-pkgconfig.patch"
- rm configure
- fi
-
- 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@@"
-
- epatch_user
-
- eautoconf
- eautoheader
-}
-
-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.
- [[ ${CHOST} == *64-apple-darwin* ]] && disable+=" Nav _Qt" # Carbon
- [[ ${CHOST} == *-apple-darwin11 ]] && disable+=" _Fm _Qd _Qdoffs"
- 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
-
- # https://bugs.gentoo.org/show_bug.cgi?id=302137
- if [[ ${CHOST} == powerpc-*-darwin* ]] && \
- ( is-flag "-mtune=*" || is-flag "-mcpu=*" ) || \
- [[ ${CHOST} == powerpc64-*-darwin* ]];
- then
- replace-flags -O2 -O3
- replace-flags -Os -O3 # comment #14
- fi
-
- if use prefix ; then
- # for Python's setup.py not to do false assumptions (only looking in
- # host paths) we need to make explicit where Prefix stuff is
- append-cppflags -I"${EPREFIX}"/usr/include
- append-ldflags -L"${EPREFIX}"/$(get_libdir)
- append-ldflags -L"${EPREFIX}"/usr/$(get_libdir)
- # fix compilation on some 64-bits Linux hosts, #381163, #473520
- for hostlibdir in /usr/lib32 /usr/lib64 /usr/lib /lib32 /lib64; do
- [[ -d ${hostlibdir} ]] || continue
- append-ldflags -L${hostlibdir}
- done
- # Have to move $(CPPFLAGS) to before $(CFLAGS) to ensure that
- # local include paths - set in $(CPPFLAGS) - are searched first.
- sed -i -e "/^PY_CFLAGS[ \\t]*=/s,\\\$(CFLAGS)[ \\t]*\\\$(CPPFLAGS),\$(CPPFLAGS) \$(CFLAGS)," Makefile.pre.in || die
- fi
-
- # Export CC so even AIX will use gcc instead of xlc_r.
- # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile.
- tc-export CC CXX
- # The configure script fails to use pkg-config correctly.
- # http://bugs.python.org/issue15506
- export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
-
- # 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!
- # On AIX this is not needed, but would record '.' as runpath.
- [[ ${CHOST} == *-aix* ]] ||
- append-ldflags "-L."
-
- local dbmliborder
- if use gdbm; then
- dbmliborder+="${dbmliborder:+:}gdbm"
- fi
- if use berkdb; then
- dbmliborder+="${dbmliborder:+:}bdb"
- fi
-
- # Don't include libmpc on IRIX - it is only available for 64bit MIPS4 (mips-sgi-irix64)
- [[ ${CHOST} == *-irix ]] && export ac_cv_lib_mpc_usconfig=no
-
- [[ ${CHOST} == *-mint* ]] && export ac_cv_func_poll=no
-
- # we need this to get pythonw, the GUI version of python
- # --enable-framework and --enable-shared are mutually exclusive:
- # http://bugs.python.org/issue5809
- use aqua \
- && myconf="${myconf} --enable-framework=${EPREFIX}/usr/lib" \
- || myconf="${myconf} --enable-shared"
-
- BUILD_DIR="${WORKDIR}/${CHOST}"
- mkdir -p "${BUILD_DIR}" || die
- cd "${BUILD_DIR}" || die
-
- # note: for a framework build we need to use ucs2 because OSX
- # uses that internally too:
- # http://bugs.python.org/issue763708
- # HAS_HG to avoid finding obsolete hg of the host
- ECONF_SOURCE="${S}" OPT="" HAS_HG="no" \
- econf \
- --with-fpectl \
- $(use_enable ipv6) \
- $(use_with threads) \
- $( (use wide-unicode && use !aqua) && 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 \
- ${myconf}
-
- if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
- eerror "configure has detected that the sem_open function is broken."
- eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
- die "Broken sem_open function (bug 496328)"
- fi
-}
-
-src_compile() {
- # Avoid invoking pgen for cross-compiles.
- touch Include/graminit.h Python/graminit.c
-
- cd "${BUILD_DIR}" || die
- emake
-
- # Work around bug 329499. See also bug 413751 and 457194.
- if has_version dev-libs/libffi[pax_kernel]; then
- pax-mark E python
- else
- pax-mark m python
- fi
-}
-
-src_test() {
- # Tests will not work when cross compiling.
- if tc-is-cross-compiler; then
- elog "Disabling tests due to crosscompiling."
- return
- fi
-
- cd "${BUILD_DIR}" || die
-
- # 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
- done
-
- elog "The following tests have been skipped:"
- for test in ${skipped_tests}; do
- elog "test_${test}.py"
- done
-
- elog "If you would like to run them, you may:"
- elog "cd '${EPREFIX}/usr/$(get_libdir)/python${SLOT}/test'"
- elog "and run the tests separately."
-
- if [[ "${result}" -ne 0 ]]; then
- die "emake test failed"
- fi
-}
-
-src_install() {
- local libdir=${ED}/usr/$(get_libdir)/python${SLOT}
-
- cd "${BUILD_DIR}" || die
- [[ ${CHOST} == *-mint* ]] && keepdir /usr/lib/python${SLOT}/lib-dynload/
- if use aqua ; then
- local fwdir="${EPREFIX}"/usr/$(get_libdir)/Python.framework
-
- # do not make multiple targets in parallel when there are broken
- # sharedmods (during bootstrap), would build them twice in parallel.
-
- # let the makefiles do their thing
- emake -j1 CC="$(tc-getCC)" DESTDIR="${D}" STRIPFLAG= altinstall
-
- # avoid framework incompatability, degrade to a normal UNIX lib
- mkdir -p "${ED}"/usr/$(get_libdir)
- cp "${D}${fwdir}"/Versions/${SLOT}/Python \
- "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib || die
- chmod u+w "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib
- install_name_tool \
- -id "${EPREFIX}"/usr/$(get_libdir)/libpython${SLOT}.dylib \
- "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib
- chmod u-w "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib
- cp libpython${SLOT}.a "${ED}"/usr/$(get_libdir)/ || die
-
- # rebuild python executable to be the non-pythonw (python wrapper)
- # version so we don't get framework crap
- rm "${ED}"/usr/bin/python${SLOT} # drop existing symlink, bug #390861
- $(tc-getCC) "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib \
- -o "${ED}"/usr/bin/python${SLOT} \
- Modules/python.o || die
-
- # don't install the "Current" symlink, will always conflict
- rm "${D}${fwdir}"/Versions/Current || die
- # update whatever points to it, eselect-python sets them
- rm "${D}${fwdir}"/{Headers,Python,Resources} || die
-
- # remove unversioned files (that are not made versioned below)
- pushd "${ED}"/usr/bin > /dev/null
- rm -f python python-config python${SLOT}-config
- # python${SLOT} was created above
- for f in pythonw smtpd${SLOT}.py pydoc idle ; do
- rm -f ${f} ${f}${SLOT}
- done
- # pythonw needs to remain in the framework (that's the whole
- # reason we go through this framework hassle)
- ln -s ../lib/Python.framework/Versions/${SLOT}/bin/pythonw${SLOT} || die
- # copy the scripts to we can fix their shebangs
- for f in 2to3 pydoc${SLOT} idle${SLOT} python${SLOT}-config ; do
- # for some reason sometimes they already exist, bug #347321
- rm -f ${f}
- cp "${D}${fwdir}"/Versions/${SLOT}/bin/${f} . || die
- sed -i -e '1c\#!'"${EPREFIX}"'/usr/bin/python'"${SLOT}" \
- ${f} || die
- done
- # "fix" to have below collision fix not to bail
- mv pydoc${SLOT} pydoc || die
- mv idle${SLOT} idle || die
- popd > /dev/null
-
- # basically we don't like the framework stuff at all, so just move
- # stuff around or add some symlinks to make our life easier
- mkdir -p "${ED}"/usr
- mv "${D}${fwdir}"/Versions/${SLOT}/share \
- "${ED}"/usr/ || die "can't move share"
- # get includes just UNIX style
- mkdir -p "${ED}"/usr/include
- mv "${D}${fwdir}"/Versions/${SLOT}/include/python${SLOT} \
- "${ED}"/usr/include/ || die "can't move include"
- pushd "${D}${fwdir}"/Versions/${SLOT}/include > /dev/null
- ln -s ../../../../../include/python${SLOT} || die
- popd > /dev/null
-
- # same for libs
- # NOTE: can't symlink the entire dir, because a real dir already exists
- # on upgrade (site-packages), however since we h4x0rzed python to
- # actually look into the UNIX-style dir, we just switch them around.
- mkdir -p "${ED}"/usr/$(get_libdir)
- mv "${D}${fwdir}"/Versions/${SLOT}/lib/python${SLOT} \
- "${ED}"/usr/lib/ || die "can't move python${SLOT}"
- pushd "${D}${fwdir}"/Versions/${SLOT}/lib > /dev/null
- ln -s ../../../../python${SLOT} || die
- popd > /dev/null
- # remove now dead symlinks
- rm "${ED}"/usr/lib/python${SLOT}/config/libpython${SLOT}.a
- rm "${ED}"/usr/lib/python${SLOT}/config/libpython${SLOT}.dylib
-
- # fix up Makefile
- sed -i \
- -e '/^LINKFORSHARED=/s/-u _PyMac_Error.*$//' \
- -e '/^LDFLAGS=/s/=.*$/=/' \
- -e '/^prefix=/s:=.*$:= '"${EPREFIX}"'/usr:' \
- -e '/^PYTHONFRAMEWORK=/s/=.*$/=/' \
- -e '/^PYTHONFRAMEWORKDIR=/s/=.*$/= no-framework/' \
- -e '/^PYTHONFRAMEWORKPREFIX=/s/=.*$/=/' \
- -e '/^PYTHONFRAMEWORKINSTALLDIR=/s/=.*$/=/' \
- -e '/^LDLIBRARY=/s:=.*$:libpython$(VERSION).dylib:' \
- "${ED}"/usr/lib/python${SLOT}/config/Makefile || die
-
- # add missing version.plist file
- mkdir -p "${D}${fwdir}"/Versions/${SLOT}/Resources
- cat > "${D}${fwdir}"/Versions/${SLOT}/Resources/version.plist << EOF
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
-"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>BuildVersion</key>
- <string>1</string>
- <key>CFBundleShortVersionString</key>
- <string>${PV}</string>
- <key>CFBundleVersion</key>
- <string>${PV}</string>
- <key>ProjectName</key>
- <string>Python</string>
- <key>SourceVersion</key>
- <string>${PV}</string>
-</dict>
-</plist>
-EOF
- else
- emake DESTDIR="${D}" altinstall
- fi
-
- sed -e "s/\(LDFLAGS=\).*/\1/" -i "${libdir}/config/Makefile" || die "sed failed"
-
- # Backwards compat with Gentoo divergence.
- dosym python${SLOT}-config /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"
-
- # http://src.opensolaris.org/source/xref/jds/spec-files/trunk/SUNWPython.spec
- # These #defines cause problems when building c99 compliant python modules
- # http://bugs.python.org/issue1759169
- [[ ${CHOST} == *-solaris* ]] && sed -i -e \
- 's:^\(^#define \(_POSIX_C_SOURCE\|_XOPEN_SOURCE\|_XOPEN_SOURCE_EXTENDED\).*$\):/* \1 */:' \
- "${ED}"/usr/include/python${SLOT}/pyconfig.h
-
- if use build; then
- rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{bsddb,dbhash.py,idlelib,lib-tk,sqlite3,test}
- else
- use berkdb || rm -r "${libdir}/"{bsddb,dbhash.py,test/test_bsddb*} || die
- use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
- use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,lib-tk} || die
- use elibc_uclibc && rm -fr "${libdir}/"{bsddb/test,test}
- fi
-
- use threads || rm -r "${libdir}/multiprocessing" || die
- use wininst || rm -r "${libdir}/distutils/command/"wininst-*.exe || die
-
- dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS} || die "dodoc failed"
-
- if use examples; then
- insinto /usr/share/doc/${PF}/examples
- doins -r "${S}"/Tools
- fi
- insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
- local libname
- if use aqua ; then
- # we do framework, so the emake trick below returns a pathname
- # since that won't work here, use a (cheap) trick instead
- libname=libpython${SLOT}
- else
- libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
- emake --no-print-directory -s -f - 2>/dev/null)
- fi
- newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
-
- newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT}
- newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT}
- 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"
-
- # for python-exec
- python_export python${SLOT} EPYTHON PYTHON PYTHON_SITEDIR
-
- # if not using a cross-compiler, use the fresh binary
- if ! tc-is-cross-compiler; then
- local PYTHON=./python
- local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}.
- fi
-
- echo "EPYTHON='${EPYTHON}'" > epython.py
- python_domodule epython.py
-}
-
-pkg_preinst() {
- if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version "${CATEGORY}/${PN}:2.7"; then
- python_updater_warning="1"
- fi
-}
-
-eselect_python_update() {
- if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
- eselect python update
- fi
-
- if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
- eselect python update --python${PV%%.*}
- fi
-}
-
-pkg_postinst() {
- eselect_python_update
-
- if [[ "${python_updater_warning}" == "1" ]]; then
- ewarn "You have just upgraded from an older version of Python."
- ewarn "You should switch active version of Python ${PV%%.*} and run"
- ewarn "'python-updater [options]' to rebuild Python modules."
- fi
-}
-
-pkg_postrm() {
- eselect_python_update
-}
diff --git a/dev-lang/python/python-2.7.6-r1.ebuild b/dev-lang/python/python-2.7.6-r1.ebuild
deleted file mode 100644
index 038039a4..00000000
--- a/dev-lang/python/python-2.7.6-r1.ebuild
+++ /dev/null
@@ -1,581 +0,0 @@
-# Copyright 1999-2014 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-2.7.6-r1.ebuild,v 1.2 2014/05/10 01:44:50 floppym Exp $
-
-EAPI="4"
-WANT_AUTOMAKE="none"
-WANT_LIBTOOL="none"
-
-inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs multiprocessing
-
-MY_P="Python-${PV}"
-PATCHSET_REVISION="1"
-PREFIX_PATCHREV=""
-
-DESCRIPTION="An interpreted, interactive, object-oriented programming language"
-HOMEPAGE="http://www.python.org/"
-SRC_URI="http://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz
- mirror://gentoo/python-gentoo-patches-${PV}-${PATCHSET_REVISION}.tar.xz
- https://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PV}-${PATCHSET_REVISION}.tar.xz
- prefix? ( https://dev.gentoo.org/~grobian/distfiles/python-prefix-${PV}-gentoo-patches${PREFIX_PATCHREV}.tar.bz2 )"
-
-LICENSE="PSF-2"
-SLOT="2.7"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-aix ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="aqua -berkdb build doc elibc_uclibc examples gdbm hardened ipv6 mercurial +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
-
-# Do not add a dependency on dev-lang/python to this ebuild.
-# If you need to apply a patch which requires python for bootstrapping, please
-# run the bootstrap code on your dev box and include the results in the
-# patchset. See bug 447752.
-
-RDEPEND="app-arch/bzip2
- >=sys-libs/zlib-1.1.3
- !m68k-mint? ( virtual/libffi )
- virtual/libintl
- !build? (
- berkdb? ( || (
- sys-libs/db:5.3
- sys-libs/db:5.2
- sys-libs/db:5.1
- sys-libs/db:5.0
- 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[berkdb] )
- mercurial? ( dev-vcs/mercurial )
- ncurses? (
- >=sys-libs/ncurses-5.2
- readline? ( >=sys-libs/readline-4.1 )
- )
- sqlite? ( >=dev-db/sqlite-3.3.8:3 )
- ssl? ( dev-libs/openssl )
- tk? (
- >=dev-lang/tk-8.0[-aqua]
- dev-tcltk/blt
- dev-tcltk/tix
- )
- xml? ( >=dev-libs/expat-2.1 )
- )
- !!<sys-apps/portage-2.1.9"
-DEPEND="${RDEPEND}
- virtual/pkgconfig
- >=sys-devel/autoconf-2.65
- !sys-devel/gcc[libffi]"
-RDEPEND+=" !build? ( app-misc/mime-types )
- doc? ( dev-python/python-docs:${SLOT} )"
-PDEPEND="app-admin/eselect-python
- app-admin/python-updater"
-
-S="${WORKDIR}/${MY_P}"
-
-pkg_setup() {
- if use berkdb; then
- ewarn "'bsddb' module is out-of-date and no longer maintained inside"
- ewarn "dev-lang/python. 'bsddb' and 'dbhash' modules have been additionally"
- ewarn "removed in Python 3. A maintained alternative of 'bsddb3' module"
- ewarn "is provided by dev-python/bsddb3."
- else
- if has_version "=${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"; then
- ewarn "You are migrating from =${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"
- ewarn "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 -r Modules/expat || die
- rm -r Modules/_ctypes/libffi* || die
- rm -r Modules/zlib || die
-
- if tc-is-cross-compiler; then
- local EPATCH_EXCLUDE="*_regenerate_platform-specific_modules.patch"
- fi
-
- # if building a patched source-tar, comment the rm's above, and uncomment
- # this line:
- #local EPATCH_EXCLUDE=" 01_all_prefix-no-patch-invention.patch"
-
- EPATCH_SUFFIX="patch" epatch "${WORKDIR}/patches"
- epatch "${FILESDIR}/python-2.7-issue18235.patch"
- epatch "${FILESDIR}/python-2.7-issue17919.patch"
-
- # Prefix' round of patches
- # http://prefix.gentooexperimental.org:8000/python-patches-2_7
- EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" \
- epatch "${WORKDIR}"/python-prefix-${PV}-gentoo-patches${PREFIX_PATCHREV}
-
- if use aqua ; then
- # make sure we don't get a framework reference here
- sed -i -e '/-DPREFIX=/s:$(prefix):$(FRAMEWORKUNIXTOOLSPREFIX):' \
- -e '/-DEXEC_PREFIX=/s:$(exec_prefix):$(FRAMEWORKUNIXTOOLSPREFIX):' \
- Makefile.pre.in || die
- # Python upstream refuses to listen to configure arguments
- sed -i -e '/FRAMEWORKINSTALLAPPSPREFIX=/s:="[^"]*":="${prefix}/../Applications":' \
- configure.ac configure || die
- fi
- # don't try to do fancy things on Darwin
- sed -i -e 's/__APPLE__/__NO_MUCKING_AROUND__/g' Modules/readline.c || die
-
- # Fix for cross-compiling.
- epatch "${FILESDIR}/python-2.7.5-nonfatal-compileall.patch"
-
- epatch "${FILESDIR}"/python-2.7-aix-dlopen-soname.patch # libtool-built modules
-
- # On AIX, we've wrapped /usr/ccs/bin/nm to work around long TMPDIR.
- sed -i -e "/^NM=.*nm$/s,^.*$,NM=$(tc-getNM)," Modules/makexp_aix || die
-
- # Make sure python doesn't use the host libffi.
- if use prefix; then
- epatch "${FILESDIR}/python-2.7-libffi-pkgconfig.patch"
- rm configure
- fi
-
- 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@@"
-
- epatch_user
-
- # fix for CVE-2014-1912 (bug #500518)
- epatch "${FILESDIR}"/${P}-recvfrom_into_buffer_overflow.patch
-
- eautoconf
- eautoheader
-}
-
-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.
- [[ ${CHOST} == *64-apple-darwin* ]] && disable+=" Nav _Qt" # Carbon
- [[ ${CHOST} == *-apple-darwin11 ]] && disable+=" _Fm _Qd _Qdoffs"
- 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
- # Force some tests that try to poke fs paths.
- export ac_cv_file__dev_ptc=no
- export ac_cv_file__dev_ptmx=yes
- fi
-
- # https://bugs.gentoo.org/show_bug.cgi?id=302137
- if [[ ${CHOST} == powerpc-*-darwin* ]] && \
- ( is-flag "-mtune=*" || is-flag "-mcpu=*" ) || \
- [[ ${CHOST} == powerpc64-*-darwin* ]];
- then
- replace-flags -O2 -O3
- replace-flags -Os -O3 # comment #14
- fi
-
- if use prefix ; then
- # for Python's setup.py not to do false assumptions (only looking in
- # host paths) we need to make explicit where Prefix stuff is
- append-cppflags -I"${EPREFIX}"/usr/include
- append-ldflags -L"${EPREFIX}"/$(get_libdir)
- append-ldflags -L"${EPREFIX}"/usr/$(get_libdir)
- # fix compilation on some 64-bits Linux hosts, #381163, #473520
- for hostlibdir in /usr/lib32 /usr/lib64 /usr/lib /lib32 /lib64; do
- [[ -d ${hostlibdir} ]] || continue
- append-ldflags -L${hostlibdir}
- done
- # Have to move $(CPPFLAGS) to before $(CFLAGS) to ensure that
- # local include paths - set in $(CPPFLAGS) - are searched first.
- sed -i -e "/^PY_CFLAGS[ \\t]*=/s,\\\$(CFLAGS)[ \\t]*\\\$(CPPFLAGS),\$(CPPFLAGS) \$(CFLAGS)," Makefile.pre.in || die
- fi
-
- # Export CC so even AIX will use gcc instead of xlc_r.
- # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile.
- tc-export CC CXX
- # The configure script fails to use pkg-config correctly.
- # http://bugs.python.org/issue15506
- export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
-
- # 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!
- # On AIX this is not needed, but would record '.' as runpath.
- [[ ${CHOST} == *-aix* ]] ||
- append-ldflags "-L."
-
- local dbmliborder
- if use gdbm; then
- dbmliborder+="${dbmliborder:+:}gdbm"
- fi
- if use berkdb; then
- dbmliborder+="${dbmliborder:+:}bdb"
- fi
-
- # Don't include libmpc on IRIX - it is only available for 64bit MIPS4 (mips-sgi-irix64)
- [[ ${CHOST} == *-irix ]] && export ac_cv_lib_mpc_usconfig=no
-
- [[ ${CHOST} == *-mint* ]] && export ac_cv_func_poll=no
-
- # we need this to get pythonw, the GUI version of python
- # --enable-framework and --enable-shared are mutually exclusive:
- # http://bugs.python.org/issue5809
- use aqua \
- && myconf="${myconf} --enable-framework=${EPREFIX}/usr/lib" \
- || myconf="${myconf} --enable-shared"
-
- BUILD_DIR="${WORKDIR}/${CHOST}"
- mkdir -p "${BUILD_DIR}" || die
- cd "${BUILD_DIR}" || die
-
- # note: for a framework build we need to use ucs2 because OSX
- # uses that internally too:
- # http://bugs.python.org/issue763708
- if use mercurial; then
- HAS_HG=""
- else
- # HAS_HG to avoid finding obsolete hg of the host
- HAS_HG="no"
- fi
- ECONF_SOURCE="${S}" OPT="" HAS_HG="${HAS_HG:-}" \
- econf \
- --with-fpectl \
- $(use_enable ipv6) \
- $(use_with threads) \
- $( (use wide-unicode && use !aqua) && 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 \
- ${myconf}
-
- if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
- eerror "configure has detected that the sem_open function is broken."
- eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
- die "Broken sem_open function (bug 496328)"
- fi
-}
-
-src_compile() {
- # Avoid invoking pgen for cross-compiles.
- touch Include/graminit.h Python/graminit.c
-
- cd "${BUILD_DIR}" || die
- emake
-
- # Work around bug 329499. See also bug 413751 and 457194.
- if has_version dev-libs/libffi[pax_kernel]; then
- pax-mark E python
- else
- pax-mark m python
- fi
-}
-
-src_test() {
- # Tests will not work when cross compiling.
- if tc-is-cross-compiler; then
- elog "Disabling tests due to crosscompiling."
- return
- fi
-
- cd "${BUILD_DIR}" || die
-
- # 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
- done
-
- elog "The following tests have been skipped:"
- for test in ${skipped_tests}; do
- elog "test_${test}.py"
- done
-
- elog "If you would like to run them, you may:"
- elog "cd '${EPREFIX}/usr/$(get_libdir)/python${SLOT}/test'"
- elog "and run the tests separately."
-
- if [[ "${result}" -ne 0 ]]; then
- die "emake test failed"
- fi
-}
-
-src_install() {
- local libdir=${ED}/usr/$(get_libdir)/python${SLOT}
-
- cd "${BUILD_DIR}" || die
- [[ ${CHOST} == *-mint* ]] && keepdir /usr/lib/python${SLOT}/lib-dynload/
- if use aqua ; then
- local fwdir="${EPREFIX}"/usr/$(get_libdir)/Python.framework
-
- # do not make multiple targets in parallel when there are broken
- # sharedmods (during bootstrap), would build them twice in parallel.
-
- # let the makefiles do their thing
- emake -j1 CC="$(tc-getCC)" DESTDIR="${D}" STRIPFLAG= altinstall
-
- # avoid framework incompatability, degrade to a normal UNIX lib
- mkdir -p "${ED}"/usr/$(get_libdir)
- cp "${D}${fwdir}"/Versions/${SLOT}/Python \
- "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib || die
- chmod u+w "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib
- install_name_tool \
- -id "${EPREFIX}"/usr/$(get_libdir)/libpython${SLOT}.dylib \
- "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib
- chmod u-w "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib
- cp libpython${SLOT}.a "${ED}"/usr/$(get_libdir)/ || die
-
- # rebuild python executable to be the non-pythonw (python wrapper)
- # version so we don't get framework crap
- rm "${ED}"/usr/bin/python${SLOT} # drop existing symlink, bug #390861
- $(tc-getCC) "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib \
- -o "${ED}"/usr/bin/python${SLOT} \
- Modules/python.o || die
-
- # don't install the "Current" symlink, will always conflict
- rm "${D}${fwdir}"/Versions/Current || die
- # update whatever points to it, eselect-python sets them
- rm "${D}${fwdir}"/{Headers,Python,Resources} || die
-
- # remove unversioned files (that are not made versioned below)
- pushd "${ED}"/usr/bin > /dev/null
- rm -f python python-config python${SLOT}-config
- # python${SLOT} was created above
- for f in pythonw smtpd${SLOT}.py pydoc idle ; do
- rm -f ${f} ${f}${SLOT}
- done
- # pythonw needs to remain in the framework (that's the whole
- # reason we go through this framework hassle)
- ln -s ../lib/Python.framework/Versions/${SLOT}/bin/pythonw${SLOT} || die
- # copy the scripts to we can fix their shebangs
- for f in 2to3 pydoc${SLOT} idle${SLOT} python${SLOT}-config ; do
- # for some reason sometimes they already exist, bug #347321
- rm -f ${f}
- cp "${D}${fwdir}"/Versions/${SLOT}/bin/${f} . || die
- sed -i -e '1c\#!'"${EPREFIX}"'/usr/bin/python'"${SLOT}" \
- ${f} || die
- done
- # "fix" to have below collision fix not to bail
- mv pydoc${SLOT} pydoc || die
- mv idle${SLOT} idle || die
- popd > /dev/null
-
- # basically we don't like the framework stuff at all, so just move
- # stuff around or add some symlinks to make our life easier
- mkdir -p "${ED}"/usr
- mv "${D}${fwdir}"/Versions/${SLOT}/share \
- "${ED}"/usr/ || die "can't move share"
- # get includes just UNIX style
- mkdir -p "${ED}"/usr/include
- mv "${D}${fwdir}"/Versions/${SLOT}/include/python${SLOT} \
- "${ED}"/usr/include/ || die "can't move include"
- pushd "${D}${fwdir}"/Versions/${SLOT}/include > /dev/null
- ln -s ../../../../../include/python${SLOT} || die
- popd > /dev/null
-
- # same for libs
- # NOTE: can't symlink the entire dir, because a real dir already exists
- # on upgrade (site-packages), however since we h4x0rzed python to
- # actually look into the UNIX-style dir, we just switch them around.
- mkdir -p "${ED}"/usr/$(get_libdir)
- mv "${D}${fwdir}"/Versions/${SLOT}/lib/python${SLOT} \
- "${ED}"/usr/lib/ || die "can't move python${SLOT}"
- pushd "${D}${fwdir}"/Versions/${SLOT}/lib > /dev/null
- ln -s ../../../../python${SLOT} || die
- popd > /dev/null
- # remove now dead symlinks
- rm "${ED}"/usr/lib/python${SLOT}/config/libpython${SLOT}.a
- rm "${ED}"/usr/lib/python${SLOT}/config/libpython${SLOT}.dylib
-
- # fix up Makefile
- sed -i \
- -e '/^LINKFORSHARED=/s/-u _PyMac_Error.*$//' \
- -e '/^LDFLAGS=/s/=.*$/=/' \
- -e '/^prefix=/s:=.*$:= '"${EPREFIX}"'/usr:' \
- -e '/^PYTHONFRAMEWORK=/s/=.*$/=/' \
- -e '/^PYTHONFRAMEWORKDIR=/s/=.*$/= no-framework/' \
- -e '/^PYTHONFRAMEWORKPREFIX=/s/=.*$/=/' \
- -e '/^PYTHONFRAMEWORKINSTALLDIR=/s/=.*$/=/' \
- -e '/^LDLIBRARY=/s:=.*$:libpython$(VERSION).dylib:' \
- "${ED}"/usr/lib/python${SLOT}/config/Makefile || die
-
- # add missing version.plist file
- mkdir -p "${D}${fwdir}"/Versions/${SLOT}/Resources
- cat > "${D}${fwdir}"/Versions/${SLOT}/Resources/version.plist << EOF
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
-"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>BuildVersion</key>
- <string>1</string>
- <key>CFBundleShortVersionString</key>
- <string>${PV}</string>
- <key>CFBundleVersion</key>
- <string>${PV}</string>
- <key>ProjectName</key>
- <string>Python</string>
- <key>SourceVersion</key>
- <string>${PV}</string>
-</dict>
-</plist>
-EOF
- else
- emake DESTDIR="${D}" altinstall
- fi
-
- sed -e "s/\(LDFLAGS=\).*/\1/" -i "${libdir}/config/Makefile" || die "sed failed"
-
- # Backwards compat with Gentoo divergence.
- dosym python${SLOT}-config /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"
-
- # http://src.opensolaris.org/source/xref/jds/spec-files/trunk/SUNWPython.spec
- # These #defines cause problems when building c99 compliant python modules
- # http://bugs.python.org/issue1759169
- [[ ${CHOST} == *-solaris* ]] && sed -i -e \
- 's:^\(^#define \(_POSIX_C_SOURCE\|_XOPEN_SOURCE\|_XOPEN_SOURCE_EXTENDED\).*$\):/* \1 */:' \
- "${ED}"/usr/include/python${SLOT}/pyconfig.h
-
- if use build; then
- rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{bsddb,dbhash.py,idlelib,lib-tk,sqlite3,test}
- else
- use berkdb || rm -r "${libdir}/"{bsddb,dbhash.py,test/test_bsddb*} || die
- use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
- use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,lib-tk} || die
- use elibc_uclibc && rm -fr "${libdir}/"{bsddb/test,test}
- fi
-
- use threads || rm -r "${libdir}/multiprocessing" || die
- use wininst || rm -r "${libdir}/distutils/command/"wininst-*.exe || die
-
- dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS}
-
- if use examples; then
- insinto /usr/share/doc/${PF}/examples
- doins -r "${S}"/Tools
- fi
- insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
- local libname
- if use aqua ; then
- # we do framework, so the emake trick below returns a pathname
- # since that won't work here, use a (cheap) trick instead
- libname=libpython${SLOT}
- else
- libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
- emake --no-print-directory -s -f - 2>/dev/null)
- fi
- newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
-
- newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT}
- newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT}
- 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"
-
- # for python-exec
- python_export python${SLOT} EPYTHON PYTHON PYTHON_SITEDIR
-
- # if not using a cross-compiler, use the fresh binary
- if ! tc-is-cross-compiler; then
- local PYTHON=./python
- local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}.
- fi
-
- echo "EPYTHON='${EPYTHON}'" > epython.py
- python_domodule epython.py
-}
-
-pkg_preinst() {
- if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version "${CATEGORY}/${PN}:2.7"; then
- python_updater_warning="1"
- fi
-}
-
-eselect_python_update() {
- if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
- eselect python update
- fi
-
- if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
- eselect python update --python${PV%%.*}
- fi
-}
-
-pkg_postinst() {
- eselect_python_update
-
- if [[ "${python_updater_warning}" == "1" ]]; then
- ewarn "You have just upgraded from an older version of Python."
- ewarn "You should switch active version of Python ${PV%%.*} and run"
- ewarn "'python-updater [options]' to rebuild Python modules."
- fi
-}
-
-pkg_postrm() {
- eselect_python_update
-}
diff --git a/dev-lang/python/python-2.7.8.ebuild b/dev-lang/python/python-2.7.8.ebuild
deleted file mode 100644
index 6c6c8d52..00000000
--- a/dev-lang/python/python-2.7.8.ebuild
+++ /dev/null
@@ -1,587 +0,0 @@
-# Copyright 1999-2014 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-2.7.8.ebuild,v 1.2 2014/09/22 16:47:38 floppym Exp $
-
-EAPI="4"
-WANT_AUTOMAKE="none"
-WANT_LIBTOOL="none"
-
-inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs multiprocessing
-
-MY_P="Python-${PV}"
-PATCHSET_VERSION="2.7.8-0"
-PREFIX_PATCHREV=""
-
-DESCRIPTION="An interpreted, interactive, object-oriented programming language"
-HOMEPAGE="http://www.python.org/"
-SRC_URI="http://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz
- https://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz
- prefix? ( https://dev.gentoo.org/~grobian/distfiles/python-prefix-${PV}-gentoo-patches${PREFIX_PATCHREV}.tar.bz2 )"
-
-LICENSE="PSF-2"
-SLOT="2.7"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-aix ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="aqua -berkdb build doc elibc_uclibc examples gdbm hardened ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
-
-# Do not add a dependency on dev-lang/python to this ebuild.
-# If you need to apply a patch which requires python for bootstrapping, please
-# run the bootstrap code on your dev box and include the results in the
-# patchset. See bug 447752.
-
-RDEPEND="app-arch/bzip2
- >=sys-libs/zlib-1.1.3
- !m68k-mint? ( virtual/libffi )
- virtual/libintl
- !build? (
- berkdb? ( || (
- sys-libs/db:5.3
- sys-libs/db:5.2
- sys-libs/db:5.1
- sys-libs/db:5.0
- 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[berkdb] )
- ncurses? (
- >=sys-libs/ncurses-5.2
- readline? ( >=sys-libs/readline-4.1 )
- )
- sqlite? ( >=dev-db/sqlite-3.3.8:3 )
- ssl? ( dev-libs/openssl )
- tk? (
- >=dev-lang/tk-8.0[-aqua]
- dev-tcltk/blt
- dev-tcltk/tix
- )
- xml? ( >=dev-libs/expat-2.1 )
- )
- !!<sys-apps/portage-2.1.9"
-DEPEND="${RDEPEND}
- virtual/pkgconfig
- >=sys-devel/autoconf-2.65
- !sys-devel/gcc[libffi]"
-RDEPEND+=" !build? ( app-misc/mime-types )
- doc? ( dev-python/python-docs:${SLOT} )"
-PDEPEND="app-eselect/eselect-python
- app-admin/python-updater"
-
-S="${WORKDIR}/${MY_P}"
-
-pkg_setup() {
- if use berkdb; then
- ewarn "'bsddb' module is out-of-date and no longer maintained inside"
- ewarn "dev-lang/python. 'bsddb' and 'dbhash' modules have been additionally"
- ewarn "removed in Python 3. A maintained alternative of 'bsddb3' module"
- ewarn "is provided by dev-python/bsddb3."
- else
- if has_version "=${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"; then
- ewarn "You are migrating from =${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"
- ewarn "to =${CATEGORY}/${PN}-${PV%%.*}*[-berkdb]."
- fi
- fi
-}
-
-src_prepare() {
- # Ensure that internal copies of expat, libffi and zlib are not used.
- rm -r Modules/expat || die
- rm -r Modules/_ctypes/libffi* || die
- rm -r Modules/zlib || die
-
- if tc-is-cross-compiler; then
- local EPATCH_EXCLUDE="*_regenerate_platform-specific_modules.patch"
- fi
-
- # if building a patched source-tar, comment the rm's above, and uncomment
- # this line:
- #local EPATCH_EXCLUDE=" 01_all_prefix-no-patch-invention.patch"
-
- EPATCH_SUFFIX="patch" epatch "${WORKDIR}/patches"
- epatch "${FILESDIR}/python-2.7-issue18235.patch"
-
- # Prefix' round of patches
- # http://prefix.gentooexperimental.org:8000/python-patches-2_7
- EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" \
- epatch "${WORKDIR}"/python-prefix-${PV}-gentoo-patches${PREFIX_PATCHREV}
-
- if use aqua ; then
- # make sure we don't get a framework reference here
- sed -i -e '/-DPREFIX=/s:$(prefix):$(FRAMEWORKUNIXTOOLSPREFIX):' \
- -e '/-DEXEC_PREFIX=/s:$(exec_prefix):$(FRAMEWORKUNIXTOOLSPREFIX):' \
- Makefile.pre.in || die
- # Python upstream refuses to listen to configure arguments
- sed -i -e '/FRAMEWORKINSTALLAPPSPREFIX=/s:="[^"]*":="${prefix}/../Applications":' \
- configure.ac configure || die
- # we handle creation of symlinks in src_install
- sed -i -e '/ln -fs .*PYTHONFRAMEWORK/d' Makefile.pre.in || die
- fi
- # don't try to do fancy things on Darwin
- sed -i -e 's/__APPLE__/__NO_MUCKING_AROUND__/g' Modules/readline.c || die
-
- # Fix for cross-compiling.
- epatch "${FILESDIR}/python-2.7.5-nonfatal-compileall.patch"
-
- epatch "${FILESDIR}"/python-2.7-aix-dlopen-soname.patch # libtool-built modules
-
- # On AIX, we've wrapped /usr/ccs/bin/nm to work around long TMPDIR.
- sed -i -e "/^NM=.*nm$/s,^.*$,NM=$(tc-getNM)," Modules/makexp_aix || die
-
- # Make sure python doesn't use the host libffi.
- if use prefix; then
- epatch "${FILESDIR}/python-2.7-libffi-pkgconfig.patch"
- rm configure
- fi
-
- 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@@"
-
- epatch_user
-
- eautoconf
- eautoheader
-}
-
-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.
- [[ ${CHOST} == *64-apple-darwin* ]] && disable+=" Nav _Qt" # Carbon
- [[ ${CHOST} == *-apple-darwin11 ]] && disable+=" _Fm _Qd _Qdoffs"
- 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
- # Force some tests that try to poke fs paths.
- export ac_cv_file__dev_ptc=no
- export ac_cv_file__dev_ptmx=yes
- fi
-
- # https://bugs.gentoo.org/show_bug.cgi?id=302137
- if [[ ${CHOST} == powerpc-*-darwin* ]] && \
- ( is-flag "-mtune=*" || is-flag "-mcpu=*" ) || \
- [[ ${CHOST} == powerpc64-*-darwin* ]];
- then
- replace-flags -O2 -O3
- replace-flags -Os -O3 # comment #14
- fi
-
- if use prefix ; then
- # for Python's setup.py not to do false assumptions (only looking in
- # host paths) we need to make explicit where Prefix stuff is
- append-cppflags -I"${EPREFIX}"/usr/include
- append-ldflags -L"${EPREFIX}"/$(get_libdir)
- append-ldflags -L"${EPREFIX}"/usr/$(get_libdir)
- # fix compilation on some 64-bits Linux hosts, #381163, #473520
- for hostlibdir in /usr/lib32 /usr/lib64 /usr/lib /lib32 /lib64; do
- [[ -d ${hostlibdir} ]] || continue
- append-ldflags -L${hostlibdir}
- done
- # Have to move $(CPPFLAGS) to before $(CFLAGS) to ensure that
- # local include paths - set in $(CPPFLAGS) - are searched first.
- sed -i -e "/^PY_CFLAGS[ \\t]*=/s,\\\$(CFLAGS)[ \\t]*\\\$(CPPFLAGS),\$(CPPFLAGS) \$(CFLAGS)," Makefile.pre.in || die
- fi
-
- # Export CC so even AIX will use gcc instead of xlc_r.
- # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile.
- tc-export CC CXX
- # The configure script fails to use pkg-config correctly.
- # http://bugs.python.org/issue15506
- export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
-
- # 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!
- # On AIX this is not needed, but would record '.' as runpath.
- [[ ${CHOST} == *-aix* ]] ||
- append-ldflags "-L."
-
- local dbmliborder
- if use gdbm; then
- dbmliborder+="${dbmliborder:+:}gdbm"
- fi
- if use berkdb; then
- dbmliborder+="${dbmliborder:+:}bdb"
- fi
-
- # Don't include libmpc on IRIX - it is only available for 64bit MIPS4 (mips-sgi-irix64)
- [[ ${CHOST} == *-irix ]] && export ac_cv_lib_mpc_usconfig=no
-
- [[ ${CHOST} == *-mint* ]] && export ac_cv_func_poll=no
-
- # we need this to get pythonw, the GUI version of python
- # --enable-framework and --enable-shared are mutually exclusive:
- # http://bugs.python.org/issue5809
- use aqua \
- && myconf="${myconf} --enable-framework=${EPREFIX}/usr/lib" \
- || myconf="${myconf} --enable-shared"
-
- BUILD_DIR="${WORKDIR}/${CHOST}"
- mkdir -p "${BUILD_DIR}" || die
- cd "${BUILD_DIR}" || die
-
- # note: for a framework build we need to use ucs2 because OSX
- # uses that internally too:
- # http://bugs.python.org/issue763708
- # HAS_HG to avoid finding obsolete hg of the host
- ECONF_SOURCE="${S}" OPT="" HAS_HG="no" \
- econf \
- --with-fpectl \
- $(use_enable ipv6) \
- $(use_with threads) \
- $( (use wide-unicode && use !aqua) && 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 \
- ${myconf}
-
- if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
- eerror "configure has detected that the sem_open function is broken."
- eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
- die "Broken sem_open function (bug 496328)"
- fi
-}
-
-src_compile() {
- # Avoid invoking pgen for cross-compiles.
- touch Include/graminit.h Python/graminit.c
-
- cd "${BUILD_DIR}" || die
- emake
-
- # Work around bug 329499. See also bug 413751 and 457194.
- if has_version dev-libs/libffi[pax_kernel]; then
- pax-mark E python
- else
- pax-mark m python
- fi
-}
-
-src_test() {
- # Tests will not work when cross compiling.
- if tc-is-cross-compiler; then
- elog "Disabling tests due to crosscompiling."
- return
- fi
-
- cd "${BUILD_DIR}" || die
-
- # 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
- done
-
- elog "The following tests have been skipped:"
- for test in ${skipped_tests}; do
- elog "test_${test}.py"
- done
-
- elog "If you would like to run them, you may:"
- elog "cd '${EPREFIX}/usr/$(get_libdir)/python${SLOT}/test'"
- elog "and run the tests separately."
-
- if [[ "${result}" -ne 0 ]]; then
- die "emake test failed"
- fi
-}
-
-src_install() {
- local libdir=${ED}/usr/$(get_libdir)/python${SLOT}
-
- cd "${BUILD_DIR}" || die
- [[ ${CHOST} == *-mint* ]] && keepdir /usr/lib/python${SLOT}/lib-dynload/
- if use aqua ; then
- local fwdir="${EPREFIX}"/usr/$(get_libdir)/Python.framework
-
- # do not make multiple targets in parallel when there are broken
- # sharedmods (during bootstrap), would build them twice in parallel.
-
- # let the makefiles do their thing
- emake -j1 CC="$(tc-getCC)" DESTDIR="${D}" STRIPFLAG= altinstall
-
- # avoid framework incompatability, degrade to a normal UNIX lib
- mkdir -p "${ED}"/usr/$(get_libdir)
- cp "${D}${fwdir}"/Versions/${SLOT}/Python \
- "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib || die
- chmod u+w "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib
- install_name_tool \
- -id "${EPREFIX}"/usr/$(get_libdir)/libpython${SLOT}.dylib \
- "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib
- chmod u-w "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib
- cp libpython${SLOT}.a "${ED}"/usr/$(get_libdir)/ || die
-
- # rebuild python executable to be the non-pythonw (python wrapper)
- # version so we don't get framework crap
- rm "${ED}"/usr/bin/python${SLOT} # drop existing symlink, bug #390861
- $(tc-getCC) "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib \
- -o "${ED}"/usr/bin/python${SLOT} \
- Modules/python.o || die
-
- # don't install the "Current" symlink, will always conflict
- rm "${D}${fwdir}"/Versions/Current || die
- # update whatever points to it, eselect-python sets them
- rm "${D}${fwdir}"/{Headers,Python,Resources} || die
-
- # remove unversioned files (that are not made versioned below)
- pushd "${ED}"/usr/bin > /dev/null
- rm -f python python-config python${SLOT}-config
- # python${SLOT} was created above
- for f in pythonw smtpd${SLOT}.py pydoc idle ; do
- rm -f ${f} ${f}${SLOT}
- done
- # pythonw needs to remain in the framework (that's the whole
- # reason we go through this framework hassle)
- ln -s ../lib/Python.framework/Versions/${SLOT}/bin/pythonw${SLOT} || die
- # copy the scripts to we can fix their shebangs
- for f in 2to3 pydoc${SLOT} idle${SLOT} python${SLOT}-config ; do
- # for some reason sometimes they already exist, bug #347321
- rm -f ${f}
- cp "${D}${fwdir}"/Versions/${SLOT}/bin/${f} . || die
- sed -i -e '1c\#!'"${EPREFIX}"'/usr/bin/python'"${SLOT}" \
- ${f} || die
- done
- # "fix" to have below collision fix not to bail
- mv pydoc${SLOT} pydoc || die
- mv idle${SLOT} idle || die
- popd > /dev/null
-
- # basically we don't like the framework stuff at all, so just move
- # stuff around or add some symlinks to make our life easier
- mkdir -p "${ED}"/usr
- mv "${D}${fwdir}"/Versions/${SLOT}/share \
- "${ED}"/usr/ || die "can't move share"
- # get includes just UNIX style
- mkdir -p "${ED}"/usr/include
- mv "${D}${fwdir}"/Versions/${SLOT}/include/python${SLOT} \
- "${ED}"/usr/include/ || die "can't move include"
- pushd "${D}${fwdir}"/Versions/${SLOT}/include > /dev/null
- ln -s ../../../../../include/python${SLOT} || die
- popd > /dev/null
- rm -f "${ED}"/usr/share/man/man1/python{,2}.1
-
- # same for libs
- # NOTE: can't symlink the entire dir, because a real dir already exists
- # on upgrade (site-packages), however since we h4x0rzed python to
- # actually look into the UNIX-style dir, we just switch them around.
- mkdir -p "${ED}"/usr/$(get_libdir)/python${SLOT}
- mv "${D}${fwdir}"/Versions/${SLOT}/lib/python${SLOT}/* \
- "${ED}"/usr/$(get_libdir)/python${SLOT}/ || die "can't move python${SLOT}"
- rmdir "${D}${fwdir}"/Versions/${SLOT}/lib/python${SLOT} || die
- pushd "${D}${fwdir}"/Versions/${SLOT}/lib > /dev/null
- ln -s ../../../../python${SLOT} || die
- popd > /dev/null
- # remove now dead symlinks
- rm "${ED}"/usr/lib/python${SLOT}/config/libpython${SLOT}.a
- rm "${ED}"/usr/lib/python${SLOT}/config/libpython${SLOT}.dylib
-
- # fix up Makefile
- sed -i \
- -e '/^LINKFORSHARED=/s/-u _PyMac_Error.*$//' \
- -e '/^LDFLAGS=/s/=.*$/=/' \
- -e '/^prefix=/s:=.*$:= '"${EPREFIX}"'/usr:' \
- -e '/^PYTHONFRAMEWORK=/s/=.*$/=/' \
- -e '/^PYTHONFRAMEWORKDIR=/s/=.*$/= no-framework/' \
- -e '/^PYTHONFRAMEWORKPREFIX=/s/=.*$/=/' \
- -e '/^PYTHONFRAMEWORKINSTALLDIR=/s/=.*$/=/' \
- -e '/^LDLIBRARY=/s:=.*$:libpython$(VERSION).dylib:' \
- "${ED}"/usr/lib/python${SLOT}/config/Makefile || die
-
- # add missing version.plist file
- mkdir -p "${D}${fwdir}"/Versions/${SLOT}/Resources
- cat > "${D}${fwdir}"/Versions/${SLOT}/Resources/version.plist << EOF
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
-"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>BuildVersion</key>
- <string>1</string>
- <key>CFBundleShortVersionString</key>
- <string>${PV}</string>
- <key>CFBundleVersion</key>
- <string>${PV}</string>
- <key>ProjectName</key>
- <string>Python</string>
- <key>SourceVersion</key>
- <string>${PV}</string>
-</dict>
-</plist>
-EOF
- else
- emake DESTDIR="${D}" altinstall
- fi
-
- sed -e "s/\(LDFLAGS=\).*/\1/" -i "${libdir}/config/Makefile" || die "sed failed"
- if [[ ${CHOST} == *-aix* ]]; then
- # fix upstream bugs with quite large proposed diffs still to be sorted out:
- # http://bugs.python.org/issue13493
- # http://bugs.python.org/issue14150
- # http://bugs.python.org/issue15590
- # http://bugs.python.org/issue16189
- sed -e "/Libs:/s|\$| -Wl,-bE:${EPREFIX}/${libdir#$ED}/config/python.exp -lld|" \
- -i "${ED}"usr/$(get_libdir)/pkgconfig/python-${SLOT}.pc || die "sed failed"
- sed -e "s|:Modules/python.exp|:${EPREFIX}/${libdir#$ED}/config/python.exp|" \
- -e 's| -bI:| -Wl,-bI:|g' \
- -e '/LINKFORSHARED/s|-bE:|-bI:|g' \
- -e '/LINKFORSHARED/s| -lld||g' \
- -i "${libdir}"/{_sysconfigdata.py,config/Makefile} || die "sed failed"
- fi
-
- # Backwards compat with Gentoo divergence.
- dosym python${SLOT}-config /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"
-
- # http://src.opensolaris.org/source/xref/jds/spec-files/trunk/SUNWPython.spec
- # These #defines cause problems when building c99 compliant python modules
- # http://bugs.python.org/issue1759169
- [[ ${CHOST} == *-solaris* ]] && sed -i -e \
- 's:^\(^#define \(_POSIX_C_SOURCE\|_XOPEN_SOURCE\|_XOPEN_SOURCE_EXTENDED\).*$\):/* \1 */:' \
- "${ED}"/usr/include/python${SLOT}/pyconfig.h
-
- if use build; then
- rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{bsddb,dbhash.py,idlelib,lib-tk,sqlite3,test}
- else
- use berkdb || rm -r "${libdir}/"{bsddb,dbhash.py,test/test_bsddb*} || die
- use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
- use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,lib-tk} || die
- use elibc_uclibc && rm -fr "${libdir}/"{bsddb/test,test}
- fi
-
- use threads || rm -r "${libdir}/multiprocessing" || die
- use wininst || rm -r "${libdir}/distutils/command/"wininst-*.exe || die
-
- dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS}
-
- if use examples; then
- insinto /usr/share/doc/${PF}/examples
- doins -r "${S}"/Tools
- fi
- insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
- local libname
- if use aqua ; then
- # we do framework, so the emake trick below returns a pathname
- # since that won't work here, use a (cheap) trick instead
- libname=libpython${SLOT}
- else
- libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
- emake --no-print-directory -s -f - 2>/dev/null)
- fi
- newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
-
- newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT}
- newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT}
- 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"
-
- # for python-exec
- python_export python${SLOT} EPYTHON PYTHON PYTHON_SITEDIR
-
- # if not using a cross-compiler, use the fresh binary
- if ! tc-is-cross-compiler; then
- local PYTHON=./python
- local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}.
- fi
-
- echo "EPYTHON='${EPYTHON}'" > epython.py
- python_domodule epython.py
-}
-
-pkg_preinst() {
- if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version "${CATEGORY}/${PN}:2.7"; then
- python_updater_warning="1"
- fi
-}
-
-eselect_python_update() {
- if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
- eselect python update
- fi
-
- if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
- eselect python update --python${PV%%.*}
- fi
-}
-
-pkg_postinst() {
- eselect_python_update
-
- if [[ "${python_updater_warning}" == "1" ]]; then
- ewarn "You have just upgraded from an older version of Python."
- ewarn "You should switch active version of Python ${PV%%.*} and run"
- ewarn "'python-updater [options]' to rebuild Python modules."
- fi
-}
-
-pkg_postrm() {
- eselect_python_update
-}