Gentoo Archives: gentoo-commits

From: Patrice Clement <monsieurp@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/line_profiler/files/
Date: Sun, 03 Dec 2017 12:16:22
Message-Id: 1512303377.82faa3e5ba5a75f015ce46359241b0348b5dbdd9.monsieurp@gentoo
1 commit: 82faa3e5ba5a75f015ce46359241b0348b5dbdd9
2 Author: Michael Mair-Keimberger <m.mairkeimberger <AT> gmail <DOT> com>
3 AuthorDate: Sun Dec 3 08:15:11 2017 +0000
4 Commit: Patrice Clement <monsieurp <AT> gentoo <DOT> org>
5 CommitDate: Sun Dec 3 12:16:17 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=82faa3e5
7
8 dev-python/line_profiler: remove unused patches.
9
10 Closes: https://github.com/gentoo/gentoo/pull/6409
11
12 ...line_profiler-1.0-fix-name-from-copypasta.patch | 25 --
13 ...ne_profiler-1.0-ipython-5.0-compatibility.patch | 299 ---------------------
14 2 files changed, 324 deletions(-)
15
16 diff --git a/dev-python/line_profiler/files/line_profiler-1.0-fix-name-from-copypasta.patch b/dev-python/line_profiler/files/line_profiler-1.0-fix-name-from-copypasta.patch
17 deleted file mode 100644
18 index e51a24f8617..00000000000
19 --- a/dev-python/line_profiler/files/line_profiler-1.0-fix-name-from-copypasta.patch
20 +++ /dev/null
21 @@ -1,25 +0,0 @@
22 -From 717df8c2088087ea4bce870400a2c99b36b0e53d Mon Sep 17 00:00:00 2001
23 -From: Robert Kern <rkern@×××××××××.com>
24 -Date: Mon, 21 Dec 2015 19:25:51 +0000
25 -Subject: [PATCH] BUG: fix name from copypasta.
26 -
27 -Fixes #43
28 -
29 -Thanks, @anntzer!
30 ----
31 - line_profiler.py | 2 +-
32 - 1 file changed, 1 insertion(+), 1 deletion(-)
33 -
34 -diff --git a/line_profiler.py b/line_profiler.py
35 -index 4480c7b..aac01c8 100755
36 ---- a/line_profiler.py
37 -+++ b/line_profiler.py
38 -@@ -303,7 +303,7 @@ def magic_lprun(self, parameter_s=''):
39 - mod = __import__(modname, fromlist=[''])
40 - profile.add_module(mod)
41 - except Exception as e:
42 -- raise UsageError('Could not find module %r.\n%s: %s' % (name,
43 -+ raise UsageError('Could not find module %r.\n%s: %s' % (modname,
44 - e.__class__.__name__, e))
45 -
46 - # Add the profiler to the builtins for @profile.
47
48 diff --git a/dev-python/line_profiler/files/line_profiler-1.0-ipython-5.0-compatibility.patch b/dev-python/line_profiler/files/line_profiler-1.0-ipython-5.0-compatibility.patch
49 deleted file mode 100644
50 index 04caa8c6987..00000000000
51 --- a/dev-python/line_profiler/files/line_profiler-1.0-ipython-5.0-compatibility.patch
52 +++ /dev/null
53 @@ -1,299 +0,0 @@
54 -https://github.com/rkern/line_profiler/pull/65
55 -
56 -From 677a43104dd537b515c06eaeffa77f8dcfa5a76e Mon Sep 17 00:00:00 2001
57 -From: Brett Olsen <brett.olsen@×××××××.com>
58 -Date: Tue, 12 Jul 2016 10:18:28 -0700
59 -Subject: [PATCH 1] Update for compatibility with IPython 5.0
60 -
61 -Also tested with IPython 4.1.1. Replaces the depreciated ip.define_magic() method with ip.register_magics() and some modifications to handle the different API required.
62 ----
63 - line_profiler.py | 245 ++++++++++++++++++++++++++++---------------------------
64 - 1 file changed, 125 insertions(+), 120 deletions(-)
65 -
66 -diff --git a/line_profiler.py b/line_profiler.py
67 -index aac01c8..7645997 100755
68 ---- a/line_profiler.py
69 -+++ b/line_profiler.py
70 -@@ -17,6 +17,8 @@
71 - import os
72 - import sys
73 -
74 -+from IPython.core.magic import (Magics, magics_class, line_magic)
75 -+
76 - from _line_profiler import LineProfiler as CLineProfiler
77 -
78 - # Python 2/3 compatibility utils
79 -@@ -226,150 +228,153 @@ def show_text(stats, unit, stream=None, stripzeros=False):
80 - for (fn, lineno, name), timings in sorted(stats.items()):
81 - show_func(fn, lineno, name, stats[fn, lineno, name], unit, stream=stream, stripzeros=stripzeros)
82 -
83 --# A %lprun magic for IPython.
84 --def magic_lprun(self, parameter_s=''):
85 -- """ Execute a statement under the line-by-line profiler from the
86 -- line_profiler module.
87 -+@magics_class
88 -+class LineProfilerMagics(Magics):
89 -
90 -- Usage:
91 -- %lprun -f func1 -f func2 <statement>
92 -+ @line_magic
93 -+ def lprun(self, parameter_s=''):
94 -+ """ Execute a statement under the line-by-line profiler from the
95 -+ line_profiler module.
96 -
97 -- The given statement (which doesn't require quote marks) is run via the
98 -- LineProfiler. Profiling is enabled for the functions specified by the -f
99 -- options. The statistics will be shown side-by-side with the code through the
100 -- pager once the statement has completed.
101 -+ Usage:
102 -+ %lprun -f func1 -f func2 <statement>
103 -
104 -- Options:
105 -+ The given statement (which doesn't require quote marks) is run via the
106 -+ LineProfiler. Profiling is enabled for the functions specified by the -f
107 -+ options. The statistics will be shown side-by-side with the code through the
108 -+ pager once the statement has completed.
109 -
110 -- -f <function>: LineProfiler only profiles functions and methods it is told
111 -- to profile. This option tells the profiler about these functions. Multiple
112 -- -f options may be used. The argument may be any expression that gives
113 -- a Python function or method object. However, one must be careful to avoid
114 -- spaces that may confuse the option parser. Additionally, functions defined
115 -- in the interpreter at the In[] prompt or via %run currently cannot be
116 -- displayed. Write these functions out to a separate file and import them.
117 -+ Options:
118 -
119 -- -m <module>: Get all the functions/methods in a module
120 -+ -f <function>: LineProfiler only profiles functions and methods it is told
121 -+ to profile. This option tells the profiler about these functions. Multiple
122 -+ -f options may be used. The argument may be any expression that gives
123 -+ a Python function or method object. However, one must be careful to avoid
124 -+ spaces that may confuse the option parser. Additionally, functions defined
125 -+ in the interpreter at the In[] prompt or via %run currently cannot be
126 -+ displayed. Write these functions out to a separate file and import them.
127 -
128 -- One or more -f or -m options are required to get any useful results.
129 -+ -m <module>: Get all the functions/methods in a module
130 -
131 -- -D <filename>: dump the raw statistics out to a pickle file on disk. The
132 -- usual extension for this is ".lprof". These statistics may be viewed later
133 -- by running line_profiler.py as a script.
134 -+ One or more -f or -m options are required to get any useful results.
135 -
136 -- -T <filename>: dump the text-formatted statistics with the code side-by-side
137 -- out to a text file.
138 -+ -D <filename>: dump the raw statistics out to a pickle file on disk. The
139 -+ usual extension for this is ".lprof". These statistics may be viewed later
140 -+ by running line_profiler.py as a script.
141 -
142 -- -r: return the LineProfiler object after it has completed profiling.
143 -+ -T <filename>: dump the text-formatted statistics with the code side-by-side
144 -+ out to a text file.
145 -
146 -- -s: strip out all entries from the print-out that have zeros.
147 -- """
148 -- # Local imports to avoid hard dependency.
149 -- from distutils.version import LooseVersion
150 -- import IPython
151 -- ipython_version = LooseVersion(IPython.__version__)
152 -- if ipython_version < '0.11':
153 -- from IPython.genutils import page
154 -- from IPython.ipstruct import Struct
155 -- from IPython.ipapi import UsageError
156 -- else:
157 -- from IPython.core.page import page
158 -- from IPython.utils.ipstruct import Struct
159 -- from IPython.core.error import UsageError
160 --
161 -- # Escape quote markers.
162 -- opts_def = Struct(D=[''], T=[''], f=[], m=[])
163 -- parameter_s = parameter_s.replace('"', r'\"').replace("'", r"\'")
164 -- opts, arg_str = self.parse_options(parameter_s, 'rsf:m:D:T:', list_all=True)
165 -- opts.merge(opts_def)
166 --
167 -- global_ns = self.shell.user_global_ns
168 -- local_ns = self.shell.user_ns
169 --
170 -- # Get the requested functions.
171 -- funcs = []
172 -- for name in opts.f:
173 -- try:
174 -- funcs.append(eval(name, global_ns, local_ns))
175 -- except Exception as e:
176 -- raise UsageError('Could not find function %r.\n%s: %s' % (name,
177 -- e.__class__.__name__, e))
178 -+ -r: return the LineProfiler object after it has completed profiling.
179 -
180 -- profile = LineProfiler(*funcs)
181 -+ -s: strip out all entries from the print-out that have zeros.
182 -+ """
183 -+ # Local imports to avoid hard dependency.
184 -+ from distutils.version import LooseVersion
185 -+ import IPython
186 -+ ipython_version = LooseVersion(IPython.__version__)
187 -+ if ipython_version < '0.11':
188 -+ from IPython.genutils import page
189 -+ from IPython.ipstruct import Struct
190 -+ from IPython.ipapi import UsageError
191 -+ else:
192 -+ from IPython.core.page import page
193 -+ from IPython.utils.ipstruct import Struct
194 -+ from IPython.core.error import UsageError
195 -+
196 -+ # Escape quote markers.
197 -+ opts_def = Struct(D=[''], T=[''], f=[], m=[])
198 -+ parameter_s = parameter_s.replace('"', r'\"').replace("'", r"\'")
199 -+ opts, arg_str = self.parse_options(parameter_s, 'rsf:m:D:T:', list_all=True)
200 -+ opts.merge(opts_def)
201 -+
202 -+ global_ns = self.shell.user_global_ns
203 -+ local_ns = self.shell.user_ns
204 -+
205 -+ # Get the requested functions.
206 -+ funcs = []
207 -+ for name in opts.f:
208 -+ try:
209 -+ funcs.append(eval(name, global_ns, local_ns))
210 -+ except Exception as e:
211 -+ raise UsageError('Could not find function %r.\n%s: %s' % (name,
212 -+ e.__class__.__name__, e))
213 -
214 -- # Get the modules, too
215 -- for modname in opts.m:
216 -- try:
217 -- mod = __import__(modname, fromlist=[''])
218 -- profile.add_module(mod)
219 -- except Exception as e:
220 -- raise UsageError('Could not find module %r.\n%s: %s' % (modname,
221 -- e.__class__.__name__, e))
222 --
223 -- # Add the profiler to the builtins for @profile.
224 -- if PY3:
225 -- import builtins
226 -- else:
227 -- import __builtin__ as builtins
228 -+ profile = LineProfiler(*funcs)
229 -
230 -- if 'profile' in builtins.__dict__:
231 -- had_profile = True
232 -- old_profile = builtins.__dict__['profile']
233 -- else:
234 -- had_profile = False
235 -- old_profile = None
236 -- builtins.__dict__['profile'] = profile
237 -+ # Get the modules, too
238 -+ for modname in opts.m:
239 -+ try:
240 -+ mod = __import__(modname, fromlist=[''])
241 -+ profile.add_module(mod)
242 -+ except Exception as e:
243 -+ raise UsageError('Could not find module %r.\n%s: %s' % (modname,
244 -+ e.__class__.__name__, e))
245 -+
246 -+ # Add the profiler to the builtins for @profile.
247 -+ if PY3:
248 -+ import builtins
249 -+ else:
250 -+ import __builtin__ as builtins
251 -+
252 -+ if 'profile' in builtins.__dict__:
253 -+ had_profile = True
254 -+ old_profile = builtins.__dict__['profile']
255 -+ else:
256 -+ had_profile = False
257 -+ old_profile = None
258 -+ builtins.__dict__['profile'] = profile
259 -
260 -- try:
261 - try:
262 -- profile.runctx(arg_str, global_ns, local_ns)
263 -- message = ''
264 -- except SystemExit:
265 -- message = """*** SystemExit exception caught in code being profiled."""
266 -- except KeyboardInterrupt:
267 -- message = ("*** KeyboardInterrupt exception caught in code being "
268 -- "profiled.")
269 -- finally:
270 -- if had_profile:
271 -- builtins.__dict__['profile'] = old_profile
272 --
273 -- # Trap text output.
274 -- stdout_trap = StringIO()
275 -- profile.print_stats(stdout_trap, stripzeros='s' in opts)
276 -- output = stdout_trap.getvalue()
277 -- output = output.rstrip()
278 --
279 -- if ipython_version < '0.11':
280 -- page(output, screen_lines=self.shell.rc.screen_length)
281 -- else:
282 -- page(output)
283 -- print(message, end="")
284 -+ try:
285 -+ profile.runctx(arg_str, global_ns, local_ns)
286 -+ message = ''
287 -+ except SystemExit:
288 -+ message = """*** SystemExit exception caught in code being profiled."""
289 -+ except KeyboardInterrupt:
290 -+ message = ("*** KeyboardInterrupt exception caught in code being "
291 -+ "profiled.")
292 -+ finally:
293 -+ if had_profile:
294 -+ builtins.__dict__['profile'] = old_profile
295 -+
296 -+ # Trap text output.
297 -+ stdout_trap = StringIO()
298 -+ profile.print_stats(stdout_trap, stripzeros='s' in opts)
299 -+ output = stdout_trap.getvalue()
300 -+ output = output.rstrip()
301 -+
302 -+ if ipython_version < '0.11':
303 -+ page(output, screen_lines=self.shell.rc.screen_length)
304 -+ else:
305 -+ page(output)
306 -+ print(message, end="")
307 -
308 -- dump_file = opts.D[0]
309 -- if dump_file:
310 -- profile.dump_stats(dump_file)
311 -- print('\n*** Profile stats pickled to file %r. %s' % (
312 -- dump_file, message))
313 -+ dump_file = opts.D[0]
314 -+ if dump_file:
315 -+ profile.dump_stats(dump_file)
316 -+ print('\n*** Profile stats pickled to file %r. %s' % (
317 -+ dump_file, message))
318 -
319 -- text_file = opts.T[0]
320 -- if text_file:
321 -- pfile = open(text_file, 'w')
322 -- pfile.write(output)
323 -- pfile.close()
324 -- print('\n*** Profile printout saved to text file %r. %s' % (
325 -- text_file, message))
326 -+ text_file = opts.T[0]
327 -+ if text_file:
328 -+ pfile = open(text_file, 'w')
329 -+ pfile.write(output)
330 -+ pfile.close()
331 -+ print('\n*** Profile printout saved to text file %r. %s' % (
332 -+ text_file, message))
333 -
334 -- return_value = None
335 -- if 'r' in opts:
336 -- return_value = profile
337 -+ return_value = None
338 -+ if 'r' in opts:
339 -+ return_value = profile
340 -
341 -- return return_value
342 -+ return return_value
343 -
344 -
345 - def load_ipython_extension(ip):
346 - """ API for IPython to recognize this module as an IPython extension.
347 - """
348 -- ip.define_magic('lprun', magic_lprun)
349 -+ ip.register_magics(LineProfilerMagics)
350 -
351 -
352 - def load_stats(filename):