rdkit_chem 2025.09.3.13 → 2025.09.3.14

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
  SHA256:
3
- metadata.gz: 4ead3b69c8da6f0fddb3a5fe01f5a8d6b50045831e09b041f3a41c77bd06c592
4
- data.tar.gz: 6198fa63ccdece161d05392f179a1c25241707680e79ec16e98de72367bc449c
3
+ metadata.gz: 5fde0a4b5dbefb09dade31e754b66bea9dbbe816cdf0a5e21bc3ab397cfb1d14
4
+ data.tar.gz: 91ada719794c6beb08034004dc4e85121c47618a4745a43dac28ba0eb0575db3
5
5
  SHA512:
6
- metadata.gz: 5d552f59f51878f3e521d80ce47c82fd8bcb387cf0fff12f5fe07edb5efe55761a9167cbbaf8189de04fc3ecfcb87d389f68ab6f118b2bef675367bdc135ec72
7
- data.tar.gz: 78ae51ccc565f8d70738184b8138efb80f43f50a4a092ab830232c085c9ec06e524b81de3acf285916e5237ceba6063a2a6c24dcb3f606435df9f84b93ed5bd5
6
+ metadata.gz: 5f156318e8e0657fb96ef9b12ce8f24e0303e5dc9a87e914d11b2d68735fb430c593cb4b594ed94c7dd384ca3a8c4e8090d96975bae7ab6d2c21b4e0aef44016
7
+ data.tar.gz: b257e8c96af48d2545a82f9516938dd65ce74ac0334efba87fa2237efdac4c484031791d7ead4c96d4e4e091b1d217c1489436a9eb0a17dff529881fd83af0cf
data/Rakefile CHANGED
@@ -30,8 +30,8 @@ task :build do
30
30
  sh 'gem build rdkit_chem.gemspec'
31
31
  end
32
32
 
33
- desc 'Build pre-compiled gem for current platform'
34
- task :build_native do
33
+ desc 'Stage native libraries for current Ruby version (used by CI)'
34
+ task :stage_native do
35
35
  ext_so = File.join(NATIVE_DIR, 'RDKitChem.so')
36
36
  ext_bundle = File.join(NATIVE_DIR, 'RDKitChem.bundle')
37
37
 
@@ -44,7 +44,7 @@ task :build_native do
44
44
  ruby_version = "#{RUBY_VERSION.split('.')[0..1].join('.')}.0"
45
45
  target_dir = "lib/rdkit_chem/#{ruby_version}"
46
46
 
47
- puts "Packaging pre-compiled gem for Ruby #{ruby_version}..."
47
+ puts "Staging native libraries for Ruby #{ruby_version} to #{target_dir}..."
48
48
 
49
49
  # Create target directory
50
50
  FileUtils.mkdir_p(target_dir)
@@ -52,7 +52,7 @@ task :build_native do
52
52
  # Copy native extension and all shared libraries
53
53
  # Linux: *.so*, macOS: *.bundle and *.dylib
54
54
  lib_patterns = ["#{NATIVE_DIR}/*.so*", "#{NATIVE_DIR}/*.bundle", "#{NATIVE_DIR}/*.dylib"]
55
-
55
+
56
56
  lib_patterns.each do |pattern|
57
57
  Dir.glob(pattern).each do |lib|
58
58
  # Skip symlinks first pass, copy only real files
@@ -63,7 +63,6 @@ task :build_native do
63
63
  end
64
64
 
65
65
  # Also copy symlinks (they're needed for library resolution)
66
- # This includes both .so -> .so.1 and .so.1 -> .so.1.version symlinks
67
66
  lib_patterns.each do |pattern|
68
67
  Dir.glob(pattern).each do |lib|
69
68
  next unless File.symlink?(lib)
@@ -74,17 +73,59 @@ task :build_native do
74
73
  end
75
74
  end
76
75
 
76
+ puts "Staged #{Dir.glob("#{target_dir}/*").count} files for Ruby #{ruby_version}"
77
+ end
78
+
79
+ desc 'Build pre-compiled gem for current platform (single Ruby version)'
80
+ task :build_native do
81
+ Rake::Task['stage_native'].invoke
82
+
77
83
  # Build the platform-specific gem
78
84
  ENV['RDKIT_PRECOMPILED'] = '1'
79
85
  sh 'gem build rdkit_chem.gemspec'
80
86
  ENV.delete('RDKIT_PRECOMPILED')
81
87
 
82
- # Clean up
83
- FileUtils.rm_rf(target_dir)
88
+ # Clean up staged files
89
+ ruby_version = "#{RUBY_VERSION.split('.')[0..1].join('.')}.0"
90
+ FileUtils.rm_rf("lib/rdkit_chem/#{ruby_version}")
84
91
 
85
92
  puts "\nBuilt: rdkit_chem-#{VERSION}-#{Gem::Platform.local}.gem"
86
93
  end
87
94
 
