numo-linalg 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8315eaaebc86b1e549f1dd1132ba0e25e895c10f6a68b7b461c734bb3fd7612e
4
- data.tar.gz: ead727d78cff037a15476917751d0373e08abe1cce5cb14931ea8a82628ab8a1
3
+ metadata.gz: a3c8bcc6ac3a9e0e97953992655b299b74a737aa5e2e208fae45144cfdaa09d8
4
+ data.tar.gz: 0460e3eb44c6f67e22d1171e9929ebf949c69ddb6f9a9355894944006ffd7366
5
5
  SHA512:
6
- metadata.gz: a228a21cc9e6cc3b44f7c11b66b1dcea76dbdc22e51b09e35ca62118a721dea4d4a6dcc729a0603f0aec64411d2c9c72d63ff922a2bb57ea0d93b5363bdab50b
7
- data.tar.gz: d9651310d52d9f1c1e41caad01bb8f706fe1a631557eaed076cd355702a1ef1ea55e88fe9b2e29ba95476f55569410c5cc737230b67e0843b623844e61f3ece8
6
+ metadata.gz: 918dc720d8d187174bf1bc04b88567b2cc6268c961b53187060ce25ff20e1b38050a58e3ed29d0993a1c4a1637193e0891272ee8628a19b7883b7136905b581c
7
+ data.tar.gz: a2eeefea7aca430c1ba6dc4d777fc87a5c12e22cd27ad5d9a53de0ce7a19b4e2e4f67add3cc1d45cb8989ea2073fb87cc85c6cfeb5c4df1a346de258a47f947c
@@ -64,9 +64,14 @@ module Numo
64
64
  end
65
65
 
66
66
  def detect_library_extension
67
- case RbConfig::CONFIG['host_os']
68
- when /mswin|msys|mingw|cygwin/
69
- 'dll'
67
+ # Ruby >= 2.5 provides SOEXT in rbconfig
68
+ so_ext = RbConfig::CONFIG["SOEXT"]
69
+ return so_ext if so_ext
70
+
71
+ return 'dll' if windows?
72
+
73
+ # For Ruby < 2.5, we use RUBY_PLATFORM
74
+ case RUBY_PLATFORM
70
75
  when /darwin|mac os/
71
76
  'dylib'
72
77
  else
@@ -74,6 +79,15 @@ module Numo
74
79
  end
75
80
  end
76
81
 
82
+ def windows?
83
+ case RUBY_PLATFORM
84
+ when /mswin|msys|mingw|cygwin/
85
+ true
86
+ else
87
+ false
88
+ end
89
+ end
90
+
77
91
  def select_dirs(dirs)
78
92
  dirs.select!{|d| Dir.exist?(d)}
79
93
  end
@@ -82,8 +96,36 @@ module Numo
82
96
  lib_ext = detect_library_extension
83
97
  lib_arr = lib_names.map do |l|
84
98
  x = nil
85
- lib_dirs.each do |d|
86
- break if x = Dir.glob("#{d}/lib#{l}{,64}.#{lib_ext}{,.*}").last
99
+ if windows?
100
+ # On Windows, try to search the default DLL search path at first
101
+ [
102
+ "lib#{l}.#{lib_ext}",
103
+ "lib#{l}64.#{lib_ext}"
104
+ ].each do |filename|
105
+ begin
106
+ Fiddle.dlopen(filename).close
107
+ rescue Fiddle::DLError
108
+ x = nil
109
+ else
110
+ x = filename
111
+ break
112
+ end
113
+ end
114
+ end
115
+ if x.nil?
116
+ # Search in the candidate directories
117
+ lib_dirs.find do |d|
118
+ x = Dir.glob("#{d}/lib#{l}{,64}.#{lib_ext}{,.*}").find do |lib|
119
+ begin
120
+ Fiddle.dlopen(lib).close
121
+ rescue Fiddle::DLError
122
+ false
123
+ else
124
+ true
125
+ end
126
+ end
127
+ break if x
128
+ end
87
129
  end
88
130
  [l.to_sym, x]
89
131
  end
@@ -1,5 +1,5 @@
1
1
  module Numo
2
2
  module Linalg
3
- VERSION = "0.1.6"
3
+ VERSION = "0.1.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: numo-linalg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro TANAKA
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-06-27 00:00:00.000000000 Z
12
+ date: 2021-07-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -228,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
228
228
  - !ruby/object:Gem::Version
229
229
  version: '0'
230
230
  requirements: []
231
- rubygems_version: 3.2.3
231
+ rubygems_version: 3.1.2
232
232
  signing_key:
233
233
  specification_version: 4
234
234
  summary: Ruby/Numo Linear Algebra library with BLAS/LAPACK