public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [gentoo-commits] gentoo-x86 commit in dev-python/snakeoil/files: snakeoil-0.3.7-multiprocess.patch snakeoil-issue-7567-term-invocation.patch
@ 2011-01-03 11:14 99% Brian Harring (ferringb)
  0 siblings, 0 replies; 1+ results
From: Brian Harring (ferringb) @ 2011-01-03 11:14 UTC (permalink / raw
  To: gentoo-commits

ferringb    11/01/03 11:14:08

  Added:                snakeoil-0.3.7-multiprocess.patch
                        snakeoil-issue-7567-term-invocation.patch
  Log:
  fix #350215, #330511
  
  (Portage version: 2.2.0_alpha3/cvs/Linux x86_64)

Revision  Changes    Path
1.1                  dev-python/snakeoil/files/snakeoil-0.3.7-multiprocess.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-python/snakeoil/files/snakeoil-0.3.7-multiprocess.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-python/snakeoil/files/snakeoil-0.3.7-multiprocess.patch?rev=1.1&content-type=text/plain

Index: snakeoil-0.3.7-multiprocess.patch
===================================================================
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




1.1                  dev-python/snakeoil/files/snakeoil-issue-7567-term-invocation.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-python/snakeoil/files/snakeoil-issue-7567-term-invocation.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-python/snakeoil/files/snakeoil-issue-7567-term-invocation.patch?rev=1.1&content-type=text/plain

Index: snakeoil-issue-7567-term-invocation.patch
===================================================================
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)






^ permalink raw reply related	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2011-01-03 11:14 99% [gentoo-commits] gentoo-x86 commit in dev-python/snakeoil/files: snakeoil-0.3.7-multiprocess.patch snakeoil-issue-7567-term-invocation.patch Brian Harring (ferringb)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox