rubypython 0.2.11 → 0.3.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.
Files changed (72) hide show
  1. data.tar.gz.sig +0 -0
  2. data/{History.txt → History.markdown} +34 -28
  3. data/Manifest.txt +26 -40
  4. data/PostInstall.txt +2 -1
  5. data/README.markdown +103 -0
  6. data/Rakefile +19 -3
  7. data/lib/rubypython.rb +118 -114
  8. data/lib/rubypython/blankobject.rb +21 -0
  9. data/lib/rubypython/conversion.rb +198 -0
  10. data/lib/rubypython/core_ext/string.rb +7 -0
  11. data/lib/rubypython/legacy.rb +15 -0
  12. data/lib/rubypython/macros.rb +47 -0
  13. data/lib/rubypython/operators.rb +111 -0
  14. data/lib/rubypython/pymainclass.rb +51 -0
  15. data/lib/rubypython/pyobject.rb +203 -0
  16. data/lib/rubypython/python.rb +111 -0
  17. data/lib/rubypython/pythonerror.rb +78 -0
  18. data/lib/rubypython/rubypyproxy.rb +214 -0
  19. data/lib/rubypython/version.rb +4 -3
  20. data/spec/conversion_spec.rb +66 -0
  21. data/spec/legacy_spec.rb +22 -0
  22. data/spec/pymainclass_spec.rb +26 -0
  23. data/spec/pyobject_spec.rb +264 -0
  24. data/spec/python_helpers/objects.py +41 -0
  25. data/spec/pythonerror_spec.rb +43 -0
  26. data/spec/refcnt_spec.rb +68 -0
  27. data/spec/rubypyclass_spec.rb +13 -0
  28. data/spec/rubypyproxy_spec.rb +249 -0
  29. data/spec/rubypython_spec.rb +62 -0
  30. data/spec/spec.opts +2 -0
  31. data/spec/spec_helper.rb +51 -0
  32. metadata +79 -73
  33. metadata.gz.sig +0 -0
  34. data/README.txt +0 -60
  35. data/ext/rubypython_bridge/cbridge.c +0 -150
  36. data/ext/rubypython_bridge/cbridge.h +0 -15
  37. data/ext/rubypython_bridge/config.h +0 -14
  38. data/ext/rubypython_bridge/extconf.rb +0 -43
  39. data/ext/rubypython_bridge/ptor.c +0 -242
  40. data/ext/rubypython_bridge/ptor.h +0 -15
  41. data/ext/rubypython_bridge/rp_blankobject.c +0 -42
  42. data/ext/rubypython_bridge/rp_blankobject.h +0 -11
  43. data/ext/rubypython_bridge/rp_class.c +0 -56
  44. data/ext/rubypython_bridge/rp_class.h +0 -7
  45. data/ext/rubypython_bridge/rp_error.c +0 -34
  46. data/ext/rubypython_bridge/rp_error.h +0 -11
  47. data/ext/rubypython_bridge/rp_function.c +0 -31
  48. data/ext/rubypython_bridge/rp_function.h +0 -7
  49. data/ext/rubypython_bridge/rp_instance.c +0 -164
  50. data/ext/rubypython_bridge/rp_instance.h +0 -7
  51. data/ext/rubypython_bridge/rp_module.c +0 -160
  52. data/ext/rubypython_bridge/rp_module.h +0 -8
  53. data/ext/rubypython_bridge/rp_object.c +0 -194
  54. data/ext/rubypython_bridge/rp_object.h +0 -23
  55. data/ext/rubypython_bridge/rp_util.c +0 -63
  56. data/ext/rubypython_bridge/rp_util.h +0 -11
  57. data/ext/rubypython_bridge/rtop.c +0 -212
  58. data/ext/rubypython_bridge/rtop.h +0 -17
  59. data/ext/rubypython_bridge/rubypython_bridge.c +0 -125
  60. data/ext/rubypython_bridge/rubypython_bridge.h +0 -10
  61. data/lib/rubypython/session.rb +0 -4
  62. data/lib/rubypython/wrapper_extensions.rb +0 -83
  63. data/setup.rb +0 -1585
  64. data/tasks/environment.rake +0 -7
  65. data/tasks/extconf.rake +0 -13
  66. data/tasks/extconf/rubypython_bridge.rake +0 -49
  67. data/test/python_helpers/objects.py +0 -12
  68. data/test/test.wav +0 -0
  69. data/test/test_helper.rb +0 -2
  70. data/test/test_rubypython.rb +0 -215
  71. data/test/test_rubypython_bridge_extn.rb +0 -133
  72. data/test/test_session.rb +0 -6
