pycall 0.1.0.alpha.20170317 → 0.1.0.alpha.20170329
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.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/lib/pycall/libpython.rb +38 -14
- data/lib/pycall/python/investigator.py +2 -1
- data/lib/pycall/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc7a3092f003ffea81240b8689ec4610e11658e4
|
4
|
+
data.tar.gz: 980774dcb4e1193dd571bcb0b0ab89fc00d3c135
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0af75af746d1d74be468f267af346267538f399f4f1a625db67542c8331c59218f058f99e3d30e29d121b291c0b49f992a6f299b9df3b2a5d63a4d752bad5e6d
|
7
|
+
data.tar.gz: b0c75fddc87eff596555d2625fa6b299b296e653e11834ccb0788fe3cf306278a418a44fb9748708b7e7a806c803a6dfce097a2c890d8e52c64e2998e4841f31
|
data/.travis.yml
CHANGED
data/lib/pycall/libpython.rb
CHANGED
@@ -31,11 +31,15 @@ module PyCall
|
|
31
31
|
|
32
32
|
v = python_config[:VERSION]
|
33
33
|
libprefix = FFI::Platform::LIBPREFIX
|
34
|
-
libs = [
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
34
|
+
libs = []
|
35
|
+
%i(INSTSONAME LDLIBRARY).each do |key|
|
36
|
+
lib = python_config[key]
|
37
|
+
libs << lib << File.basename(lib) if lib
|
38
|
+
end
|
39
|
+
if (lib = python_config[:LIBRARY])
|
40
|
+
libs << File.basename(lib, File.extname(lib))
|
41
|
+
end
|
42
|
+
libs << "#{libprefix}python#{v}" << "#{libprefix}python"
|
39
43
|
libs.uniq!
|
40
44
|
|
41
45
|
executable = python_config[:executable]
|
@@ -46,9 +50,9 @@ module PyCall
|
|
46
50
|
libpaths << File.expand_path('../../lib', executable)
|
47
51
|
end
|
48
52
|
libpaths << python_config[:PYTHONFRAMEWORKPREFIX] if FFI::Platform.mac?
|
49
|
-
|
50
53
|
exec_prefix = python_config[:exec_prefix]
|
51
54
|
libpaths << exec_prefix << File.join(exec_prefix, 'lib')
|
55
|
+
libpaths.compact!
|
52
56
|
|
53
57
|
unless ENV['PYTHONHOME']
|
54
58
|
# PYTHONHOME tells python where to look for both pure python and binary modules.
|
@@ -69,19 +73,39 @@ module PyCall
|
|
69
73
|
end
|
70
74
|
end
|
71
75
|
|
76
|
+
# Try LIBPYTHON environment variable first.
|
77
|
+
if ENV['LIBPYTHON']
|
78
|
+
if File.file?(ENV['LIBPYTHON'])
|
79
|
+
begin
|
80
|
+
libs = ffi_lib(ENV['LIBPYTHON'])
|
81
|
+
return libs.first
|
82
|
+
rescue LoadError
|
83
|
+
end
|
84
|
+
end
|
85
|
+
$stderr.puts '[WARN] Ignore the wrong libpython location specified in LIBPYTHON environment variable.'
|
86
|
+
end
|
87
|
+
|
72
88
|
# Find libpython (we hope):
|
73
89
|
libsuffix = FFI::Platform::LIBSUFFIX
|
90
|
+
multiarch = python_config[:MULTIARCH] || python_config[:multiarch]
|
91
|
+
dir_sep = File::ALT_SEPARATOR || File::SEPARATOR
|
74
92
|
libs.each do |lib|
|
75
93
|
libpaths.each do |libpath|
|
76
|
-
next unless libpath
|
77
94
|
# NOTE: File.join doesn't use File::ALT_SEPARATOR
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
95
|
+
libpath_libs = [ [libpath, lib].join(dir_sep) ]
|
96
|
+
libpath_libs << [libpath, multiarch, lib].join(dir_sep) if multiarch
|
97
|
+
libpath_libs.each do |libpath_lib|
|
98
|
+
[
|
99
|
+
libpath_lib,
|
100
|
+
"#{libpath_lib}.#{libsuffix}"
|
101
|
+
].each do |fullname|
|
102
|
+
next unless File.file?(fullname)
|
103
|
+
begin
|
104
|
+
libs = ffi_lib(fullname)
|
105
|
+
return libs.first
|
106
|
+
rescue LoadError
|
107
|
+
# skip load error
|
108
|
+
end
|
85
109
|
end
|
86
110
|
end
|
87
111
|
end
|
@@ -2,5 +2,6 @@ from distutils.sysconfig import get_config_var
|
|
2
2
|
import sys
|
3
3
|
for var in ('executable', 'exec_prefix', 'prefix'):
|
4
4
|
print(var + ': ' + str(getattr(sys, var)))
|
5
|
-
|
5
|
+
print('multiarch: ' + str(getattr(getattr(sys, 'implementation', sys), '_multiarch', None)))
|
6
|
+
for var in ('VERSION', 'INSTSONAME', 'LIBRARY', 'LDLIBRARY', 'LIBDIR', 'PYTHONFRAMEWORKPREFIX', 'MULTIARCH'):
|
6
7
|
print(var + ': ' + str(get_config_var(var)))
|
data/lib/pycall/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pycall
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.alpha.
|
4
|
+
version: 0.1.0.alpha.20170329
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenta Murata
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
130
|
version: 1.3.1
|
131
131
|
requirements: []
|
132
132
|
rubyforge_project:
|
133
|
-
rubygems_version: 2.6.
|
133
|
+
rubygems_version: 2.6.11
|
134
134
|
signing_key:
|
135
135
|
specification_version: 4
|
136
136
|
summary: pycall
|