Remove readline and zlib hacks
This commit is contained in:
parent
a2a24b3a0d
commit
a52143c63c
@ -1,4 +1,5 @@
|
|||||||
require "mutex_m"
|
require "mutex_m"
|
||||||
|
require "debrew/irb"
|
||||||
|
|
||||||
module Debrew
|
module Debrew
|
||||||
extend Mutex_m
|
extend Mutex_m
|
||||||
@ -120,9 +121,6 @@ module Debrew
|
|||||||
menu.choice(:ignore) { return :ignore } if Ignorable === e
|
menu.choice(:ignore) { return :ignore } if Ignorable === e
|
||||||
menu.choice(:backtrace) { puts e.backtrace }
|
menu.choice(:backtrace) { puts e.backtrace }
|
||||||
|
|
||||||
unless ENV["HOMEBREW_NO_READLINE"]
|
|
||||||
require "debrew/irb"
|
|
||||||
|
|
||||||
menu.choice(:irb) do
|
menu.choice(:irb) do
|
||||||
puts "When you exit this IRB session, execution will continue."
|
puts "When you exit this IRB session, execution will continue."
|
||||||
set_trace_func proc { |event, _, _, id, binding, klass|
|
set_trace_func proc { |event, _, _, id, binding, klass|
|
||||||
@ -134,7 +132,6 @@ module Debrew
|
|||||||
|
|
||||||
return :ignore
|
return :ignore
|
||||||
end if Ignorable === e
|
end if Ignorable === e
|
||||||
end
|
|
||||||
|
|
||||||
menu.choice(:shell) do
|
menu.choice(:shell) do
|
||||||
puts "When you exit this shell, you will return to the menu."
|
puts "When you exit this shell, you will return to the menu."
|
||||||
|
|||||||
@ -190,14 +190,6 @@ class FormulaInstaller
|
|||||||
opoo "Nothing was installed to #{formula.prefix}" unless formula.installed?
|
opoo "Nothing was installed to #{formula.prefix}" unless formula.installed?
|
||||||
end
|
end
|
||||||
|
|
||||||
# HACK: If readline is present in the dependency tree, it will clash
|
|
||||||
# with the stdlib's Readline module when the debugger is loaded
|
|
||||||
def perform_readline_hack
|
|
||||||
if (formula.recursive_dependencies.any? { |d| d.name == "readline" } || formula.name == "readline") && debug?
|
|
||||||
ENV['HOMEBREW_NO_READLINE'] = '1'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def check_conflicts
|
def check_conflicts
|
||||||
return if ARGV.force?
|
return if ARGV.force?
|
||||||
|
|
||||||
@ -210,8 +202,6 @@ class FormulaInstaller
|
|||||||
end
|
end
|
||||||
|
|
||||||
def compute_and_install_dependencies
|
def compute_and_install_dependencies
|
||||||
perform_readline_hack
|
|
||||||
|
|
||||||
req_map, req_deps = expand_requirements
|
req_map, req_deps = expand_requirements
|
||||||
|
|
||||||
check_requirements(req_map)
|
check_requirements(req_map)
|
||||||
|
|||||||
@ -314,7 +314,7 @@ module GitHub extend self
|
|||||||
# This is a no-op if the user is opting out of using the GitHub API.
|
# This is a no-op if the user is opting out of using the GitHub API.
|
||||||
return if ENV['HOMEBREW_NO_GITHUB_API']
|
return if ENV['HOMEBREW_NO_GITHUB_API']
|
||||||
|
|
||||||
safely_load_net_https
|
require "net/https"
|
||||||
|
|
||||||
default_headers = {
|
default_headers = {
|
||||||
"User-Agent" => HOMEBREW_USER_AGENT,
|
"User-Agent" => HOMEBREW_USER_AGENT,
|
||||||
@ -411,24 +411,4 @@ module GitHub extend self
|
|||||||
uri = URI.parse("https://api.github.com/repos/#{user}/#{repo}")
|
uri = URI.parse("https://api.github.com/repos/#{user}/#{repo}")
|
||||||
open(uri) { |json| json["private"] }
|
open(uri) { |json| json["private"] }
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
# If the zlib formula is loaded, TypeError will be raised when we try to load
|
|
||||||
# net/https. This monkeypatch prevents that and lets Net::HTTP fall back to
|
|
||||||
# the non-gzip codepath.
|
|
||||||
def safely_load_net_https
|
|
||||||
return if defined?(Net::HTTP)
|
|
||||||
if defined?(Zlib) && RUBY_VERSION >= "1.9"
|
|
||||||
require "net/protocol"
|
|
||||||
http = Class.new(Net::Protocol) do
|
|
||||||
def self.require(lib)
|
|
||||||
raise LoadError if lib == "zlib"
|
|
||||||
super
|
|
||||||
end
|
|
||||||
end
|
|
||||||
Net.const_set(:HTTP, http)
|
|
||||||
end
|
|
||||||
require "net/https"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user