rubypython-raspi 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,59 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe RubyPython do
4
+ describe "#import" do
5
+ it "should handle multiple imports" do
6
+ lambda do
7
+ RubyPython.import 'cPickle'
8
+ RubyPython.import 'urllib'
9
+ end.should_not raise_exception
10
+ end
11
+
12
+ it "should propagate Python errors" do
13
+ lambda do
14
+ RubyPython.import 'nonExistentModule'
15
+ end.should raise_exception(RubyPython::PythonError)
16
+ end
17
+
18
+ it "should return a RubyPyModule" do
19
+ RubyPython.import('urllib2').should be_a(RubyPython::RubyPyModule)
20
+ end
21
+ end
22
+ end
23
+
24
+ describe RubyPython, :self_start => true do
25
+
26
+ describe "#session" do
27
+ it "should start interpreter" do
28
+ RubyPython.session do
29
+ cPickle = RubyPython.import "cPickle"
30
+ cPickle.loads("(dp1\nS'a'\nS'n'\ns(I1\nS'2'\ntp2\nI4\ns.").rubify.should == {"a"=>"n", [1, "2"]=>4}
31
+ end
32
+ end
33
+
34
+ it "should stop the interpreter" do
35
+ RubyPython.session do
36
+ cPickle = RubyPython.import "cPickle"
37
+ end
38
+
39
+ RubyPython.stop.should be_false
40
+ end
41
+ end
42
+
43
+ describe "#run" do
44
+ it "should start interpreter" do
45
+ RubyPython.run do
46
+ cPickle = import "cPickle"
47
+ cPickle.loads("(dp1\nS'a'\nS'n'\ns(I1\nS'2'\ntp2\nI4\ns.").rubify.should == {"a"=>"n", [1, "2"]=>4}
48
+ end
49
+ end
50
+
51
+ it "should stop the interpreter" do
52
+ RubyPython.run do
53
+ cPickle = import "cPickle"
54
+ end
55
+
56
+ RubyPython.stop.should be_false
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,67 @@
1
+ begin
2
+ require 'rspec'
3
+ rescue LoadError
4
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
5
+ require 'rspec'
6
+ end
7
+
8
+ dir = File.dirname(__FILE__)
9
+
10
+ $:.unshift(File.join(dir, '..', 'lib'))
11
+ require 'rubypython'
12
+
13
+ module TestConstants
14
+ AString = "STRING"
15
+ AStringWithNULLs = "STRING\0WITH\0NULLS"
16
+ AnInt = 1
17
+ AChar = 'a'
18
+ AFloat = 1.0
19
+ AnArray = [AnInt, AChar, AFloat, AString]
20
+ ATuple = RubyPython::Tuple.tuple(AnArray)
21
+ # ATuple << AnInt << AChar << AFloat << AString
22
+ ASym = :sym
23
+ AHash = {
24
+ AnInt => AnInt,
25
+ AChar.to_sym => AChar,
26
+ ASym => AFloat,
27
+ AString => AString
28
+ }
29
+ AConvertedHash = Hash[*AHash.map do |k, v|
30
+ key = k.is_a?(Symbol) ? k.to_s : k
31
+ [key, v]
32
+ end.flatten]
33
+ AProc = Proc.new { |a1, a2| a1 + a2 }
34
+ def self.a_method(a1, a2)
35
+ a1 + a2
36
+ end
37
+ AMethod = method(:a_method)
38
+ end
39
+
40
+ def run_python_command(cmd)
41
+ %x(python -c '#{cmd}').chomp
42
+ end
43
+
44
+ RSpec.configure do |config|
45
+ if RUBY_VERSION < '1.9.2'
46
+ config.filter_run_excluding :ruby_version => '1.9'
47
+ end
48
+
49
+ config.before(:all) do
50
+ class RubyPython::RubyPyProxy
51
+ [:should, :should_not, :class].each { |m| reveal(m) }
52
+ end
53
+ end
54
+
55
+ config.before(:all, :self_start => nil) do
56
+ RubyPython.start
57
+
58
+ @sys = RubyPython.import 'sys'
59
+ @sys.path.append File.join(dir, 'python_helpers')
60
+ @objects = RubyPython.import 'objects'
61
+ @basics = RubyPython.import 'basics'
62
+ end
63
+
64
+ config.after(:all) do
65
+ RubyPython.stop
66
+ end
67
+ end
metadata ADDED
@@ -0,0 +1,200 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubypython-raspi
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Steeve Morin
9
+ - Austin Ziegler
10
+ - Zach Raines
11
+ - Lewis O'Driscoll
12
+ autorequire:
13
+ bindir: bin
14
+ cert_chain: []
15
+ date: 2011-10-21 00:00:00.000000000 Z
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: ffi
19
+ requirement: !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ~>
23
+ - !ruby/object:Gem::Version
24
+ version: 1.0.7
25
+ type: :runtime
26
+ prerelease: false
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 1.0.7
33
+ - !ruby/object:Gem::Dependency
34
+ name: blankslate
35
+ requirement: !ruby/object:Gem::Requirement
36
+ none: false
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: 2.1.2.3
41
+ type: :runtime
42
+ prerelease: false
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ! '>='
47
+ - !ruby/object:Gem::Version
48
+ version: 2.1.2.3
49
+ - !ruby/object:Gem::Dependency
50
+ name: rspec
51
+ requirement: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ version: '2.0'
57
+ type: :development
58
+ prerelease: false
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ~>
63
+ - !ruby/object:Gem::Version
64
+ version: '2.0'
65
+ - !ruby/object:Gem::Dependency
66
+ name: tilt
67
+ requirement: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ~>
71
+ - !ruby/object:Gem::Version
72
+ version: '1.0'
73
+ type: :development
74
+ prerelease: false
75
+ version_requirements: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ~>
79
+ - !ruby/object:Gem::Version
80
+ version: '1.0'
81
+ - !ruby/object:Gem::Dependency
82
+ name: hoe
83
+ requirement: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ~>
87
+ - !ruby/object:Gem::Version
88
+ version: '2.12'
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ none: false
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: '2.12'
97
+ description: ! 'RubyPython is a bridge between the Ruby and Python interpreters. It
98
+ embeds a
99
+
100
+ running Python interpreter in the Ruby application''s process using FFI and
101
+
102
+ provides a means for wrapping, converting, and calling Python objects and
103
+
104
+ methods.
105
+
106
+
107
+ RubyPython uses FFI to marshal the data between the Ruby and Python VMs and
108
+
109
+ make Python calls. You can:
110
+
111
+
112
+ * Inherit from Python classes.
113
+
114
+ * Configure callbacks from Python.
115
+
116
+ * Run Python generators (on Ruby 1.9.2 or later).'
117
+ email:
118
+ - swiuzzz+rubypython@gmail.com
119
+ - austin@rubyforge.org
120
+ - raineszm+rubypython@gmail.com
121
+ - lewis.odriscoll@gmail.com
122
+ executables: []
123
+ extensions: []
124
+ extra_rdoc_files:
125
+ - Manifest.txt
126
+ - PostInstall.txt
127
+ - Contributors.rdoc
128
+ - History.rdoc
129
+ - License.rdoc
130
+ - README.rdoc
131
+ files:
132
+ - .autotest
133
+ - .gitignore
134
+ - .hgignore
135
+ - .hgtags
136
+ - .rspec
137
+ - Contributors.rdoc
138
+ - History.rdoc
139
+ - License.rdoc
140
+ - Manifest.txt
141
+ - PostInstall.txt
142
+ - README.rdoc
143
+ - Rakefile
144
+ - autotest/discover.rb
145
+ - lib/rubypython.rb
146
+ - lib/rubypython/blankobject.rb
147
+ - lib/rubypython/conversion.rb
148
+ - lib/rubypython/legacy.rb
149
+ - lib/rubypython/macros.rb
150
+ - lib/rubypython/operators.rb
151
+ - lib/rubypython/pygenerator.rb
152
+ - lib/rubypython/pymainclass.rb
153
+ - lib/rubypython/pyobject.rb
154
+ - lib/rubypython/python.rb
155
+ - lib/rubypython/pythonerror.rb
156
+ - lib/rubypython/rubypyproxy.rb
157
+ - lib/rubypython/type.rb
158
+ - spec/basic_spec.rb
159
+ - spec/callback_spec.rb
160
+ - spec/conversion_spec.rb
161
+ - spec/legacy_spec.rb
162
+ - spec/pymainclass_spec.rb
163
+ - spec/pyobject_spec.rb
164
+ - spec/python_helpers/basics.py
165
+ - spec/python_helpers/errors.py
166
+ - spec/python_helpers/objects.py
167
+ - spec/pythonerror_spec.rb
168
+ - spec/refcnt_spec.rb
169
+ - spec/rubypyclass_spec.rb
170
+ - spec/rubypyproxy_spec.rb
171
+ - spec/rubypython_spec.rb
172
+ - spec/spec_helper.rb
173
+ homepage:
174
+ licenses: []
175
+ post_install_message:
176
+ rdoc_options:
177
+ - --main
178
+ - README.rdoc
179
+ require_paths:
180
+ - lib
181
+ required_ruby_version: !ruby/object:Gem::Requirement
182
+ none: false
183
+ requirements:
184
+ - - ! '>='
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
187
+ required_rubygems_version: !ruby/object:Gem::Requirement
188
+ none: false
189
+ requirements:
190
+ - - ! '>='
191
+ - !ruby/object:Gem::Version
192
+ version: '0'
193
+ requirements:
194
+ - Python, ~> 2.4
195
+ rubyforge_project: rubypython
196
+ rubygems_version: 1.8.22
197
+ signing_key:
198
+ specification_version: 3
199
+ summary: RubyPython is a bridge between the Ruby and Python interpreters
200
+ test_files: []