Show More
@@ -0,0 +1,311 b'' | |||||
|
1 | # -*- coding: utf-8 -*- | |||
|
2 | """ | |||
|
3 | %jot magic for lightweight persistence. | |||
|
4 | ||||
|
5 | Stores variables in Struct with some notes in PicleShare database | |||
|
6 | ||||
|
7 | ||||
|
8 | """ | |||
|
9 | ||||
|
10 | from datetime import datetime | |||
|
11 | import IPython.ipapi | |||
|
12 | ip = IPython.ipapi.get() | |||
|
13 | ||||
|
14 | import pickleshare | |||
|
15 | ||||
|
16 | import inspect,pickle,os,sys,textwrap | |||
|
17 | from IPython.FakeModule import FakeModule | |||
|
18 | from IPython.ipstruct import Struct | |||
|
19 | ||||
|
20 | ||||
|
21 | def refresh_variables(ip, key=None): | |||
|
22 | db = ip.db | |||
|
23 | if key is None: | |||
|
24 | keys = db.keys('jot/*') | |||
|
25 | else: | |||
|
26 | keys = db.keys('jot/'+key) | |||
|
27 | for key in keys: | |||
|
28 | # strip autorestore | |||
|
29 | justkey = os.path.basename(key) | |||
|
30 | print "Restoring from", justkey, "..." | |||
|
31 | try: | |||
|
32 | obj = db[key] | |||
|
33 | except KeyError: | |||
|
34 | print "Unable to restore variable '%s', ignoring (use %%jot -d to forget!)" % justkey | |||
|
35 | print "The error was:",sys.exc_info()[0] | |||
|
36 | else: | |||
|
37 | #print "restored",justkey,"=",obj #dbg | |||
|
38 | try: | |||
|
39 | origname = obj.name | |||
|
40 | except: | |||
|
41 | ip.user_ns[justkey] = obj | |||
|
42 | print "Restored", justkey | |||
|
43 | else: | |||
|
44 | ip.user_ns[origname] = obj['val'] | |||
|
45 | print "Restored", origname | |||
|
46 | ||||
|
47 | def read_variables(ip, key=None): | |||
|
48 | db = ip.db | |||
|
49 | if key is None: | |||
|
50 | return None | |||
|
51 | else: | |||
|
52 | keys = db.keys('jot/'+key) | |||
|
53 | for key in keys: | |||
|
54 | # strip autorestore | |||
|
55 | justkey = os.path.basename(key) | |||
|
56 | print "restoring from ", justkey | |||
|
57 | try: | |||
|
58 | obj = db[key] | |||
|
59 | except KeyError: | |||
|
60 | print "Unable to read variable '%s', ignoring (use %%jot -d to forget!)" % justkey | |||
|
61 | print "The error was:",sys.exc_info()[0] | |||
|
62 | else: | |||
|
63 | return obj | |||
|
64 | ||||
|
65 | ||||
|
66 | def detail_variables(ip, key=None): | |||
|
67 | db, get = ip.db, ip.db.get | |||
|
68 | ||||
|
69 | if key is None: | |||
|
70 | keys = db.keys('jot/*') | |||
|
71 | else: | |||
|
72 | keys = db.keys('jot/'+key) | |||
|
73 | if keys: | |||
|
74 | size = max(map(len,keys)) | |||
|
75 | else: | |||
|
76 | size = 0 | |||
|
77 | ||||
|
78 | fmthead = '%-'+str(size)+'s [%s]' | |||
|
79 | fmtbody = 'Comment:\n %s' | |||
|
80 | fmtdata = 'Data:\n %s, %s' | |||
|
81 | for key in keys: | |||
|
82 | v = get(key,'<unavailable>') | |||
|
83 | justkey = os.path.basename(key) | |||
|
84 | try: | |||
|
85 | print fmthead % (justkey, datetime.ctime(v.get('time','<unavailable>'))) | |||
|
86 | print fmtbody % (v.get('comment','<unavailable>')) | |||
|
87 | d = v.get('val','unavailable') | |||
|
88 | print fmtdata % (repr(type(d)), '') | |||
|
89 | print repr(d)[0:200] | |||
|
90 | ||||
|
91 | ||||
|
92 | except AttributeError: | |||
|
93 | print fmt % (justkey, '<unavailable>', '<unavailable>', repr(v)[:50]) | |||
|
94 | ||||
|
95 | ||||
|
96 | def intm(n): | |||
|
97 | try: | |||
|
98 | return int(n) | |||
|
99 | except: | |||
|
100 | return 0 | |||
|
101 | ||||
|
102 | def jot_obj(self, obj, name, comment=''): | |||
|
103 | """ | |||
|
104 | write obj data to the note database, with whatever that should be noted. | |||
|
105 | """ | |||
|
106 | had = self.db.keys('jot/'+name+'*') | |||
|
107 | # if it the same name but a later version, we stupidly add a number to the | |||
|
108 | # so the name doesn't collide. Any better idea? | |||
|
109 | suffix = '' | |||
|
110 | if len(had)>0: | |||
|
111 | pre = os.path.commonprefix(had) | |||
|
112 | suf = [n.split(pre)[1] for n in had] | |||
|
113 | versions = map(intm, suf) | |||
|
114 | suffix = str(max(versions)+1) | |||
|
115 | ||||
|
116 | uname = 'jot/'+name+suffix | |||
|
117 | ||||
|
118 | # which one works better? | |||
|
119 | #all = ip.IP.shadowhist.all() | |||
|
120 | all = ip.IP.shell.input_hist | |||
|
121 | ||||
|
122 | # We may actually want to make snapshot of files that are run-ned. | |||
|
123 | ||||
|
124 | # get the comment | |||
|
125 | try: | |||
|
126 | comment = ip.IP.magic_edit('-x').strip() | |||
|
127 | except: | |||
|
128 | print "No comment is recorded." | |||
|
129 | comment = '' | |||
|
130 | ||||
|
131 | self.db[uname] = Struct({'val':obj, | |||
|
132 | 'time' : datetime.now(), | |||
|
133 | 'hist' : all, | |||
|
134 | 'name' : name, | |||
|
135 | 'comment' : comment,}) | |||
|
136 | ||||
|
137 | print "Jotted down notes for '%s' (%s)" % (uname, obj.__class__.__name__) | |||
|
138 | ||||
|
139 | ||||
|
140 | ||||
|
141 | def magic_jot(self, parameter_s=''): | |||
|
142 | """Lightweight persistence for python variables. | |||
|
143 | ||||
|
144 | Example: | |||
|
145 | ||||
|
146 | ville@badger[~]|1> A = ['hello',10,'world']\\ | |||
|
147 | ville@badger[~]|2> %jot A\\ | |||
|
148 | ville@badger[~]|3> Exit | |||
|
149 | ||||
|
150 | (IPython session is closed and started again...) | |||
|
151 | ||||
|
152 | ville@badger:~$ ipython -p pysh\\ | |||
|
153 | ville@badger[~]|1> print A | |||
|
154 | ||||
|
155 | ['hello', 10, 'world'] | |||
|
156 | ||||
|
157 | Usage: | |||
|
158 | ||||
|
159 | %jot - Show list of all variables and their current values\\ | |||
|
160 | %jot -l - Show list of all variables and their current values in detail\\ | |||
|
161 | %jot -l <var> - Show one variable and its current values in detail\\ | |||
|
162 | %jot <var> - Store the *current* value of the variable to disk\\ | |||
|
163 | %jot -d <var> - Remove the variable and its value from storage\\ | |||
|
164 | %jot -z - Remove all variables from storage (disabled)\\ | |||
|
165 | %jot -r <var> - Refresh/Load variable from jot (delete current vals)\\ | |||
|
166 | %jot foo >a.txt - Store value of foo to new file a.txt\\ | |||
|
167 | %jot foo >>a.txt - Append value of foo to file a.txt\\ | |||
|
168 | ||||
|
169 | It should be noted that if you change the value of a variable, you | |||
|
170 | need to %note it again if you want to persist the new value. | |||
|
171 | ||||
|
172 | Note also that the variables will need to be pickleable; most basic | |||
|
173 | python types can be safely %stored. | |||
|
174 | ||||
|
175 | """ | |||
|
176 | ||||
|
177 | opts,argsl = self.parse_options(parameter_s,'drzl',mode='string') | |||
|
178 | args = argsl.split(None,1) | |||
|
179 | ip = self.getapi() | |||
|
180 | db = ip.db | |||
|
181 | # delete | |||
|
182 | if opts.has_key('d'): | |||
|
183 | try: | |||
|
184 | todel = args[0] | |||
|
185 | except IndexError: | |||
|
186 | error('You must provide the variable to forget') | |||
|
187 | else: | |||
|
188 | try: | |||
|
189 | del db['jot/' + todel] | |||
|
190 | except: | |||
|
191 | error("Can't delete variable '%s'" % todel) | |||
|
192 | # reset the whole database | |||
|
193 | elif opts.has_key('z'): | |||
|
194 | print "reseting the whole database has been disabled." | |||
|
195 | #for k in db.keys('autorestore/*'): | |||
|
196 | # del db[k] | |||
|
197 | ||||
|
198 | elif opts.has_key('r'): | |||
|
199 | try: | |||
|
200 | toret = args[0] | |||
|
201 | except: | |||
|
202 | print "restoring all the variables jotted down..." | |||
|
203 | refresh_variables(ip) | |||
|
204 | else: | |||
|
205 | refresh_variables(ip, toret) | |||
|
206 | ||||
|
207 | elif opts.has_key('l'): | |||
|
208 | try: | |||
|
209 | tolist = args[0] | |||
|
210 | except: | |||
|
211 | print "List details for all the items." | |||
|
212 | detail_variables(ip) | |||
|
213 | else: | |||
|
214 | print "Details for", tolist, ":" | |||
|
215 | detail_variables(ip, tolist) | |||
|
216 | ||||
|
217 | # run without arguments -> list noted variables & notes | |||
|
218 | elif not args: | |||
|
219 | vars = self.db.keys('jot/*') | |||
|
220 | vars.sort() | |||
|
221 | if vars: | |||
|
222 | size = max(map(len,vars)) - 4 | |||
|
223 | else: | |||
|
224 | size = 0 | |||
|
225 | ||||
|
226 | print 'Variables and their in-db values:' | |||
|
227 | fmt = '%-'+str(size)+'s [%s] -> %s' | |||
|
228 | get = db.get | |||
|
229 | for var in vars: | |||
|
230 | justkey = os.path.basename(var) | |||
|
231 | v = get(var,'<unavailable>') | |||
|
232 | try: | |||
|
233 | print fmt % (justkey,\ | |||
|
234 | datetime.ctime(v.get('time','<unavailable>')),\ | |||
|
235 | v.get('comment','<unavailable>')[:70].replace('\n',' '),) | |||
|
236 | except AttributeError: | |||
|
237 | print fmt % (justkey, '<unavailable>', '<unavailable>', repr(v)[:50]) | |||
|
238 | ||||
|
239 | ||||
|
240 | # default action - store the variable | |||
|
241 | else: | |||
|
242 | # %store foo >file.txt or >>file.txt | |||
|
243 | if len(args) > 1 and args[1].startswith('>'): | |||
|
244 | fnam = os.path.expanduser(args[1].lstrip('>').lstrip()) | |||
|
245 | if args[1].startswith('>>'): | |||
|
246 | fil = open(fnam,'a') | |||
|
247 | else: | |||
|
248 | fil = open(fnam,'w') | |||
|
249 | obj = ip.ev(args[0]) | |||
|
250 | print "Writing '%s' (%s) to file '%s'." % (args[0], | |||
|
251 | obj.__class__.__name__, fnam) | |||
|
252 | ||||
|
253 | ||||
|
254 | if not isinstance (obj,basestring): | |||
|
255 | from pprint import pprint | |||
|
256 | pprint(obj,fil) | |||
|
257 | else: | |||
|
258 | fil.write(obj) | |||
|
259 | if not obj.endswith('\n'): | |||
|
260 | fil.write('\n') | |||
|
261 | ||||
|
262 | fil.close() | |||
|
263 | return | |||
|
264 | ||||
|
265 | # %note foo | |||
|
266 | try: | |||
|
267 | obj = ip.user_ns[args[0]] | |||
|
268 | except KeyError: | |||
|
269 | # this should not be alias, for aliases, use %store | |||
|
270 | ||||
|
271 | print "Error: %s doesn't exist." % args[0] | |||
|
272 | ||||
|
273 | print "Use %note -r <var> to retrieve variables. This should not be used " +\ | |||
|
274 | "to store alias, for saving aliases, use %store" | |||
|
275 | return | |||
|
276 | else: | |||
|
277 | if isinstance(inspect.getmodule(obj), FakeModule): | |||
|
278 | print textwrap.dedent("""\ | |||
|
279 | Warning:%s is %s | |||
|
280 | Proper storage of interactively declared classes (or instances | |||
|
281 | of those classes) is not possible! Only instances | |||
|
282 | of classes in real modules on file system can be %%store'd. | |||
|
283 | """ % (args[0], obj) ) | |||
|
284 | return | |||
|
285 | #pickled = pickle.dumps(obj) | |||
|
286 | #self.db[ 'jot/' + args[0] ] = obj | |||
|
287 | jot_obj(self, obj, args[0]) | |||
|
288 | ||||
|
289 | ||||
|
290 | def magic_read(self, parameter_s=''): | |||
|
291 | """ | |||
|
292 | %read <var> - Load variable from data that is jotted down.\\ | |||
|
293 | ||||
|
294 | """ | |||
|
295 | ||||
|
296 | opts,argsl = self.parse_options(parameter_s,'drzl',mode='string') | |||
|
297 | args = argsl.split(None,1) | |||
|
298 | ip = self.getapi() | |||
|
299 | db = ip.db | |||
|
300 | #if opts.has_key('r'): | |||
|
301 | try: | |||
|
302 | toret = args[0] | |||
|
303 | except: | |||
|
304 | print "which record do you want to read out?" | |||
|
305 | return | |||
|
306 | else: | |||
|
307 | return read_variables(ip, toret) | |||
|
308 | ||||
|
309 | ||||
|
310 | ip.expose_magic('jot',magic_jot) | |||
|
311 | ip.expose_magic('read',magic_read) |
@@ -0,0 +1,234 b'' | |||||
|
1 | """ | |||
|
2 | IPython extension: %lookfor command for searching docstrings | |||
|
3 | ||||
|
4 | """ | |||
|
5 | # Pauli Virtanen <pav@iki.fi>, 2008. | |||
|
6 | ||||
|
7 | import re, inspect, pkgutil, pydoc | |||
|
8 | ||||
|
9 | #------------------------------------------------------------------------------ | |||
|
10 | # Lookfor functionality | |||
|
11 | #------------------------------------------------------------------------------ | |||
|
12 | ||||
|
13 | # Cache for lookfor: {id(module): {name: (docstring, kind, index), ...}...} | |||
|
14 | # where kind: "func", "class", "module", "object" | |||
|
15 | # and index: index in breadth-first namespace traversal | |||
|
16 | _lookfor_caches = {} | |||
|
17 | ||||
|
18 | # regexp whose match indicates that the string may contain a function signature | |||
|
19 | _function_signature_re = re.compile(r"[a-z_]+\(.*[,=].*\)", re.I) | |||
|
20 | ||||
|
21 | def lookfor(what, modules=None, import_modules=True, regenerate=False): | |||
|
22 | """ | |||
|
23 | Search for objects whose documentation contains all given words. | |||
|
24 | Shows a summary of matching objects, sorted roughly by relevance. | |||
|
25 | ||||
|
26 | Parameters | |||
|
27 | ---------- | |||
|
28 | what : str | |||
|
29 | String containing words to look for. | |||
|
30 | ||||
|
31 | module : str, module | |||
|
32 | Module whose docstrings to go through. | |||
|
33 | import_modules : bool | |||
|
34 | Whether to import sub-modules in packages. | |||
|
35 | Will import only modules in __all__ | |||
|
36 | regenerate: bool | |||
|
37 | Re-generate the docstring cache | |||
|
38 | ||||
|
39 | """ | |||
|
40 | # Cache | |||
|
41 | cache = {} | |||
|
42 | for module in modules: | |||
|
43 | try: | |||
|
44 | c = _lookfor_generate_cache(module, import_modules, regenerate) | |||
|
45 | cache.update(c) | |||
|
46 | except ImportError: | |||
|
47 | pass | |||
|
48 | ||||
|
49 | # Search | |||
|
50 | # XXX: maybe using a real stemming search engine would be better? | |||
|
51 | found = [] | |||
|
52 | whats = str(what).lower().split() | |||
|
53 | if not whats: return | |||
|
54 | ||||
|
55 | for name, (docstring, kind, index) in cache.iteritems(): | |||
|
56 | if kind in ('module', 'object'): | |||
|
57 | # don't show modules or objects | |||
|
58 | continue | |||
|
59 | ok = True | |||
|
60 | doc = docstring.lower() | |||
|
61 | for w in whats: | |||
|
62 | if w not in doc: | |||
|
63 | ok = False | |||
|
64 | break | |||
|
65 | if ok: | |||
|
66 | found.append(name) | |||
|
67 | ||||
|
68 | # Relevance sort | |||
|
69 | # XXX: this is full Harrison-Stetson heuristics now, | |||
|
70 | # XXX: it probably could be improved | |||
|
71 | ||||
|
72 | kind_relevance = {'func': 1000, 'class': 1000, | |||
|
73 | 'module': -1000, 'object': -1000} | |||
|
74 | ||||
|
75 | def relevance(name, docstr, kind, index): | |||
|
76 | r = 0 | |||
|
77 | # do the keywords occur within the start of the docstring? | |||
|
78 | first_doc = "\n".join(docstr.lower().strip().split("\n")[:3]) | |||
|
79 | r += sum([200 for w in whats if w in first_doc]) | |||
|
80 | # do the keywords occur in the function name? | |||
|
81 | r += sum([30 for w in whats if w in name]) | |||
|
82 | # is the full name long? | |||
|
83 | r += -len(name) * 5 | |||
|
84 | # is the object of bad type? | |||
|
85 | r += kind_relevance.get(kind, -1000) | |||
|
86 | # is the object deep in namespace hierarchy? | |||
|
87 | r += -name.count('.') * 10 | |||
|
88 | r += max(-index / 100, -100) | |||
|
89 | return r | |||
|
90 | ||||
|
91 | def relevance_sort(a, b): | |||
|
92 | dr = relevance(b, *cache[b]) - relevance(a, *cache[a]) | |||
|
93 | if dr != 0: return dr | |||
|
94 | else: return cmp(a, b) | |||
|
95 | found.sort(relevance_sort) | |||
|
96 | ||||
|
97 | # Pretty-print | |||
|
98 | s = "Search results for '%s'" % (' '.join(whats)) | |||
|
99 | help_text = [s, "-"*len(s)] | |||
|
100 | for name in found: | |||
|
101 | doc, kind, ix = cache[name] | |||
|
102 | ||||
|
103 | doclines = [line.strip() for line in doc.strip().split("\n") | |||
|
104 | if line.strip()] | |||
|
105 | ||||
|
106 | # find a suitable short description | |||
|
107 | try: | |||
|
108 | first_doc = doclines[0].strip() | |||
|
109 | if _function_signature_re.search(first_doc): | |||
|
110 | first_doc = doclines[1].strip() | |||
|
111 | except IndexError: | |||
|
112 | first_doc = "" | |||
|
113 | help_text.append("%s\n %s" % (name, first_doc)) | |||
|
114 | ||||
|
115 | # Output | |||
|
116 | if len(help_text) > 10: | |||
|
117 | pager = pydoc.getpager() | |||
|
118 | pager("\n".join(help_text)) | |||
|
119 | else: | |||
|
120 | print "\n".join(help_text) | |||
|
121 | ||||
|
122 | def _lookfor_generate_cache(module, import_modules, regenerate): | |||
|
123 | """ | |||
|
124 | Generate docstring cache for given module. | |||
|
125 | ||||
|
126 | Parameters | |||
|
127 | ---------- | |||
|
128 | module : str, None, module | |||
|
129 | Module for which to generate docstring cache | |||
|
130 | import_modules : bool | |||
|
131 | Whether to import sub-modules in packages. | |||
|
132 | Will import only modules in __all__ | |||
|
133 | regenerate: bool | |||
|
134 | Re-generate the docstring cache | |||
|
135 | ||||
|
136 | Returns | |||
|
137 | ------- | |||
|
138 | cache : dict {obj_full_name: (docstring, kind, index), ...} | |||
|
139 | Docstring cache for the module, either cached one (regenerate=False) | |||
|
140 | or newly generated. | |||
|
141 | ||||
|
142 | """ | |||
|
143 | global _lookfor_caches | |||
|
144 | ||||
|
145 | if module is None: | |||
|
146 | module = "numpy" | |||
|
147 | ||||
|
148 | if isinstance(module, str): | |||
|
149 | module = __import__(module) | |||
|
150 | ||||
|
151 | if id(module) in _lookfor_caches and not regenerate: | |||
|
152 | return _lookfor_caches[id(module)] | |||
|
153 | ||||
|
154 | # walk items and collect docstrings | |||
|
155 | cache = {} | |||
|
156 | _lookfor_caches[id(module)] = cache | |||
|
157 | seen = {} | |||
|
158 | index = 0 | |||
|
159 | stack = [(module.__name__, module)] | |||
|
160 | while stack: | |||
|
161 | name, item = stack.pop(0) | |||
|
162 | if id(item) in seen: continue | |||
|
163 | seen[id(item)] = True | |||
|
164 | ||||
|
165 | index += 1 | |||
|
166 | kind = "object" | |||
|
167 | ||||
|
168 | if inspect.ismodule(item): | |||
|
169 | kind = "module" | |||
|
170 | try: | |||
|
171 | _all = item.__all__ | |||
|
172 | except AttributeError: | |||
|
173 | _all = None | |||
|
174 | # import sub-packages | |||
|
175 | if import_modules and hasattr(item, '__path__'): | |||
|
176 | for m in pkgutil.iter_modules(item.__path__): | |||
|
177 | if _all is not None and m[1] not in _all: | |||
|
178 | continue | |||
|
179 | try: | |||
|
180 | __import__("%s.%s" % (name, m[1])) | |||
|
181 | except ImportError: | |||
|
182 | continue | |||
|
183 | for n, v in inspect.getmembers(item): | |||
|
184 | if _all is not None and n not in _all: | |||
|
185 | continue | |||
|
186 | stack.append(("%s.%s" % (name, n), v)) | |||
|
187 | elif inspect.isclass(item): | |||
|
188 | kind = "class" | |||
|
189 | for n, v in inspect.getmembers(item): | |||
|
190 | stack.append(("%s.%s" % (name, n), v)) | |||
|
191 | elif callable(item): | |||
|
192 | kind = "func" | |||
|
193 | ||||
|
194 | doc = inspect.getdoc(item) | |||
|
195 | if doc is not None: | |||
|
196 | cache[name] = (doc, kind, index) | |||
|
197 | ||||
|
198 | return cache | |||
|
199 | ||||
|
200 | #------------------------------------------------------------------------------ | |||
|
201 | # IPython connectivity | |||
|
202 | #------------------------------------------------------------------------------ | |||
|
203 | ||||
|
204 | import IPython.ipapi | |||
|
205 | ip = IPython.ipapi.get() | |||
|
206 | ||||
|
207 | _lookfor_modules = ['numpy', 'scipy'] | |||
|
208 | ||||
|
209 | def lookfor_f(self, arg=''): | |||
|
210 | r""" | |||
|
211 | Search for objects whose documentation contains all given words. | |||
|
212 | Shows a summary of matching objects, sorted roughly by relevance. | |||
|
213 | ||||
|
214 | Usage | |||
|
215 | ----- | |||
|
216 | %lookfor +numpy some words | |||
|
217 | Search module 'numpy' | |||
|
218 | ||||
|
219 | %lookfor_modules numpy scipy | |||
|
220 | Set default modules whose docstrings to search | |||
|
221 | ||||
|
222 | """ | |||
|
223 | lookfor(arg, modules=_lookfor_modules) | |||
|
224 | ||||
|
225 | def lookfor_modules_f(self, arg=''): | |||
|
226 | global _lookfor_modules | |||
|
227 | if not arg: | |||
|
228 | print "Modules included in %lookfor search:", _lookfor_modules | |||
|
229 | else: | |||
|
230 | _lookfor_modules = arg.split() | |||
|
231 | ||||
|
232 | ip.expose_magic('lookfor', lookfor_f) | |||
|
233 | ip.expose_magic('lookfor_modules', lookfor_modules_f) | |||
|
234 |
@@ -0,0 +1,6 b'' | |||||
|
1 | completion=IPYTHON | |||
|
2 | background_color=BLACK | |||
|
3 | filter_empty=True | |||
|
4 | filter_magic=True | |||
|
5 | filter_doc=True | |||
|
6 | filter_cmd=True |
@@ -0,0 +1,1 b'' | |||||
|
1 | doc/ipython.el usr/share/emacs/site-lisp |
@@ -0,0 +1,52 b'' | |||||
|
1 | .TH IRUNNER 1 "April 24, 2007" "" "" | |||
|
2 | .SH NAME | |||
|
3 | \fBirunner \- interactive runner interface | |||
|
4 | .SH SYNOPSIS | |||
|
5 | .nf | |||
|
6 | .fam C | |||
|
7 | \fBirunner\fP [\fIoptions\fP] \fIfile_to_run\fP | |||
|
8 | .fam T | |||
|
9 | .fi | |||
|
10 | .SH DESCRIPTION | |||
|
11 | irunner is an interface to the various interactive runners | |||
|
12 | available in IPython's \fBirunner\fP module. | |||
|
13 | .PP | |||
|
14 | The already implemented runners are listed below; adding | |||
|
15 | one for a new program is a trivial task, see the source | |||
|
16 | for examples. | |||
|
17 | .SH OPTIONS | |||
|
18 | .TP | |||
|
19 | .B | |||
|
20 | \-h, \-\-help | |||
|
21 | show this help message and exit | |||
|
22 | .TP | |||
|
23 | .B | |||
|
24 | \-\-ipython | |||
|
25 | IPython interactive runner (default). | |||
|
26 | .TP | |||
|
27 | .B | |||
|
28 | \-\-python | |||
|
29 | Python interactive runner. | |||
|
30 | .TP | |||
|
31 | .B | |||
|
32 | \-\-sage | |||
|
33 | SAGE interactive runner. | |||
|
34 | .SH EXAMPLE | |||
|
35 | irunner.py \-\-python \-\- \-\-help | |||
|
36 | will pass \-\-help to the python runner. | |||
|
37 | Similarly, | |||
|
38 | irunner.py \-\-ipython \-\- \-\-interact script.ipy | |||
|
39 | .SH SEE ALSO | |||
|
40 | .BR ipython(1) | |||
|
41 | .br | |||
|
42 | .SH BUGS | |||
|
43 | The SAGE runner only works if you manually configure your SAGE | |||
|
44 | copy to use 'colors NoColor' in the ipythonrc config file, since | |||
|
45 | currently the prompt matching regexp does not identify color sequences. | |||
|
46 | .SH AUTHOR | |||
|
47 | \fBirunner\fP is an extension of Ken Schutte <kschutte-AT-csail.mit.edu>'s | |||
|
48 | script contributed on the ipython-user list: | |||
|
49 | http://scipy.net/pipermail/ipython-user/2006-May/001705.html | |||
|
50 | .PP | |||
|
51 | This manual page was written by Bernd Zeimetz <bernd@bzed.de>, | |||
|
52 | for the Debian project (but may be used by others). |
@@ -0,0 +1,1 b'' | |||||
|
1 | debian/irunner.1 |
@@ -0,0 +1,1 b'' | |||||
|
1 | 2 |
@@ -1,4 +1,3 b'' | |||||
1 | #!/usr/bin/env python |
|
|||
2 |
|
|
1 | ||
3 | """ Implementations for various useful completers |
|
2 | """ Implementations for various useful completers | |
4 |
|
3 |
@@ -443,7 +443,14 b' def push_ev_node(node):' | |||||
443 |
|
443 | |||
444 |
|
444 | |||
445 | def push_position_from_leo(p): |
|
445 | def push_position_from_leo(p): | |
446 | push_from_leo(LeoNode(p)) |
|
446 | try: | |
|
447 | push_from_leo(LeoNode(p)) | |||
|
448 | except AttributeError,e: | |||
|
449 | if e.args == ("Commands instance has no attribute 'frame'",): | |||
|
450 | es("Error: ILeo not associated with .leo document") | |||
|
451 | es("Press alt+shift+I to fix!") | |||
|
452 | else: | |||
|
453 | raise | |||
447 |
|
454 | |||
448 | @generic |
|
455 | @generic | |
449 | def edit_object_in_leo(obj, varname): |
|
456 | def edit_object_in_leo(obj, varname): |
@@ -115,9 +115,9 b' class Magic:' | |||||
115 |
|
115 | |||
116 | def profile_missing_notice(self, *args, **kwargs): |
|
116 | def profile_missing_notice(self, *args, **kwargs): | |
117 | error("""\ |
|
117 | error("""\ | |
118 |
The profile module could not be found. |
|
118 | The profile module could not be found. It has been removed from the standard | |
119 | it has been removed from the standard Debian package because of its non-free |
|
119 | python packages because of its non-free license. To use profiling, install the | |
120 | license. To use profiling, please install"python2.3-profiler" from non-free.""") |
|
120 | python-profiler package from non-free.""") | |
121 |
|
121 | |||
122 | def default_option(self,fn,optstr): |
|
122 | def default_option(self,fn,optstr): | |
123 | """Make an entry in the options_table for fn, with value optstr""" |
|
123 | """Make an entry in the options_table for fn, with value optstr""" |
@@ -119,7 +119,7 b' class NonBlockingIPShell(object):' | |||||
119 | #vars used by _execute |
|
119 | #vars used by _execute | |
120 | self._iter_more = 0 |
|
120 | self._iter_more = 0 | |
121 | self._history_level = 0 |
|
121 | self._history_level = 0 | |
122 | self._complete_sep = re.compile('[\s\{\}\[\]\(\)]') |
|
122 | self._complete_sep = re.compile('[\s\{\}\[\]\(\)\=]') | |
123 | self._prompt = str(self._IP.outputcache.prompt1).strip() |
|
123 | self._prompt = str(self._IP.outputcache.prompt1).strip() | |
124 |
|
124 | |||
125 | #thread working vars |
|
125 | #thread working vars |
@@ -28,10 +28,30 b' class IPythonHistoryPanel(wx.Panel):' | |||||
28 | self.filter_cmd = wx.CheckBox(self, -1, "!: Sys commands") |
|
28 | self.filter_cmd = wx.CheckBox(self, -1, "!: Sys commands") | |
29 | self.filter_magic = wx.CheckBox(self, -1, "%: Magic keys") |
|
29 | self.filter_magic = wx.CheckBox(self, -1, "%: Magic keys") | |
30 |
|
30 | |||
31 |
self.filter_empty |
|
31 | self.options={'filter_empty':{'value':'True', | |
32 | self.filter_doc.SetValue(flt_doc) |
|
32 | 'checkbox':self.filter_empty,'True':True,'False':False, | |
33 | self.filter_cmd.SetValue(flt_cmd) |
|
33 | 'setfunc':lambda x:None}, | |
34 | self.filter_magic.SetValue(flt_magic) |
|
34 | 'filter_doc':{'value':'True', | |
|
35 | 'checkbox':self.filter_doc,'True':True,'False':False, | |||
|
36 | 'setfunc':lambda x:None}, | |||
|
37 | 'filter_cmd':{'value':'True', | |||
|
38 | 'checkbox':self.filter_cmd,'True':True,'False':False, | |||
|
39 | 'setfunc':lambda x:None}, | |||
|
40 | 'filter_magic':{'value':'True', | |||
|
41 | 'checkbox':self.filter_magic,'True':True,'False':False, | |||
|
42 | 'setfunc':lambda x:None}, | |||
|
43 | } | |||
|
44 | self.reloadOptions(self.options) | |||
|
45 | ||||
|
46 | self.filter_empty.Bind(wx.EVT_CHECKBOX, self.evtCheckEmptyFilter) | |||
|
47 | self.filter_doc.Bind(wx.EVT_CHECKBOX, self.evtCheckDocFilter) | |||
|
48 | self.filter_cmd.Bind(wx.EVT_CHECKBOX, self.evtCheckCmdFilter) | |||
|
49 | self.filter_magic.Bind(wx.EVT_CHECKBOX, self.evtCheckMagicFilter) | |||
|
50 | ||||
|
51 | #self.filter_empty.SetValue(flt_empty) | |||
|
52 | #self.filter_doc.SetValue(flt_doc) | |||
|
53 | #self.filter_cmd.SetValue(flt_cmd) | |||
|
54 | #self.filter_magic.SetValue(flt_magic) | |||
35 |
|
55 | |||
36 | sizer = wx.BoxSizer(wx.VERTICAL) |
|
56 | sizer = wx.BoxSizer(wx.VERTICAL) | |
37 |
|
57 | |||
@@ -73,7 +93,51 b' class IPythonHistoryPanel(wx.Panel):' | |||||
73 | if add: |
|
93 | if add: | |
74 | self.text_ctrl.AppendText(history_line+'\n') |
|
94 | self.text_ctrl.AppendText(history_line+'\n') | |
75 |
|
95 | |||
|
96 | #------------------------ Option Section ----------------------------------- | |||
|
97 | def processOptionCheckedEvt(self, event, name): | |||
|
98 | if event.IsChecked(): | |||
|
99 | self.options[name]['value']='True' | |||
|
100 | else: | |||
|
101 | self.options[name]['value']='False' | |||
|
102 | self.updateOptionTracker(name, | |||
|
103 | self.options[name]['value']) | |||
|
104 | ||||
|
105 | def evtCheckEmptyFilter(self, event): | |||
|
106 | self.processOptionCheckedEvt(event, 'filter_empty') | |||
|
107 | ||||
|
108 | def evtCheckDocFilter(self, event): | |||
|
109 | self.processOptionCheckedEvt(event, 'filter_doc') | |||
|
110 | ||||
|
111 | def evtCheckCmdFilter(self, event): | |||
|
112 | self.processOptionCheckedEvt(event, 'filter_cmd') | |||
76 |
|
113 | |||
|
114 | def evtCheckMagicFilter(self, event): | |||
|
115 | self.processOptionCheckedEvt(event, 'filter_magic') | |||
|
116 | ||||
|
117 | def getOptions(self): | |||
|
118 | return self.options | |||
|
119 | ||||
|
120 | def reloadOptions(self,options): | |||
|
121 | self.options = options | |||
|
122 | for key in self.options.keys(): | |||
|
123 | value = self.options[key]['value'] | |||
|
124 | self.options[key]['checkbox'].SetValue(self.options[key][value]) | |||
|
125 | self.options[key]['setfunc'](value) | |||
|
126 | ||||
|
127 | #------------------------ Hook Section ----------------------------------- | |||
|
128 | def updateOptionTracker(self,name,value): | |||
|
129 | ''' | |||
|
130 | Default history tracker (does nothing) | |||
|
131 | ''' | |||
|
132 | pass | |||
|
133 | ||||
|
134 | def setOptionTrackerHook(self,func): | |||
|
135 | ''' | |||
|
136 | Define a new history tracker | |||
|
137 | ''' | |||
|
138 | self.updateOptionTracker = func | |||
|
139 | ||||
|
140 | ||||
77 | #---------------------------------------------------------------------- |
|
141 | #---------------------------------------------------------------------- | |
78 | # Font definition for Styled Text Control |
|
142 | # Font definition for Styled Text Control | |
79 |
|
143 |
@@ -26,7 +26,6 b' __license__ = "BSD"' | |||||
26 |
|
26 | |||
27 | import wx |
|
27 | import wx | |
28 | import wx.stc as stc |
|
28 | import wx.stc as stc | |
29 | import wx.lib.newevent |
|
|||
30 |
|
29 | |||
31 | import re |
|
30 | import re | |
32 | import sys |
|
31 | import sys | |
@@ -39,7 +38,6 b' except Exception,e:' | |||||
39 |
|
38 | |||
40 | from ipshell_nonblocking import NonBlockingIPShell |
|
39 | from ipshell_nonblocking import NonBlockingIPShell | |
41 |
|
40 | |||
42 |
|
||||
43 | class WxNonBlockingIPShell(NonBlockingIPShell): |
|
41 | class WxNonBlockingIPShell(NonBlockingIPShell): | |
44 | ''' |
|
42 | ''' | |
45 | An NonBlockingIPShell Thread that is WX dependent. |
|
43 | An NonBlockingIPShell Thread that is WX dependent. | |
@@ -109,7 +107,7 b' class WxConsoleView(stc.StyledTextCtrl):' | |||||
109 |
|
107 | |||
110 | def __init__(self,parent,prompt,intro="",background_color="BLACK", |
|
108 | def __init__(self,parent,prompt,intro="",background_color="BLACK", | |
111 | pos=wx.DefaultPosition, ID = -1, size=wx.DefaultSize, |
|
109 | pos=wx.DefaultPosition, ID = -1, size=wx.DefaultSize, | |
112 | style=0): |
|
110 | style=0, autocomplete_mode = 'IPYTHON'): | |
113 | ''' |
|
111 | ''' | |
114 | Initialize console view. |
|
112 | Initialize console view. | |
115 |
|
113 | |||
@@ -121,6 +119,9 b' class WxConsoleView(stc.StyledTextCtrl):' | |||||
121 | @param background_color: Can be BLACK or WHITE |
|
119 | @param background_color: Can be BLACK or WHITE | |
122 | @type background_color: string |
|
120 | @type background_color: string | |
123 | @param other: init param of styledTextControl (can be used as-is) |
|
121 | @param other: init param of styledTextControl (can be used as-is) | |
|
122 | @param autocomplete_mode: Can be 'IPYTHON' or 'STC' | |||
|
123 | 'IPYTHON' show autocompletion the ipython way | |||
|
124 | 'STC" show it scintilla text control way | |||
124 | ''' |
|
125 | ''' | |
125 | stc.StyledTextCtrl.__init__(self, parent, ID, pos, size, style) |
|
126 | stc.StyledTextCtrl.__init__(self, parent, ID, pos, size, style) | |
126 |
|
127 | |||
@@ -131,6 +132,45 b' class WxConsoleView(stc.StyledTextCtrl):' | |||||
131 | self.CmdKeyAssign(ord('B'), stc.STC_SCMOD_CTRL, stc.STC_CMD_ZOOMIN) |
|
132 | self.CmdKeyAssign(ord('B'), stc.STC_SCMOD_CTRL, stc.STC_CMD_ZOOMIN) | |
132 | self.CmdKeyAssign(ord('N'), stc.STC_SCMOD_CTRL, stc.STC_CMD_ZOOMOUT) |
|
133 | self.CmdKeyAssign(ord('N'), stc.STC_SCMOD_CTRL, stc.STC_CMD_ZOOMOUT) | |
133 |
|
134 | |||
|
135 | #We draw a line at position 80 | |||
|
136 | self.SetEdgeMode(stc.STC_EDGE_LINE) | |||
|
137 | self.SetEdgeColumn(80) | |||
|
138 | self.SetEdgeColour(wx.LIGHT_GREY) | |||
|
139 | ||||
|
140 | #self.SetViewWhiteSpace(True) | |||
|
141 | #self.SetViewEOL(True) | |||
|
142 | self.SetEOLMode(stc.STC_EOL_CRLF) | |||
|
143 | #self.SetWrapMode(stc.STC_WRAP_CHAR) | |||
|
144 | #self.SetWrapMode(stc.STC_WRAP_WORD) | |||
|
145 | self.SetBufferedDraw(True) | |||
|
146 | #self.SetUseAntiAliasing(True) | |||
|
147 | self.SetLayoutCache(stc.STC_CACHE_PAGE) | |||
|
148 | self.SetUndoCollection(False) | |||
|
149 | ||||
|
150 | self.EnsureCaretVisible() | |||
|
151 | ||||
|
152 | self.SetMargins(3,3) #text is moved away from border with 3px | |||
|
153 | # Suppressing Scintilla margins | |||
|
154 | self.SetMarginWidth(0,0) | |||
|
155 | self.SetMarginWidth(1,0) | |||
|
156 | self.SetMarginWidth(2,0) | |||
|
157 | ||||
|
158 | self.background_color = background_color | |||
|
159 | self.buildStyles() | |||
|
160 | ||||
|
161 | self.indent = 0 | |||
|
162 | self.prompt_count = 0 | |||
|
163 | self.color_pat = re.compile('\x01?\x1b\[(.*?)m\x02?') | |||
|
164 | ||||
|
165 | self.write(intro) | |||
|
166 | self.setPrompt(prompt) | |||
|
167 | self.showPrompt() | |||
|
168 | ||||
|
169 | self.autocomplete_mode = autocomplete_mode | |||
|
170 | ||||
|
171 | self.Bind(wx.EVT_KEY_DOWN, self._onKeypress) | |||
|
172 | ||||
|
173 | def buildStyles(self): | |||
134 | #we define platform specific fonts |
|
174 | #we define platform specific fonts | |
135 | if wx.Platform == '__WXMSW__': |
|
175 | if wx.Platform == '__WXMSW__': | |
136 | faces = { 'times': 'Times New Roman', |
|
176 | faces = { 'times': 'Times New Roman', | |
@@ -157,35 +197,12 b' class WxConsoleView(stc.StyledTextCtrl):' | |||||
157 | 'size2': 8, |
|
197 | 'size2': 8, | |
158 | } |
|
198 | } | |
159 |
|
199 | |||
160 | #We draw a line at position 80 |
|
|||
161 | self.SetEdgeMode(stc.STC_EDGE_LINE) |
|
|||
162 | self.SetEdgeColumn(80) |
|
|||
163 | self.SetEdgeColour(wx.LIGHT_GREY) |
|
|||
164 |
|
||||
165 | #self.SetViewWhiteSpace(True) |
|
|||
166 | #self.SetViewEOL(True) |
|
|||
167 | self.SetEOLMode(stc.STC_EOL_CRLF) |
|
|||
168 | #self.SetWrapMode(stc.STC_WRAP_CHAR) |
|
|||
169 | #self.SetWrapMode(stc.STC_WRAP_WORD) |
|
|||
170 | self.SetBufferedDraw(True) |
|
|||
171 | #self.SetUseAntiAliasing(True) |
|
|||
172 | self.SetLayoutCache(stc.STC_CACHE_PAGE) |
|
|||
173 |
|
||||
174 | self.EnsureCaretVisible() |
|
|||
175 |
|
||||
176 | self.SetMargins(3,3) #text is moved away from border with 3px |
|
|||
177 | # Suppressing Scintilla margins |
|
|||
178 | self.SetMarginWidth(0,0) |
|
|||
179 | self.SetMarginWidth(1,0) |
|
|||
180 | self.SetMarginWidth(2,0) |
|
|||
181 |
|
||||
182 | # make some styles |
|
200 | # make some styles | |
183 | if background_color != "BLACK": |
|
201 | if self.background_color != "BLACK": | |
184 | self.background_color = "WHITE" |
|
202 | self.background_color = "WHITE" | |
185 | self.SetCaretForeground("BLACK") |
|
203 | self.SetCaretForeground("BLACK") | |
186 | self.ANSI_STYLES = self.ANSI_STYLES_WHITE |
|
204 | self.ANSI_STYLES = self.ANSI_STYLES_WHITE | |
187 | else: |
|
205 | else: | |
188 | self.background_color = background_color |
|
|||
189 | self.SetCaretForeground("WHITE") |
|
206 | self.SetCaretForeground("WHITE") | |
190 | self.ANSI_STYLES = self.ANSI_STYLES_BLACK |
|
207 | self.ANSI_STYLES = self.ANSI_STYLES_BLACK | |
191 |
|
208 | |||
@@ -199,22 +216,19 b' class WxConsoleView(stc.StyledTextCtrl):' | |||||
199 | "fore:#FF0000,back:#0000FF,bold") |
|
216 | "fore:#FF0000,back:#0000FF,bold") | |
200 | self.StyleSetSpec(stc.STC_STYLE_BRACEBAD, |
|
217 | self.StyleSetSpec(stc.STC_STYLE_BRACEBAD, | |
201 | "fore:#000000,back:#FF0000,bold") |
|
218 | "fore:#000000,back:#FF0000,bold") | |
202 |
|
219 | |||
203 | for style in self.ANSI_STYLES.values(): |
|
220 | for style in self.ANSI_STYLES.values(): | |
204 | self.StyleSetSpec(style[0], "bold,fore:%s" % style[1]) |
|
221 | self.StyleSetSpec(style[0], "bold,fore:%s" % style[1]) | |
205 |
|
222 | |||
206 | ####################################################################### |
|
223 | ####################################################################### | |
207 |
|
224 | |||
208 | self.indent = 0 |
|
225 | def setBackgroundColor(self,color): | |
209 |
self. |
|
226 | self.background_color = color | |
210 | self.color_pat = re.compile('\x01?\x1b\[(.*?)m\x02?') |
|
227 | self.buildStyles() | |
211 |
|
||||
212 | self.write(intro) |
|
|||
213 | self.setPrompt(prompt) |
|
|||
214 | self.showPrompt() |
|
|||
215 |
|
||||
216 | self.Bind(wx.EVT_KEY_DOWN, self._onKeypress, self) |
|
|||
217 |
|
228 | |||
|
229 | def getBackgroundColor(self,color): | |||
|
230 | return self.background_color | |||
|
231 | ||||
218 | def asyncWrite(self, text): |
|
232 | def asyncWrite(self, text): | |
219 | ''' |
|
233 | ''' | |
220 | Write given text to buffer in an asynchroneous way. |
|
234 | Write given text to buffer in an asynchroneous way. | |
@@ -229,6 +243,7 b' class WxConsoleView(stc.StyledTextCtrl):' | |||||
229 |
|
243 | |||
230 | #be sure not to be interrutpted before the MutexGuiLeave! |
|
244 | #be sure not to be interrutpted before the MutexGuiLeave! | |
231 | self.write(text) |
|
245 | self.write(text) | |
|
246 | ||||
232 | #print >>sys.__stdout__,'done' |
|
247 | #print >>sys.__stdout__,'done' | |
233 |
|
248 | |||
234 | except KeyboardInterrupt: |
|
249 | except KeyboardInterrupt: | |
@@ -353,33 +368,53 b' class WxConsoleView(stc.StyledTextCtrl):' | |||||
353 | def writeHistory(self,history): |
|
368 | def writeHistory(self,history): | |
354 | self.removeFromTo(self.getCurrentPromptStart(),self.getCurrentLineEnd()) |
|
369 | self.removeFromTo(self.getCurrentPromptStart(),self.getCurrentLineEnd()) | |
355 | self.changeLine(history) |
|
370 | self.changeLine(history) | |
|
371 | ||||
|
372 | def setCompletionMethod(self, completion): | |||
|
373 | if completion in ['IPYTHON','STC']: | |||
|
374 | self.autocomplete_mode = completion | |||
|
375 | else: | |||
|
376 | raise AttributeError | |||
|
377 | ||||
|
378 | def getCompletionMethod(self, completion): | |||
|
379 | return self.autocomplete_mode | |||
356 |
|
380 | |||
357 | def writeCompletion(self, possibilities): |
|
381 | def writeCompletion(self, possibilities): | |
358 | max_len = len(max(possibilities,key=len)) |
|
382 | if self.autocomplete_mode == 'IPYTHON': | |
359 | max_symbol =' '*max_len |
|
383 | max_len = len(max(possibilities,key=len)) | |
360 |
|
384 | max_symbol =' '*max_len | ||
361 | #now we check how much symbol we can put on a line... |
|
385 | ||
362 | cursor_pos = self.getCursorPos() |
|
386 | #now we check how much symbol we can put on a line... | |
363 | test_buffer = max_symbol + ' '*4 |
|
387 | cursor_pos = self.getCursorPos() | |
364 | current_lines = self.GetLineCount() |
|
388 | test_buffer = max_symbol + ' '*4 | |
365 |
|
389 | current_lines = self.GetLineCount() | ||
366 | allowed_symbols = 80/len(test_buffer) |
|
390 | ||
367 |
|
|
391 | allowed_symbols = 80/len(test_buffer) | |
368 |
|
|
392 | if allowed_symbols == 0: | |
|
393 | allowed_symbols = 1 | |||
|
394 | ||||
|
395 | pos = 1 | |||
|
396 | buf = '' | |||
|
397 | for symbol in possibilities: | |||
|
398 | #buf += symbol+'\n'#*spaces) | |||
|
399 | if pos<allowed_symbols: | |||
|
400 | spaces = max_len - len(symbol) + 4 | |||
|
401 | buf += symbol+' '*spaces | |||
|
402 | pos += 1 | |||
|
403 | else: | |||
|
404 | buf+=symbol+'\n' | |||
|
405 | pos = 1 | |||
|
406 | self.write(buf) | |||
|
407 | else: | |||
|
408 | possibilities.sort() # Python sorts are case sensitive | |||
|
409 | self.AutoCompSetIgnoreCase(False) | |||
|
410 | self.AutoCompSetAutoHide(False) | |||
|
411 | #let compute the length ot last word | |||
|
412 | splitter = [' ','(','[','{'] | |||
|
413 | last_word = self.getCurrentLine() | |||
|
414 | for breaker in splitter: | |||
|
415 | last_word = last_word.split(breaker)[-1] | |||
|
416 | self.AutoCompShow(len(last_word), " ".join(possibilities)) | |||
369 |
|
417 | |||
370 | pos = 1 |
|
|||
371 | buf = '' |
|
|||
372 | for symbol in possibilities: |
|
|||
373 | #buf += symbol+'\n'#*spaces) |
|
|||
374 | if pos<allowed_symbols: |
|
|||
375 | spaces = max_len - len(symbol) + 4 |
|
|||
376 | buf += symbol+' '*spaces |
|
|||
377 | pos += 1 |
|
|||
378 | else: |
|
|||
379 | buf+=symbol+'\n' |
|
|||
380 | pos = 1 |
|
|||
381 | self.write(buf) |
|
|||
382 |
|
||||
383 | def _onKeypress(self, event, skip=True): |
|
418 | def _onKeypress(self, event, skip=True): | |
384 | ''' |
|
419 | ''' | |
385 | Key press callback used for correcting behavior for console-like |
|
420 | Key press callback used for correcting behavior for console-like | |
@@ -394,42 +429,45 b' class WxConsoleView(stc.StyledTextCtrl):' | |||||
394 | @return: Return True if event as been catched. |
|
429 | @return: Return True if event as been catched. | |
395 | @rtype: boolean |
|
430 | @rtype: boolean | |
396 | ''' |
|
431 | ''' | |
397 |
|
||||
398 | if event.GetKeyCode() == wx.WXK_HOME: |
|
|||
399 | if event.Modifiers == wx.MOD_NONE: |
|
|||
400 | self.moveCursorOnNewValidKey() |
|
|||
401 | self.moveCursor(self.getCurrentPromptStart()) |
|
|||
402 | return True |
|
|||
403 | elif event.Modifiers == wx.MOD_SHIFT: |
|
|||
404 | self.moveCursorOnNewValidKey() |
|
|||
405 | self.selectFromTo(self.getCurrentPromptStart(),self.getCursorPos()) |
|
|||
406 | return True |
|
|||
407 | else: |
|
|||
408 | return False |
|
|||
409 |
|
432 | |||
410 | elif event.GetKeyCode() == wx.WXK_LEFT: |
|
433 | if not self.AutoCompActive(): | |
411 |
if event. |
|
434 | if event.GetKeyCode() == wx.WXK_HOME: | |
412 | self.moveCursorOnNewValidKey() |
|
435 | if event.Modifiers == wx.MOD_NONE: | |
413 |
|
436 | self.moveCursorOnNewValidKey() | ||
414 | self.moveCursor(self.getCursorPos()-1) |
|
|||
415 | if self.getCursorPos() < self.getCurrentPromptStart(): |
|
|||
416 | self.moveCursor(self.getCurrentPromptStart()) |
|
437 | self.moveCursor(self.getCurrentPromptStart()) | |
|
438 | return True | |||
|
439 | elif event.Modifiers == wx.MOD_SHIFT: | |||
|
440 | self.moveCursorOnNewValidKey() | |||
|
441 | self.selectFromTo(self.getCurrentPromptStart(),self.getCursorPos()) | |||
|
442 | return True | |||
|
443 | else: | |||
|
444 | return False | |||
|
445 | ||||
|
446 | elif event.GetKeyCode() == wx.WXK_LEFT: | |||
|
447 | if event.Modifiers == wx.MOD_NONE: | |||
|
448 | self.moveCursorOnNewValidKey() | |||
|
449 | ||||
|
450 | self.moveCursor(self.getCursorPos()-1) | |||
|
451 | if self.getCursorPos() < self.getCurrentPromptStart(): | |||
|
452 | self.moveCursor(self.getCurrentPromptStart()) | |||
|
453 | return True | |||
|
454 | ||||
|
455 | elif event.GetKeyCode() == wx.WXK_BACK: | |||
|
456 | self.moveCursorOnNewValidKey() | |||
|
457 | if self.getCursorPos() > self.getCurrentPromptStart(): | |||
|
458 | event.Skip() | |||
417 | return True |
|
459 | return True | |
418 |
|
460 | |||
419 | elif event.GetKeyCode() == wx.WXK_BACK: |
|
461 | if skip: | |
420 | self.moveCursorOnNewValidKey() |
|
462 | if event.GetKeyCode() not in [wx.WXK_PAGEUP,wx.WXK_PAGEDOWN] and event.Modifiers == wx.MOD_NONE: | |
421 | if self.getCursorPos() > self.getCurrentPromptStart(): |
|
463 | self.moveCursorOnNewValidKey() | |
|
464 | ||||
422 | event.Skip() |
|
465 | event.Skip() | |
423 | return True |
|
466 | return True | |
424 |
|
467 | return False | ||
425 |
|
|
468 | else: | |
426 | if event.GetKeyCode() not in [wx.WXK_PAGEUP,wx.WXK_PAGEDOWN] and event.Modifiers == wx.MOD_NONE: |
|
|||
427 | self.moveCursorOnNewValidKey() |
|
|||
428 |
|
||||
429 | event.Skip() |
|
469 | event.Skip() | |
430 |
|
|
470 | ||
431 | return False |
|
|||
432 |
|
||||
433 | def OnUpdateUI(self, evt): |
|
471 | def OnUpdateUI(self, evt): | |
434 | # check for matching braces |
|
472 | # check for matching braces | |
435 | braceAtCaret = -1 |
|
473 | braceAtCaret = -1 | |
@@ -485,8 +523,9 b' class IPShellWidget(wx.Panel):' | |||||
485 | Instanciate a WxConsoleView. |
|
523 | Instanciate a WxConsoleView. | |
486 | Redirect I/O to console. |
|
524 | Redirect I/O to console. | |
487 | ''' |
|
525 | ''' | |
488 |
wx.Panel.__init__(self,parent, |
|
526 | wx.Panel.__init__(self,parent,wx.ID_ANY) | |
489 |
|
527 | |||
|
528 | self.parent = parent | |||
490 | ### IPython non blocking shell instanciation ### |
|
529 | ### IPython non blocking shell instanciation ### | |
491 | self.cout = StringIO() |
|
530 | self.cout = StringIO() | |
492 | self.add_button_handler = add_button_handler |
|
531 | self.add_button_handler = add_button_handler | |
@@ -500,7 +539,7 b' class IPShellWidget(wx.Panel):' | |||||
500 |
|
539 | |||
501 | ### IPython wx console view instanciation ### |
|
540 | ### IPython wx console view instanciation ### | |
502 | #If user didn't defined an intro text, we create one for him |
|
541 | #If user didn't defined an intro text, we create one for him | |
503 |
#If you really wnat an empty intr |
|
542 | #If you really wnat an empty intro just call wxIPythonViewPanel | |
504 | #with intro='' |
|
543 | #with intro='' | |
505 | if intro is None: |
|
544 | if intro is None: | |
506 | welcome_text = "Welcome to WxIPython Shell.\n\n" |
|
545 | welcome_text = "Welcome to WxIPython Shell.\n\n" | |
@@ -516,12 +555,38 b' class IPShellWidget(wx.Panel):' | |||||
516 | background_color=background_color) |
|
555 | background_color=background_color) | |
517 |
|
556 | |||
518 | self.cout.write = self.text_ctrl.asyncWrite |
|
557 | self.cout.write = self.text_ctrl.asyncWrite | |
|
558 | ||||
|
559 | option_text = wx.StaticText(self, -1, "Options:") | |||
|
560 | self.completion_option = wx.CheckBox(self, -1, "Scintilla Completion") | |||
|
561 | #self.completion_option.SetValue(False) | |||
|
562 | self.background_option = wx.CheckBox(self, -1, "White Background") | |||
|
563 | #self.background_option.SetValue(False) | |||
519 |
|
564 | |||
520 | self.text_ctrl.Bind(wx.EVT_KEY_DOWN, self.keyPress, self.text_ctrl) |
|
565 | self.options={'completion':{'value':'IPYTHON', | |
521 |
|
566 | 'checkbox':self.completion_option,'STC':True,'IPYTHON':False, | ||
|
567 | 'setfunc':self.text_ctrl.setCompletionMethod}, | |||
|
568 | 'background_color':{'value':'BLACK', | |||
|
569 | 'checkbox':self.background_option,'WHITE':True,'BLACK':False, | |||
|
570 | 'setfunc':self.text_ctrl.setBackgroundColor}, | |||
|
571 | } | |||
|
572 | self.reloadOptions(self.options) | |||
|
573 | ||||
|
574 | self.text_ctrl.Bind(wx.EVT_KEY_DOWN, self.keyPress) | |||
|
575 | self.completion_option.Bind(wx.EVT_CHECKBOX, self.evtCheckOptionCompletion) | |||
|
576 | self.background_option.Bind(wx.EVT_CHECKBOX, self.evtCheckOptionBackgroundColor) | |||
|
577 | ||||
522 | ### making the layout of the panel ### |
|
578 | ### making the layout of the panel ### | |
523 | sizer = wx.BoxSizer(wx.VERTICAL) |
|
579 | sizer = wx.BoxSizer(wx.VERTICAL) | |
524 | sizer.Add(self.text_ctrl, 1, wx.EXPAND) |
|
580 | sizer.Add(self.text_ctrl, 1, wx.EXPAND) | |
|
581 | option_sizer = wx.BoxSizer(wx.HORIZONTAL) | |||
|
582 | sizer.Add(option_sizer, 0) | |||
|
583 | option_sizer.AddMany([(10, 20), | |||
|
584 | (option_text, 0, wx.ALIGN_CENTER_VERTICAL), | |||
|
585 | (5, 5), | |||
|
586 | (self.completion_option, 0, wx.ALIGN_CENTER_VERTICAL), | |||
|
587 | (8, 8), | |||
|
588 | (self.background_option, 0, wx.ALIGN_CENTER_VERTICAL) | |||
|
589 | ]) | |||
525 | self.SetAutoLayout(True) |
|
590 | self.SetAutoLayout(True) | |
526 | sizer.Fit(self) |
|
591 | sizer.Fit(self) | |
527 | sizer.SetSizeHints(self) |
|
592 | sizer.SetSizeHints(self) | |
@@ -542,8 +607,8 b' class IPShellWidget(wx.Panel):' | |||||
542 | lines=self.text_ctrl.getCurrentLine() |
|
607 | lines=self.text_ctrl.getCurrentLine() | |
543 | self.text_ctrl.write('\n') |
|
608 | self.text_ctrl.write('\n') | |
544 | lines_to_execute = lines.replace('\t',' '*4) |
|
609 | lines_to_execute = lines.replace('\t',' '*4) | |
545 |
lines_to_execute = lines_to_execute.replace('\r |
|
610 | lines_to_execute = lines_to_execute.replace('\r','') | |
546 | self.IP.doExecute(lines.encode('cp1252')) |
|
611 | self.IP.doExecute(lines_to_execute.encode('cp1252')) | |
547 | self.updateHistoryTracker(lines) |
|
612 | self.updateHistoryTracker(lines) | |
548 | self.setCurrentState('WAIT_END_OF_EXECUTION') |
|
613 | self.setCurrentState('WAIT_END_OF_EXECUTION') | |
549 |
|
614 | |||
@@ -630,20 +695,28 b' class IPShellWidget(wx.Panel):' | |||||
630 | Key press callback with plenty of shell goodness, like history, |
|
695 | Key press callback with plenty of shell goodness, like history, | |
631 | autocompletions, etc. |
|
696 | autocompletions, etc. | |
632 | ''' |
|
697 | ''' | |
633 |
|
||||
634 | if event.GetKeyCode() == ord('C'): |
|
698 | if event.GetKeyCode() == ord('C'): | |
635 | if event.Modifiers == wx.MOD_CONTROL: |
|
699 | if event.Modifiers == wx.MOD_CONTROL or event.Modifiers == wx.MOD_ALT: | |
636 | if self.cur_state == 'WAIT_END_OF_EXECUTION': |
|
700 | if self.cur_state == 'WAIT_END_OF_EXECUTION': | |
637 | #we raise an exception inside the IPython thread container |
|
701 | #we raise an exception inside the IPython thread container | |
638 | self.IP.ce.raise_exc(KeyboardInterrupt) |
|
702 | self.IP.ce.raise_exc(KeyboardInterrupt) | |
639 | return |
|
703 | return | |
640 |
|
704 | |||
|
705 | #let this before 'wx.WXK_RETURN' because we have to put 'IDLE' | |||
|
706 | #mode if AutoComp has been set as inactive | |||
|
707 | if self.cur_state == 'COMPLETING': | |||
|
708 | if not self.text_ctrl.AutoCompActive(): | |||
|
709 | self.cur_state = 'IDLE' | |||
|
710 | else: | |||
|
711 | event.Skip() | |||
|
712 | ||||
641 | if event.KeyCode == wx.WXK_RETURN: |
|
713 | if event.KeyCode == wx.WXK_RETURN: | |
642 | if self.cur_state == 'IDLE': |
|
714 | if self.cur_state == 'IDLE': | |
643 | #we change the state ot the state machine |
|
715 | #we change the state ot the state machine | |
644 | self.setCurrentState('DO_EXECUTE_LINE') |
|
716 | self.setCurrentState('DO_EXECUTE_LINE') | |
645 | self.stateDoExecuteLine() |
|
717 | self.stateDoExecuteLine() | |
646 | return |
|
718 | return | |
|
719 | ||||
647 | if self.pager_state == 'WAITING': |
|
720 | if self.pager_state == 'WAITING': | |
648 | self.pager_state = 'PROCESS_LINES' |
|
721 | self.pager_state = 'PROCESS_LINES' | |
649 | self.pager(self.doc) |
|
722 | self.pager(self.doc) | |
@@ -664,7 +737,7 b' class IPShellWidget(wx.Panel):' | |||||
664 |
|
737 | |||
665 | if self.cur_state == 'WAITING_USER_INPUT': |
|
738 | if self.cur_state == 'WAITING_USER_INPUT': | |
666 | event.Skip() |
|
739 | event.Skip() | |
667 |
|
740 | |||
668 | if self.cur_state == 'IDLE': |
|
741 | if self.cur_state == 'IDLE': | |
669 | if event.KeyCode == wx.WXK_UP: |
|
742 | if event.KeyCode == wx.WXK_UP: | |
670 | history = self.IP.historyBack() |
|
743 | history = self.IP.historyBack() | |
@@ -681,19 +754,68 b' class IPShellWidget(wx.Panel):' | |||||
681 | return |
|
754 | return | |
682 | completed, possibilities = self.IP.complete(self.text_ctrl.getCurrentLine()) |
|
755 | completed, possibilities = self.IP.complete(self.text_ctrl.getCurrentLine()) | |
683 | if len(possibilities) > 1: |
|
756 | if len(possibilities) > 1: | |
684 |
|
|
757 | if self.text_ctrl.autocomplete_mode == 'IPYTHON': | |
685 |
self.text_ctrl. |
|
758 | cur_slice = self.text_ctrl.getCurrentLine() | |
686 |
self.text_ctrl.write |
|
759 | self.text_ctrl.write('\n') | |
687 |
self.text_ctrl.write( |
|
760 | self.text_ctrl.writeCompletion(possibilities) | |
688 |
|
761 | self.text_ctrl.write('\n') | ||
689 | self.text_ctrl.showPrompt() |
|
762 | ||
690 |
self.text_ctrl. |
|
763 | self.text_ctrl.showPrompt() | |
691 |
self.text_ctrl. |
|
764 | self.text_ctrl.write(cur_slice) | |
692 |
|
765 | self.text_ctrl.changeLine(completed or cur_slice) | ||
|
766 | else: | |||
|
767 | self.cur_state = 'COMPLETING' | |||
|
768 | self.text_ctrl.writeCompletion(possibilities) | |||
|
769 | else: | |||
|
770 | self.text_ctrl.changeLine(completed or cur_slice) | |||
693 | return |
|
771 | return | |
694 | event.Skip() |
|
772 | event.Skip() | |
695 |
|
773 | |||
|
774 | #------------------------ Option Section --------------------------------- | |||
|
775 | def evtCheckOptionCompletion(self, event): | |||
|
776 | if event.IsChecked(): | |||
|
777 | self.options['completion']['value']='STC' | |||
|
778 | else: | |||
|
779 | self.options['completion']['value']='IPYTHON' | |||
|
780 | self.text_ctrl.setCompletionMethod(self.options['completion']['value']) | |||
|
781 | self.updateOptionTracker('completion', | |||
|
782 | self.options['completion']['value']) | |||
|
783 | self.text_ctrl.SetFocus() | |||
|
784 | ||||
|
785 | def evtCheckOptionBackgroundColor(self, event): | |||
|
786 | if event.IsChecked(): | |||
|
787 | self.options['background_color']['value']='WHITE' | |||
|
788 | else: | |||
|
789 | self.options['background_color']['value']='BLACK' | |||
|
790 | self.text_ctrl.setBackgroundColor(self.options['background_color']['value']) | |||
|
791 | self.updateOptionTracker('background_color', | |||
|
792 | self.options['background_color']['value']) | |||
|
793 | self.text_ctrl.SetFocus() | |||
|
794 | ||||
|
795 | def getOptions(self): | |||
|
796 | return self.options | |||
|
797 | ||||
|
798 | def reloadOptions(self,options): | |||
|
799 | self.options = options | |||
|
800 | for key in self.options.keys(): | |||
|
801 | value = self.options[key]['value'] | |||
|
802 | self.options[key]['checkbox'].SetValue(self.options[key][value]) | |||
|
803 | self.options[key]['setfunc'](value) | |||
|
804 | ||||
|
805 | ||||
696 | #------------------------ Hook Section ----------------------------------- |
|
806 | #------------------------ Hook Section ----------------------------------- | |
|
807 | def updateOptionTracker(self,name,value): | |||
|
808 | ''' | |||
|
809 | Default history tracker (does nothing) | |||
|
810 | ''' | |||
|
811 | pass | |||
|
812 | ||||
|
813 | def setOptionTrackerHook(self,func): | |||
|
814 | ''' | |||
|
815 | Define a new history tracker | |||
|
816 | ''' | |||
|
817 | self.updateOptionTracker = func | |||
|
818 | ||||
697 | def updateHistoryTracker(self,command_line): |
|
819 | def updateHistoryTracker(self,command_line): | |
698 | ''' |
|
820 | ''' | |
699 | Default history tracker (does nothing) |
|
821 | Default history tracker (does nothing) |
@@ -7,7 +7,7 b' import wx.aui' | |||||
7 | from wx.lib.wordwrap import wordwrap |
|
7 | from wx.lib.wordwrap import wordwrap | |
8 |
|
8 | |||
9 | #used for ipython GUI objects |
|
9 | #used for ipython GUI objects | |
10 |
from IPython.gui.wx.ipython_view import IPShellWidget |
|
10 | from IPython.gui.wx.ipython_view import IPShellWidget | |
11 | from IPython.gui.wx.ipython_history import IPythonHistoryPanel |
|
11 | from IPython.gui.wx.ipython_history import IPythonHistoryPanel | |
12 |
|
12 | |||
13 | __version__ = 0.8 |
|
13 | __version__ = 0.8 | |
@@ -33,15 +33,19 b' class MyFrame(wx.Frame):' | |||||
33 |
|
33 | |||
34 | #create differents panels and make them persistant |
|
34 | #create differents panels and make them persistant | |
35 | self.history_panel = IPythonHistoryPanel(self) |
|
35 | self.history_panel = IPythonHistoryPanel(self) | |
|
36 | ||||
|
37 | self.history_panel.setOptionTrackerHook(self.optionSave) | |||
36 |
|
38 | |||
37 | self.ipython_panel = IPShellWidget(self,background_color = "BLACK") |
|
39 | self.ipython_panel = IPShellWidget(self,background_color = "BLACK") | |
38 |
|
||||
39 | #self.ipython_panel = IPShellWidget(self,background_color = "WHITE") |
|
40 | #self.ipython_panel = IPShellWidget(self,background_color = "WHITE") | |
40 |
|
41 | |||
41 | self.ipython_panel.setHistoryTrackerHook(self.history_panel.write) |
|
42 | self.ipython_panel.setHistoryTrackerHook(self.history_panel.write) | |
42 | self.ipython_panel.setStatusTrackerHook(self.updateStatus) |
|
43 | self.ipython_panel.setStatusTrackerHook(self.updateStatus) | |
43 | self.ipython_panel.setAskExitHandler(self.OnExitDlg) |
|
44 | self.ipython_panel.setAskExitHandler(self.OnExitDlg) | |
|
45 | self.ipython_panel.setOptionTrackerHook(self.optionSave) | |||
44 |
|
46 | |||
|
47 | self.optionLoad() | |||
|
48 | ||||
45 | self.statusbar = self.createStatus() |
|
49 | self.statusbar = self.createStatus() | |
46 | self.createMenu() |
|
50 | self.createMenu() | |
47 |
|
51 | |||
@@ -66,7 +70,7 b' class MyFrame(wx.Frame):' | |||||
66 | self.Bind(wx.EVT_MENU, self.OnShowHistoryPanel,id=wx.ID_HIGHEST+2) |
|
70 | self.Bind(wx.EVT_MENU, self.OnShowHistoryPanel,id=wx.ID_HIGHEST+2) | |
67 | self.Bind(wx.EVT_MENU, self.OnShowAbout, id=wx.ID_HIGHEST+3) |
|
71 | self.Bind(wx.EVT_MENU, self.OnShowAbout, id=wx.ID_HIGHEST+3) | |
68 | self.Bind(wx.EVT_MENU, self.OnShowAllPanel,id=wx.ID_HIGHEST+6) |
|
72 | self.Bind(wx.EVT_MENU, self.OnShowAllPanel,id=wx.ID_HIGHEST+6) | |
69 |
|
73 | |||
70 | warn_text = 'Hello from IPython and wxPython.\n' |
|
74 | warn_text = 'Hello from IPython and wxPython.\n' | |
71 | warn_text +='Please Note that this work is still EXPERIMENTAL\n' |
|
75 | warn_text +='Please Note that this work is still EXPERIMENTAL\n' | |
72 | warn_text +='It does NOT emulate currently all the IPython functions.\n' |
|
76 | warn_text +='It does NOT emulate currently all the IPython functions.\n' | |
@@ -78,7 +82,41 b' class MyFrame(wx.Frame):' | |||||
78 | ) |
|
82 | ) | |
79 | dlg.ShowModal() |
|
83 | dlg.ShowModal() | |
80 | dlg.Destroy() |
|
84 | dlg.Destroy() | |
81 |
|
85 | |||
|
86 | def optionSave(self, name, value): | |||
|
87 | opt = open('options.conf','w') | |||
|
88 | ||||
|
89 | try: | |||
|
90 | options_ipython_panel = self.ipython_panel.getOptions() | |||
|
91 | options_history_panel = self.history_panel.getOptions() | |||
|
92 | ||||
|
93 | for key in options_ipython_panel.keys(): | |||
|
94 | opt.write(key + '=' + options_ipython_panel[key]['value']+'\n') | |||
|
95 | for key in options_history_panel.keys(): | |||
|
96 | opt.write(key + '=' + options_history_panel[key]['value']+'\n') | |||
|
97 | finally: | |||
|
98 | opt.close() | |||
|
99 | ||||
|
100 | def optionLoad(self): | |||
|
101 | opt = open('options.conf','r') | |||
|
102 | lines = opt.readlines() | |||
|
103 | opt.close() | |||
|
104 | ||||
|
105 | options_ipython_panel = self.ipython_panel.getOptions() | |||
|
106 | options_history_panel = self.history_panel.getOptions() | |||
|
107 | ||||
|
108 | for line in lines: | |||
|
109 | key = line.split('=')[0] | |||
|
110 | value = line.split('=')[1].replace('\n','').replace('\r','') | |||
|
111 | if key in options_ipython_panel.keys(): | |||
|
112 | options_ipython_panel[key]['value'] = value | |||
|
113 | elif key in options_history_panel.keys(): | |||
|
114 | options_history_panel[key]['value'] = value | |||
|
115 | else: | |||
|
116 | print >>sys.__stdout__,"Warning: key ",key,"not found in widget options. Check Options.conf" | |||
|
117 | self.ipython_panel.reloadOptions(options_ipython_panel) | |||
|
118 | self.history_panel.reloadOptions(options_history_panel) | |||
|
119 | ||||
82 | def createMenu(self): |
|
120 | def createMenu(self): | |
83 | """local method used to create one menu bar""" |
|
121 | """local method used to create one menu bar""" | |
84 |
|
122 |
@@ -2016,7 +2016,7 b' want to merge them back into the new files.""" % locals()' | |||||
2016 |
|
2016 | |||
2017 | try: |
|
2017 | try: | |
2018 | code = self.compile(source,filename,symbol) |
|
2018 | code = self.compile(source,filename,symbol) | |
2019 | except (OverflowError, SyntaxError, ValueError): |
|
2019 | except (OverflowError, SyntaxError, ValueError, TypeError): | |
2020 | # Case 1 |
|
2020 | # Case 1 | |
2021 | self.showsyntaxerror(filename) |
|
2021 | self.showsyntaxerror(filename) | |
2022 | return None |
|
2022 | return None |
@@ -200,7 +200,7 b' class TwistedInteractiveShell(InteractiveShell):' | |||||
200 |
|
200 | |||
201 |
|
201 | |||
202 |
|
202 | |||
203 |
class IPShellTwisted |
|
203 | class IPShellTwisted: | |
204 | """Run a Twisted reactor while in an IPython session. |
|
204 | """Run a Twisted reactor while in an IPython session. | |
205 |
|
205 | |||
206 | Python commands can be passed to the thread where they will be |
|
206 | Python commands can be passed to the thread where they will be |
@@ -1,8 +1,330 b'' | |||||
|
1 | ipython (0.8.1-2) unstable; urgency=low | |||
|
2 | ||||
|
3 | [ Piotr OΕΌarowski ] | |||
|
4 | * Homepage field added | |||
|
5 | * Rename XS-Vcs-* fields to Vcs-* (dpkg supports them now) | |||
|
6 | * Add 04_remove_shebang patch | |||
|
7 | * Removing lintian overrides, adding proper patches instead. | |||
|
8 | ||||
|
9 | [ Bernd Zeimetz ] | |||
|
10 | * Replacing Recommends by Suggests to stop ipython from installing ~500MB | |||
|
11 | of dependencies. Thanks to Marcela Tiznado (Closes: #451887). | |||
|
12 | ||||
|
13 | -- Bernd Zeimetz <bernd@bzed.de> Mon, 19 Nov 2007 19:10:14 +0100 | |||
|
14 | ||||
|
15 | ipython (0.8.1-1) unstable; urgency=low | |||
|
16 | ||||
|
17 | [ Bernd Zeimetz ] | |||
|
18 | * debian/control: | |||
|
19 | - adding python-matplotlib to Recommends because | |||
|
20 | it is needed to run ipython -pylab | |||
|
21 | ||||
|
22 | [ Norbert Tretkowski ] | |||
|
23 | * New upstream release. (closes: #428398) | |||
|
24 | ||||
|
25 | [ Reinhard Tartler ] | |||
|
26 | * Install ipython.el properly. | |||
|
27 | ||||
|
28 | -- Norbert Tretkowski <nobse@debian.org> Mon, 11 Jun 2007 20:05:30 +0200 | |||
|
29 | ||||
|
30 | ipython (0.8.0-2) unstable; urgency=low | |||
|
31 | ||||
|
32 | * debian/changelog: | |||
|
33 | - adding missing colons to Closes entries to fix two | |||
|
34 | lintian warnings | |||
|
35 | * debian/compat: | |||
|
36 | - bumping compat level to 5 | |||
|
37 | * debian/control: | |||
|
38 | - adding XS-Vcs-Browser | |||
|
39 | - remove no longer needed X*-Python-Version fields | |||
|
40 | - moving python-pexpect from Recommends to Depends because | |||
|
41 | /usr/bin/irunner is not useable without it | |||
|
42 | - moving debhelper and dpatch from Build-Depends-Indep to | |||
|
43 | Build-Depends, fixing the following lintian errors: | |||
|
44 | - clean-should-be-satisfied-by-build-depends debhelper | |||
|
45 | - clean-should-be-satisfied-by-build-depends dpatch | |||
|
46 | - removing unnecessary Build-Depends-Indep on python-all-dev, | |||
|
47 | adding python to Build-Depends instead | |||
|
48 | - replacing python-central by python-support to be able to | |||
|
49 | fix #420134 without hassle | |||
|
50 | - adding ${misc:Depends} | |||
|
51 | - adding the missing identation for Homepage: | |||
|
52 | - adding cdbs as Build-Depends | |||
|
53 | - adding myself to Uploaders | |||
|
54 | - removing the short description from the long description | |||
|
55 | * debian/patches/03_ipy_gnuglobal.dpatch: | |||
|
56 | - fix the location of the global binary - we're not on windows | |||
|
57 | * debian/rules: | |||
|
58 | - removing old crust, using cdbs to make things clear again | |||
|
59 | - using python-support instead of python-central to make | |||
|
60 | modules for 2.5 avaiable now. (Closes: #420134) | |||
|
61 | - making sure the bogus /usr/IPython directory is not | |||
|
62 | included in the package again | |||
|
63 | - do not remove docs/ipython.el (Closes: #198505, #415427) | |||
|
64 | * adding lintian ovverrides for several scripts included in the | |||
|
65 | IPython/Extensions directory. | |||
|
66 | * adding a manpage for /usr/bin/irunner | |||
|
67 | ||||
|
68 | -- Bernd Zeimetz <bernd@bzed.de> Tue, 24 Apr 2007 02:47:26 +0200 | |||
|
69 | ||||
|
70 | ipython (0.8.0-1) unstable; urgency=low | |||
|
71 | ||||
|
72 | * New upstream release. (closes: #419716) | |||
|
73 | * Removed patches merged upstream. | |||
|
74 | ||||
|
75 | -- Norbert Tretkowski <nobse@debian.org> Tue, 17 Apr 2007 20:26:43 +0200 | |||
|
76 | ||||
|
77 | ipython (0.7.3-2) unstable; urgency=low | |||
|
78 | ||||
|
79 | * Added a new patch from svn to fix jobctrl to work properly on posix. | |||
|
80 | ||||
|
81 | -- Norbert Tretkowski <nobse@debian.org> Thu, 21 Dec 2006 20:13:57 +0100 | |||
|
82 | ||||
|
83 | ipython (0.7.3-1) unstable; urgency=low | |||
|
84 | ||||
|
85 | * New upstream release. | |||
|
86 | ||||
|
87 | -- Norbert Tretkowski <nobse@debian.org> Mon, 18 Dec 2006 22:23:55 +0100 | |||
|
88 | ||||
|
89 | ipython (0.7.3~rc2-1) experimental; urgency=low | |||
|
90 | ||||
|
91 | * New upstream release candidate. | |||
|
92 | ||||
|
93 | -- Norbert Tretkowski <nobse@debian.org> Sat, 16 Dec 2006 02:20:13 +0100 | |||
|
94 | ||||
|
95 | ipython (0.7.3~beta2-1) experimental; urgency=low | |||
|
96 | ||||
|
97 | * New upstream beta release. | |||
|
98 | ||||
|
99 | -- Norbert Tretkowski <nobse@debian.org> Fri, 8 Dec 2006 08:02:16 +0100 | |||
|
100 | ||||
|
101 | ipython (0.7.3~beta1-1) experimental; urgency=low | |||
|
102 | ||||
|
103 | * New upstream beta release. | |||
|
104 | * Removed backported patch added in 0.7.2-5 to workaround bugs in python | |||
|
105 | 2.3's inspect module. | |||
|
106 | ||||
|
107 | -- Norbert Tretkowski <nobse@debian.org> Wed, 29 Nov 2006 12:35:22 +0100 | |||
|
108 | ||||
|
109 | ipython (0.7.2-6) UNRELEASED; urgency=low | |||
|
110 | ||||
|
111 | * Added XS-Vcs-Svn field. | |||
|
112 | ||||
|
113 | -- Piotr Ozarowski <ozarow@gmail.com> Thu, 23 Nov 2006 14:44:43 +0100 | |||
|
114 | ||||
|
115 | ipython (0.7.2-5) unstable; urgency=low | |||
|
116 | ||||
|
117 | * Added a new patch from svn to workaround bugs in python 2.3's inspect | |||
|
118 | module. (closes: #374625) | |||
|
119 | ||||
|
120 | -- Norbert Tretkowski <nobse@debian.org> Thu, 10 Aug 2006 18:36:12 +0200 | |||
|
121 | ||||
|
122 | ipython (0.7.2-4) unstable; urgency=low | |||
|
123 | ||||
|
124 | * Fixed spelling error in description. (closes: #363976) | |||
|
125 | * Ack NMU 0.7.2-3.1, thanks Matthias. (closes: #377787) | |||
|
126 | ||||
|
127 | -- Norbert Tretkowski <nobse@debian.org> Tue, 1 Aug 2006 22:45:11 +0200 | |||
|
128 | ||||
|
129 | ipython (0.7.2-3.1) unstable; urgency=medium | |||
|
130 | ||||
|
131 | * NMU. | |||
|
132 | * Convert to updated Python policy. (closes: #377787) | |||
|
133 | ||||
|
134 | -- Matthias Klose <doko@debian.org> Thu, 13 Jul 2006 17:42:06 +0000 | |||
|
135 | ||||
|
136 | ipython (0.7.2-3ubuntu1) edgy; urgency=low | |||
|
137 | ||||
|
138 | * Synchronize with Debian unstable. | |||
|
139 | * Convert to updated Python policy. Collapse all packages into one | |||
|
140 | ipython package, don't handle ipython using alternatives. | |||
|
141 | ||||
|
142 | -- Matthias Klose <doko@ubuntu.com> Tue, 11 Jul 2006 09:47:37 +0000 | |||
|
143 | ||||
|
144 | ipython (0.7.2-3) unstable; urgency=low | |||
|
145 | ||||
|
146 | * Removed alternative for irunner manpage. | |||
|
147 | ||||
|
148 | -- Norbert Tretkowski <nobse@debian.org> Sat, 17 Jun 2006 09:49:10 +0200 | |||
|
149 | ||||
|
150 | ipython (0.7.2-2) unstable; urgency=medium | |||
|
151 | ||||
|
152 | * Fixed conflict in irunner. (closes: #373874) | |||
|
153 | * Added recommendation for python-pexpect. (closes: #373794) | |||
|
154 | ||||
|
155 | -- Norbert Tretkowski <nobse@debian.org> Fri, 16 Jun 2006 10:43:45 +0200 | |||
|
156 | ||||
|
157 | ipython (0.7.2-1) unstable; urgency=low | |||
|
158 | ||||
|
159 | [ Piotr Ozarowski ] | |||
|
160 | * Added watch file. | |||
|
161 | ||||
|
162 | [ Norbert Tretkowski ] | |||
|
163 | * New upstream release. | |||
|
164 | ||||
|
165 | -- Norbert Tretkowski <nobse@debian.org> Thu, 8 Jun 2006 23:36:03 +0200 | |||
|
166 | ||||
|
167 | ipython (0.7.1.fix1+0.7.2.rc1-1) experimental; urgency=low | |||
|
168 | ||||
|
169 | * New upstream release candidate. | |||
|
170 | * Updated Standards-Version to 3.7.2.0, no changes required. | |||
|
171 | ||||
|
172 | -- Norbert Tretkowski <nobse@debian.org> Sat, 27 May 2006 14:49:24 +0200 | |||
|
173 | ||||
|
174 | ipython (0.7.1.fix1-2) unstable; urgency=low | |||
|
175 | ||||
|
176 | * Set maintainer to Debian Python modules team and added myself to | |||
|
177 | uploaders. | |||
|
178 | ||||
|
179 | -- Norbert Tretkowski <nobse@debian.org> Sun, 16 Apr 2006 15:53:43 +0200 | |||
|
180 | ||||
|
181 | ipython (0.7.1.fix1-1) unstable; urgency=low | |||
|
182 | ||||
|
183 | * New upstream bugfix release. | |||
|
184 | * Removed backported patch which was added in 0.7.1-3 to catch | |||
|
185 | KeyboardInterrupt exceptions properly, it's part of this release. | |||
|
186 | * Fixed names of pdfs in doc-base file to shut up linda. | |||
|
187 | ||||
|
188 | -- Norbert Tretkowski <nobse@debian.org> Tue, 14 Feb 2006 23:51:17 +0100 | |||
|
189 | ||||
|
190 | ipython (0.7.1-3) unstable; urgency=low | |||
|
191 | ||||
|
192 | * Added a new patch from upstream to catch KeyboardInterrupt exceptions | |||
|
193 | properly. | |||
|
194 | ||||
|
195 | -- Norbert Tretkowski <nobse@debian.org> Mon, 30 Jan 2006 19:42:31 +0100 | |||
|
196 | ||||
|
197 | ipython (0.7.1-2) unstable; urgency=low | |||
|
198 | ||||
|
199 | * Really remove alternatives on purge, thanks Lars Wirzenius for finding | |||
|
200 | the problem. (closes: #317269) | |||
|
201 | ||||
|
202 | -- Norbert Tretkowski <nobse@debian.org> Sun, 29 Jan 2006 23:11:28 +0100 | |||
|
203 | ||||
|
204 | ipython (0.7.1-1) unstable; urgency=low | |||
|
205 | ||||
|
206 | * New upstream release. | |||
|
207 | ||||
|
208 | -- Norbert Tretkowski <nobse@debian.org> Tue, 24 Jan 2006 21:42:33 +0100 | |||
|
209 | ||||
|
210 | ipython (0.7.0-2) unstable; urgency=low | |||
|
211 | ||||
|
212 | * Fixed circular dependencies (closes: #341980) | |||
|
213 | * Added version to dependency on ipython dummy package. (closes: #320235) | |||
|
214 | * Removed python2.2 package, ipython now depends on python >= 2.3. | |||
|
215 | * Bumped up standards-version, no changes needed. | |||
|
216 | ||||
|
217 | -- Norbert Tretkowski <nobse@debian.org> Sat, 21 Jan 2006 23:27:53 +0100 | |||
|
218 | ||||
|
219 | ipython (0.7.0-1) unstable; urgency=low | |||
|
220 | ||||
|
221 | * New upstream release. | |||
|
222 | * Updated 01_docdir-base.dpatch and 02_profiler-message.dpatch. | |||
|
223 | ||||
|
224 | -- Norbert Tretkowski <nobse@debian.org> Sat, 21 Jan 2006 20:08:23 +0100 | |||
|
225 | ||||
|
226 | ipython (0.6.15-2) unstable; urgency=low | |||
|
227 | ||||
|
228 | * New maintainer, thanks Jack for your work. | |||
|
229 | ||||
|
230 | -- Norbert Tretkowski <nobse@debian.org> Sun, 28 Aug 2005 19:57:09 +0200 | |||
|
231 | ||||
|
232 | ipython (0.6.15-1) unstable; urgency=low | |||
|
233 | ||||
|
234 | * New upstream release. | |||
|
235 | ||||
|
236 | -- Norbert Tretkowski <nobse@debian.org> Thu, 2 Jun 2005 23:51:45 +0200 | |||
|
237 | ||||
|
238 | ipython (0.6.14-1) unstable; urgency=low | |||
|
239 | ||||
|
240 | * New upstream release. | |||
|
241 | ||||
|
242 | -- Norbert Tretkowski <nobse@debian.org> Tue, 31 May 2005 22:53:25 +0200 | |||
|
243 | ||||
|
244 | ipython (0.6.13-1) unstable; urgency=low | |||
|
245 | ||||
|
246 | * New upstream release. | |||
|
247 | * Removed backported patch which was added in 0.6.12-3 to fix misleading | |||
|
248 | prompt, it's part of this release. | |||
|
249 | ||||
|
250 | -- Norbert Tretkowski <nobse@debian.org> Fri, 15 Apr 2005 09:42:35 +0200 | |||
|
251 | ||||
|
252 | ipython (0.6.12-4) unstable; urgency=medium | |||
|
253 | ||||
|
254 | * Re-added python build-dependency, it got lost in 0.6.12-2. | |||
|
255 | (closes: #301636) | |||
|
256 | ||||
|
257 | -- Norbert Tretkowski <nobse@debian.org> Sun, 27 Mar 2005 14:28:26 +0200 | |||
|
258 | ||||
|
259 | ipython (0.6.12-3) unstable; urgency=low | |||
|
260 | ||||
|
261 | * Added a new patch from cvs to fix misleading prompt2. (closes: #300847) | |||
|
262 | ||||
|
263 | -- Norbert Tretkowski <nobse@debian.org> Sun, 27 Mar 2005 00:05:26 +0100 | |||
|
264 | ||||
|
265 | ipython (0.6.12-2) unstable; urgency=low | |||
|
266 | ||||
|
267 | * Added packages for python2.2 and python2.4, ipython package is now a dummy | |||
|
268 | package depending on ipython built for Debians default python. | |||
|
269 | (closes: #292537) | |||
|
270 | * Split out generic files into separate ipython-common package. | |||
|
271 | * Enhanced package descriptions. | |||
|
272 | * Removed CFLAGS settings from debian/rules, not required. | |||
|
273 | * Tweaked message displayed when profiler support is missing. | |||
|
274 | * Suggest the python-profiler package. | |||
|
275 | ||||
|
276 | -- Norbert Tretkowski <nobse@debian.org> Fri, 25 Mar 2005 20:24:36 +0100 | |||
|
277 | ||||
|
278 | ipython (0.6.12-1) unstable; urgency=low | |||
|
279 | ||||
|
280 | * New upstream release. | |||
|
281 | * Removed patch which was added in 0.6.5-1.1 to make profiling support | |||
|
282 | optional, it was merged upstream. | |||
|
283 | ||||
|
284 | -- Norbert Tretkowski <nobse@debian.org> Wed, 2 Mar 2005 12:15:09 +0100 | |||
|
285 | ||||
|
286 | ipython (0.6.11-1) unstable; urgency=low | |||
|
287 | ||||
|
288 | * New upstream release. | |||
|
289 | + Fixed broken profiling support unless -D is specified. (closes: #295779) | |||
|
290 | * Acknowledged NMUs. (closes: #206653, #294500, #294861, #280505) | |||
|
291 | * New co-maintainer, added myself to uploaders. | |||
|
292 | ||||
|
293 | -- Norbert Tretkowski <nobse@debian.org> Tue, 1 Mar 2005 12:40:33 +0100 | |||
|
294 | ||||
|
295 | ipython (0.6.5-1.2) unstable; urgency=low | |||
|
296 | ||||
|
297 | * Non-maintainer upload. | |||
|
298 | * Rebuild with a python version that is actually in Debian. | |||
|
299 | ||||
|
300 | -- Wichert Akkerman <wichert@wiggy.net> Thu, 17 Feb 2005 23:08:52 +0100 | |||
|
301 | ||||
|
302 | ipython (0.6.5-1.1) unstable; urgency=low | |||
|
303 | ||||
|
304 | * NMU to apply patch making profiling support optional (provided by | |||
|
305 | Torsten Marek). (closes: #294500) | |||
|
306 | ||||
|
307 | -- Steven R. Baker <srbaker@debian.org> Thu, 17 Feb 2005 05:02:55 -0400 | |||
|
308 | ||||
|
309 | ipython (0.6.5-1) unstable; urgency=low | |||
|
310 | ||||
|
311 | * New upstream release | |||
|
312 | ||||
|
313 | -- Jack Moffitt <jack@xiph.org> Thu, 2 Dec 2004 15:49:27 -0700 | |||
|
314 | ||||
|
315 | ipython (0.6.4-1.1) unstable; urgency=low | |||
|
316 | ||||
|
317 | * NMU from BSP Frankfurt: | |||
|
318 | - Added Build-Depends on dpatch (Closes: #280505) | |||
|
319 | ||||
|
320 | -- Joerg Jaspert <joerg@debian.org> Sat, 27 Nov 2004 18:28:17 +0100 | |||
|
321 | ||||
1 | ipython (0.6.4-1) unstable; urgency=low |
|
322 | ipython (0.6.4-1) unstable; urgency=low | |
2 |
|
323 | |||
3 | * Fix dpatch dependency (Closes: #280505) |
|
324 | * New upstream release | |
|
325 | * Updated debian/rules to use dpatch and added debian/patches/* | |||
4 |
|
326 | |||
5 | -- Fernando Perez <fperez@colorado.edu> Wed Nov 17 22:54:23 MST 2004 |
|
327 | -- Jack Moffitt <jack@xiph.org> Tue, 9 Nov 2004 10:38:51 -0700 | |
6 |
|
328 | |||
7 | ipython (0.6.3-1) unstable; urgency=low |
|
329 | ipython (0.6.3-1) unstable; urgency=low | |
8 |
|
330 | |||
@@ -27,8 +349,8 b' ipython (0.4.0-1.1) unstable; urgency=low' | |||||
27 |
|
349 | |||
28 | ipython (0.4.0-1) unstable; urgency=low |
|
350 | ipython (0.4.0-1) unstable; urgency=low | |
29 |
|
351 | |||
30 | * New upstream release (Closes #195215) |
|
352 | * New upstream release (Closes: #195215) | |
31 | * Updated Build-Depends (Closes #200021) |
|
353 | * Updated Build-Depends (Closes: #200021) | |
32 |
|
354 | |||
33 | -- Jack Moffitt <jack@xiph.org> Fri, 25 Jul 2003 10:16:12 -0600 |
|
355 | -- Jack Moffitt <jack@xiph.org> Fri, 25 Jul 2003 10:16:12 -0600 | |
34 |
|
356 |
@@ -1,21 +1,26 b'' | |||||
1 | Source: ipython |
|
1 | Source: ipython | |
2 |
Section: |
|
2 | Section: python | |
3 | Priority: optional |
|
3 | Priority: optional | |
4 | Maintainer: Jack Moffitt <jack@xiph.org> |
|
4 | Maintainer: Debian Python Modules Team <python-modules-team@lists.alioth.debian.org> | |
5 | Build-Depends-Indep: debhelper (>> 4.1.65), dpatch, python-dev |
|
5 | Uploaders: Norbert Tretkowski <nobse@debian.org>, Bernd Zeimetz <bernd@bzed.de> | |
6 | Standards-Version: 3.6.1 |
|
6 | Build-Depends: debhelper (>= 5.0.37.2), dpatch (>= 2.0.10), cdbs (>= 0.4.43), python, python-support (>= 0.4) | |
|
7 | Homepage: http://ipython.scipy.org/ | |||
|
8 | Vcs-Svn: svn://svn.debian.org/python-modules/packages/ipython/trunk/ | |||
|
9 | Vcs-Browser: http://svn.debian.org/wsvn/python-modules/packages/ipython/trunk/ | |||
|
10 | Standards-Version: 3.7.2.2 | |||
7 |
|
11 | |||
8 | Package: ipython |
|
12 | Package: ipython | |
9 | Architecture: all |
|
13 | Architecture: all | |
10 | Depends: ${python:Depends} |
|
14 | Depends: ${python:Depends}, ${misc:Depends}, python-pexpect | |
11 | Recommends: python-numeric, python-numeric-ext |
|
15 | Conflicts: python2.3-ipython, python2.4-ipython, ipython-common | |
12 | Description: An enhanced interactive Python shell |
|
16 | Replaces: python2.3-ipython, python2.4-ipython, ipython-common | |
13 | IPython is an enhanced interactive Python shell. It can be used as a |
|
17 | Suggests: python-profiler, python-numeric, python-numeric-ext, python-matplotlib | |
14 | replacement for the standard Python shell, or it can be used as a |
|
18 | Description: enhanced interactive Python shell | |
15 | complete working environment for scientific computing (like Matlab or |
|
19 | IPython can be used as a replacement for the standard Python shell, | |
16 | Mathematica) when paired with the standard Python scientific and |
|
20 | or it can be used as a complete working environment for scientific | |
17 | numerical tools. It supports dynamic object introspections, numbered |
|
21 | computing (like Matlab or Mathematica) when paired with the standard | |
18 | input/output prompts, a macro system, session logging, session |
|
22 | Python scientific and numerical tools. It supports dynamic object | |
19 | restoring, complete system shell access, verbose and colored |
|
23 | introspections, numbered input/output prompts, a macro system, | |
20 | traceback reports, auto-parentheses, auto-quoting, and is |
|
24 | session logging, session restoring, complete system shell access, | |
21 | embeddedable in other Python programs. |
|
25 | verbose and colored traceback reports, auto-parentheses, auto-quoting, | |
|
26 | and is embeddable in other Python programs. |
@@ -4,51 +4,15 b' Wed, 12 Mar 2003 20:38:14 -0700.' | |||||
4 | It was downloaded from http://ipython.scipy.org/ |
|
4 | It was downloaded from http://ipython.scipy.org/ | |
5 |
|
5 | |||
6 | Upstream Author: Fernando Perez <fperez@colorado.edu>, |
|
6 | Upstream Author: Fernando Perez <fperez@colorado.edu>, | |
7 |
Janko Hauser <jhauser@ |
|
7 | Janko Hauser <jhauser@ifm.uni-kiel.de>, | |
8 | Nathaniel Gray <n8gray@caltech.edu> |
|
8 | Nathaniel Gray <n8gray@caltech.edu> | |
9 |
|
9 | |||
10 | Copyright: |
|
10 | Copyright: | |
11 |
|
11 | |||
12 |
Most IPython code is copyright (C) 2001 |
|
12 | Most IPython code is copyright (C) 2001 by Fernando Perez, Janko | |
13 |
and Nathaniel Gray. All code is licensed under |
|
13 | Hauser, and Nathaniel Gray. All code is licensed under the GNU Lesser | |
14 | explicitly mentioned below. The full IPython license is: |
|
14 | General Public License (LGPL) except as explicitly mentioned below. | |
15 |
|
15 | Its full text is included in the file /usr/share/common-licenses/LGPL. | ||
16 | IPython is released under a BSD-type license. |
|
|||
17 |
|
||||
18 | Copyright (c) 2001, 2002, 2003, 2004 Fernando Perez <fperez@colorado.edu>. |
|
|||
19 |
|
||||
20 | Copyright (c) 2001 Janko Hauser <jhauser@zscout.de> and Nathaniel Gray |
|
|||
21 | <n8gray@caltech.edu>. |
|
|||
22 |
|
||||
23 | All rights reserved. |
|
|||
24 |
|
||||
25 | Redistribution and use in source and binary forms, with or without |
|
|||
26 | modification, are permitted provided that the following conditions are met: |
|
|||
27 |
|
||||
28 | a. Redistributions of source code must retain the above copyright notice, |
|
|||
29 | this list of conditions and the following disclaimer. |
|
|||
30 |
|
||||
31 | b. Redistributions in binary form must reproduce the above copyright |
|
|||
32 | notice, this list of conditions and the following disclaimer in the |
|
|||
33 | documentation and/or other materials provided with the distribution. |
|
|||
34 |
|
||||
35 | c. Neither the name of the copyright holders nor the names of any |
|
|||
36 | contributors to this software may be used to endorse or promote products |
|
|||
37 | derived from this software without specific prior written permission. |
|
|||
38 |
|
||||
39 |
|
||||
40 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
|
|||
41 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|
|||
42 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
|
|||
43 | ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR |
|
|||
44 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
|
|||
45 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
|||
46 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
|
|||
47 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
|||
48 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
|
|||
49 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
|
|||
50 | DAMAGE. |
|
|||
51 |
|
||||
52 |
|
16 | |||
53 | DPyGetOpt.py is copyright (C) 2001 by Bill Bumgarner <bbum@friday.com> |
|
17 | DPyGetOpt.py is copyright (C) 2001 by Bill Bumgarner <bbum@friday.com> | |
54 | and is licensed under the MIT license, reproduced below: |
|
18 | and is licensed under the MIT license, reproduced below: |
@@ -1,98 +1,25 b'' | |||||
1 | #!/usr/bin/make -f |
|
1 | #!/usr/bin/make -f | |
2 | # Sample debian/rules that uses debhelper. |
|
2 | # ipython debian/rules file | |
3 | # GNU copyright 1997 to 1999 by Joey Hess. |
|
3 | DEB_PYTHON_SYSTEM=pysupport | |
4 |
|
4 | include /usr/share/cdbs/1/rules/debhelper.mk | ||
5 | # Uncomment this to turn on verbose mode. |
|
5 | include /usr/share/cdbs/1/class/python-distutils.mk | |
6 | #export DH_VERBOSE=1 |
|
6 | include /usr/share/cdbs/1/rules/dpatch.mk | |
7 |
|
7 | |||
8 |
|
8 | install/ipython:: | ||
9 |
|
9 | # remove documentation | ||
10 |
|
10 | rm $(CURDIR)/debian/ipython/usr/share/doc/ipython/COPYING | ||
11 | CFLAGS = -Wall -g |
|
11 | rm $(CURDIR)/debian/ipython/usr/share/doc/ipython/ChangeLog | |
12 |
|
12 | rm $(CURDIR)/debian/ipython/usr/share/doc/ipython/README_Windows.txt | ||
13 | ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) |
|
13 | rm $(CURDIR)/debian/ipython/usr/share/doc/ipython/pycon.ico | |
14 | CFLAGS += -O0 |
|
14 | ||
15 | else |
|
|||
16 | CFLAGS += -O2 |
|
|||
17 | endif |
|
|||
18 | ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) |
|
|||
19 | INSTALL_PROGRAM += -s |
|
|||
20 | endif |
|
|||
21 |
|
||||
22 | configure: configure-stamp |
|
|||
23 | configure-stamp: |
|
|||
24 | dh_testdir |
|
|||
25 |
|
||||
26 | python setup.py config |
|
|||
27 |
|
||||
28 | touch configure-stamp |
|
|||
29 |
|
||||
30 |
|
||||
31 | build: build-stamp |
|
|||
32 |
|
||||
33 | build-stamp: configure-stamp |
|
|||
34 | dh_testdir |
|
|||
35 |
|
||||
36 | python setup.py build |
|
|||
37 |
|
||||
38 | touch build-stamp |
|
|||
39 |
|
||||
40 | clean: |
|
|||
41 | dh_testdir |
|
|||
42 | dh_testroot |
|
|||
43 | rm -f build-stamp configure-stamp |
|
|||
44 |
|
||||
45 | -python setup.py clean --all |
|
|||
46 | rm -f setupext/*.pyc |
|
|||
47 |
|
||||
48 | dh_clean |
|
|||
49 |
|
||||
50 | install: build |
|
|||
51 | dh_testdir |
|
|||
52 | dh_testroot |
|
|||
53 | dh_clean -k |
|
|||
54 | dh_installdirs |
|
|||
55 |
|
||||
56 | python setup.py install --prefix $(CURDIR)/debian/ipython/usr |
|
|||
57 |
|
||||
58 | # remove extra license docs that get installed |
|
|||
59 | rm -f $(CURDIR)/debian/ipython/usr/share/doc/ipython/COPYING |
|
|||
60 | #rm -f $(CURDIR)/debian/ipython/usr/share/doc/ipython/GNU-LGPL |
|
|||
61 |
|
||||
62 | # change permission on scripts |
|
15 | # change permission on scripts | |
63 |
chmod |
|
16 | chmod a-x $(CURDIR)/debian/ipython/usr/share/doc/ipython/examples/* | |
64 | chmod 755 $(CURDIR)/debian/ipython/usr/share/doc/ipython/examples/example-gnuplot.py |
|
17 | ||
65 |
|
18 | # removing bogus usr/IPython directory | ||
66 | binary-indep: build install |
|
19 | rm -rf $(CURDIR)/debian/ipython/usr/IPython | |
67 | dh_testdir |
|
20 | ||
68 | dh_testroot |
|
21 | binary-fixup/ipython:: | |
69 | dh_installchangelogs doc/ChangeLog |
|
22 | # fix lintian warnings (see also patches/04_remove_shebang.dpatch) | |
70 | dh_installdocs |
|
23 | chmod +x $(CURDIR)/debian/ipython/usr/share/python-support/ipython/IPython/upgrade_dir.py | |
71 | # dh_installexamples |
|
24 | chmod +x $(CURDIR)/debian/ipython/usr/share/python-support/ipython/IPython/Extensions/pickleshare.py | |
72 | dh_install |
|
25 | chmod +x $(CURDIR)/debian/ipython/usr/share/python-support/ipython/IPython/irunner.py | |
73 | # dh_installmenu |
|
|||
74 | # dh_installdebconf |
|
|||
75 | # dh_installlogrotate |
|
|||
76 | # dh_installemacsen |
|
|||
77 | # dh_installpam |
|
|||
78 | # dh_installmime |
|
|||
79 | # dh_installinit |
|
|||
80 | # dh_installcron |
|
|||
81 | # dh_installinfo |
|
|||
82 | dh_installman doc/ipython.1.gz doc/pycolor.1.gz |
|
|||
83 | dh_compress |
|
|||
84 | dh_fixperms |
|
|||
85 | dh_python |
|
|||
86 | # dh_makeshlibs |
|
|||
87 | dh_installdeb |
|
|||
88 | # dh_shlibdeps |
|
|||
89 | dh_gencontrol |
|
|||
90 | dh_md5sums |
|
|||
91 | dh_builddeb |
|
|||
92 |
|
||||
93 | # Build architecture-dependent files here. |
|
|||
94 | binary-arch: build install |
|
|||
95 | # We have nothing to do by default. |
|
|||
96 |
|
||||
97 | binary: binary-indep binary-arch |
|
|||
98 | .PHONY: build clean binary-indep binary-arch binary install configure |
|
@@ -1,3 +1,13 b'' | |||||
|
1 | 2008-04-20 Ville Vainio <vivainio@gmail.com> | |||
|
2 | ||||
|
3 | * Extensions/ipy_lookfor.py: add %lookfor magic command | |||
|
4 | (search docstrings for words) by Pauli Virtanen. Close #245. | |||
|
5 | ||||
|
6 | * Extension/ipy_jot.py: %jot and %read magics, analogous | |||
|
7 | to %store but you can specify some notes. Not read | |||
|
8 | in automatically on startup, you need %read. | |||
|
9 | Contributed by Yichun Wei. | |||
|
10 | ||||
1 | 2008-04-18 Fernando Perez <Fernando.Perez@berkeley.edu> |
|
11 | 2008-04-18 Fernando Perez <Fernando.Perez@berkeley.edu> | |
2 |
|
12 | |||
3 | * IPython/genutils.py (page): apply workaround to curses bug that |
|
13 | * IPython/genutils.py (page): apply workaround to curses bug that |
@@ -1,4 +1,30 b'' | |||||
1 | import os |
|
1 | import fileinput,os,sys | |
|
2 | ||||
2 | def oscmd(c): |
|
3 | def oscmd(c): | |
3 |
|
|
4 | os.system(c) | |
4 | oscmd('sphinx-build -d build/doctrees source build/html') No newline at end of file |
|
5 | ||
|
6 | # html manual. | |||
|
7 | oscmd('sphinx-build -d build/doctrees source build/html') | |||
|
8 | ||||
|
9 | if sys.platform != 'win32': | |||
|
10 | # LaTeX format. | |||
|
11 | oscmd('sphinx-build -b latex -d build/doctrees source build/latex') | |||
|
12 | ||||
|
13 | # Produce pdf. | |||
|
14 | os.chdir('build/latex') | |||
|
15 | ||||
|
16 | # Change chapter style to section style: allows chapters to start on the current page. Works much better for the short chapters we have. | |||
|
17 | for line in fileinput.FileInput('manual.cls',inplace=1): | |||
|
18 | line=line.replace('py@OldChapter=\chapter','py@OldChapter=\section') | |||
|
19 | print line, | |||
|
20 | ||||
|
21 | # Copying the makefile produced by sphinx... | |||
|
22 | oscmd('pdflatex ipython.tex') | |||
|
23 | oscmd('pdflatex ipython.tex') | |||
|
24 | oscmd('pdflatex ipython.tex') | |||
|
25 | oscmd('makeindex -s python.ist ipython.idx') | |||
|
26 | oscmd('makeindex -s python.ist modipython.idx') | |||
|
27 | oscmd('pdflatex ipython.tex') | |||
|
28 | oscmd('pdflatex ipython.tex') | |||
|
29 | ||||
|
30 | os.chdir('../..') |
@@ -113,17 +113,17 b" htmlhelp_basename = 'IPythondoc'" | |||||
113 | # ------------------------ |
|
113 | # ------------------------ | |
114 |
|
114 | |||
115 | # The paper size ('letter' or 'a4'). |
|
115 | # The paper size ('letter' or 'a4'). | |
116 |
|
|
116 | latex_paper_size = 'a4' | |
117 |
|
117 | |||
118 | # The font size ('10pt', '11pt' or '12pt'). |
|
118 | # The font size ('10pt', '11pt' or '12pt'). | |
119 |
|
|
119 | latex_font_size = '10pt' | |
120 |
|
120 | |||
121 | # Grouping the document tree into LaTeX files. List of tuples |
|
121 | # Grouping the document tree into LaTeX files. List of tuples | |
122 | # (source start file, target name, title, author, document class [howto/manual]). |
|
122 | # (source start file, target name, title, author, document class [howto/manual]). | |
123 | #latex_documents = [] |
|
123 | latex_documents = [('ipython','ipython.tex','IPython Documentation','IPython developers','manual')] | |
124 |
|
124 | |||
125 | # Additional stuff for the LaTeX preamble. |
|
125 | # Additional stuff for the LaTeX preamble. | |
126 | #latex_preamble = '' |
|
126 | latex_preamble = '\\def\\thesection{\\arabic{section}}' | |
127 |
|
127 | |||
128 | # Documents to append as an appendix to all manuals. |
|
128 | # Documents to append as an appendix to all manuals. | |
129 | #latex_appendices = [] |
|
129 | #latex_appendices = [] |
@@ -104,7 +104,7 b' def file_doesnt_endwith(test,endings):' | |||||
104 | # Note that http://www.redbrick.dcu.ie/~noel/distutils.html, ex. 2/3, contain |
|
104 | # Note that http://www.redbrick.dcu.ie/~noel/distutils.html, ex. 2/3, contain | |
105 | # information on how to do this more cleanly once python 2.4 can be assumed. |
|
105 | # information on how to do this more cleanly once python 2.4 can be assumed. | |
106 | # Thanks to Noel for the tip. |
|
106 | # Thanks to Noel for the tip. | |
107 |
docdirbase = 'share/doc/ipython |
|
107 | docdirbase = 'share/doc/ipython' | |
108 | manpagebase = 'share/man/man1' |
|
108 | manpagebase = 'share/man/man1' | |
109 |
|
109 | |||
110 | # We only need to exclude from this things NOT already excluded in the |
|
110 | # We only need to exclude from this things NOT already excluded in the | |
@@ -136,7 +136,6 b" datafiles = [('data', docdirbase, docfiles)," | |||||
136 | ('data', pjoin(docdirbase, 'examples'),examfiles), |
|
136 | ('data', pjoin(docdirbase, 'examples'),examfiles), | |
137 | ('data', pjoin(docdirbase, 'manual'),manfiles), |
|
137 | ('data', pjoin(docdirbase, 'manual'),manfiles), | |
138 | ('data', manpagebase, manpages), |
|
138 | ('data', manpagebase, manpages), | |
139 | ('lib', 'IPython/UserConfig', cfgfiles), |
|
|||
140 | ('data',pjoin(docdirbase, 'extensions'),igridhelpfiles), |
|
139 | ('data',pjoin(docdirbase, 'extensions'),igridhelpfiles), | |
141 | ] |
|
140 | ] | |
142 |
|
141 | |||
@@ -156,6 +155,11 b" if 'setuptools' in sys.modules:" | |||||
156 | #datafiles = [('lib', 'IPython/UserConfig', cfgfiles)] |
|
155 | #datafiles = [('lib', 'IPython/UserConfig', cfgfiles)] | |
157 | else: |
|
156 | else: | |
158 | egg_extra_kwds = {} |
|
157 | egg_extra_kwds = {} | |
|
158 | # package_data of setuptools was introduced to distutils in 2.4 | |||
|
159 | if sys.version_info < (2,4): | |||
|
160 | datafiles.append(('lib', 'IPython/UserConfig', cfgfiles)) | |||
|
161 | ||||
|
162 | ||||
159 |
|
163 | |||
160 |
|
164 | |||
161 | # Call the setup() routine which does most of the work |
|
165 | # Call the setup() routine which does most of the work | |
@@ -170,8 +174,9 b' setup(name = name,' | |||||
170 | license = license, |
|
174 | license = license, | |
171 | platforms = platforms, |
|
175 | platforms = platforms, | |
172 | keywords = keywords, |
|
176 | keywords = keywords, | |
173 | packages = ['IPython', 'IPython.Extensions', 'IPython.external', 'IPython.gui', 'IPython.gui.wx'], |
|
177 | packages = ['IPython', 'IPython.Extensions', 'IPython.external', 'IPython.gui', 'IPython.gui.wx', 'IPython.UserConfig'], | |
174 | scripts = scriptfiles, |
|
178 | scripts = scriptfiles, | |
|
179 | package_data = {'IPython.UserConfig' : ['*'] }, | |||
175 |
|
180 | |||
176 | cmdclass = {'install_data': install_data_ext}, |
|
181 | cmdclass = {'install_data': install_data_ext}, | |
177 | data_files = datafiles, |
|
182 | data_files = datafiles, |
General Comments 0
You need to be logged in to leave comments.
Login now