rubypython 0.5.3 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -96,7 +96,7 @@ module RubyPython
96
96
  def _wrap(pyobject)
97
97
  if pyobject.class?
98
98
  RubyPyClass.new(pyobject)
99
- elsif RubyPython.legacy_mode
99
+ elsif RubyPython.__send__ :legacy_mode?
100
100
  pyobject.rubify
101
101
  else
102
102
  RubyPyProxy.new(pyobject)
@@ -0,0 +1,10 @@
1
+ module RubyPython
2
+ # A subclass of ::Array that will convert to a Python Tuple automatically.
3
+ class Tuple < ::Array
4
+ def self.tuple(array)
5
+ value = self.new
6
+ value.replace(array.dup)
7
+ value
8
+ end
9
+ end
10
+ end
@@ -12,7 +12,7 @@ describe RubyPython::Conversion do
12
12
  ["a string", "a string", AString],
13
13
  ["a string_with_nulls", "a string_with_nulls", AStringWithNULLs],
14
14
  ["a list", "an array", AnArray],
15
- ["a tuple", "an array", AnArray],
15
+ ["a tuple", "a tuple", ATuple],
16
16
  ["a dict", "a hash", AConvertedHash],
17
17
  ["python True", "true", true],
18
18
  ["python False", "false", false],
@@ -20,7 +20,9 @@ describe RubyPython::Conversion do
20
20
  ].each do |py_type, rb_type, output|
21
21
  it "should convert #{py_type} to #{rb_type}" do
22
22
  py_object_ptr = @objects.__send__(py_type.sub(' ', '_')).pObject.pointer
23
- subject.ptorObject(py_object_ptr).should == output
23
+ obj = subject.ptorObject(py_object_ptr)
24
+ obj.should == output
25
+ obj.class.should == output.class
24
26
  end
25
27
  end
26
28
 
@@ -38,6 +40,7 @@ describe RubyPython::Conversion do
38
40
  ["a string_with_nulls", "a string_with_nulls", AStringWithNULLs],
39
41
  ["a string", "a symbol", ASym],
40
42
  ["a list", "an array", AnArray],
43
+ ["a tuple", "a tuple", ATuple ],
41
44
  ["a dict", "a hash", AConvertedHash],
42
45
  ["python True", "true", true],
43
46
  ["python False", "false", false],
@@ -56,5 +59,10 @@ describe RubyPython::Conversion do
56
59
  it "should raise an exception when it cannot convert" do
57
60
  lambda { subject.rtopObject(Class) }.should raise_exception(subject::UnsupportedConversion)
58
61
  end
62
+
63
+ it "should convert a tuple correctly" do
64
+ @basics.expects_tuple(AnArray).should == false
65
+ @basics.expects_tuple(RubyPython::Tuple.tuple(AnArray)).should == true
66
+ end
59
67
  end
60
68
  end
@@ -18,3 +18,6 @@ def simple_generator(callback):
18
18
 
19
19
  def named_args(arg1, arg2):
20
20
  return [arg1, arg2]
21
+
22
+ def expects_tuple(tvalue):
23
+ return isinstance(tvalue, tuple)
@@ -56,28 +56,4 @@ describe RubyPython, :self_start => true do
56
56
  RubyPython.stop.should be_false
57
57
  end
58
58
  end
59
-
60
- describe '#reload_library', :slow => true do
61
- it 'leaves RubyPython in a stable state' do
62
- lambda do
63
- RubyPython.instance_eval { reload_library }
64
- RubyPython.run {}
65
- end.should_not raise_exception
66
- end
67
- end
68
-
69
- describe '.configure', :slow => true do
70
- it 'allows python executable to be specified', :unless => `which python2.6`.empty? do
71
- RubyPython.configure :python_exe => 'python2.6'
72
- RubyPython.run do
73
- sys = RubyPython.import 'sys'
74
- sys.version.rubify.to_f.should == 2.6
75
- end
76
- end
77
-
78
- after(:all) do
79
- RubyPython.clear_options
80
- RubyPython.instance_eval { reload_library }
81
- end
82
- end
83
59
  end
@@ -17,6 +17,8 @@ module TestConstants
17
17
  AChar = 'a'
18
18
  AFloat = 1.0
19
19
  AnArray = [AnInt, AChar, AFloat, AString]
20
+ ATuple = RubyPython::Tuple.tuple(AnArray)
21
+ # ATuple << AnInt << AChar << AFloat << AString
20
22
  ASym = :sym
