rubypython 0.2.4 → 0.2.5
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 +7 -3
- data/ext/rubypython_bridge/config.h +1 -1
- data/ext/rubypython_bridge/extconf.rb +5 -0
- data/ext/rubypython_bridge/rp_object.c +22 -19
- data/ext/rubypython_bridge/rtop.c +2 -1
- data/ext/rubypython_bridge/rubypython_bridge.h +5 -1
- data/lib/rubypython/version.rb +1 -1
- data/test/test_rubypython.rb +4 -1
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
== 0.2.5 2009-3-18
|
2
|
+
* Bug Fixes
|
3
|
+
* Updated to build and run under Ruby 1.9.
|
4
|
+
|
1
5
|
== 0.2.4 2008-10-24
|
2
6
|
* Major Enhancements
|
3
7
|
* Provided setter methods for object attributes. Python object attributes can now be set
|
@@ -8,13 +12,13 @@
|
|
8
12
|
* Changed part of extconf.rb file that would not work under windows.
|
9
13
|
== 0.2.3 2008-08-29
|
10
14
|
* 2 Major Enhancements
|
11
|
-
* Introduced PyMain object
|
15
|
+
* Introduced PyMain object as a singleton wrapper for the Python __main__ and
|
12
16
|
__builtin__ modules.
|
13
17
|
* Introduced block functionality for PyMain object.
|
14
18
|
|
15
19
|
* Compatibility Updates
|
16
|
-
* Changed some declarations in the C code make RubyPython more compatible with the
|
17
|
-
conventions of the Ruby C API.
|
20
|
+
* Changed some declarations in the C code to make RubyPython more compatible with the
|
21
|
+
style conventions of the Ruby C API.
|
18
22
|
* Update how RubyPython locates the Python headers and library.
|
19
23
|
* 1 Bug Fix
|
20
24
|
* Fixed an error in ptor.c that might have prevented RubyPython from building correctly
|
@@ -25,6 +25,11 @@ unless find_library("python2.5",nil)||find("python2.4",nil)
|
|
25
25
|
exit -1
|
26
26
|
end
|
27
27
|
|
28
|
+
if RUBY_VERSION=~/1\.9/ then
|
29
|
+
puts "Building for Ruby 1.9"
|
30
|
+
$CPPFLAGS += " -DRUBY_19"
|
31
|
+
end
|
32
|
+
|
28
33
|
find_header("Python.h",*`python-config --includes`.split.map{|s| s[2..-1]<<"/"})
|
29
34
|
|
30
35
|
create_makefile("rubypython_bridge")
|
@@ -7,8 +7,10 @@ RUBY_EXTERN VALUE ePythonError;
|
|
7
7
|
VALUE cBlankObject;
|
8
8
|
|
9
9
|
// :nodoc:
|
10
|
-
VALUE blank_undef_if(VALUE
|
10
|
+
VALUE blank_undef_if(VALUE name,VALUE klass)
|
11
11
|
{
|
12
|
+
VALUE mname=rb_funcall(name,rb_intern("to_s"),0);
|
13
|
+
printf("OH SHIT\n");
|
12
14
|
if(rb_funcall(mname,rb_intern("match"),1,rb_str_new2("(?:^__)|(?:\\?$)|(?:^send$)|(?:^class$)"))==Qnil)
|
13
15
|
{
|
14
16
|
rb_undef_method(klass,STR2CSTR(mname));
|
@@ -49,7 +51,7 @@ void rp_obj_free(PObj* self)
|
|
49
51
|
|
50
52
|
/*
|
51
53
|
Decreases the reference count on the object wrapped by this instance.
|
52
|
-
This is used for cleanup in RubyPython.stop. RubyPyObject
|
54
|
+
This is used for cleanup in RubyPython.stop. RubyPyObject instances automatically
|
53
55
|
decrease the reference count on their associated objects before they are garbage collected.
|
54
56
|
*/
|
55
57
|
VALUE rp_obj_free_pobj(VALUE self)
|
@@ -164,29 +166,30 @@ VALUE rp_inst_attr_set(VALUE self,VALUE args)
|
|
164
166
|
char *cname;
|
165
167
|
PObj *pClassDict,*pInstDict,*pDict;
|
166
168
|
PyObject *pName;
|
167
|
-
|
168
|
-
|
169
|
+
name=rb_ary_shift(args);
|
170
|
+
name_string=rb_funcall(name,rb_intern("to_s"),0);
|
171
|
+
rb_funcall(name_string,rb_intern("chop!"),0);
|
172
|
+
if(!rp_has_attr(self,name_string))
|
169
173
|
{
|
170
|
-
int argc;
|
171
|
-
|
174
|
+
int argc;
|
172
175
|
VALUE *argv;
|
173
|
-
argc=
|
176
|
+
argc=RARRAY_LEN(args);
|
174
177
|
argv=ALLOC_N(VALUE,argc);
|
175
|
-
MEMCPY(argv,
|
178
|
+
MEMCPY(argv,RARRAY_PTR(args),VALUE,argc);
|
176
179
|
return rb_call_super(argc,argv);
|
177
180
|
}
|
178
|
-
|
179
|
-
name_string=rb_funcall(name,rb_intern("to_s"),0);
|
181
|
+
|
180
182
|
cname=STR2CSTR(name_string);
|
181
|
-
rb_funcall(name_string,rb_intern("chop!"),0);
|
182
183
|
|
183
|
-
if(NUM2INT(rb_funcall(args,rb_intern("size"),0))==1)
|
184
|
+
if((NUM2INT(rb_funcall(args,rb_intern("size"),0))==1))
|
184
185
|
{
|
185
186
|
args=rb_ary_entry(args,0);
|
186
187
|
}
|
188
|
+
|
187
189
|
|
188
190
|
rClassDict=rb_iv_get(self,"@pclassdict");
|
189
191
|
rInstDict=rb_iv_get(self,"@pinstdict");
|
192
|
+
|
190
193
|
Data_Get_Struct(rClassDict,PObj,pClassDict);
|
191
194
|
Data_Get_Struct(rInstDict,PObj,pInstDict);
|
192
195
|
pName=PyString_FromString(cname);
|
@@ -223,9 +226,9 @@ VALUE rp_inst_delegate(VALUE self,VALUE args)
|
|
223
226
|
int argc;
|
224
227
|
|
225
228
|
VALUE *argv;
|
226
|
-
argc=
|
229
|
+
argc=RARRAY_LEN(args);
|
227
230
|
argv=ALLOC_N(VALUE,argc);
|
228
|
-
MEMCPY(argv,
|
231
|
+
MEMCPY(argv,RARRAY_PTR(args),VALUE,argc);
|
229
232
|
return rb_call_super(argc,argv);
|
230
233
|
}
|
231
234
|
name=rb_ary_shift(args);
|
@@ -391,9 +394,9 @@ VALUE rp_mod_attr_set(VALUE self,VALUE args)
|
|
391
394
|
int argc;
|
392
395
|
|
393
396
|
VALUE *argv;
|
394
|
-
argc=
|
397
|
+
argc=RARRAY_LEN(args);
|
395
398
|
argv=ALLOC_N(VALUE,argc);
|
396
|
-
MEMCPY(argv,
|
399
|
+
MEMCPY(argv,RARRAY_PTR(args),VALUE,argc);
|
397
400
|
return rb_call_super(argc,argv);
|
398
401
|
}
|
399
402
|
if(NUM2INT(rb_funcall(args,rb_intern("size"),0))==1)
|
@@ -426,9 +429,9 @@ VALUE rp_mod_delegate(VALUE self,VALUE args)
|
|
426
429
|
int argc;
|
427
430
|
|
428
431
|
VALUE *argv;
|
429
|
-
argc=
|
432
|
+
argc=RARRAY_LEN(args);
|
430
433
|
argv=ALLOC_N(VALUE,argc);
|
431
|
-
MEMCPY(argv,
|
434
|
+
MEMCPY(argv,RARRAY_PTR(args),VALUE,argc);
|
432
435
|
return rb_call_super(argc,argv);
|
433
436
|
}
|
434
437
|
name=rb_ary_shift(args);
|
@@ -523,4 +526,4 @@ void Init_RubyPyInstance()
|
|
523
526
|
{
|
524
527
|
cRubyPyInstance=rb_define_class_under(mRubyPythonBridge,"RubyPyInstance",cRubyPyObject);
|
525
528
|
rb_define_method(cRubyPyInstance,"method_missing",rp_inst_delegate,-2);
|
526
|
-
}
|
529
|
+
}
|
@@ -46,6 +46,7 @@ PyObject* rtop_hash(VALUE rHash)
|
|
46
46
|
int i;
|
47
47
|
|
48
48
|
pDict=PyDict_New();
|
49
|
+
|
49
50
|
for(i=0;i<RARRAY(rKeys)->len;i++)
|
50
51
|
{
|
51
52
|
rKey=rb_ary_entry(rKeys,i);
|
@@ -92,7 +93,7 @@ PyObject* rtop_true()
|
|
92
93
|
PyObject* rtop_symbol(VALUE rSymbol)
|
93
94
|
{
|
94
95
|
PyObject* pString;
|
95
|
-
pString=PyString_FromString(
|
96
|
+
pString=PyString_FromString(STR2CSTR(rb_funcall(rSymbol,rb_intern("to_s"),0)));
|
96
97
|
return pString;
|
97
98
|
|
98
99
|
}
|
@@ -1,7 +1,11 @@
|
|
1
|
+
#ifndef RUBY_19
|
2
|
+
#define RARRAY_LEN(arr) (RARRAY(arr)->len)
|
3
|
+
#define RARRAY_PTR(arr) (RARRAY(arr)->ptr)
|
4
|
+
#endif
|
1
5
|
#include "config.h"
|
2
6
|
|
3
7
|
#include "ptor.h" //PyObject to VALUE conversion
|
4
8
|
#include "rtop.h" //VALUE to PyObject conversion
|
5
9
|
#include "cbridge.h" //General interface functions
|
6
10
|
#include "rp_error.h"
|
7
|
-
#include "rp_object.h"
|
11
|
+
#include "rp_object.h"
|
data/lib/rubypython/version.rb
CHANGED
data/test/test_rubypython.rb
CHANGED
@@ -101,7 +101,10 @@ class TestRubypython < Test::Unit::TestCase
|
|
101
101
|
|
102
102
|
def test_setter_instance
|
103
103
|
RubyPython.session do
|
104
|
-
|
104
|
+
urllib2=RubyPython.import "urllib2"
|
105
|
+
req=urllib2.Request("google.com")
|
106
|
+
req.headers={:a=>"2","k"=>4}
|
107
|
+
assert_equal({"a"=>"2","k"=>4},req.headers)
|
105
108
|
end
|
106
109
|
end
|
107
110
|
|
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.5
|
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:
|
12
|
+
date: 2009-03-18 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|