mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/psych] Improve libyaml source downloading error messages
People trying to build CRuby by following the instructions in its [README] have been running into [errors] due to missing `libyaml` on their system. Let's try to present a better error message when it happens. [README]:fb5aa31e2d (how-to-compile-and-install)
[errors]: https://github.com/ruby/psych/issues/55220a633028e
This commit is contained in:
parent
a19b2d59fc
commit
18044f4fbb
1 changed files with 10 additions and 4 deletions
|
@ -19,10 +19,16 @@ if yaml_source == true
|
|||
# search the latest libyaml source under $srcdir
|
||||
yaml_source = Dir.glob("#{$srcdir}/yaml{,-*}/").max_by {|n| File.basename(n).scan(/\d+/).map(&:to_i)}
|
||||
unless yaml_source
|
||||
require_relative '../../tool/extlibs.rb'
|
||||
extlibs = ExtLibs.new(cache_dir: File.expand_path("../../tmp/download_cache", $srcdir))
|
||||
unless extlibs.process_under($srcdir)
|
||||
raise "failed to download libyaml source"
|
||||
download_failure = "failed to download libyaml source"
|
||||
begin
|
||||
require_relative '../../tool/extlibs.rb'
|
||||
extlibs = ExtLibs.new(cache_dir: File.expand_path("../../tmp/download_cache", $srcdir))
|
||||
unless extlibs.process_under($srcdir)
|
||||
raise download_failure
|
||||
end
|
||||
rescue
|
||||
# Implicitly captures Exception#cause. Newer rubies show it in the backtrace.
|
||||
raise download_failure
|
||||
end
|
||||
yaml_source, = Dir.glob("#{$srcdir}/yaml-*/")
|
||||
raise "libyaml not found" unless yaml_source
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue