rubypython 0.2.2 → 0.2.3
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/History.txt +14 -0
- data/config/hoe.rb +3 -1
- data/ext/rubypython_bridge/config.h +1 -1
- data/ext/rubypython_bridge/extconf.rb +17 -2
- data/ext/rubypython_bridge/ptor.c +1 -1
- data/ext/rubypython_bridge/rp_object.c +2 -2
- data/ext/rubypython_bridge/rtop.c +1 -1
- data/ext/rubypython_bridge/rubypython_bridge.c +3 -3
- data/lib/rubypython/version.rb +1 -1
- data/lib/rubypython/wrapper_extensions.rb +42 -0
- data/test/test_rubypython.rb +2 -2
- data/website/index.html +1 -1
- metadata +4 -4
data/History.txt
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
== 0.2.3 2008-08-29
|
2
|
+
* 2 Major Enhancements
|
3
|
+
* Introduced PyMain object to as a singleton wrapper for the Python __main__ and
|
4
|
+
__builtin__ modules.
|
5
|
+
* Introduced block functionality for PyMain object.
|
6
|
+
|
7
|
+
* Compatibility Updates
|
8
|
+
* Changed some declarations in the C code make RubyPython more compatible with the style
|
9
|
+
conventions of the Ruby C API.
|
10
|
+
* Update how RubyPython locates the Python headers and library.
|
11
|
+
* 1 Bug Fix
|
12
|
+
* Fixed an error in ptor.c that might have prevented RubyPython from building correctly
|
13
|
+
on certain systems.
|
14
|
+
|
1
15
|
== 0.2.2 2008-08-07
|
2
16
|
* Major Enhancements
|
3
17
|
* Wrapped classes and instances should now behave as expected.
|
data/config/hoe.rb
CHANGED
@@ -63,7 +63,9 @@ $hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
|
63
63
|
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
64
64
|
#p.extra_deps = EXTRA_DEPENDENCIES
|
65
65
|
|
66
|
-
|
66
|
+
p.spec_extras = {
|
67
|
+
:requirements => ["Python, ~>2.4"]
|
68
|
+
} # A hash of extra values to set in the gemspec.
|
67
69
|
end
|
68
70
|
|
69
71
|
CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
@@ -1,7 +1,22 @@
|
|
1
1
|
require 'mkmf'
|
2
|
+
require 'open3'
|
3
|
+
|
4
|
+
if (Open3.popen3("python --version") { |i,o,e| e.read}.chomp.split[1].to_f < 2.4)
|
5
|
+
puts "I'm sorry you need at least Python 2.4 to use rubypython"
|
6
|
+
exit -1
|
7
|
+
end
|
2
8
|
|
3
9
|
dir_config("rubypython_bridge")
|
4
|
-
|
5
|
-
|
10
|
+
if(!`which python-config`)
|
11
|
+
print "Can't configure with python_config"
|
12
|
+
exit -1
|
13
|
+
end
|
14
|
+
|
15
|
+
unless find_library("python2.5",nil)||find("python2.4",nil)
|
16
|
+
puts "Could not find python libraries"
|
17
|
+
exit -1
|
18
|
+
end
|
19
|
+
|
20
|
+
find_header("Python.h",*`python-config --includes`.split.map{|s| s[2..-1]<<"/"})
|
6
21
|
|
7
22
|
create_makefile("rubypython_bridge")
|
@@ -1,9 +1,9 @@
|
|
1
1
|
#include "rubypython_bridge.h"
|
2
2
|
|
3
3
|
VALUE mRubyPythonBridge;
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
RUBY_EXTERN VALUE cRubyPyObject;
|
5
|
+
RUBY_EXTERN VALUE cRubyPyModule;
|
6
|
+
RUBY_EXTERN VALUE cRubyPyClass;
|
7
7
|
|
8
8
|
|
9
9
|
/*
|
data/lib/rubypython/version.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'singleton'
|
1
2
|
class RubyPythonBridge::RubyPyObject
|
2
3
|
def inspect
|
3
4
|
"<#{self.class}:#{__name}>"
|
@@ -5,6 +6,47 @@ class RubyPythonBridge::RubyPyObject
|
|
5
6
|
end
|
6
7
|
|
7
8
|
|
9
|
+
# A singleton object providing access to the python __main__ and __builtin__ modules.
|
10
|
+
# This can be conveniently accessed through the already instaniated PyMain constant.
|
11
|
+
# The __main__ namespace is searched beofre the __builtin__ namespace. As such,
|
12
|
+
# naming clashes will be resolved in that order.
|
13
|
+
#
|
14
|
+
# == Block Syntax
|
15
|
+
# The PyMainClass object provides somewhat experimental block support.
|
16
|
+
# A block may be passed to a method call and the object returned by the function call
|
17
|
+
# will be passed as an argument to the block.
|
18
|
+
class PyMainClass
|
19
|
+
include Singleton
|
20
|
+
#:nodoc:
|
21
|
+
def main
|
22
|
+
@main||=RubyPython.import "__main__"
|
23
|
+
end
|
24
|
+
|
25
|
+
#:nodoc:
|
26
|
+
def builtin
|
27
|
+
@builtin||=RubyPython.import "__builtin__"
|
28
|
+
end
|
29
|
+
|
30
|
+
#:nodoc:
|
31
|
+
def method_missing(name,*args,&block)
|
32
|
+
begin
|
33
|
+
result=main.send(name,*args)
|
34
|
+
rescue NoMethodError
|
35
|
+
begin
|
36
|
+
result=builtin.send(name,*args)
|
37
|
+
rescue NoMethodError
|
38
|
+
super(name,*args)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
if(block)
|
42
|
+
return block.call(result)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# See _PyMainClass_
|
48
|
+
PyMain=PyMainClass.instance
|
49
|
+
|
8
50
|
# A wrapper class for Python Modules.
|
9
51
|
#
|
10
52
|
# Methods calls are delegated to the equivalent Python methods/functions. Attribute references
|
data/test/test_rubypython.rb
CHANGED
@@ -30,14 +30,14 @@ class TestRubypython < Test::Unit::TestCase
|
|
30
30
|
assert(RubyPython.stop)
|
31
31
|
end
|
32
32
|
|
33
|
-
def
|
33
|
+
def test_two_imports
|
34
34
|
RubyPython.start
|
35
35
|
RubyPython.import "cPickle"
|
36
36
|
RubyPython.import "urllib"
|
37
37
|
RubyPython.stop
|
38
38
|
end
|
39
39
|
|
40
|
-
def
|
40
|
+
def test_propogate_python_errror
|
41
41
|
RubyPython.start
|
42
42
|
assert_raise PythonError do
|
43
43
|
RubyPython.import "slasdfj"
|
data/website/index.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<h1>rubypython</h1>
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/rubypython"; return false'>
|
35
35
|
<p>Get Version</p>
|
36
|
-
<a href="http://rubyforge.org/projects/rubypython" class="numbers">0.2.
|
36
|
+
<a href="http://rubyforge.org/projects/rubypython" class="numbers">0.2.3</a>
|
37
37
|
</div>
|
38
38
|
<h2>What</h2>
|
39
39
|
<p>RubyPython is a C bridge between Ruby and Python with a Ruby interface. It’s aim is to make the power of the Python’s great standard library available to Ruby programmers from within Ruby.<br />
|
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.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zach Raines
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-08-
|
12
|
+
date: 2008-08-29 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -102,8 +102,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: "0"
|
104
104
|
version:
|
105
|
-
requirements:
|
106
|
-
|
105
|
+
requirements:
|
106
|
+
- Python, ~>2.4
|
107
107
|
rubyforge_project: rubypython
|
108
108
|
rubygems_version: 1.2.0
|
109
109
|
signing_key:
|