21
23
  AHash = {
22
24
  AnInt => AnInt,
metadata CHANGED
@@ -1,150 +1,158 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rubypython
3
- version: !ruby/object:Gem::Version
4
- hash: 13
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.6.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 5
9
- - 3
10
- version: 0.5.3
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Steeve Morin
14
9
  - Austin Ziegler
15
10
  - Zach Raines
16
11
  autorequire:
17
12
  bindir: bin
18
- cert_chain: []
19
-
20
- date: 2011-10-23 00:00:00 Z
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
13
+ cert_chain:
14
+ - !binary |-
15
+ LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURTRENDQWpDZ0F3SUJB
16
+ Z0lCQURBTkJna3Foa2lHOXcwQkFRVUZBREJLTVJ3d0dnWURWUVFEREJOeVlX
17
+ bHUKWlhONmJWOXlkV0o1Y0hsMGFHOXVNUlV3RXdZS0NaSW1pWlB5TEdRQkdS
18
+ WUZaMjFoYVd3eEV6QVJCZ29Ka2lhSgprL0lzWkFFWkZnTmpiMjB3SGhjTk1U
19
+ QXdPREE0TURJME5UTXdXaGNOTVRFd09EQTRNREkwTlRNd1dqQktNUnd3Ckdn
20
+ WURWUVFEREJOeVlXbHVaWE42YlY5eWRXSjVjSGwwYUc5dU1SVXdFd1lLQ1pJ
21
+ bWlaUHlMR1FCR1JZRloyMWgKYVd3eEV6QVJCZ29Ka2lhSmsvSXNaQUVaRmdO
22
+ amIyMHdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCRHdBdwpnZ0VLQW9J
23
+ QkFRRFBTbW14WXFXV041M1hyRDRidFowOHR3aXBSejVwcmlURnR3bUtMMDFX
24
+ ZmhIYTY2T2hEb1YyCk9QdFcwUm9XZWdaNWd0aS9nSjY3UDZJVmwxeUJla2ZW
25
+ NTgxeUhzWnFWN1ZxY09rRGJUOTNGM0h1VExIMTJkMUMKdy9PaEhvR1pVVVJl
26
+ ZE5lU01qS21NU2xDQ0Q0cnpDZlhUZUFFVTZFM3JYaDN1MkFEN2tRZmVZY1pB
27
+ L3UwWWdyRApsUzNjMm9YM0d2SkhqZDRoVjVoSUdnT0dYRHhjZ0g1UzFpTzY1
28
+ ODhTQnhMTit4ZFlDODJ3MDllNXIwOXRCdm8zCkJYWmxzRXJ3dVdSSThIYTd5
29
+ NnRoYnJCMjhHUzVqSTM3OGV3NGtTVVMvMVQ5U3o0RWNQbWh5aHlDZVh2dnNk
30
+ Q20KNEJ2TlBNQmwveVAyZmhjdWJNRC9RMHQ5SWE5Y2hWYzNBZ01CQUFHak9U
31
+ QTNNQWtHQTFVZEV3UUNNQUF3SFFZRApWUjBPQkJZRUZOTG5jVS9LajFSUnNq
32
+ YjVibEFoaWswaGd2S0NNQXNHQTFVZER3UUVBd0lFc0RBTkJna3Foa2lHCjl3
33
+ MEJBUVVGQUFPQ0FRRUFqOHoxa1JTLzFzSFUyeVJab3RoS3Jnc09Mb0R4RjEr
34
+ dVlxOTA5clMyZDZGcU9KYnQKVjA4SmFPaWwvZU1sVGpQazduQlVVOU9abE5t
35
+ YjhvRDBXdDJMZ3Y5R0ZNSkptMG1jaDc2N05rM2gxdDlxaUpKQwp2NElkYTdl
36
+ NitBckFjSEV4UXgvbHVsMmpKQ1dlemdJVnh6OVQ5dW5PZnZ5bE95WHdBSFY0
37
+ RUVLNDdFZVUxVFpWClQ0Y01sMkp5eXRCdGpDUHlkVkpHZmlyeGxNN2FUTU9a
38
+ NkZ2VWJDaUZ2SGF5bUFnb09WWm1tN05wRTZHc01UN2cKMWIxVWNRcXZMcXlw
39
+ OWdkQjNqVmViN0puVExZK1dsSFd0MnJGVmJlcXY3S3RKbHA3KzR1V01La3pU
40
+ YlcvdWpkRwpjZ3VKTWlRQ1NPbFVQWnhDV1dNa2pmWmJYdnRTNVZkekpldlNx
41
+ UT09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
42
+ date: 2012-04-17 00:00:00.000000000 Z
43
+ dependencies:
44
+ - !ruby/object:Gem::Dependency
23
45
  name: ffi
24
- prerelease: false
25
- requirement: &id001 !ruby/object:Gem::Requirement
46
+ requirement: &70222401734660 !ruby/object:Gem::Requirement
26
47
  none: false
27
- requirements:
48
+ requirements:
28
49
  - - ~>
29
- - !ruby/object:Gem::Version
30
- hash: 25
31
- segments:
32
- - 1
33
- - 0
34
- - 7
50
+ - !ruby/object:Gem::Version
35
51
  version: 1.0.7
36
52
  type: :runtime
37
- version_requirements: *id001
38
- - !ruby/object:Gem::Dependency
39
- name: blankslate
40
53
  prerelease: false
41
- requirement: &id002 !ruby/object:Gem::Requirement
54
+ version_requirements: *70222401734660
55
+ - !ruby/object:Gem::Dependency
56
+ name: blankslate
57
+ requirement: &70222401749300 !ruby/object:Gem::Requirement
42
58
  none: false
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- hash: 105
47
- segments:
48
- - 2
49
- - 1
50
- - 2
51
- - 3
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
52
62
  version: 2.1.2.3
53
63
  type: :runtime
54
- version_requirements: *id002
55
- - !ruby/object:Gem::Dependency
56
- name: rubyforge
57
64
  prerelease: false
58
- requirement: &id003 !ruby/object:Gem::Requirement
65
+ version_requirements: *70222401749300
66
+ - !ruby/object:Gem::Dependency
67
+ name: rubyforge
68
+ requirement: &70222401748780 !ruby/object:Gem::Requirement
59
69
  none: false
60
- requirements:
61
- - - ">="
62
- - !ruby/object:Gem::Version
63
- hash: 7
64
- segments:
65
- - 2
66
- - 0
67
- - 4
70
+ requirements:
71
+ - - ! '>='
72
+ - !ruby/object:Gem::Version
68
73
  version: 2.0.4
69
74
  type: :development
70
- version_requirements: *id003
71
- - !ruby/object:Gem::Dependency
72
- name: rspec
73
75
  prerelease: false
74
- requirement: &id004 !ruby/object:Gem::Requirement
76
+ version_requirements: *70222401748780
77
+ - !ruby/object:Gem::Dependency
78
+ name: rdoc
79
+ requirement: &70222401748240 !ruby/object:Gem::Requirement
75
80
  none: false
76
- requirements:
81
+ requirements:
77
82
  - - ~>
78
- - !ruby/object:Gem::Version
79
- hash: 3
80
- segments:
81
- - 2
82
- - 0
83
- version: "2.0"
83
+ - !ruby/object:Gem::Version
84
+ version: '3.10'
85
+ type: :development
86
+ prerelease: false
87
+ version_requirements: *70222401748240
88
+ - !ruby/object:Gem::Dependency
89
+ name: rspec
90
+ requirement: &70222401747560 !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ~>
94
+ - !ruby/object:Gem::Version
95
+ version: '2.0'
84
96
  type: :development
85
- version_requirements: *id004
86
- - !ruby/object:Gem::Dependency
87
- name: tilt
88
97
  prerelease: false
89
- requirement: &id005 !ruby/object:Gem::Requirement
98
+ version_requirements: *70222401747560
99
+ - !ruby/object:Gem::Dependency
100
+ name: tilt
101
+ requirement: &70222401746580 !ruby/object:Gem::Requirement
90
102
  none: false
91
- requirements:
103
+ requirements:
92
104
  - - ~>
93
- - !ruby/object:Gem::Version
94
- hash: 15
95
- segments:
96
- - 1
97
- - 0
98
- version: "1.0"
105
+ - !ruby/object:Gem::Version
106
+ version: '1.0'
99
107
  type: :development
100
- version_requirements: *id005
101
- - !ruby/object:Gem::Dependency
102
- name: hoe
103
108
  prerelease: false
104
- requirement: &id006 !ruby/object:Gem::Requirement
109
+ version_requirements: *70222401746580
110
+ - !ruby/object:Gem::Dependency
111
+ name: hoe
112
+ requirement: &70222401745800 !ruby/object:Gem::Requirement
105
113
  none: false
106
- requirements:
114
+ requirements:
107
115
  - - ~>
108
- - !ruby/object:Gem::Version
109
- hash: 27
110
- segments:
111
- - 2
112
- - 12
113
- version: "2.12"
116
+ - !ruby/object:Gem::Version
117
+ version: '3.0'
114
118
  type: :development
115
- version_requirements: *id006
116
- description: |-
117
- RubyPython is a bridge between the Ruby and Python interpreters. It embeds a
118
- running Python interpreter in the Ruby application's process using FFI and
119
+ prerelease: false
120
+ version_requirements: *70222401745800
121
+ description: ! 'RubyPython is a bridge between the Ruby and Python interpreters. It
122
+ embeds a
123
+
124
+ running Python interpreter in the Ruby application''s process using FFI and
125
+
119
126
  provides a means for wrapping, converting, and calling Python objects and
127
+
120
128
  methods.
121
-
129
+
130
+
122
131
  RubyPython uses FFI to marshal the data between the Ruby and Python VMs and
132
+
123
133
  make Python calls. You can:
124
-
134
+
135
+
125
136
  * Inherit from Python classes.
137
+
126
138
  * Configure callbacks from Python.
127
- * Run Python generators (on Ruby 1.9.2 or later).
128
- email:
139
+
140
+ * Run Python generators (on Ruby 1.9.2 or later).'
141
+ email:
129
142
  - swiuzzz+rubypython@gmail.com
130
143
  - austin@rubyforge.org
131
144
  - raineszm+rubypython@gmail.com
132
145
  executables: []
133
-
134
146
  extensions: []
135
-
136
- extra_rdoc_files:
137
- - Manifest.txt
138
- - PostInstall.txt
147
+ extra_rdoc_files:
139
148
  - Contributors.rdoc
140
149
  - History.rdoc
141
150
  - License.rdoc
151
+ - Manifest.txt
152
+ - PostInstall.txt
142
153
  - README.rdoc
143
- files:
154
+ files:
144
155
  - .autotest
145
- - .gitignore
146
- - .hgignore
147
- - .hgtags
148
156
  - .rspec
149
157
  - Contributors.rdoc
150
158
  - History.rdoc
@@ -157,17 +165,17 @@ files:
157
165
  - lib/rubypython.rb
158
166
  - lib/rubypython/blankobject.rb
159
167
  - lib/rubypython/conversion.rb
168
+ - lib/rubypython/interpreter.rb
160
169
  - lib/rubypython/legacy.rb
161
170
  - lib/rubypython/macros.rb
162
171
  - lib/rubypython/operators.rb
163
- - lib/rubypython/options.rb
164
172
  - lib/rubypython/pygenerator.rb
165
173
  - lib/rubypython/pymainclass.rb
166
174
  - lib/rubypython/pyobject.rb
167
175
  - lib/rubypython/python.rb
168
176
  - lib/rubypython/pythonerror.rb
169
- - lib/rubypython/pythonexec.rb
170
177
  - lib/rubypython/rubypyproxy.rb
178
+ - lib/rubypython/tuple.rb
171
179
  - lib/rubypython/type.rb
172
180
  - spec/basic_spec.rb
173
181
  - spec/callback_spec.rb
@@ -187,37 +195,29 @@ files:
187
195
  - .gemtest
188
196
  homepage:
189
197
  licenses: []
190
-
191
198
  post_install_message:
192
- rdoc_options:
199
+ rdoc_options:
193
200
  - --main
194
201
  - README.rdoc
195
- require_paths:
202
+ require_paths:
196
203
  - lib
197
- required_ruby_version: !ruby/object:Gem::Requirement
204
+ required_ruby_version: !ruby/object:Gem::Requirement
198
205
  none: false
199
- requirements:
200
- - - ">="
201
- - !ruby/object:Gem::Version
202
- hash: 3
203
- segments:
204
- - 0
205
- version: "0"
206
- required_rubygems_version: !ruby/object:Gem::Requirement
206
+ requirements:
207
+ - - ! '>='
208
+ - !ruby/object:Gem::Version
209
+ version: '0'
210
+ required_rubygems_version: !ruby/object:Gem::Requirement
207
211
  none: false
208
- requirements:
209
- - - ">="
210
- - !ruby/object:Gem::Version
211
- hash: 3
212
- segments:
213
- - 0
214
- version: "0"
215
- requirements:
212
+ requirements:
213
+ - - ! '>='
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ requirements:
216
217
  - Python, ~> 2.4
217
218
  rubyforge_project: rubypython
218
- rubygems_version: 1.8.10
219
+ rubygems_version: 1.8.17
219
220
  signing_key:
220
221
  specification_version: 3
221
222
  summary: RubyPython is a bridge between the Ruby and Python interpreters
222
223
  test_files: []
223
-
Binary file
data/.gitignore DELETED
@@ -1,13 +0,0 @@
1
- spec/ldap.yml
2
- .rvmrc
3
- pkg/
4
- *.swp
5
- *.pyc
6
- html/
7
- doc/
8
- publish/
9
- coverage/
10
- coverage.info
11
- .rake_tasks~
12
- .DS_Store
13
- website/index.html