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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 82eaa5c280e2f8206627b19e57cc630938807c4d
4
- data.tar.gz: 7d78f624374cf5ef65d7a292f96de5ba3fc218f0
3
+ metadata.gz: cc7a3092f003ffea81240b8689ec4610e11658e4
4
+ data.tar.gz: 980774dcb4e1193dd571bcb0b0ab89fc00d3c135
5
5
  SHA512:
6
- metadata.gz: c4b46544cebf53e321c1436d20fd523d3c58a7f1d54fa64dcc92b9eb76657bd808ac1aece7be3be8bfbaa8a418b4d4686b761eb93cfacc499b9960ff97a00ab1
7
- data.tar.gz: 8667a9bd1f58598db6de020c4739f14619ce4fa694d71ef50435ccaedc725536c2013b8682c205ff4fe316d51a4027d5b0487c57575457310e30db09aac32733
6
+ metadata.gz: 0af75af746d1d74be468f267af346267538f399f4f1a625db67542c8331c59218f058f99e3d30e29d121b291c0b49f992a6f299b9df3b2a5d63a4d752bad5e6d
7
+ data.tar.gz: b0c75fddc87eff596555d2625fa6b299b296e653e11834ccb0788fe3cf306278a418a44fb9748708b7e7a806c803a6dfce097a2c890d8e52c64e2998e4841f31
data/.travis.yml CHANGED
@@ -10,7 +10,8 @@ rvm:
10
10
 
11
11
  env:
12
12
  - PYTHON=python
13
- - PYTHON=python3
13
+ - PYTHON=python3 LIBPYTHON=wrong_value
14
+ - LIBPYTHON=/usr/lib/libpython3.2mu.so.1
14
15
 
15
16
  addons:
16
17
  apt:
@@ -31,11 +31,15 @@ module PyCall
31
31
 
32
32
  v = python_config[:VERSION]
33
33
  libprefix = FFI::Platform::LIBPREFIX
34
- libs = [ "#{libprefix}python#{v}", "#{libprefix}python" ]
35
- lib = python_config[:LIBRARY]
36
- libs.unshift(File.basename(lib, File.extname(lib))) if lib
37
- lib = python_config[:LDLIBRARY]
38
- libs.unshift(lib, File.basename(lib)) if lib
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
- libpath_lib = [libpath, lib].join(File::ALT_SEPARATOR || File::SEPARATOR)
79
- if File.file?("#{libpath_lib}.#{libsuffix}")
80
- begin
81
- libs = ffi_lib("#{libpath_lib}.#{libsuffix}")
82
- return libs.first
83
- rescue LoadError
84
- # skip load error
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
- for var in ('VERSION', 'LIBRARY', 'LDLIBRARY', 'LIBDIR', 'PYTHONFRAMEWORKPREFIX'):
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)))
@@ -1,3 +1,3 @@
1
1
  module PyCall
2
- VERSION = "0.1.0.alpha.20170317"
2
+ VERSION = "0.1.0.alpha.20170329"
3
3
  end
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.20170317
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-17 00:00:00.000000000 Z
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.8
133
+ rubygems_version: 2.6.11
134
134
  signing_key:
135
135
  specification_version: 4
136
136
  summary: pycall