Show More
@@ -21,7 +21,7 b" name = 'ipython'" | |||||
21 | # bdist_deb does not accept underscores (a Debian convention). |
|
21 | # bdist_deb does not accept underscores (a Debian convention). | |
22 |
|
22 | |||
23 | development = False # change this to False to do a release |
|
23 | development = False # change this to False to do a release | |
24 | version_base = '0.9' |
|
24 | version_base = '0.9.1' | |
25 | branch = 'ipython' |
|
25 | branch = 'ipython' | |
26 | revision = '1143' |
|
26 | revision = '1143' | |
27 |
|
27 |
@@ -21,8 +21,77 b' __docformat__ = "restructuredtext en"' | |||||
21 | # Imports |
|
21 | # Imports | |
22 | #------------------------------------------------------------------------------- |
|
22 | #------------------------------------------------------------------------------- | |
23 | import string |
|
23 | import string | |
24 | import uuid |
|
24 | ||
25 | import _ast |
|
25 | try: | |
|
26 | import _ast | |||
|
27 | except ImportError: | |||
|
28 | # Python 2.4 hackish workaround. | |||
|
29 | class bunch: pass | |||
|
30 | _ast = bunch() | |||
|
31 | _ast.PyCF_ONLY_AST = 1024 | |||
|
32 | ||||
|
33 | ||||
|
34 | ||||
|
35 | try: | |||
|
36 | import uuid | |||
|
37 | except ImportError: | |||
|
38 | # Python 2.4 hackish workaround. | |||
|
39 | class UUID: | |||
|
40 | def __init__(self,bytes): | |||
|
41 | version = 4 | |||
|
42 | int = long(('%02x'*16) % tuple(map(ord, bytes)), 16) | |||
|
43 | # Set the variant to RFC 4122. | |||
|
44 | int &= ~(0xc000 << 48L) | |||
|
45 | int |= 0x8000 << 48L | |||
|
46 | # Set the version number. | |||
|
47 | int &= ~(0xf000 << 64L) | |||
|
48 | int |= version << 76L | |||
|
49 | self.__dict__['int'] = int | |||
|
50 | ||||
|
51 | def __cmp__(self, other): | |||
|
52 | if isinstance(other, UUID): | |||
|
53 | return cmp(self.int, other.int) | |||
|
54 | return NotImplemented | |||
|
55 | ||||
|
56 | def __hash__(self): | |||
|
57 | return hash(self.int) | |||
|
58 | ||||
|
59 | def __int__(self): | |||
|
60 | return self.int | |||
|
61 | ||||
|
62 | def __repr__(self): | |||
|
63 | return 'UUID(%r)' % str(self) | |||
|
64 | ||||
|
65 | def __setattr__(self, name, value): | |||
|
66 | raise TypeError('UUID objects are immutable') | |||
|
67 | ||||
|
68 | def __str__(self): | |||
|
69 | hex = '%032x' % self.int | |||
|
70 | return '%s-%s-%s-%s-%s' % ( | |||
|
71 | hex[:8], hex[8:12], hex[12:16], hex[16:20], hex[20:]) | |||
|
72 | ||||
|
73 | def get_bytes(self): | |||
|
74 | bytes = '' | |||
|
75 | for shift in range(0, 128, 8): | |||
|
76 | bytes = chr((self.int >> shift) & 0xff) + bytes | |||
|
77 | return bytes | |||
|
78 | ||||
|
79 | bytes = property(get_bytes) | |||
|
80 | ||||
|
81 | ||||
|
82 | def _u4(): | |||
|
83 | "Fake random uuid" | |||
|
84 | ||||
|
85 | import random | |||
|
86 | bytes = [chr(random.randrange(256)) for i in range(16)] | |||
|
87 | return UUID(bytes) | |||
|
88 | ||||
|
89 | class bunch: pass | |||
|
90 | uuid = bunch() | |||
|
91 | uuid.uuid4 = _u4 | |||
|
92 | del _u4 | |||
|
93 | ||||
|
94 | ||||
26 |
|
95 | |||
27 | from IPython.frontend.zopeinterface import ( |
|
96 | from IPython.frontend.zopeinterface import ( | |
28 | Interface, |
|
97 | Interface, |
@@ -182,16 +182,29 b' class LineFrontEndBase(FrontEndBase):' | |||||
182 | raw_string = python_string |
|
182 | raw_string = python_string | |
183 | # Create a false result, in case there is an exception |
|
183 | # Create a false result, in case there is an exception | |
184 | self.last_result = dict(number=self.prompt_number) |
|
184 | self.last_result = dict(number=self.prompt_number) | |
|
185 | ||||
|
186 | ## try: | |||
|
187 | ## self.history.input_cache[-1] = raw_string.rstrip() | |||
|
188 | ## result = self.shell.execute(python_string) | |||
|
189 | ## self.last_result = result | |||
|
190 | ## self.render_result(result) | |||
|
191 | ## except: | |||
|
192 | ## self.show_traceback() | |||
|
193 | ## finally: | |||
|
194 | ## self.after_execute() | |||
|
195 | ||||
185 | try: |
|
196 | try: | |
186 | self.history.input_cache[-1] = raw_string.rstrip() |
|
197 | try: | |
187 | result = self.shell.execute(python_string) |
|
198 | self.history.input_cache[-1] = raw_string.rstrip() | |
188 | self.last_result = result |
|
199 | result = self.shell.execute(python_string) | |
189 |
self. |
|
200 | self.last_result = result | |
190 | except: |
|
201 | self.render_result(result) | |
191 | self.show_traceback() |
|
202 | except: | |
|
203 | self.show_traceback() | |||
192 | finally: |
|
204 | finally: | |
193 | self.after_execute() |
|
205 | self.after_execute() | |
194 |
|
206 | |||
|
207 | ||||
195 | #-------------------------------------------------------------------------- |
|
208 | #-------------------------------------------------------------------------- | |
196 | # LineFrontEndBase interface |
|
209 | # LineFrontEndBase interface | |
197 | #-------------------------------------------------------------------------- |
|
210 | #-------------------------------------------------------------------------- |
@@ -196,17 +196,33 b' This is the wx frontend, by Gael Varoquaux. This is EXPERIMENTAL code."""' | |||||
196 | # capture it. |
|
196 | # capture it. | |
197 | self.capture_output() |
|
197 | self.capture_output() | |
198 | self.last_result = dict(number=self.prompt_number) |
|
198 | self.last_result = dict(number=self.prompt_number) | |
|
199 | ||||
|
200 | ## try: | |||
|
201 | ## for line in input_string.split('\n'): | |||
|
202 | ## filtered_lines.append( | |||
|
203 | ## self.ipython0.prefilter(line, False).rstrip()) | |||
|
204 | ## except: | |||
|
205 | ## # XXX: probably not the right thing to do. | |||
|
206 | ## self.ipython0.showsyntaxerror() | |||
|
207 | ## self.after_execute() | |||
|
208 | ## finally: | |||
|
209 | ## self.release_output() | |||
|
210 | ||||
|
211 | ||||
199 | try: |
|
212 | try: | |
200 | for line in input_string.split('\n'): |
|
213 | try: | |
201 | filtered_lines.append( |
|
214 | for line in input_string.split('\n'): | |
202 | self.ipython0.prefilter(line, False).rstrip()) |
|
215 | filtered_lines.append( | |
203 | except: |
|
216 | self.ipython0.prefilter(line, False).rstrip()) | |
204 | # XXX: probably not the right thing to do. |
|
217 | except: | |
205 | self.ipython0.showsyntaxerror() |
|
218 | # XXX: probably not the right thing to do. | |
206 | self.after_execute() |
|
219 | self.ipython0.showsyntaxerror() | |
|
220 | self.after_execute() | |||
207 | finally: |
|
221 | finally: | |
208 | self.release_output() |
|
222 | self.release_output() | |
209 |
|
223 | |||
|
224 | ||||
|
225 | ||||
210 | # Clean up the trailing whitespace, to avoid indentation errors |
|
226 | # Clean up the trailing whitespace, to avoid indentation errors | |
211 | filtered_string = '\n'.join(filtered_lines) |
|
227 | filtered_string = '\n'.join(filtered_lines) | |
212 | return filtered_string |
|
228 | return filtered_string |
@@ -19,10 +19,6 b' __docformat__ = "restructuredtext en"' | |||||
19 | #------------------------------------------------------------------------------- |
|
19 | #------------------------------------------------------------------------------- | |
20 | # Imports |
|
20 | # Imports | |
21 | #------------------------------------------------------------------------------- |
|
21 | #------------------------------------------------------------------------------- | |
22 | import string |
|
|||
23 | import uuid |
|
|||
24 | import _ast |
|
|||
25 |
|
||||
26 | try: |
|
22 | try: | |
27 | from zope.interface import Interface, Attribute, implements, classProvides |
|
23 | from zope.interface import Interface, Attribute, implements, classProvides | |
28 | except ImportError: |
|
24 | except ImportError: |
@@ -8,8 +8,6 b' which can also be useful as templates for writing new, application-specific' | |||||
8 | managers. |
|
8 | managers. | |
9 | """ |
|
9 | """ | |
10 |
|
10 | |||
11 | from __future__ import with_statement |
|
|||
12 |
|
||||
13 | __docformat__ = "restructuredtext en" |
|
11 | __docformat__ = "restructuredtext en" | |
14 |
|
12 | |||
15 | #------------------------------------------------------------------------------- |
|
13 | #------------------------------------------------------------------------------- |
@@ -1,4 +1,6 b'' | |||||
1 | from __future__ import with_statement |
|
1 | #from __future__ import with_statement | |
|
2 | ||||
|
3 | # XXX This file is currently disabled to preserve 2.4 compatibility. | |||
2 |
|
4 | |||
3 | #def test_simple(): |
|
5 | #def test_simple(): | |
4 | if 0: |
|
6 | if 0: | |
@@ -25,17 +27,17 b' if 0:' | |||||
25 |
|
27 | |||
26 | mec.pushAll() |
|
28 | mec.pushAll() | |
27 |
|
29 | |||
28 | with parallel as pr: |
|
30 | ## with parallel as pr: | |
29 | # A comment |
|
31 | ## # A comment | |
30 | remote() # this means the code below only runs remotely |
|
32 | ## remote() # this means the code below only runs remotely | |
31 | print 'Hello remote world' |
|
33 | ## print 'Hello remote world' | |
32 | x = range(10) |
|
34 | ## x = range(10) | |
33 | # Comments are OK |
|
35 | ## # Comments are OK | |
34 | # Even misindented. |
|
36 | ## # Even misindented. | |
35 | y = x+1 |
|
37 | ## y = x+1 | |
36 |
|
38 | |||
37 |
|
39 | |||
38 | with pfor('i',sequence) as pr: |
|
40 | ## with pfor('i',sequence) as pr: | |
39 | print x[i] |
|
41 | ## print x[i] | |
40 |
|
42 | |||
41 | print pr.x + pr.y |
|
43 | print pr.x + pr.y |
@@ -45,7 +45,10 b' def mergesort(list_of_lists, key=None):' | |||||
45 | for i, itr in enumerate(iter(pl) for pl in list_of_lists): |
|
45 | for i, itr in enumerate(iter(pl) for pl in list_of_lists): | |
46 | try: |
|
46 | try: | |
47 | item = itr.next() |
|
47 | item = itr.next() | |
48 | toadd = (key(item), i, item, itr) if key else (item, i, itr) |
|
48 | if key: | |
|
49 | toadd = (key(item), i, item, itr) | |||
|
50 | else: | |||
|
51 | toadd = (item, i, itr) | |||
49 | heap.append(toadd) |
|
52 | heap.append(toadd) | |
50 | except StopIteration: |
|
53 | except StopIteration: | |
51 | pass |
|
54 | pass |
@@ -15,8 +15,8 b' cd $ipdir' | |||||
15 | ./setup.py sdist --formats=gztar |
|
15 | ./setup.py sdist --formats=gztar | |
16 |
|
16 | |||
17 | # Build rpms |
|
17 | # Build rpms | |
18 |
|
|
18 | python2.4 ./setup.py bdist_rpm --binary-only --release=py24 --python=/usr/bin/python2.4 | |
19 |
|
|
19 | python2.5 ./setup.py bdist_rpm --binary-only --release=py25 --python=/usr/bin/python2.5 | |
20 |
|
20 | |||
21 | # Build eggs |
|
21 | # Build eggs | |
22 | python2.4 ./setup_bdist_egg.py |
|
22 | python2.4 ./setup_bdist_egg.py |
General Comments 0
You need to be logged in to leave comments.
Login now