metadata CHANGED
@@ -1,122 +1,129 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubypython
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 2
9
- - 11
10
- version: 0.2.11
8
+ - 3
9
+ - 0
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Zach Raines
14
14
  autorequire:
15
15
  bindir: bin
16
- cert_chain: []
16
+ cert_chain:
17
+ - |
18
+ -----BEGIN CERTIFICATE-----
19
+ MIIDSDCCAjCgAwIBAgIBADANBgkqhkiG9w0BAQUFADBKMRwwGgYDVQQDDBNyYWlu
20
+ ZXN6bV9ydWJ5cHl0aG9uMRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJ
21
+ k/IsZAEZFgNjb20wHhcNMTAwODA4MDI0NTMwWhcNMTEwODA4MDI0NTMwWjBKMRww
22
+ GgYDVQQDDBNyYWluZXN6bV9ydWJ5cHl0aG9uMRUwEwYKCZImiZPyLGQBGRYFZ21h
23
+ aWwxEzARBgoJkiaJk/IsZAEZFgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
24
+ ggEKAoIBAQDPSmmxYqWWN53XrD4btZ08twipRz5priTFtwmKL01WfhHa66OhDoV2
25
+ OPtW0RoWegZ5gti/gJ67P6IVl1yBekfV581yHsZqV7VqcOkDbT93F3HuTLH12d1C
26
+ w/OhHoGZUURedNeSMjKmMSlCCD4rzCfXTeAEU6E3rXh3u2AD7kQfeYcZA/u0YgrD
27
+ lS3c2oX3GvJHjd4hV5hIGgOGXDxcgH5S1iO6588SBxLN+xdYC82w09e5r09tBvo3
28
+ BXZlsErwuWRI8Ha7y6thbrB28GS5jI378ew4kSUS/1T9Sz4EcPmhyhyCeXvvsdCm
29
+ 4BvNPMBl/yP2fhcubMD/Q0t9Ia9chVc3AgMBAAGjOTA3MAkGA1UdEwQCMAAwHQYD
30
+ VR0OBBYEFNLncU/Kj1RRsjb5blAhik0hgvKCMAsGA1UdDwQEAwIEsDANBgkqhkiG
31
+ 9w0BAQUFAAOCAQEAj8z1kRS/1sHU2yRZothKrgsOLoDxF1+uYq909rS2d6FqOJbt
32
+ V08JaOil/eMlTjPk7nBUU9OZlNmb8oD0Wt2Lgv9GFMJJm0mch767Nk3h1t9qiJJC
33
+ v4Ida7e6+ArAcHExQx/lul2jJCWezgIVxz9T9unOfvylOyXwAHV4EEK47EeU1TZV
34
+ T4cMl2JyytBtjCPydVJGfirxlM7aTMOZ6FvUbCiFvHaymAgoOVZmm7NpE6GsMT7g
35
+ 1b1UcQqvLqyp9gdB3jVeb7JnTLY+WlHWt2rFVbeqv7KtJlp7+4uWMKkzTbW/ujdG
36
+ cguJMiQCSOlUPZxCWWMkjfZbXvtS5VdzJevSqQ==
37
+ -----END CERTIFICATE-----
17
38
 
18
- date: 2010-07-12 00:00:00 -04:00
39
+ date: 2010-09-23 00:00:00 -04:00
19
40
  default_executable:
20
41
  dependencies:
21
42
  - !ruby/object:Gem::Dependency
22
- name: rubyforge
43
+ name: ffi
23
44
  prerelease: false
24
45
  requirement: &id001 !ruby/object:Gem::Requirement
25
46
  none: false
26
47
  requirements:
27
48
  - - ">="
28
49
  - !ruby/object:Gem::Version
29
- hash: 7
50
+ hash: 1
30
51
  segments:
31
- - 2
32
52
  - 0
33
- - 4
34
- version: 2.0.4
35
- type: :development
53
+ - 6
54
+ - 3
55
+ version: 0.6.3
56
+ type: :runtime
36
57
  version_requirements: *id001
37
58
  - !ruby/object:Gem::Dependency
38
- name: hoe
59
+ name: blankslate
39
60
  prerelease: false
