[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
This commit is contained in:
David Rodríguez 2024-10-14 19:55:38 +02:00 committed by git
parent 48fdb9faa0
commit 8240fe88f3
2 changed files with 14 additions and 15 deletions

View File

@ -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

View File

@ -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?