Remove readline and zlib hacks

This commit is contained in:
Jack Nagel 2015-01-01 01:21:59 -05:00
parent a2a24b3a0d
commit a52143c63c
3 changed files with 12 additions and 45 deletions

View File

@ -1,4 +1,5 @@
require "mutex_m"
require "debrew/irb"
module Debrew
extend Mutex_m
@ -120,9 +121,6 @@ module Debrew
menu.choice(:ignore) { return :ignore } if Ignorable === e
menu.choice(:backtrace) { puts e.backtrace }
unless ENV["HOMEBREW_NO_READLINE"]
require "debrew/irb"
menu.choice(:irb) do
puts "When you exit this IRB session, execution will continue."
set_trace_func proc { |event, _, _, id, binding, klass|
@ -134,7 +132,6 @@ module Debrew
return :ignore
end if Ignorable === e
end
menu.choice(:shell) do
puts "When you exit this shell, you will return to the menu."

View File

@ -190,14 +190,6 @@ class FormulaInstaller
opoo "Nothing was installed to #{formula.prefix}" unless formula.installed?
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
return if ARGV.force?
@ -210,8 +202,6 @@ class FormulaInstaller
end
def compute_and_install_dependencies
perform_readline_hack
req_map, req_deps = expand_requirements
check_requirements(req_map)

View File

@ -314,7 +314,7 @@ module GitHub extend self
# This is a no-op if the user is opting out of using the GitHub API.
return if ENV['HOMEBREW_NO_GITHUB_API']
safely_load_net_https
require "net/https"
default_headers = {
"User-Agent" => HOMEBREW_USER_AGENT,
@ -411,24 +411,4 @@ module GitHub extend self
uri = URI.parse("https://api.github.com/repos/#{user}/#{repo}")
open(uri) { |json| json["private"] }
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