40
61
  requirement: &id002 !ruby/object:Gem::Requirement
41
62
  none: false
42
63
  requirements:
43
64
  - - ">="
44
65
  - !ruby/object:Gem::Version
45
- hash: 21
66
+ hash: 105
46
67
  segments:
47
68
  - 2
48
- - 6
49
69
  - 1
50
- version: 2.6.1
51
- type: :development
70
+ - 2
71
+ - 3
72
+ version: 2.1.2.3
73
+ type: :runtime
52
74
  version_requirements: *id002
53
75
  description: A bridge between ruby and python
54
76
  email:
55
- - achatesavc+rubypython@gmail.com
77
+ - raineszm+rubypython@gmail.com
56
78
  executables: []
57
79
 
58
- extensions:
59
- - ext/rubypython_bridge/extconf.rb
80
+ extensions: []
81
+
60
82
  extra_rdoc_files:
61
- - History.txt
62
83
  - License.txt
63
84
  - Manifest.txt
64
85
  - PostInstall.txt
65
- - README.txt
86
+ - History.markdown
66
87
  files:
67
- - History.txt
88
+ - History.markdown
68
89
  - License.txt
69
90
  - Manifest.txt
70
91
  - PostInstall.txt
71
- - README.txt
92
+ - README.markdown
72
93
  - Rakefile
73
- - ext/rubypython_bridge/cbridge.c
74
- - ext/rubypython_bridge/cbridge.h
75
- - ext/rubypython_bridge/config.h
76
- - ext/rubypython_bridge/extconf.rb
77
- - ext/rubypython_bridge/ptor.c
78
- - ext/rubypython_bridge/ptor.h
79
- - ext/rubypython_bridge/rp_blankobject.c
80
- - ext/rubypython_bridge/rp_blankobject.h
81
- - ext/rubypython_bridge/rp_class.c
82
- - ext/rubypython_bridge/rp_class.h
83
- - ext/rubypython_bridge/rp_error.c
84
- - ext/rubypython_bridge/rp_error.h
85
- - ext/rubypython_bridge/rp_function.c
86
- - ext/rubypython_bridge/rp_function.h
87
- - ext/rubypython_bridge/rp_instance.c
88
- - ext/rubypython_bridge/rp_instance.h
89
- - ext/rubypython_bridge/rp_module.c
90
- - ext/rubypython_bridge/rp_module.h
91
- - ext/rubypython_bridge/rp_object.c
92
- - ext/rubypython_bridge/rp_object.h
93
- - ext/rubypython_bridge/rp_util.c
94
- - ext/rubypython_bridge/rp_util.h
95
- - ext/rubypython_bridge/rtop.c
96
- - ext/rubypython_bridge/rtop.h
97
- - ext/rubypython_bridge/rubypython_bridge.c
98
- - ext/rubypython_bridge/rubypython_bridge.h
99
94
  - lib/rubypython.rb
100
- - lib/rubypython/session.rb
95
+ - lib/rubypython/blankobject.rb
96
+ - lib/rubypython/core_ext/string.rb
97
+ - lib/rubypython/pythonerror.rb
98
+ - lib/rubypython/macros.rb
99
+ - lib/rubypython/conversion.rb
100
+ - lib/rubypython/operators.rb
101
+ - lib/rubypython/pyobject.rb
102
+ - lib/rubypython/pymainclass.rb
103
+ - lib/rubypython/python.rb
104
+ - lib/rubypython/rubypyproxy.rb
101
105
  - lib/rubypython/version.rb
102
- - lib/rubypython/wrapper_extensions.rb
103
- - setup.rb
104
- - tasks/environment.rake
105
- - tasks/extconf.rake
106
- - tasks/extconf/rubypython_bridge.rake
107
- - test/python_helpers/objects.py
108
- - test/test.wav
109
- - test/test_helper.rb
110
- - test/test_rubypython.rb
111
- - test/test_rubypython_bridge_extn.rb
112
- - test/test_session.rb
113
- has_rdoc: true
114
- homepage: http://rubypython.rubyforge.org
106
+ - lib/rubypython/legacy.rb
107
+ - spec/pymainclass_spec.rb
108
+ - spec/pyobject_spec.rb
109
+ - spec/python_helpers/objects.py
110
+ - spec/pythonerror_spec.rb
111
+ - spec/rubypyclass_spec.rb
112
+ - spec/rubypyproxy_spec.rb
113
+ - spec/rubypython_spec.rb
114
+ - spec/refcnt_spec.rb
115
+ - spec/conversion_spec.rb
116
+ - spec/legacy_spec.rb
117
+ - spec/spec.opts
118
+ - spec/spec_helper.rb
119
+ has_rdoc: yard
120
+ homepage: http://bitbucket.org/raineszm/rubypython/
115
121
  licenses: []
