diff options
author | David RodrÃguez <[email protected]> | 2024-10-14 19:55:38 +0200 |
---|---|---|
committer | git <[email protected]> | 2024-10-14 19:43:39 +0000 |
commit | 8240fe88f32ff4fec54cb6c425782597efa4d397 (patch) | |
tree | e540ab34c3befbf85dbb3cf9e120ff92935016be | |
parent | 48fdb9faa0a408c0855e84cfd6451393c8b67180 (diff) |
[rubygems/rubygems] Prevent some test suite warnings about missing extensions
We fixed some issues recently where Bundler would try to activate a
pysch spec with missing extensions and crash. However, as a side effect,
we started printing warnings about missing extensions in situations
where we did not warn before.
It may be interesting to warn on these new situations too, but in order
to minimize changes for now, I'm reverting to printing warnings in the
same situations as before.
https://github.com/rubygems/rubygems/commit/51ebff6982
-rw-r--r-- | lib/bundler/rubygems_ext.rb | 12 | ||||
-rw-r--r-- | lib/rubygems/basic_specification.rb | 17 |
2 files changed, 14 insertions, 15 deletions
diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb index 547102be41..296bcfff38 100644 --- a/lib/bundler/rubygems_ext.rb +++ b/lib/bundler/rubygems_ext.rb @@ -384,13 +384,13 @@ module Gem end end - remove_method :ignored? if new.respond_to?(:ignored?) + # Can be removed once RubyGems 3.5.22 support is dropped + unless new.respond_to?(:ignored?) + def ignored? + return @ignored unless @ignored.nil? - # Same as RubyGems, but without warnings, because Bundler prints its own warnings - def ignored? - return @ignored unless @ignored.nil? - - @ignored = missing_extensions? + @ignored = missing_extensions? + end end end diff --git a/lib/rubygems/basic_specification.rb b/lib/rubygems/basic_specification.rb index 8c75fd41d4..a09e8ed0e1 100644 --- a/lib/rubygems/basic_specification.rb +++ b/lib/rubygems/basic_specification.rb @@ -71,7 +71,14 @@ class Gem::BasicSpecification # Return true if this spec can require +file+. def contains_requirable_file?(file) - return false if ignored? + if ignored? + if platform == Gem::Platform::RUBY || Gem::Platform.local === platform + warn "Ignoring #{full_name} because its extensions are not built. " \ + "Try: gem pristine #{name} --version #{version}" + end + + return false + end is_soext = file.end_with?(".so", ".o") @@ -89,14 +96,6 @@ class Gem::BasicSpecification return @ignored unless @ignored.nil? @ignored = missing_extensions? - return false unless @ignored - - if platform == Gem::Platform::RUBY || Gem::Platform.local === platform - warn "Ignoring #{full_name} because its extensions are not built. " \ - "Try: gem pristine #{name} --version #{version}" - end - - true end def default_gem? |