rubypython 0.3.0 → 0.3.1
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 +0 -0
- data/History.markdown +9 -1
- data/lib/rubypython/python.rb +56 -5
- data/lib/rubypython/version.rb +1 -2
- metadata +6 -6
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.markdown
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
-
## 0.3.
|
1
|
+
## 0.3.1 2011-01-19
|
2
|
+
* Compatability Updates
|
3
|
+
* Cleanup of code which finds Python library thanks to Austin Ziegler.
|
4
|
+
|
5
|
+
## 0.3.0 2010-09-06
|
2
6
|
* Major Enhancements
|
3
7
|
* Version 0.3.0 represents an almost complete rewrite of the RubyPython codebase.
|
4
8
|
* A native C extension is no longer required. RubyPython uses the 'ffi' gem.
|
@@ -7,6 +11,10 @@
|
|
7
11
|
* Version 0.3.0 was created with the goal of being compatible with as many Ruby versions as possible. It should at the very least run on MRI 1.8.6 - 1.9.1.
|
8
12
|
* A legacy mode option has been added to provide partial compatibility with version 0.2.x.
|
9
13
|
|
14
|
+
## 0.2.11 2010-07-12
|
15
|
+
* Bug Fixes
|
16
|
+
* Fixed some issues with building the extension under ruby 1.9. Sould now be truly 1.9 compatible.
|
17
|
+
|
10
18
|
## 0.2.10 2010-07-08
|
11
19
|
* Bug Fixes
|
12
20
|
* Made some changes to how the native extension is configured and build.
|
data/lib/rubypython/python.rb
CHANGED
@@ -6,13 +6,64 @@ module RubyPython
|
|
6
6
|
#gem. Documentation for these functions may be found [here](http://docs.python.org/c-api/). Likewise the FFI gem documentation may be found [here](http://rdoc.info/projects/ffi/ffi).
|
7
7
|
module Python
|
8
8
|
extend FFI::Library
|
9
|
-
|
9
|
+
|
10
|
+
# This much we can assume works without anything special at all.
|
11
|
+
PYTHON_VERSION = Open3.popen3("python --version") { |i,o,e| e.read }.chomp.split[1].to_f
|
10
12
|
PYTHON_NAME = "python#{PYTHON_VERSION}"
|
11
|
-
LIB_NAME = "
|
13
|
+
LIB_NAME = "#{FFI::Platform::LIBPREFIX}#{PYTHON_NAME}"
|
12
14
|
LIB_EXT = FFI::Platform::LIBSUFFIX
|
13
|
-
|
14
|
-
|
15
|
-
|
15
|
+
PYTHON_SYS_PREFIX = %x{#{PYTHON_NAME} -c "import sys; print(sys.prefix)"}.chomp
|
16
|
+
|
17
|
+
# Here's where we run into problems, as not everything works quite the
|
18
|
+
# way we expect it to.
|
19
|
+
#
|
20
|
+
# The default libname will be something like libpython2.6.so (or .dylib)
|
21
|
+
# or maybe even python2.6.dll on Windows.
|
22
|
+
libname = "#{LIB_NAME}.#{LIB_EXT}"
|
23
|
+
|
24
|
+
# We may need to look in multiple locations for Python, so let's build
|
25
|
+
# this as an array.
|
26
|
+
locations = [ File.join(PYTHON_SYS_PREFIX, "lib", libname) ]
|
27
|
+
|
28
|
+
if FFI::Platform.mac?
|
29
|
+
# On the Mac, let's add a special case that has even a different
|
30
|
+
# libname. This may not be fully useful on future versions of OS X,
|
31
|
+
# but it should work on 10.5 and 10.6. Even if it doesn't, the next
|
32
|
+
# step will (/usr/lib/libpython<version>.dylib is a symlink to the
|
33
|
+
# correct location).
|
34
|
+
locations << File.join(PYTHON_SYS_PREFIX, "Python")
|
35
|
+
# Let's also look in the location that was originally set in this
|
36
|
+
# library:
|
37
|
+
File.join(PYTHON_SYS_PREFIX, "lib", "#{PYTHON_NAME}", "config",
|
38
|
+
libname)
|
39
|
+
end
|
40
|
+
|
41
|
+
if FFI::Platform.unix?
|
42
|
+
# On Unixes, let's look in alternative places, too. Just in case.
|
43
|
+
locations << File.join("/opt/local/lib", libname)
|
44
|
+
locations << File.join("/opt/lib", libname)
|
45
|
+
locations << File.join("/usr/local/lib", libname)
|
46
|
+
locations << File.join("/usr/lib", libname)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Get rid of redundant locations.
|
50
|
+
locations.uniq!
|
51
|
+
|
52
|
+
dyld_flags = FFI::DynamicLibrary::RTLD_LAZY | FFI::DynamicLibrary::RTLD_GLOBAL
|
53
|
+
exceptions = []
|
54
|
+
|
55
|
+
locations.each do |location|
|
56
|
+
begin
|
57
|
+
@ffi_libs = [ FFI::DynamicLibrary.open(location, dyld_flags) ]
|
58
|
+
LIB = location
|
59
|
+
break
|
60
|
+
rescue LoadError => ex
|
61
|
+
@ffi_libs = nil
|
62
|
+
exceptions << ex
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
raise exceptions.first if @ffi_libs.nil?
|
16
67
|
|
17
68
|
#The class is a little bit of a hack to extract the address of global
|
18
69
|
#structs. If someone knows a better way please let me know.
|
data/lib/rubypython/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubypython
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 17
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 1
|
10
|
+
version: 0.3.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Zach Raines
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
cguJMiQCSOlUPZxCWWMkjfZbXvtS5VdzJevSqQ==
|
37
37
|
-----END CERTIFICATE-----
|
38
38
|
|
39
|
-
date:
|
39
|
+
date: 2011-01-19 00:00:00 -05:00
|
40
40
|
default_executable:
|
41
41
|
dependencies:
|
42
42
|
- !ruby/object:Gem::Dependency
|
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
159
|
requirements:
|
160
160
|
- Python, ~>2.4
|
161
161
|
rubyforge_project: rubypython
|
162
|
-
rubygems_version: 1.
|
162
|
+
rubygems_version: 1.4.2
|
163
163
|
signing_key:
|
164
164
|
specification_version: 3
|
165
165
|
summary: A bridge between ruby and python
|
metadata.gz.sig
CHANGED
Binary file
|