116
122
 
117
123
  post_install_message: |+
124
+ A number of things have changed with version 0.3.0. If you are upgrading from a previous version of RubyPython, you should check the docs for instructions on how to get your code working with the new version of RubyPython.
118
125
 
119
- For more information on RubyPython, see http://rubypython.rubyforge.org
126
+ For more information on RubyPython, see http://raineszm.bitbucket.org/rubypython/index.html
120
127
 
121
128
  If you find a bug, or have any suggestions, email me at: raineszm+rubypython@gmail.com
122
129
 
@@ -124,11 +131,13 @@ post_install_message: |+
124
131
 
125
132
 
126
133
  rdoc_options:
127
- - --main
128
- - README.txt
134
+ - --markup
135
+ - markdown
136
+ - --title
137
+ - RubyPython Documentation
138
+ - --quiet
129
139
  require_paths:
130
140
  - lib
131
- - ext/rubypython_bridge
132
141
  required_ruby_version: !ruby/object:Gem::Requirement
133
142
  none: false
134
143
  requirements:
@@ -154,8 +163,5 @@ rubygems_version: 1.3.7
154
163
  signing_key:
155
164
  specification_version: 3
156
165
  summary: A bridge between ruby and python
157
- test_files:
158
- - test/test_helper.rb
159
- - test/test_rubypython.rb
160
- - test/test_rubypython_bridge_extn.rb
161
- - test/test_session.rb
166
+ test_files: []
167
+
metadata.gz.sig ADDED
Binary file
data/README.txt DELETED
@@ -1,60 +0,0 @@
1
- = rubypython
2
-
3
- * htp://rubypython.rubyforge.org
4
-
5
- == DESCRIPTION:
6
-
7
- 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.
8
-
9
- == FEATURES/PROBLEMS:
10
-
11
- Features:
12
- * Can handle simple conversion of Python builtin types to ruby builtin types and vice versa
13
- * Can import python modules
14
- * Can execute arbitrary methods on imported modules and return the result
15
- * Python objects can be treated as Ruby objects!
16
- * Python's standard library available to you from within ruby.
17
-
18
- == SYNOPSIS:
19
- RubyPython.start
20
- cPickle=RubyPython.import("cPickle")
21
- p cPickle.dumps("RubyPython is awesome!")
22
- RubyPython.stop
23
-
24
- == REQUIREMENTS:
25
-
26
- * Python >=2.4, < 3.0
27
- * Ruby >=1.8.7
28
-
29
- Note: Rubypython has been test on Mac OS 10.5.x and 10.6.1 as well
30
- as Ubuntu Jaunty 9.04.
31
-
32
-
33
- == INSTALL:
34
-
35
- sudo gem install rubypython
36
-
37
- == LICENSE:
38
-
39
- (The MIT License)
40
-
41
- Copyright (c) 2008 Zach Raines
42
-
43
- Permission is hereby granted, free of charge, to any person obtaining
44
- a copy of this software and associated documentation files (the
45
- 'Software'), to deal in the Software without restriction, including
46
- without limitation the rights to use, copy, modify, merge, publish,
47
- distribute, sublicense, and/or sell copies of the Software, and to
48
- permit persons to whom the Software is furnished to do so, subject to
49
- the following conditions:
50
-
51
- The above copyright notice and this permission notice shall be
52
- included in all copies or substantial portions of the Software.
53
-
54
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
55
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
56
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
57
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
58
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
59
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
60
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,150 +0,0 @@
1
- #include "cbridge.h"
2
-
3
- #include "rtop.h"
4
- #include "ptor.h"
5
- #include "rp_error.h"
6
-
7
- /* Attempt to initialize the embedded python interpreter.
8
- Return 1 if we initialize it here and 0 if the interpreter is
9
- already running.
10
- */
11
- int rpSafeStart()
12
- {
13
- int here = 0;
14
-
15
- if(!Py_IsInitialized())
16
- {
17
- Py_Initialize();
18
- here = 1;
19
- }
20
-
21
- return here;
22
- }
23
-
24
- /* Attempt to stop the embedded python interpreter.*/
25
- void rpSafeStop(int here)
26
- {
27
-
28
- if(here && Py_IsInitialized())
29
- {
30
- Py_Finalize();
31
- }
32
- }
33
-
34
- VALUE rpCall(PyObject* pFunc, VALUE args)
35
- {
36
- VALUE rArgs, rReturn;
37
- PyObject *pReturn, *pArgs;
38
-
39
- /* Check to see if the passed argument is an array. If it is we
40
- * box it in another array so that the presentation of
41
- * arguments is the same i.e. each method is supllied with an
42
- * array of arguments.
43
- */
44
- if(!(TYPE(args) == T_ARRAY))
45
- {
46
-
47
- rArgs = rb_ary_new();
48
- rb_ary_push(rArgs, args);
49
- }
50
- else
51
- {
52
- rArgs = args;
53
- }
54
-
55
- // Convert the supplied arguments to python objects
56
- pArgs = rtopObject(rArgs, 1);
57
-
58
- // Execute the function and obtain a pointer to the return object
59
- pReturn = PyObject_CallObject(pFunc, pArgs);
60
-
61
- if(PyErr_Occurred())
62
- {
63
- Py_XDECREF(pArgs);
64
- Py_XDECREF(pReturn);
65
- rpPythonError();
66
- return Qnil;
67
- }
68
-
69
- rReturn = ptorObjectKeep(pReturn);
70
- Py_XDECREF(pArgs);
71
-
72
- return rReturn;
73
- }
74
-
75
- VALUE rpCallWithModule(VALUE module, VALUE name, VALUE args)
76
- {
77
-
78
- VALUE rReturn;
79
-
80
- PyObject *pModule, *pFunc;
81
-
82
-
83
- // Load the requested python module
84
- pModule = rpGetModule(module);
85
-
86
- // Get a pointer to the requested function
87
- pFunc = rpGetFunctionWithModule(pModule, name);
88
-
89
- Py_XDECREF(pModule);
90
-
91
- rReturn = rpCall(pFunc, args);
92
-
93
- // Check for an error and do any necessary cleanup before
94
- // propagating error
95
- if(PyErr_Occurred())
96
- {
97
- Py_XDECREF(pFunc);
98
- rpPythonError();
99
- return Qnil;
100
- }
101
-
102
- // Cleanup temporary objects
103
- Py_XDECREF(pFunc);
104
-
105
- return rReturn;
106
- }
107
-
108
- PyObject* rpGetModule(VALUE mname)
109
- {
110
- PyObject *pModule, *pModuleName;
111
-
112
- // A little syntatic sugar here. We will allow users access the
113
- // __builtins__ module under the name builtins
114
- // FIXME: replace this with a call to rb_get_module
115
- if(rb_eql(mname, rb_str_new2("builtins")))
116
- {
117
- mname = rb_str_new2("__builtins__");
118
- }
119
-
120
- pModuleName = rtopString(mname);
121
- pModule = PyImport_Import(pModuleName);
122
- Py_XDECREF(pModuleName);
123
-
124
- if(PyErr_Occurred())
125
- {
126
- Py_XDECREF(pModule);
127
- rpPythonError();
128
- return Py_None;
129
- }
130
-
131
- return pModule;
132
- }
133
-
134
- PyObject* rpGetFunctionWithModule(PyObject* pModule, VALUE name)
135
- {
136
- PyObject *pFunc;
137
-
138
- pFunc = PyObject_GetAttrString(pModule, STR2CSTR(name));
139
-
140
- if(PyErr_Occurred())
141
- {
142
- Py_XDECREF(pFunc);
143
- rpPythonError();
144
- return Py_None;
145
- }
146
-
147
- return pFunc;
148
- }
149
-
150
-
@@ -1,15 +0,0 @@
1
- #include "config.h"
2
-
3
- #ifndef _BRIDGE_H_
4
- #define _BRIDGE_H_
5
- int rpSafeStart();
6
- void rpSafeStop(int);
7
-
8
- VALUE rpCallWithModule(VALUE, VALUE, VALUE);
9
- VALUE rpCall(PyObject*, VALUE);
10
-
11
- PyObject* rpGetModule(VALUE);
12
- PyObject* rpGetFunctionWithModule(PyObject*, VALUE);
13
- #endif /* _BRIDGE_H_ */
14
-
15
-