rubypython 0.6.1 → 0.6.2
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.
- data.tar.gz.sig +2 -2
- data/History.rdoc +4 -0
- data/lib/rubypython.rb +1 -1
- data/lib/rubypython/conversion.rb +11 -11
- data/lib/rubypython/interpreter.rb +11 -11
- data/lib/rubypython/pygenerator.rb +1 -1
- data/lib/rubypython/pyobject.rb +4 -4
- data/lib/rubypython/python.rb +4 -4
- data/lib/rubypython/pythonerror.rb +3 -3
- metadata +16 -16
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
��
|
2
|
-
|
1
|
+
������M��2*��{\l�W�0��1��?n��v{}<)�B���� �e%d\<n��{�"ۗD�qc�<7S()d{p�-x�C�O�Z�j[.�w�u�1��!���LI���x�>��Jݓ=Z����c\Ћ����z�Q:|�w�0�Hu�����k�q�0�*�d�r/�e| 0�m��5iRwypu0��6%ã����Rτ�M��KE�y��<p�;������
|
2
|
+
��|�j��ʶ�>d���>av�
|
data/History.rdoc
CHANGED
data/lib/rubypython.rb
CHANGED
@@ -95,7 +95,7 @@ module RubyPython::Conversion
|
|
95
95
|
# Convert a Ruby Proc to a \Python Function. Returns an FFI::Pointer to a
|
96
96
|
# PyCFunction.
|
97
97
|
def self.rtopFunction(rObj)
|
98
|
-
proc = FFI::Function.new(:pointer, [:pointer, :pointer]) do |p_self, p_args|
|
98
|
+
proc = ::FFI::Function.new(:pointer, [:pointer, :pointer]) do |p_self, p_args|
|
99
99
|
retval = rObj.call(*ptorTuple(p_args))
|
100
100
|
pObject = retval.is_a?(RubyPython::RubyPyProxy) ? retval.pObject : RubyPython::PyObject.new(retval)
|
101
101
|
|
@@ -105,7 +105,7 @@ module RubyPython::Conversion
|
|
105
105
|
end
|
106
106
|
|
107
107
|
defn = RubyPython::Python::PyMethodDef.new
|
108
|
-
defn[:ml_name] = FFI::MemoryPointer.from_string("RubyPython::Proc::%s" % rObj.object_id)
|
108
|
+
defn[:ml_name] = ::FFI::MemoryPointer.from_string("RubyPython::Proc::%s" % rObj.object_id)
|
109
109
|
defn[:ml_meth] = proc
|
110
110
|
defn[:ml_flags] = RubyPython::Python::METH_VARARGS
|
111
111
|
defn[:ml_doc] = nil
|
@@ -169,17 +169,17 @@ module RubyPython::Conversion
|
|
169
169
|
# Convert an FFI::Pointer to a \Python String (PyStringObject) to a Ruby
|
170
170
|
# String.
|
171
171
|
def self.ptorString(pString)
|
172
|
-
strPtr = FFI::MemoryPointer.new(:pointer)
|
173
|
-
sizePtr = FFI::MemoryPointer.new(:ssize_t)
|
172
|
+
strPtr = ::FFI::MemoryPointer.new(:pointer)
|
173
|
+
sizePtr = ::FFI::MemoryPointer.new(:ssize_t)
|
174
174
|
|
175
175
|
RubyPython::Python.PyString_AsStringAndSize(pString, strPtr, sizePtr)
|
176
176
|
|
177
|
-
size = case FFI.find_type(:ssize_t)
|
178
|
-
when FFI.find_type(:long)
|
177
|
+
size = case ::FFI.find_type(:ssize_t)
|
178
|
+
when ::FFI.find_type(:long)
|
179
179
|
sizePtr.read_long
|
180
|
-
when FFI.find_type(:int)
|
180
|
+
when ::FFI.find_type(:int)
|
181
181
|
sizePtr.read_int
|
182
|
-
when FFI.find_type(:long_long)
|
182
|
+
when ::FFI.find_type(:long_long)
|
183
183
|
sizePtr.read_long_long
|
184
184
|
else
|
185
185
|
nil
|
@@ -237,10 +237,10 @@ module RubyPython::Conversion
|
|
237
237
|
def self.ptorDict(pDict)
|
238
238
|
rb_hash = {}
|
239
239
|
|
240
|
-
pos = FFI::MemoryPointer.new :ssize_t
|
240
|
+
pos = ::FFI::MemoryPointer.new :ssize_t
|
241
241
|
pos.write_int 0
|
242
|
-
key = FFI::MemoryPointer.new :pointer
|
243
|
-
val = FFI::MemoryPointer.new :pointer
|
242
|
+
key = ::FFI::MemoryPointer.new :pointer
|
243
|
+
val = ::FFI::MemoryPointer.new :pointer
|
244
244
|
|
245
245
|
while RubyPython::Python.PyDict_Next(pDict, pos, key, val) != 0
|
246
246
|
pKey = key.read_pointer
|
@@ -47,7 +47,7 @@ class RubyPython::Interpreter
|
|
47
47
|
rc, @version = runpy "import sys; print '%d.%d' % sys.version_info[:2]"
|
48
48
|
rc, @sys_prefix = runpy "import sys; print sys.prefix"
|
49
49
|
|
50
|
-
if FFI::Platform.windows?
|
50
|
+
if ::FFI::Platform.windows?
|
51
51
|
flat_version = @version.tr('.', '')
|
52
52
|
basename = File.basename(@python, '.exe')
|
53
53
|
|
@@ -72,15 +72,15 @@ class RubyPython::Interpreter
|
|
72
72
|
def find_python_lib
|
73
73
|
# By default, the library name will be something like
|
74
74
|
# libpython2.6.so, but that won't always work.
|
75
|
-
@libbase = "#{FFI::Platform::LIBPREFIX}#{@version_name}"
|
76
|
-
@libext = FFI::Platform::LIBSUFFIX
|
75
|
+
@libbase = "#{::FFI::Platform::LIBPREFIX}#{@version_name}"
|
76
|
+
@libext = ::FFI::Platform::LIBSUFFIX
|
77
77
|
@libname = "#{@libbase}.#{@libext}"
|
78
78
|
|
79
79
|
# We may need to look in multiple locations for Python, so let's
|
80
80
|
# build this as an array.
|
81
81
|
@locations = [ File.join(@sys_prefix, "lib", @libname) ]
|
82
82
|
|
83
|
-
if FFI::Platform.mac?
|
83
|
+
if ::FFI::Platform.mac?
|
84
84
|
# On the Mac, let's add a special case that has even a different
|
85
85
|
# @libname. This may not be fully useful on future versions of OS
|
86
86
|
# X, but it should work on 10.5 and 10.6. Even if it doesn't, the
|
@@ -92,12 +92,12 @@ class RubyPython::Interpreter
|
|
92
92
|
File.join(@sys_prefix, "lib", "#{@realname}", "config", @libname)
|
93
93
|
end
|
94
94
|
|
95
|
-
if FFI::Platform.unix?
|
95
|
+
if ::FFI::Platform.unix?
|
96
96
|
# On Unixes, let's look in some standard alternative places, too.
|
97
97
|
# Just in case. Some Unixes don't include a .so symlink when they
|
98
98
|
# should, so let's look for the base cases of .so.1 and .so.1.0, too.
|
99
99
|
[ @libname, "#{@libname}.1", "#{@libname}.1.0" ].each do |name|
|
100
|
-
if FFI::Platform::ARCH != 'i386'
|
100
|
+
if ::FFI::Platform::ARCH != 'i386'
|
101
101
|
@locations << File.join("/opt/local/lib64", name)
|
102
102
|
@locations << File.join("/opt/lib64", name)
|
103
103
|
@locations << File.join("/usr/local/lib64", name)
|
@@ -110,7 +110,7 @@ class RubyPython::Interpreter
|
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
-
if FFI::Platform.windows?
|
113
|
+
if ::FFI::Platform.windows?
|
114
114
|
# On Windows, the appropriate DLL is usually be found in
|
115
115
|
# %SYSTEMROOT%\system or %SYSTEMROOT%\system32; as a fallback we'll
|
116
116
|
# use C:\Windows\system{,32} as well as the install directory and the
|
@@ -190,7 +190,7 @@ class RubyPython::Interpreter
|
|
190
190
|
# Run a Python command-line command.
|
191
191
|
def runpy(command)
|
192
192
|
i = @python || @python_exe || 'python'
|
193
|
-
if FFI::Platform.windows?
|
193
|
+
if ::FFI::Platform.windows?
|
194
194
|
o = %x(#{i} -c "#{command}" 2> NUL:)
|
195
195
|
else
|
196
196
|
o = %x(#{i} -c "#{command}" 2> /dev/null)
|
@@ -212,9 +212,9 @@ class RubyPython::Interpreter
|
|
212
212
|
|
213
213
|
def debug_s(format = nil)
|
214
214
|
system = ""
|
215
|
-
system << "windows " if FFI::Platform.windows?
|
216
|
-
system << "mac " if FFI::Platform.mac?
|
217
|
-
system << "unix " if FFI::Platform.unix?
|
215
|
+
system << "windows " if ::FFI::Platform.windows?
|
216
|
+
system << "mac " if ::FFI::Platform.mac?
|
217
|
+
system << "unix " if ::FFI::Platform.unix?
|
218
218
|
system << "unknown " if system.empty?
|
219
219
|
|
220
220
|
case format
|
data/lib/rubypython/pyobject.rb
CHANGED
@@ -11,7 +11,7 @@ class RubyPython::PyObject # :nodoc: all
|
|
11
11
|
# This class wraps C <tt>Py…Object</tt>s so that the RubyPython::Python
|
12
12
|
# reference count is automatically decreased when the Ruby object
|
13
13
|
# referencing them goes out of scope.
|
14
|
-
class AutoPyPointer < FFI::AutoPointer # :nodoc:
|
14
|
+
class AutoPyPointer < ::FFI::AutoPointer # :nodoc:
|
15
15
|
class << self
|
16
16
|
# Keeps track of which objects are associated with the currently
|
17
17
|
# running RubyPython::Python interpreter, so that RubyPython knows not
|
@@ -57,11 +57,11 @@ class RubyPython::PyObject # :nodoc: all
|
|
57
57
|
# and wrapped in an AutoPyPointer. The conversion is done with
|
58
58
|
# +RubyPython::Conversion.rtopObject+.
|
59
59
|
def initialize(rObject)
|
60
|
-
if rObject.kind_of? FFI::AutoPointer
|
61
|
-
new_pointer = FFI::Pointer.new rObject
|
60
|
+
if rObject.kind_of? ::FFI::AutoPointer
|
61
|
+
new_pointer = ::FFI::Pointer.new rObject
|
62
62
|
@pointer = AutoPyPointer.new new_pointer
|
63
63
|
xIncref
|
64
|
-
elsif rObject.kind_of? FFI::Pointer
|
64
|
+
elsif rObject.kind_of? ::FFI::Pointer
|
65
65
|
@pointer = AutoPyPointer.new rObject
|
66
66
|
else
|
67
67
|
@pointer = AutoPyPointer.new RubyPython::Conversion.rtopObject(rObject)
|
data/lib/rubypython/python.rb
CHANGED
@@ -18,7 +18,7 @@ class RubyPython::Interpreter
|
|
18
18
|
undef :infect!
|
19
19
|
end
|
20
20
|
|
21
|
-
mod.extend FFI::Library
|
21
|
+
mod.extend ::FFI::Library
|
22
22
|
# FFI::DynamicLibrary::RTLD_LAZY | FFI::DynamicLibrary::RTLD_GLOBAL
|
23
23
|
mod.ffi_lib_flags :lazy, :global
|
24
24
|
mod.ffi_lib self.library
|
@@ -26,7 +26,7 @@ class RubyPython::Interpreter
|
|
26
26
|
# This class is a little bit of a hack to extract the address of
|
27
27
|
# global structs. If someone knows a better way please let me know.
|
28
28
|
mod.module_eval do
|
29
|
-
self.const_set :DummyStruct, Class.new(FFI::Struct)
|
29
|
+
self.const_set :DummyStruct, Class.new(::FFI::Struct)
|
30
30
|
self::DummyStruct.layout :dummy_var, :int
|
31
31
|
|
32
32
|
self.const_set(:PY_FILE_INPUT, 257)
|
@@ -177,12 +177,12 @@ class RubyPython::Interpreter
|
|
177
177
|
# struct. The C struct is actually much larger, but since we only access
|
178
178
|
# the first two data members via FFI and always deal with struct
|
179
179
|
# pointers there is no need to mess around with the rest of the object.
|
180
|
-
self.const_set :PyObjectStruct, Class.new(FFI::Struct)
|
180
|
+
self.const_set :PyObjectStruct, Class.new(::FFI::Struct)
|
181
181
|
self::PyObjectStruct.layout :ob_refcnt, :ssize_t,
|
182
182
|
:ob_type, :pointer
|
183
183
|
|
184
184
|
# This struct is used when defining Python methods.
|
185
|
-
self.const_set :PyMethodDef, Class.new(FFI::Struct)
|
185
|
+
self.const_set :PyMethodDef, Class.new(::FFI::Struct)
|
186
186
|
self::PyMethodDef.layout :ml_name, :pointer,
|
187
187
|
:ml_meth, :PyCFunction,
|
188
188
|
:ml_flags, :int,
|
@@ -56,9 +56,9 @@ class RubyPython::PythonError < RuntimeError
|
|
56
56
|
# with three PyObject instances, representing the Type, the Value, and the
|
57
57
|
# stack trace of the Python error.
|
58
58
|
def self.fetch
|
59
|
-
typePointer = FFI::MemoryPointer.new :pointer
|
60
|
-
valuePointer = FFI::MemoryPointer.new :pointer
|
61
|
-
tracebackPointer = FFI::MemoryPointer.new :pointer
|
59
|
+
typePointer = ::FFI::MemoryPointer.new :pointer
|
60
|
+
valuePointer = ::FFI::MemoryPointer.new :pointer
|
61
|
+
tracebackPointer = ::FFI::MemoryPointer.new :pointer
|
62
62
|
|
63
63
|
RubyPython::Python.PyErr_Fetch typePointer, valuePointer, tracebackPointer
|
64
64
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubypython
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -39,11 +39,11 @@ cert_chain:
|
|
39
39
|
OWdkQjNqVmViN0puVExZK1dsSFd0MnJGVmJlcXY3S3RKbHA3KzR1V01La3pU
|
40
40
|
YlcvdWpkRwpjZ3VKTWlRQ1NPbFVQWnhDV1dNa2pmWmJYdnRTNVZkekpldlNx
|
41
41
|
UT09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
|
42
|
-
date: 2012-05-
|
42
|
+
date: 2012-05-24 00:00:00.000000000 Z
|
43
43
|
dependencies:
|
44
44
|
- !ruby/object:Gem::Dependency
|
45
45
|
name: ffi
|
46
|
-
requirement: &
|
46
|
+
requirement: &70207972655700 !ruby/object:Gem::Requirement
|
47
47
|
none: false
|
48
48
|
requirements:
|
49
49
|
- - ~>
|
@@ -51,10 +51,10 @@ dependencies:
|
|
51
51
|
version: 1.0.7
|
52
52
|
type: :runtime
|
53
53
|
prerelease: false
|
54
|
-
version_requirements: *
|
54
|
+
version_requirements: *70207972655700
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: blankslate
|
57
|
-
requirement: &
|
57
|
+
requirement: &70207972655080 !ruby/object:Gem::Requirement
|
58
58
|
none: false
|
59
59
|
requirements:
|
60
60
|
- - ! '>='
|
@@ -62,10 +62,10 @@ dependencies:
|
|
62
62
|
version: 2.1.2.3
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
|
-
version_requirements: *
|
65
|
+
version_requirements: *70207972655080
|
66
66
|
- !ruby/object:Gem::Dependency
|
67
67
|
name: rubyforge
|
68
|
-
requirement: &
|
68
|
+
requirement: &70207972653860 !ruby/object:Gem::Requirement
|
69
69
|
none: false
|
70
70
|
requirements:
|
71
71
|
- - ! '>='
|
@@ -73,10 +73,10 @@ dependencies:
|
|
73
73
|
version: 2.0.4
|
74
74
|
type: :development
|
75
75
|
prerelease: false
|
76
|
-
version_requirements: *
|
76
|
+
version_requirements: *70207972653860
|
77
77
|
- !ruby/object:Gem::Dependency
|
78
78
|
name: rdoc
|
79
|
-
requirement: &
|
79
|
+
requirement: &70207972652560 !ruby/object:Gem::Requirement
|
80
80
|
none: false
|
81
81
|
requirements:
|
82
82
|
- - ~>
|
@@ -84,10 +84,10 @@ dependencies:
|
|
84
84
|
version: '3.10'
|
85
85
|
type: :development
|
86
86
|
prerelease: false
|
87
|
-
version_requirements: *
|
87
|
+
version_requirements: *70207972652560
|
88
88
|
- !ruby/object:Gem::Dependency
|
89
89
|
name: rspec
|
90
|
-
requirement: &
|
90
|
+
requirement: &70207972651440 !ruby/object:Gem::Requirement
|
91
91
|
none: false
|
92
92
|
requirements:
|
93
93
|
- - ~>
|
@@ -95,10 +95,10 @@ dependencies:
|
|
95
95
|
version: '2.0'
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
|
-
version_requirements: *
|
98
|
+
version_requirements: *70207972651440
|
99
99
|
- !ruby/object:Gem::Dependency
|
100
100
|
name: tilt
|
101
|
-
requirement: &
|
101
|
+
requirement: &70207972649980 !ruby/object:Gem::Requirement
|
102
102
|
none: false
|
103
103
|
requirements:
|
104
104
|
- - ~>
|
@@ -106,10 +106,10 @@ dependencies:
|
|
106
106
|
version: '1.0'
|
107
107
|
type: :development
|
108
108
|
prerelease: false
|
109
|
-
version_requirements: *
|
109
|
+
version_requirements: *70207972649980
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
111
|
name: hoe
|
112
|
-
requirement: &
|
112
|
+
requirement: &70207972648560 !ruby/object:Gem::Requirement
|
113
113
|
none: false
|
114
114
|
requirements:
|
115
115
|
- - ~>
|
@@ -117,7 +117,7 @@ dependencies:
|
|
117
117
|
version: '3.0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
|
-
version_requirements: *
|
120
|
+
version_requirements: *70207972648560
|
121
121
|
description: ! 'RubyPython is a bridge between the Ruby and Python interpreters. It
|
122
122
|
embeds a
|
123
123
|
|
metadata.gz.sig
CHANGED
Binary file
|