Gentoo Archives: gentoo-commits

From: "Brian Harring (ferringb)" <ferringb@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-python/snakeoil/files: snakeoil-0.3.7-multiprocess.patch snakeoil-issue-7567-term-invocation.patch
Date: Mon, 03 Jan 2011 11:14:19
Message-Id: 20110103111408.B94AE2005C@flycatcher.gentoo.org
1 ferringb 11/01/03 11:14:08
2
3 Added: snakeoil-0.3.7-multiprocess.patch
4 snakeoil-issue-7567-term-invocation.patch
5 Log:
6 fix #350215, #330511
7
8 (Portage version: 2.2.0_alpha3/cvs/Linux x86_64)
9
10 Revision Changes Path
11 1.1 dev-python/snakeoil/files/snakeoil-0.3.7-multiprocess.patch
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-python/snakeoil/files/snakeoil-0.3.7-multiprocess.patch?rev=1.1&view=markup
14 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
15
16 Index: snakeoil-0.3.7-multiprocess.patch
17 ===================================================================
18 From 1a2408eff074901d98a3ba79af6eebd7444a3a8f Mon Sep 17 00:00:00 2001
19 From: Brian Harring <ferringb@×××××.com>
20 Date: Tue, 28 Dec 2010 03:48:14 -0800
21 Subject: [PATCH 1/4] detect python bug 3770 (gentoo bug 330511), and disable multiprocessing for 2to3 conversion
22
23 ---
24 NEWS | 5 +++++
25 snakeoil/caching_2to3.py | 13 +++++++++++--
26 snakeoil/distutils_extensions.py | 7 ++-----
27 3 files changed, 18 insertions(+), 7 deletions(-)
28
29 diff --git a/NEWS b/NEWS
30 index 1423171..b92a130 100644
31 --- a/NEWS
32 +++ b/NEWS
33 @@ -58,6 +58,10 @@ Snakeoil Release Notes
34 other sequence where it evaluates false.
35
36
37 +* detect python bug 3770 (gentoo bug 330511), and disable multiprocessing
38 + for 2to3 conversion if it's found.
39 +
40 +
41 snakeoil 0.3.7: June 26th, 2010
42
43 * detect python bug 4660, and disable parallelization in 2to3 conversion if
44 @@ -72,6 +76,7 @@ snakeoil 0.3.7: June 26th, 2010
45 for 2.4
46
47
48 +
49 snakeoil 0.3.6.5: May 21st, 2010
50
51 * add discard method to AtomicWriteFile to intentionally discard the
52 diff --git a/snakeoil/caching_2to3.py b/snakeoil/caching_2to3.py
53 index 407aba4..4c8a3a8 100755
54 --- a/snakeoil/caching_2to3.py
55 +++ b/snakeoil/caching_2to3.py
56 @@ -88,8 +88,17 @@ class caching_mixin(object):
57 class RefactoringTool(caching_mixin, lib2to3.refactor.RefactoringTool):
58 pass
59
60 -class MultiprocessRefactoringTool(caching_mixin, lib2to3.refactor.MultiprocessRefactoringTool):
61 - pass
62 +multiprocessing_available = False
63 +try:
64 + import multiprocessing
65 + # this is to detect python upstream bug 3770
66 + from _multiprocessing import SemLock
67 + multiprocessing_available = True
68 +except ImportError:
69 + MultiprocessRefactoringTool = RefactoringTool
70 +else:
71 + class MultiprocessRefactoringTool(caching_mixin, lib2to3.refactor.MultiprocessRefactoringTool):
72 + pass
73
74
75 def StdoutRefactoringTool(*args):
76 diff --git a/snakeoil/distutils_extensions.py b/snakeoil/distutils_extensions.py
77 index 5883672..2c9b6d3 100644
78 --- a/snakeoil/distutils_extensions.py
79 +++ b/snakeoil/distutils_extensions.py
80 @@ -234,11 +234,8 @@ class build_py(dst_build_py.build_py):
81
82 assert proc_count >= 1
83
84 - if proc_count > 1:
85 - try:
86 - import multiprocessing
87 - except ImportError:
88 - proc_count == 1
89 + if proc_count > 1 and not caching_2to3.multiprocessing_available:
90 + proc_count = 1
91
92 refactor_kls = caching_2to3.MultiprocessRefactoringTool
93
94 --
95 1.7.3.4
96
97
98
99
100 1.1 dev-python/snakeoil/files/snakeoil-issue-7567-term-invocation.patch
101
102 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-python/snakeoil/files/snakeoil-issue-7567-term-invocation.patch?rev=1.1&view=markup
103 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
104
105 Index: snakeoil-issue-7567-term-invocation.patch
106 ===================================================================
107 diff --git a/snakeoil/test/test_formatters.py b/snakeoil/test/test_formatters.py
108 index f6e3038..cf523b2 100644
109 --- a/snakeoil/test/test_formatters.py
110 +++ b/snakeoil/test/test_formatters.py
111 @@ -8,6 +8,7 @@
112 # aside from that, tests need heavy expansion
113
114 import os
115 +import sys
116 import pty
117 import StringIO
118 import tempfile
119 @@ -23,6 +24,13 @@ if compatibility.is_py3k:
120 else:
121 mk_tempfile = tempfile.TemporaryFile
122
123 +sys_ver = sys.version_info[:3]
124 +if (sys_ver >= (2,6,6) and sys_ver < (2,7)) or sys_ver >= (3,2,0):
125 + def issue7567(functor):
126 + functor.skip = "issue 7567 patch breaks multiple term invocations, disabled till it's sorted"
127 + return functor
128 +else:
129 + issue7567 = lambda x:x
130
131 class native_PlainTextFormatterTest(TestCase):
132
133 @@ -178,6 +186,7 @@ class TerminfoFormatterTest(TestCase):
134 self.assertEqual(''.join(output), result,
135 msg="given(%r), expected(%r), got(%r)" % (inputs, output, result))
136
137 + @issue7567
138 def test_terminfo(self):
139 esc = '\x1b['
140 stream = mk_tempfile()
141 @@ -206,6 +215,9 @@ class TerminfoFormatterTest(TestCase):
142 formatters.TerminfoHatesOurTerminal,
143 formatters.TerminfoFormatter, stream, term='dumb')
144
145 + if sys_ver >= (2,6,6) and sys_ver < (2,7):
146 + test_terminfo_hates_term.skip = "issue doesn't exist for 2.6.6 till 2.7"
147 +
148
149 def _with_term(term, func, *args, **kwargs):
150 orig_term = os.environ.get('TERM')
151 @@ -232,21 +244,25 @@ def _get_pty_pair(encoding='ascii'):
152
153 class GetFormatterTest(TestCase):
154
155 + @issue7567
156 def test_dumb_terminal(self):
157 master, out = _get_pty_pair()
158 formatter = _with_term('dumb', formatters.get_formatter, master)
159 self.failUnless(isinstance(formatter, formatters.PlainTextFormatter))
160
161 + @issue7567
162 def test_smart_terminal(self):
163 master, out = _get_pty_pair()
164 formatter = _with_term('xterm', formatters.get_formatter, master)
165 self.failUnless(isinstance(formatter, formatters.TerminfoFormatter))
166
167 + @issue7567
168 def test_not_a_tty(self):
169 stream = mk_tempfile()
170 formatter = _with_term('xterm', formatters.get_formatter, stream)
171 self.failUnless(isinstance(formatter, formatters.PlainTextFormatter))
172
173 + @issue7567
174 def test_no_fd(self):
175 stream = StringIO.StringIO()
176 formatter = _with_term('xterm', formatters.get_formatter, stream)