summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dev-python/snakeoil/ChangeLog12
-rw-r--r--dev-python/snakeoil/files/snakeoil-0.3.7-multiprocess.patch79
-rw-r--r--dev-python/snakeoil/files/snakeoil-issue-7567-term-invocation.patch70
-rw-r--r--dev-python/snakeoil/snakeoil-0.3.7-r1.ebuild (renamed from dev-python/snakeoil/snakeoil-0.3.7.ebuild)10
4 files changed, 166 insertions, 5 deletions
diff --git a/dev-python/snakeoil/ChangeLog b/dev-python/snakeoil/ChangeLog
index 08dbd63823b4..23419d4fb817 100644
--- a/dev-python/snakeoil/ChangeLog
+++ b/dev-python/snakeoil/ChangeLog
@@ -1,6 +1,14 @@
# ChangeLog for dev-python/snakeoil
-# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-python/snakeoil/ChangeLog,v 1.35 2010/06/27 09:38:18 ferringb Exp $
+# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/dev-python/snakeoil/ChangeLog,v 1.36 2011/01/03 11:14:08 ferringb Exp $
+
+*snakeoil-0.3.7-r1 (03 Jan 2011)
+
+ 03 Jan 2011; Brian Harring <ferringb@gentoo.org> -snakeoil-0.3.7.ebuild,
+ +snakeoil-0.3.7-r1.ebuild, +files/snakeoil-0.3.7-multiprocess.patch,
+ +files/snakeoil-issue-7567-term-invocation.patch:
+ Work around python upstream bugs; fixes gentoo bugs #350215 (test failure in
+ formatters) and build failure for py3k behaviour via bug #330511.
*snakeoil-0.3.7 (27 Jun 2010)
diff --git a/dev-python/snakeoil/files/snakeoil-0.3.7-multiprocess.patch b/dev-python/snakeoil/files/snakeoil-0.3.7-multiprocess.patch
new file mode 100644
index 000000000000..5c7b9ffcf098
--- /dev/null
+++ b/dev-python/snakeoil/files/snakeoil-0.3.7-multiprocess.patch
@@ -0,0 +1,79 @@
+From 1a2408eff074901d98a3ba79af6eebd7444a3a8f Mon Sep 17 00:00:00 2001
+From: Brian Harring <ferringb@gmail.com>
+Date: Tue, 28 Dec 2010 03:48:14 -0800
+Subject: [PATCH 1/4] detect python bug 3770 (gentoo bug 330511), and disable multiprocessing for 2to3 conversion
+
+---
+ NEWS | 5 +++++
+ snakeoil/caching_2to3.py | 13 +++++++++++--
+ snakeoil/distutils_extensions.py | 7 ++-----
+ 3 files changed, 18 insertions(+), 7 deletions(-)
+
+diff --git a/NEWS b/NEWS
+index 1423171..b92a130 100644
+--- a/NEWS
++++ b/NEWS
+@@ -58,6 +58,10 @@ Snakeoil Release Notes
+ other sequence where it evaluates false.
+
+
++* detect python bug 3770 (gentoo bug 330511), and disable multiprocessing
++ for 2to3 conversion if it's found.
++
++
+ snakeoil 0.3.7: June 26th, 2010
+
+ * detect python bug 4660, and disable parallelization in 2to3 conversion if
+@@ -72,6 +76,7 @@ snakeoil 0.3.7: June 26th, 2010
+ for 2.4
+
+
++
+ snakeoil 0.3.6.5: May 21st, 2010
+
+ * add discard method to AtomicWriteFile to intentionally discard the
+diff --git a/snakeoil/caching_2to3.py b/snakeoil/caching_2to3.py
+index 407aba4..4c8a3a8 100755
+--- a/snakeoil/caching_2to3.py
++++ b/snakeoil/caching_2to3.py
+@@ -88,8 +88,17 @@ class caching_mixin(object):
+ class RefactoringTool(caching_mixin, lib2to3.refactor.RefactoringTool):
+ pass
+
+-class MultiprocessRefactoringTool(caching_mixin, lib2to3.refactor.MultiprocessRefactoringTool):
+- pass
++multiprocessing_available = False
++try:
++ import multiprocessing
++ # this is to detect python upstream bug 3770
++ from _multiprocessing import SemLock
++ multiprocessing_available = True
++except ImportError:
++ MultiprocessRefactoringTool = RefactoringTool
++else:
++ class MultiprocessRefactoringTool(caching_mixin, lib2to3.refactor.MultiprocessRefactoringTool):
++ pass
+
+
+ def StdoutRefactoringTool(*args):
+diff --git a/snakeoil/distutils_extensions.py b/snakeoil/distutils_extensions.py
+index 5883672..2c9b6d3 100644
+--- a/snakeoil/distutils_extensions.py
++++ b/snakeoil/distutils_extensions.py
+@@ -234,11 +234,8 @@ class build_py(dst_build_py.build_py):
+
+ assert proc_count >= 1
+
+- if proc_count > 1:
+- try:
+- import multiprocessing
+- except ImportError:
+- proc_count == 1
++ if proc_count > 1 and not caching_2to3.multiprocessing_available:
++ proc_count = 1
+
+ refactor_kls = caching_2to3.MultiprocessRefactoringTool
+
+--
+1.7.3.4
+
diff --git a/dev-python/snakeoil/files/snakeoil-issue-7567-term-invocation.patch b/dev-python/snakeoil/files/snakeoil-issue-7567-term-invocation.patch
new file mode 100644
index 000000000000..5fdf2ee6d181
--- /dev/null
+++ b/dev-python/snakeoil/files/snakeoil-issue-7567-term-invocation.patch
@@ -0,0 +1,70 @@
+diff --git a/snakeoil/test/test_formatters.py b/snakeoil/test/test_formatters.py
+index f6e3038..cf523b2 100644
+--- a/snakeoil/test/test_formatters.py
++++ b/snakeoil/test/test_formatters.py
+@@ -8,6 +8,7 @@
+ # aside from that, tests need heavy expansion
+
+ import os
++import sys
+ import pty
+ import StringIO
+ import tempfile
+@@ -23,6 +24,13 @@ if compatibility.is_py3k:
+ else:
+ mk_tempfile = tempfile.TemporaryFile
+
++sys_ver = sys.version_info[:3]
++if (sys_ver >= (2,6,6) and sys_ver < (2,7)) or sys_ver >= (3,2,0):
++ def issue7567(functor):
++ functor.skip = "issue 7567 patch breaks multiple term invocations, disabled till it's sorted"
++ return functor
++else:
++ issue7567 = lambda x:x
+
+ class native_PlainTextFormatterTest(TestCase):
+
+@@ -178,6 +186,7 @@ class TerminfoFormatterTest(TestCase):
+ self.assertEqual(''.join(output), result,
+ msg="given(%r), expected(%r), got(%r)" % (inputs, output, result))
+
++ @issue7567
+ def test_terminfo(self):
+ esc = '\x1b['
+ stream = mk_tempfile()
+@@ -206,6 +215,9 @@ class TerminfoFormatterTest(TestCase):
+ formatters.TerminfoHatesOurTerminal,
+ formatters.TerminfoFormatter, stream, term='dumb')
+
++ if sys_ver >= (2,6,6) and sys_ver < (2,7):
++ test_terminfo_hates_term.skip = "issue doesn't exist for 2.6.6 till 2.7"
++
+
+ def _with_term(term, func, *args, **kwargs):
+ orig_term = os.environ.get('TERM')
+@@ -232,21 +244,25 @@ def _get_pty_pair(encoding='ascii'):
+
+ class GetFormatterTest(TestCase):
+
++ @issue7567
+ def test_dumb_terminal(self):
+ master, out = _get_pty_pair()
+ formatter = _with_term('dumb', formatters.get_formatter, master)
+ self.failUnless(isinstance(formatter, formatters.PlainTextFormatter))
+
++ @issue7567
+ def test_smart_terminal(self):
+ master, out = _get_pty_pair()
+ formatter = _with_term('xterm', formatters.get_formatter, master)
+ self.failUnless(isinstance(formatter, formatters.TerminfoFormatter))
+
++ @issue7567
+ def test_not_a_tty(self):
+ stream = mk_tempfile()
+ formatter = _with_term('xterm', formatters.get_formatter, stream)
+ self.failUnless(isinstance(formatter, formatters.PlainTextFormatter))
+
++ @issue7567
+ def test_no_fd(self):
+ stream = StringIO.StringIO()
+ formatter = _with_term('xterm', formatters.get_formatter, stream)
diff --git a/dev-python/snakeoil/snakeoil-0.3.7.ebuild b/dev-python/snakeoil/snakeoil-0.3.7-r1.ebuild
index ac4f57024d77..c33eb8bca625 100644
--- a/dev-python/snakeoil/snakeoil-0.3.7.ebuild
+++ b/dev-python/snakeoil/snakeoil-0.3.7-r1.ebuild
@@ -1,11 +1,11 @@
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-python/snakeoil/snakeoil-0.3.7.ebuild,v 1.1 2010/06/27 09:38:18 ferringb Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-python/snakeoil/snakeoil-0.3.7-r1.ebuild,v 1.1 2011/01/03 11:14:08 ferringb Exp $
EAPI="2"
SUPPORT_PYTHON_ABIS="1"
-inherit distutils
+inherit eutils distutils
DESCRIPTION="Miscellaneous python utility code."
HOMEPAGE="http://www.pkgcore.org/"
@@ -21,6 +21,10 @@ RDEPEND=${DEPEND}
DOCS="AUTHORS NEWS"
+src_prepare() {
+ epatch "${FILESDIR}"/*.patch
+}
+
pkg_setup() {
python_pkg_setup