95
+ desc 'Build fat gem containing all staged Ruby versions'
96
+ task :build_fat_gem do
97
+ staged_dirs = Dir.glob('lib/rdkit_chem/*.0').select { |d| File.directory?(d) }
98
+
99
+ if staged_dirs.empty?
100
+ abort "ERROR: No staged Ruby versions found in lib/rdkit_chem/\n" \
101
+ "Run 'rake stage_native' for each Ruby version first."
102
+ end
103
+
104
+ puts "Building fat gem with Ruby versions: #{staged_dirs.map { |d| File.basename(d) }.join(', ')}"
105
+
106
+ # Verify each staged directory has the extension
107
+ staged_dirs.each do |dir|
108
+ unless File.exist?(File.join(dir, 'RDKitChem.so')) || File.exist?(File.join(dir, 'RDKitChem.bundle'))
109
+ abort "ERROR: #{dir} missing RDKitChem.{so,bundle}"
110
+ end
111
+ end
112
+
113
+ # Build the platform-specific gem
114
+ ENV['RDKIT_PRECOMPILED'] = '1'
115
+ sh 'gem build rdkit_chem.gemspec'
116
+ ENV.delete('RDKIT_PRECOMPILED')
117
+
118
+ puts "\nBuilt fat gem: rdkit_chem-#{VERSION}-#{Gem::Platform.local}.gem"
119
+ puts "Contains Ruby versions: #{staged_dirs.map { |d| File.basename(d) }.join(', ')}"
120
+ end
121
+
122
+ desc 'Clean staged native libraries'
123
+ task :clean_staged do
124
+ Dir.glob('lib/rdkit_chem/*.0').each do |dir|
125
+ FileUtils.rm_rf(dir, verbose: true)
126
+ end
127
+ end
128
+
88
129
  desc 'Bundle system libraries (Boost) into native directory'
89
130
  task :bundle_system_libs do
90
131
  so_file = File.join(NATIVE_DIR, 'RDKitChem.so')
@@ -247,10 +288,7 @@ end
247
288
  desc 'Clean build artifacts'
248
289
  task :clean do
249
290
  FileUtils.rm_f(Dir.glob('*.gem'))
250
- FileUtils.rm_rf('lib/rdkit_chem/3.0')
251
- FileUtils.rm_rf('lib/rdkit_chem/3.1')
252
- FileUtils.rm_rf('lib/rdkit_chem/3.2')
253
- FileUtils.rm_rf('lib/rdkit_chem/3.3')
291
+ Rake::Task['clean_staged'].invoke
254
292
  end
255
293
 
256
294
  task default: :test
@@ -2,5 +2,5 @@
2
2
 
3
3
  module RDKitChem
4
4
  VERSION = '2025.09.3'
5
- GEMVERSION = "#{VERSION}.13"
5
+ GEMVERSION = "#{VERSION}.14"
6
6
  end
data/lib/rdkit_chem.rb CHANGED
@@ -3,31 +3,34 @@
3
3
  require 'rdkit_chem/version'
4
4
 
5
5
  # Try to load the native extension from multiple possible locations:
6
- # 1. Pre-compiled gem: lib/rdkit_chem/<ruby_version>/RDKitChem.so
7
- # 2. Source-compiled gem: rdkit_chem/lib/RDKitChem.so (legacy location)
6
+ # 1. Pre-compiled gem: lib/rdkit_chem/<ruby_version>/RDKitChem.so (fat gem with all Ruby versions)
7
+ # 2. Source-compiled gem: rdkit_chem/lib/RDKitChem.so (development/legacy location)
8
8
 
9
9
  def find_rdkit_native_extension
10
10
  ruby_version = "#{RUBY_VERSION.split('.')[0..1].join('.')}.0"
11
11
  base_dir = File.expand_path('rdkit_chem', __dir__)
12
12
 
13
- # Location 1: Pre-compiled gem - exact Ruby version match
13
+ # Location 1: Pre-compiled gem - exact Ruby version match (fat gem)
14
14
  precompiled_path = File.join(base_dir, ruby_version)
15
15
  return precompiled_path if File.directory?(precompiled_path) && has_native_extension?(precompiled_path)
16
16
 
17
- # Location 2: Pre-compiled gem - any available Ruby version (fallback)
18
- # This handles cases where gem was built with different Ruby minor version
19
- if File.directory?(base_dir)
20
- Dir.glob(File.join(base_dir, '*.0')).sort.reverse.each do |version_dir|
21
- return version_dir if has_native_extension?(version_dir)
22
- end
23
- end
24
-
25
- # Location 3: Source-compiled gem (legacy rdkit_chem/lib/)
17
+ # Location 2: Source-compiled gem (development build at rdkit_chem/lib/)
26
18
  source_compiled_path = File.expand_path('../rdkit_chem/lib', __dir__)
27
19
  return source_compiled_path if has_native_extension?(source_compiled_path)
28
20
 
29
- raise LoadError, 'Cannot find RDKitChem native extension. ' \
30
- "Searched in:\n - #{precompiled_path}\n - #{base_dir}/*.0\n - #{source_compiled_path}"
21
+ # List available Ruby versions for better error message
22
+ available_versions = Dir.glob(File.join(base_dir, '*.0'))
23
+ .select { |d| has_native_extension?(d) }
24
+ .map { |d| File.basename(d) }
25
+
26
+ error_msg = "Cannot find RDKitChem native extension for Ruby #{ruby_version}.\n"
27
+ error_msg += "Searched in:\n - #{precompiled_path}\n - #{source_compiled_path}\n"
28
+ if available_versions.any?
29
+ error_msg += "Available versions in gem: #{available_versions.join(', ')}\n"
30
+ error_msg += 'You may need to install a newer version of rdkit_chem gem.'
31
+ end
32
+
33
+ raise LoadError, error_msg
31
34
  end
32
35
 
33
36
  def has_native_extension?(dir)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdkit_chem
3
3
  version: !ruby/object:Gem::Version
4
- version: 2025.09.3.13
4
+ version: 2025.09.3.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - An Nguyen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-01-22 00:00:00.000000000 Z
11
+ date: 2026-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake