From adb8c252b0e81f345d8bcc6952b1adce5b0fbc47 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Mon, 26 Feb 2018 09:21:38 +0000 Subject: [PATCH 01/47] info: sort HEAD keys by install date This makes a lot more sense than sorting alphabetically by commit hash, the previous behaviour. --- Library/Homebrew/cmd/info.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb index 1eb9fe9fed..3c79b6f7e5 100644 --- a/Library/Homebrew/cmd/info.rb +++ b/Library/Homebrew/cmd/info.rb @@ -137,7 +137,12 @@ module Homebrew EOS end - kegs = f.installed_kegs.sort_by(&:version) + kegs = f.installed_kegs + heads, versioned = kegs.partition { |k| k.version.head? } + kegs = [ + *heads.sort_by { |k| -Tab.for_keg(k).time.to_i }, + *versioned.sort_by(&:version), + ] if kegs.empty? puts "Not installed" else From bfa474857adb749a4edc7727987bb42ce66de728 Mon Sep 17 00:00:00 2001 From: Alex Wang Date: Mon, 26 Feb 2018 18:29:37 -0500 Subject: [PATCH 02/47] Add macOS libs ahead of brewed llvm libs in lib search path This ensures that libraries that are built with brewed LLVM but not included in the Command Line Tools/Xcode (e.g. libomp) can be found during a build, while still using system libraries for the essential stuff (e.g. libc++) --- Library/Homebrew/extend/ENV/super.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb index b4f0dfcac0..ce17af5ca3 100644 --- a/Library/Homebrew/extend/ENV/super.rb +++ b/Library/Homebrew/extend/ENV/super.rb @@ -176,6 +176,8 @@ module Superenv PATH.new( keg_only_deps.map(&:opt_lib), HOMEBREW_PREFIX/"lib", + "#{MacOS.sdk_path}/usr/lib", + (compiler == :llvm_clang ? Formula["llvm"].opt_lib.to_s : ""), homebrew_extra_library_paths, ).existing end From 7b94842610119cb12c4ac706e936565d3cfbb98e Mon Sep 17 00:00:00 2001 From: Alex Wang Date: Wed, 28 Feb 2018 09:26:15 -0500 Subject: [PATCH 03/47] Split ternary for PATH building into if/else cases --- Library/Homebrew/extend/ENV/super.rb | 32 ++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb index ce17af5ca3..c3806d421e 100644 --- a/Library/Homebrew/extend/ENV/super.rb +++ b/Library/Homebrew/extend/ENV/super.rb @@ -173,13 +173,31 @@ module Superenv end def determine_library_paths - PATH.new( - keg_only_deps.map(&:opt_lib), - HOMEBREW_PREFIX/"lib", - "#{MacOS.sdk_path}/usr/lib", - (compiler == :llvm_clang ? Formula["llvm"].opt_lib.to_s : ""), - homebrew_extra_library_paths, - ).existing + if compiler == :llvm_clang + if MacOS::CLT.installed? + PATH.new( + keg_only_deps.map(&:opt_lib), + HOMEBREW_PREFIX/"lib", + "/usr/lib", + Formula["llvm"].opt_lib.to_s, + homebrew_extra_library_paths, + ).existing + else + PATH.new( + keg_only_deps.map(&:opt_lib), + HOMEBREW_PREFIX/"lib", + "#{MacOS.sdk_path}/usr/lib", + Formula["llvm"].opt_lib.to_s, + homebrew_extra_library_paths, + ).existing + end + else + PATH.new( + keg_only_deps.map(&:opt_lib), + HOMEBREW_PREFIX/"lib", + homebrew_extra_library_paths, + ).existing + end end def determine_dependencies From 09f343d4961c454100c01390761c8ebc153fe594 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Mon, 19 Feb 2018 23:40:07 +0530 Subject: [PATCH 04/47] rubocop: Add cop to check `depends_on` order and tests --- Library/Homebrew/rubocops.rb | 1 + .../Homebrew/rubocops/dependency_order_cop.rb | 166 ++++++++++++++++++ .../rubocops/dependency_order_cop_spec.rb | 75 ++++++++ 3 files changed, 242 insertions(+) create mode 100644 Library/Homebrew/rubocops/dependency_order_cop.rb create mode 100644 Library/Homebrew/test/rubocops/dependency_order_cop_spec.rb diff --git a/Library/Homebrew/rubocops.rb b/Library/Homebrew/rubocops.rb index 8dc49bb459..f1923ee654 100644 --- a/Library/Homebrew/rubocops.rb +++ b/Library/Homebrew/rubocops.rb @@ -2,6 +2,7 @@ require_relative "./rubocops/bottle_block_cop" require_relative "./rubocops/formula_desc_cop" require_relative "./rubocops/components_order_cop" require_relative "./rubocops/components_redundancy_cop" +require_relative "./rubocops/dependency_order_cop" require_relative "./rubocops/homepage_cop" require_relative "./rubocops/text_cop" require_relative "./rubocops/caveats_cop" diff --git a/Library/Homebrew/rubocops/dependency_order_cop.rb b/Library/Homebrew/rubocops/dependency_order_cop.rb new file mode 100644 index 0000000000..1d1481f280 --- /dev/null +++ b/Library/Homebrew/rubocops/dependency_order_cop.rb @@ -0,0 +1,166 @@ +require_relative "./extend/formula_cop" + +module RuboCop + module Cop + module NewFormulaAudit + # This cop checks for correct order of `depends_on` in a Formula + # + # precedence order: + # build-time > run-time > normal > recommended > optional + class DependencyOrder < FormulaCop + def audit_formula(_node, _class_node, _parent_class_node, body_node) + check_dependency_nodes_order(body_node) + [:devel, :head, :stable].each do |block_name| + block = find_block(body_node, block_name) + next unless block + check_dependency_nodes_order(block.body) + end + end + + def check_dependency_nodes_order(parent_node) + return if parent_node.nil? + dependency_nodes = fetch_depends_on_nodes(parent_node) + ordered = dependency_nodes.sort { |a, b| sort_by_dependency_name(a, b) } + ordered = sort_dependencies_by_type(ordered) + sort_conditional_dependencies!(ordered) + verify_order_in_source(ordered) + end + + # Match all `depends_on` nodes among childnodes of given parent node + def fetch_depends_on_nodes(parent_node) + parent_node.each_child_node.select { |x| depends_on_node?(x) } + end + + def sort_by_dependency_name(a, b) + a_name = dependency_name(a) + b_name = dependency_name(b) + if a_name < b_name + -1 + elsif a_name > b_name + 1 + else + 0 + end + end + + # Separate dependencies according to precedence order: + # build-time > run-time > normal > recommended > optional + def sort_dependencies_by_type(dependency_nodes) + ordered = [] + ordered.concat(dependency_nodes.select { |dep| buildtime_dependency? dep }.to_a) + ordered.concat(dependency_nodes.select { |dep| runtime_dependency? dep }.to_a) + ordered.concat(dependency_nodes.reject { |dep| negate_normal_dependency? dep }.to_a) + ordered.concat(dependency_nodes.select { |dep| recommended_dependency? dep }.to_a) + ordered.concat(dependency_nodes.select { |dep| optional_dependency? dep }.to_a) + end + + # `depends_on :apple if build.with? "foo"` should always be defined + # after `depends_on :foo` + # This method reorders dependencies array according to above rule + def sort_conditional_dependencies!(ordered) + length = ordered.size + idx = 0 + while idx < length + idx1, idx2 = nil + ordered.each_with_index do |dep, pos| + idx = pos+1 + match_nodes = build_with_dependency_name(dep) + idx1 = pos if match_nodes && !match_nodes.empty? + next unless idx1 + idx2 = nil + ordered.drop(idx1+1).each_with_index do |dep2, pos2| + next unless match_nodes.index(dependency_name(dep2)) + idx2 = pos2 if idx2.nil? || pos2 > idx2 + end + break if idx2 + end + insert_after!(ordered, idx1, idx2+idx1) if idx2 + end + ordered + end + + # Verify actual order of sorted `depends_on` nodes in source code + # Else raise RuboCop problem + def verify_order_in_source(ordered) + ordered.each_with_index do |dependency_node_1, idx| + l1 = line_number(dependency_node_1) + dependency_node_2 = nil + ordered.drop(idx+1).each do |node2| + l2 = line_number(node2) + dependency_node_2 = node2 if l2 < l1 + end + next unless dependency_node_2 + @offensive_nodes = [dependency_node_1, dependency_node_2] + component_problem dependency_node_1, dependency_node_2 + end + end + + # Node pattern method to match + # `depends_on` variants + def_node_matcher :depends_on_node?, <<~EOS + {(if _ (send nil? :depends_on ...) nil?) + (send nil? :depends_on ...)} + EOS + + def_node_search :buildtime_dependency?, "(sym :build)" + + def_node_search :recommended_dependency?, "(sym :recommended)" + + def_node_search :runtime_dependency?, "(sym :run)" + + def_node_search :optional_dependency?, "(sym :optional)" + + def_node_search :negate_normal_dependency?, "(sym {:build :recommended :run :optional})" + + # Node pattern method to extract `name` in `depends_on :name` + def_node_search :dependency_name_node, <<~EOS + {(send nil? :depends_on {(hash (pair $_ _)) $({str sym} _)}) + (if _ (send nil? :depends_on {(hash (pair $_ _)) $({str sym} _)}) nil?)} + EOS + + # Node pattern method to extract `name` in `build.with? :name` + def_node_search :build_with_dependency_node, <<~EOS + (send (send nil? :build) :with? $({str sym} _)) + EOS + + def insert_after!(arr, idx1, idx2) + arr.insert(idx2+1, arr.delete_at(idx1)) + end + + def build_with_dependency_name(node) + match_nodes = build_with_dependency_node(node) + match_nodes = match_nodes.to_a.delete_if(&:nil?) + match_nodes.map { |n| string_content(n) } unless match_nodes.empty? + end + + def dependency_name(dependency_node) + match_node = dependency_name_node(dependency_node).to_a.first + string_content(match_node) if match_node + end + + def autocorrect(_node) + succeeding_node = @offensive_nodes[0] + preceding_node = @offensive_nodes[1] + lambda do |corrector| + reorder_components(corrector, succeeding_node, preceding_node) + end + end + + private + + def component_problem(c1, c2) + offending_node(c1) + problem "dependency \"#{dependency_name(c1)}\" (line #{line_number(c1)}) should be put before dependency \"#{dependency_name(c2)}\" (line #{line_number(c2)})" + end + + # Reorder two nodes in the source, using the corrector instance in autocorrect method + def reorder_components(corrector, node1, node2) + indentation = " " * (start_column(node2) - line_start_column(node2)) + line_breaks = "\n" + corrector.insert_before(node2.source_range, node1.source + line_breaks + indentation) + corrector.remove(range_with_surrounding_space(range: node1.source_range, side: :left)) + end + end + end + end +end diff --git a/Library/Homebrew/test/rubocops/dependency_order_cop_spec.rb b/Library/Homebrew/test/rubocops/dependency_order_cop_spec.rb new file mode 100644 index 0000000000..92ca724750 --- /dev/null +++ b/Library/Homebrew/test/rubocops/dependency_order_cop_spec.rb @@ -0,0 +1,75 @@ +require_relative "../../rubocops/dependency_order_cop" + +describe RuboCop::Cop::NewFormulaAudit::DependencyOrder do + subject(:cop) { described_class.new } + + context "depends_on" do + it "wrong conditional depends_on order" do + expect_offense(<<~RUBY) + class Foo < Formula + homepage "http://example.com" + url "http://example.com/foo-1.0.tgz" + depends_on "apple" if build.with? "foo" + depends_on "foo" => :optional + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dependency "foo" (line 5) should be put before dependency "apple" (line 4) + end + RUBY + end + + it "wrong alphabetical depends_on order" do + expect_offense(<<~RUBY) + class Foo < Formula + homepage "http://example.com" + url "http://example.com/foo-1.0.tgz" + depends_on "foo" + depends_on "bar" + ^^^^^^^^^^^^^^^^ dependency "bar" (line 5) should be put before dependency "foo" (line 4) + end + RUBY + end + + it "wrong conditional depends_on order" do + expect_offense(<<~RUBY) + class Foo < Formula + homepage "http://example.com" + url "http://example.com/foo-1.0.tgz" + head do + depends_on "apple" if build.with? "foo" + depends_on "bar" + ^^^^^^^^^^^^^^^^ dependency "bar" (line 6) should be put before dependency "apple" (line 5) + depends_on "foo" => :optional + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dependency "foo" (line 7) should be put before dependency "apple" (line 5) + end + depends_on "apple" if build.with? "foo" + depends_on "foo" => :optional + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dependency "foo" (line 10) should be put before dependency "apple" (line 9) + end + RUBY + end + end + + context "autocorrect" do + it "wrong conditional depends_on order" do + source = <<~EOS + class Foo < Formula + homepage "http://example.com" + url "http://example.com/foo-1.0.tgz" + depends_on "apple" if build.with? "foo" + depends_on "foo" => :optional + end + EOS + + correct_source = <<~EOS + class Foo < Formula + homepage "http://example.com" + url "http://example.com/foo-1.0.tgz" + depends_on "foo" => :optional + depends_on "apple" if build.with? "foo" + end + EOS + + corrected_source = autocorrect_source(source) + expect(corrected_source).to eq(correct_source) + end + end +end From 84dda31e82607424b435a60504ffc288f16c6ade Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Thu, 1 Mar 2018 17:48:08 +0000 Subject: [PATCH 05/47] Add tests for ENV#clear_sensitive_environment! --- Library/Homebrew/extend/ENV.rb | 4 ++-- Library/Homebrew/test/ENV_spec.rb | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb index 374be49b92..002220764a 100644 --- a/Library/Homebrew/extend/ENV.rb +++ b/Library/Homebrew/extend/ENV.rb @@ -28,9 +28,9 @@ module EnvActivation end def clear_sensitive_environment! - ENV.each_key do |key| + each_key do |key| next unless /(cookie|key|token|password)/i =~ key - ENV.delete key + delete key end end end diff --git a/Library/Homebrew/test/ENV_spec.rb b/Library/Homebrew/test/ENV_spec.rb index 07f6cdb6b0..8b39e52d78 100644 --- a/Library/Homebrew/test/ENV_spec.rb +++ b/Library/Homebrew/test/ENV_spec.rb @@ -141,6 +141,20 @@ shared_examples EnvActivation do expect(subject["MAKEFLAGS"]).to eq("-j4") end + + describe "#clear_sensitive_environment!" do + it "removes sensitive environment variables" do + subject["SECRET_TOKEN"] = "password" + subject.clear_sensitive_environment! + expect(subject).not_to include("SECRET_TOKEN") + end + + it "leaves non-sensitive environment variables alone" do + subject["FOO"] = "bar" + subject.clear_sensitive_environment! + expect(subject["FOO"]).to eq "bar" + end + end end describe Stdenv do From e960ccdf18fb1c6b0fe120b87378453df096e44d Mon Sep 17 00:00:00 2001 From: Dominyk Tiller Date: Fri, 2 Mar 2018 06:42:24 +0000 Subject: [PATCH 06/47] utils: stop suggesting fixing hard deprecations --- Library/Homebrew/utils.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 03924dcef2..9b0d8be13b 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -109,7 +109,11 @@ def odeprecated(method, replacement = nil, disable: false, disable_on: nil, call if ARGV.homebrew_developer? || disable || Homebrew.raise_deprecation_exceptions? - developer_message = message + "Or, even better, submit a PR to fix it!" + if replacement_message != "There is no replacement." + developer_message = message + "Or, even better, submit a PR to fix it!" + else + developer_message = message + end raise MethodDeprecatedError, developer_message elsif !Homebrew.auditing? opoo "#{message}\n" From 8668b7108ae96ef64f44d3d789247b0cf53d1d53 Mon Sep 17 00:00:00 2001 From: Dominyk Tiller Date: Fri, 2 Mar 2018 07:10:31 +0000 Subject: [PATCH 07/47] utils: stop suggesting fixing hard deprecations tweak --- Library/Homebrew/utils.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 9b0d8be13b..88abd53f89 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -109,10 +109,12 @@ def odeprecated(method, replacement = nil, disable: false, disable_on: nil, call if ARGV.homebrew_developer? || disable || Homebrew.raise_deprecation_exceptions? - if replacement_message != "There is no replacement." - developer_message = message + "Or, even better, submit a PR to fix it!" - else + if caller_message.match?(HOMEBREW_LIBRARY_PATH/"cmd") || + caller_message.match?(HOMEBREW_LIBRARY_PATH/"dev-cmd") && + replacement_message == "There is no replacement." developer_message = message + else + developer_message = message + "Or, even better, submit a PR to fix it!" end raise MethodDeprecatedError, developer_message elsif !Homebrew.auditing? From 84363f8a3a62508162ffae6bed10e1dc4ef4dae8 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 2 Mar 2018 16:21:29 +0000 Subject: [PATCH 08/47] docs/Acceptable-Formulae: remove bindings mention. We do accept these e.g. `boost-python`. --- docs/Acceptable-Formulae.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/docs/Acceptable-Formulae.md b/docs/Acceptable-Formulae.md index df799bb1a7..5f6e6fcc62 100644 --- a/docs/Acceptable-Formulae.md +++ b/docs/Acceptable-Formulae.md @@ -38,15 +38,6 @@ tarballs should include the version in the filename whenever possible. We don’t accept software without a tagged version because they regularly break due to upstream changes and we can’t provide [bottles](Bottles.md) for them. -### Bindings -First check that there is not already a binding available via -[`gem`](https://rubygems.org/) or [`pip`](http://www.pip-installer.org/) -etc. - -If not, then put bindings in the formula they bind to. This is more -useful to people. Just install the stuff! Having to faff around with -foo-ruby, foo-perl etc. is a bad user experience. - ### Niche (or self-submitted) stuff The software in question must: From 0d5ae6cf0b603f3fbea0c18fad1cd406d7a5847e Mon Sep 17 00:00:00 2001 From: Steven Peters Date: Fri, 2 Mar 2018 09:05:41 -0800 Subject: [PATCH 09/47] language/python: version 3.6 in site_packages --- Library/Homebrew/language/python.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/language/python.rb b/Library/Homebrew/language/python.rb index 648abb5b11..64c57db726 100644 --- a/Library/Homebrew/language/python.rb +++ b/Library/Homebrew/language/python.rb @@ -9,7 +9,7 @@ module Language Version.create(version.to_s) end - def self.homebrew_site_packages(version = "2.7") + def self.homebrew_site_packages(version = "3.6") HOMEBREW_PREFIX/"lib/python#{version}/site-packages" end From b4c268e3c59f011f2de7ba0f1a466d54a4ccd97c Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 2 Mar 2018 17:21:17 +0000 Subject: [PATCH 10/47] migrator: overwrite by default. This avoids getting into an invalid state which will and does break for users. --- Library/Homebrew/migrator.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/migrator.rb b/Library/Homebrew/migrator.rb index 8664d474be..3ccf2f23c0 100644 --- a/Library/Homebrew/migrator.rb +++ b/Library/Homebrew/migrator.rb @@ -288,7 +288,8 @@ class Migrator new_keg.remove_linked_keg_record if new_keg.linked? begin - new_keg.link + mode = OpenStruct.new(overwrite: true) + new_keg.link(mode) rescue Keg::ConflictError => e onoe "Error while executing `brew link` step on #{newname}" puts e From 2f776ed5233cf9620d7a9284b013a8a0f6572d10 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 2 Mar 2018 21:23:04 +0000 Subject: [PATCH 11/47] migrator: recommend `brew upgrade`. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit You’re in a weird middle state if you run `brew update` but haven’t upgraded a migrated formula. --- Library/Homebrew/migrator.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Library/Homebrew/migrator.rb b/Library/Homebrew/migrator.rb index 8664d474be..6c03219382 100644 --- a/Library/Homebrew/migrator.rb +++ b/Library/Homebrew/migrator.rb @@ -193,6 +193,11 @@ class Migrator link_oldname_opt link_newname unless old_linked_keg.nil? update_tabs + return unless formula.outdated? + opoo <<~EOS + #{Formatter.identifier(newname)} is outdated! Please run as soon as possible: + brew upgrade #{newname} + EOS rescue Interrupt ignore_interrupts { backup_oldname } rescue Exception => e # rubocop:disable Lint/RescueException From 2404279d6399a567a310f6204863eaed106e4bdb Mon Sep 17 00:00:00 2001 From: commitay Date: Thu, 1 Mar 2018 17:19:00 +1000 Subject: [PATCH 12/47] Fix SystemCommand escaping --- Library/Homebrew/cask/lib/hbc/system_command.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/cask/lib/hbc/system_command.rb b/Library/Homebrew/cask/lib/hbc/system_command.rb index dfb3019998..e5a7d9202b 100644 --- a/Library/Homebrew/cask/lib/hbc/system_command.rb +++ b/Library/Homebrew/cask/lib/hbc/system_command.rb @@ -85,7 +85,7 @@ module Hbc executable, *args = expanded_command raw_stdin, raw_stdout, raw_stderr, raw_wait_thr = - Open3.popen3({ "PATH" => path }, executable, *args, **options) + Open3.popen3({ "PATH" => path }, [executable, executable], *args, **options) write_input_to(raw_stdin) raw_stdin.close_write From 70253f0009ee8095a5d10ee7bdd891f1fe5cc35c Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 3 Mar 2018 09:42:25 +0000 Subject: [PATCH 13/47] Adjust docs and more internal code for Python 3. Now we have `python` for Python 3 and `python@2` for Python 2 some more adjustments need to be made. --- .../Homebrew/compat/dependency_collector.rb | 6 ++-- Library/Homebrew/compat/requirements.rb | 8 ++--- .../language_module_requirement.rb | 8 ++--- Library/Homebrew/diagnostic.rb | 2 +- Library/Homebrew/exceptions.rb | 4 +-- Library/Homebrew/formula.rb | 10 +++--- Library/Homebrew/language/python.rb | 24 +++++++------- .../test/language_module_requirement_spec.rb | 4 --- docs/Gems,-Eggs-and-Perl-Modules.md | 10 +++--- docs/Homebrew-and-Python.md | 33 +++++++++---------- docs/Python-for-Formula-Authors.md | 16 +++++---- 11 files changed, 60 insertions(+), 65 deletions(-) diff --git a/Library/Homebrew/compat/dependency_collector.rb b/Library/Homebrew/compat/dependency_collector.rb index 88d393488f..8bea8a5aa9 100644 --- a/Library/Homebrew/compat/dependency_collector.rb +++ b/Library/Homebrew/compat/dependency_collector.rb @@ -52,11 +52,11 @@ class DependencyCollector output_deprecation(spec, "open-mpi") Dependency.new("open-mpi", tags) when :python, :python2 + output_deprecation(spec, "python@2") + Dependency.new("python@2", tags) + when :python3 output_deprecation(spec, "python") Dependency.new("python", tags) - when :python3 - output_deprecation(spec, "python3") - Dependency.new("python3", tags) when :emacs, :mysql, :perl, :postgresql, :rbenv, :ruby output_deprecation(spec) Dependency.new(spec.to_s, tags) diff --git a/Library/Homebrew/compat/requirements.rb b/Library/Homebrew/compat/requirements.rb index 38344c1fcd..3dd5c74795 100644 --- a/Library/Homebrew/compat/requirements.rb +++ b/Library/Homebrew/compat/requirements.rb @@ -84,16 +84,16 @@ end class PythonRequirement < Requirement fatal true satisfy do - odeprecated("PythonRequirement", "'depends_on \"python\"'") - which "python" + odeprecated("PythonRequirement", "'depends_on \"python@2\"'") + which "python2" end end class Python3Requirement < Requirement fatal true satisfy do - odeprecated("Python3Requirement", "'depends_on \"python3\"'") - which "python3" + odeprecated("Python3Requirement", "'depends_on \"python\"'") + which "python" end end diff --git a/Library/Homebrew/compat/requirements/language_module_requirement.rb b/Library/Homebrew/compat/requirements/language_module_requirement.rb index 5ddce7a66b..fc9dcc4428 100644 --- a/Library/Homebrew/compat/requirements/language_module_requirement.rb +++ b/Library/Homebrew/compat/requirements/language_module_requirement.rb @@ -38,9 +38,9 @@ class LanguageModuleRequirement < Requirement when :perl ["/usr/bin/env", "perl", "-e", "use #{@import_name}"] when :python - ["/usr/bin/env", "python", "-c", "import #{@import_name}"] + ["/usr/bin/env", "python2", "-c", "import #{@import_name}"] when :python3 - ["/usr/bin/env", "python3", "-c", "import #{@import_name}"] + ["/usr/bin/env", "python", "-c", "import #{@import_name}"] when :ruby ["/usr/bin/env", "ruby", "-rubygems", "-e", "require '#{@import_name}'"] end @@ -51,8 +51,8 @@ class LanguageModuleRequirement < Requirement when :lua then "luarocks-5.2 install" when :lua51 then "luarocks-5.1 install" when :perl then "cpan -i" - when :python then "pip install" - when :python3 then "pip3 install" + when :python then "pip3 install" + when :python3 then "pip install" when :ruby then "gem install" end end diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 8cbf124e61..79f5b2f1d0 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -934,7 +934,7 @@ module Homebrew from your PATH variable. Python scripts will now install into #{HOMEBREW_PREFIX}/bin. You can delete anything, except 'Extras', from the #{HOMEBREW_PREFIX}/share/python - (and #{HOMEBREW_PREFIX}/share/python3) dir and install affected Python packages + (and #{HOMEBREW_PREFIX}/share/python@2) dir and install affected Python packages anew with `pip install --upgrade`. EOS end diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index 42c62338a8..20ad2a3788 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -343,8 +343,8 @@ class FormulaAmbiguousPythonError < RuntimeError def initialize(formula) super <<~EOS The version of python to use with the virtualenv in the `#{formula.full_name}` formula - cannot be guessed automatically. If the simultaneous use of python and python3 - is intentional, please add `:using => "python"` or `:using => "python3"` to + cannot be guessed automatically. If the simultaneous use of python and python@2 + is intentional, please add `:using => "python"` or `:using => "python@2"` to `virtualenv_install_with_resources` to resolve the ambiguity manually. EOS end diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 228eb537be..521c626374 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -2201,12 +2201,12 @@ class Formula # # `build.with?` or `build.without? "another_formula"`: # depends_on "postgresql" if build.without? "sqlite" # - #
# Python 2.7:
-    # depends_on "python"
- #
# Python 2.7 but use system Python where possible
-    # depends_on "python" if MacOS.version <= :snow_leopard
- #
# Python 3.x if the `--with-python3` is given to `brew install example`
+    # 
# Python 3.x if the `--with-python` is given to `brew install example`
     # depends_on "python3" => :optional
+ #
# Python 2.7:
+    # depends_on "python@2"
+ #
# Python 2.7 but use system Python where possible
+    # depends_on "python@2" if MacOS.version <= :snow_leopard
def depends_on(dep) specs.each { |spec| spec.depends_on(dep) } end diff --git a/Library/Homebrew/language/python.rb b/Library/Homebrew/language/python.rb index 648abb5b11..898f2ae59d 100644 --- a/Library/Homebrew/language/python.rb +++ b/Library/Homebrew/language/python.rb @@ -89,7 +89,7 @@ module Language # @param venv_root [Pathname, String] the path to the root of the virtualenv # (often `libexec/"venv"`) # @param python [String] which interpreter to use (e.g. "python" - # or "python3") + # or "python2") # @param formula [Formula] the active Formula # @return [Virtualenv] a {Virtualenv} instance def virtualenv_create(venv_root, python = "python", formula = self) @@ -115,8 +115,8 @@ module Language # Returns true if a formula option for the specified python is currently # active or if the specified python is required by the formula. Valid - # inputs are "python", "python3", :python, and :python3. Note that - # "with-python", "without-python", "with-python3", and "without-python3" + # inputs are "python", "python2", :python, and :python2. Note that + # "with-python", "without-python", "with-python@2", and "without-python@2" # formula options are handled correctly even if not associated with any # corresponding depends_on statement. # @api private @@ -128,16 +128,16 @@ module Language # Helper method for the common case of installing a Python application. # Creates a virtualenv in `libexec`, installs all `resource`s defined # on the formula, and then installs the formula. An options hash may be - # passed (e.g., :using => "python3") to override the default, guessed - # formula preference for python or python3, or to resolve an ambiguous - # case where it's not clear whether python or python3 should be the + # passed (e.g., :using => "python") to override the default, guessed + # formula preference for python or python2, or to resolve an ambiguous + # case where it's not clear whether python or python2 should be the # default guess. def virtualenv_install_with_resources(options = {}) python = options[:using] if python.nil? - wanted = %w[python python@2 python@3 python3].select { |py| needs_python?(py) } + wanted = %w[python python@2 python2 python3].select { |py| needs_python?(py) } raise FormulaAmbiguousPythonError, self if wanted.size > 1 - python = wanted.first || "python2.7" + python = wanted.first || "python" end venv = virtualenv_create(libexec, python.delete("@")) venv.pip_install resources @@ -154,7 +154,7 @@ module Language # @param venv_root [Pathname, String] the path to the root of the # virtualenv # @param python [String] which interpreter to use; i.e. "python" or - # "python3" + # "python2" def initialize(formula, venv_root, python) @formula = formula @venv_root = Pathname.new(venv_root) @@ -180,11 +180,11 @@ module Language end end - # Robustify symlinks to survive python3 patch upgrades + # Robustify symlinks to survive python patch upgrades @venv_root.find do |f| next unless f.symlink? next unless (rp = f.realpath.to_s).start_with? HOMEBREW_CELLAR - python = rp.include?("python3") ? "python3" : "python" + python = rp.include?("python2") ? "python2" : "python" new_target = rp.sub %r{#{HOMEBREW_CELLAR}/#{python}/[^/]+}, Formula[python].opt_prefix f.unlink f.make_symlink new_target @@ -192,7 +192,7 @@ module Language Pathname.glob(@venv_root/"lib/python*/orig-prefix.txt").each do |prefix_file| prefix_path = prefix_file.read - python = prefix_path.include?("python3") ? "python3" : "python" + python = prefix_path.include?("python2") ? "python2" : "python" prefix_path.sub! %r{^#{HOMEBREW_CELLAR}/#{python}/[^/]+}, Formula[python].opt_prefix prefix_file.atomic_write prefix_path end diff --git a/Library/Homebrew/test/language_module_requirement_spec.rb b/Library/Homebrew/test/language_module_requirement_spec.rb index 6ca8cbd0e8..74d092bac9 100644 --- a/Library/Homebrew/test/language_module_requirement_spec.rb +++ b/Library/Homebrew/test/language_module_requirement_spec.rb @@ -31,10 +31,6 @@ describe LanguageModuleRequirement, :needs_compat do it "does not satisfy invalid dependencies" do expect(described_class.new(:python, "notapackage")).not_to be_satisfied end - - it "satisfies valid dependencies" do - expect(described_class.new(:python, "datetime")).to be_satisfied - end end context "when the language is Ruby" do diff --git a/docs/Gems,-Eggs-and-Perl-Modules.md b/docs/Gems,-Eggs-and-Perl-Modules.md index 4a1b1ba44b..14d38003b3 100644 --- a/docs/Gems,-Eggs-and-Perl-Modules.md +++ b/docs/Gems,-Eggs-and-Perl-Modules.md @@ -11,8 +11,8 @@ Starting with OS X Lion (10.7), you need `sudo` to install to these like so: `sudo gem install`, `sudo easy_install` or `sudo cpan -i`. An option to avoid sudo is to use an access control list: -`chmod +a 'user:YOUR_NAME_HERE allow add_subdirectory,add_file,delete_child,directory_inherit' /Library/Python/2.7/site-packages`, -for example, will let you add packages to Python 2.7 as yourself. That +`chmod +a 'user:YOUR_NAME_HERE allow add_subdirectory,add_file,delete_child,directory_inherit' /Library/Python/3.6/site-packages`, +for example, will let you add packages to Python 3.6 as yourself. That is probably safer than changing the group ownership of the directory. ### So why was I using sudo? @@ -29,14 +29,14 @@ Rather than changing the rights on `/Library/Python`, we recommend the following options: ### With a brewed Python -Note, `easy_install` is deprecated. We install `pip` (or `pip3` for -Python 3) along with python/python3. +Note, `easy_install` is deprecated. We install `pip` (or `pip2` for +Python 2) along with python/python2. We set up distutils such that `pip install` will always put modules in `$(brew --prefix)/lib/pythonX.Y/site-packages` and scripts in `$(brew --prefix)/share/python`. Therefore, you won’t need sudo! -Do `brew info python` or `brew info python3` for precise information +Do `brew info python` or `brew info python@2` for precise information about the paths. Note, a brewed Python still searches for modules in `/Library/Python/X.Y/site-packages` and also in `~/Library/Python/X.Y/lib/python/site-packages`. diff --git a/docs/Homebrew-and-Python.md b/docs/Homebrew-and-Python.md index eb96e57583..6d24b214f4 100644 --- a/docs/Homebrew-and-Python.md +++ b/docs/Homebrew-and-Python.md @@ -4,33 +4,32 @@ This page describes how Python is handled in Homebrew for users. See [Python for Homebrew should work with any [CPython](https://stackoverflow.com/questions/2324208/is-there-any-difference-between-cpython-and-python) and defaults to the macOS system Python. -Homebrew provides formulae to brew a more up-to-date Python 2.7.x and 3.x. +Homebrew provides formulae to brew 3.x and a more up-to-date Python 2.7.x. -**Important:** If you choose to install a Python which isn't either of these two (system Python or brewed Python), the Homebrew team can only provide limited support. +**Important:** If you choose to install a Python which isn't either of these two (system Python or brewed Python), the Homebrew team cannot support any breakage that may occur. -## Python 2.x or Python 3.x +## Python 3.x or Python 2.x Homebrew provides one formula for Python 2.7.x and another for Python 3.x. The executables are organized as follows so that Python 2 and Python 3 can both be installed without conflict: -* `python` points to the macOS system Python (with no manual PATH modification) +* `python` and `python3` point to Homebrew's Python 3.x (if installed) otherwise the macOS system Python * `python2` points to Homebrew's Python 2.7.x (if installed) -* `python3` points to Homebrew's Python 3.x (if installed) +* `pip` and `pip3` point to Homebrew's Python 3.x's pip (if installed) * `pip2` points to Homebrew's Python 2.7.x's pip (if installed) -* `pip3` points to Homebrew's Python 3.x's pip (if installed) ([Wondering which one to choose?](https://wiki.python.org/moin/Python2orPython3)) ## Setuptools, Pip, etc. -The Python formulae install [pip](http://www.pip-installer.org) (as `pip2` or `pip3`) and [Setuptools](https://pypi.python.org/pypi/setuptools). +The Python formulae install [pip](http://www.pip-installer.org) (as `pip` or `pip2`) and [Setuptools](https://pypi.python.org/pypi/setuptools). Setuptools can be updated via pip, without having to re-brew Python: ```sh -python2 -m pip install --upgrade setuptools +python -m pip install --upgrade setuptools ``` Similarly, pip can be used to upgrade itself via: ```sh -python2 -m pip install --upgrade pip +python -m pip install --upgrade pip ``` ### Note on `pip install --user` @@ -39,7 +38,7 @@ The normal `pip install --user` is disabled for brewed Python. This is because o A possible workaround (which puts executable scripts in `~/Library/Python/./bin`) is: ```sh -python2 -m pip install --user --install-option="--prefix=" +python -m pip install --user --install-option="--prefix=" ``` ## `site-packages` and the `PYTHONPATH` @@ -49,12 +48,12 @@ The `site-packages` is a directory that contains Python modules (especially bind $(brew --prefix)/lib/pythonX.Y/site-packages ``` -So, for Python 2.7.x, you'll find it at `/usr/local/lib/python2.7/site-packages`. +So, for Python 3.6.x, you'll find it at `/usr/local/lib/python3.6/site-packages`. -Python 2.7 also searches for modules in: +Python 3.6 also searches for modules in: -- `/Library/Python/2.7/site-packages` -- `~/Library/Python/2.7/lib/python/site-packages` +- `/Library/Python/3.6/site-packages` +- `~/Library/Python/3.6/lib/python/site-packages` Homebrew's `site-packages` directory is first created if (1) any Homebrew formula with Python bindings are installed, or (2) upon `brew install python`. @@ -62,9 +61,7 @@ Homebrew's `site-packages` directory is first created if (1) any Homebrew formul The reasoning for this location is to preserve your modules between (minor) upgrades or re-installations of Python. Additionally, Homebrew has a strict policy never to write stuff outside of the `brew --prefix`, so we don't spam your system. ## Homebrew-provided Python bindings -Some formulae provide Python bindings. Sometimes a `--with-python` or `--with-python3` option has to be passed to `brew install` in order to build the Python bindings. (Check with `brew options `.) - -Homebrew builds bindings against the first `python` (and `python-config`) in your `PATH`. (Check with `which python`). +Some formulae provide Python bindings. Sometimes a `--with-python` or `--with-python@2` option has to be passed to `brew install` in order to build the Python bindings. (Check with `brew options `.) **Warning!** Python may crash (see [Common Issues](Common-Issues.md)) if you `import ` from a brewed Python if you ran `brew install ` against the system Python. If you decide to switch to the brewed Python, then reinstall all formulae with Python bindings (e.g. `pyside`, `wxwidgets`, `pygtk`, `pygobject`, `opencv`, `vtk` and `boost-python`). @@ -89,4 +86,4 @@ Homebrew will still install Python modules into Homebrew's `site-packages` and * Virtualenv has a `--system-site-packages` switch to allow "global" (i.e. Homebrew's) `site-packages` to be accessible from within the virtualenv. ## Why is Homebrew's Python being installed as a dependency? -Formulae that declare an unconditional dependency on the `"python"` or `"python3"` formulae are bottled against Homebrew's Python 2.7.x or 3.x and require it to be installed. +Formulae that declare an unconditional dependency on the `"python"` or `"python@2"` formulae are bottled against Homebrew's Python 3.x or 2.7.x and require it to be installed. diff --git a/docs/Python-for-Formula-Authors.md b/docs/Python-for-Formula-Authors.md index a530dbef7d..e4d50e5246 100644 --- a/docs/Python-for-Formula-Authors.md +++ b/docs/Python-for-Formula-Authors.md @@ -16,16 +16,16 @@ Applications should unconditionally bundle all of their Python-language dependen ### Python declarations +Formulae for apps that require Python 3 **should** declare an unconditional dependency on `"python"`. These apps **must** work with the current Homebrew Python 3.x formula. + Applications that are compatible with Python 2 **should** use the Apple-provided system Python in `/usr/bin` on systems that provide Python 2.7. To do this, declare: ```ruby -depends_on "python" if MacOS.version <= :snow_leopard +depends_on "python@2" if MacOS.version <= :snow_leopard ``` No explicit Python dependency is needed on recent OS versions since `/usr/bin` is always in `PATH` for Homebrew formulae; on Leopard and older, the `python` in `PATH` is used if it's at least version 2.7, or else Homebrew's Python 2.7.x is installed. -Formulae for apps that require Python 3 **should** declare an unconditional dependency on `"python3"`. These apps **must** work with the current Homebrew Python 3.x formula. - ### Installing Applications should be installed into a Python [virtualenv](https://virtualenv.pypa.io/en/stable/) environment rooted in `libexec`. This prevents the app's Python modules from contaminating the system site-packages and vice versa. @@ -66,7 +66,7 @@ This is exactly the same as writing: ```ruby def install # Create a virtualenv in `libexec`. If your app needs Python 3, make sure that - # `depends_on "python3"` is declared, and use `virtualenv_create(libexec, "python3")`. + # `depends_on "python"` is declared, and use `virtualenv_create(libexec, "python")`. venv = virtualenv_create(libexec) # Install all of the resources declared on the formula into the virtualenv. venv.pip_install resources @@ -121,9 +121,9 @@ in case you need to do different things for different resources. ## Bindings -Build bindings with the system Python by default (don't add an option) and they should be usable with any binary-compatible Python. If that isn't the case, it's an upstream bug; [here's some advice for resolving it](http://blog.tim-smith.us/2015/09/python-extension-modules-os-x/). +To add bindings for Python 3, please add `depends_on "python"`. -To add bindings for Python 3, please add `depends_on "python3" => :optional` and make the bindings conditional on `build.with?("python3")`. +Build Python 2 bindings with the system Python by default (don't add an option) and they should be usable with any binary-compatible Python. If that isn't the case, it's an upstream bug; [here's some advice for resolving it](http://blog.tim-smith.us/2015/09/python-extension-modules-os-x/). ### Dependencies @@ -153,7 +153,9 @@ Sometimes we have to `inreplace` a `Makefile` to use our prefix for the Python b ### Python declarations -Python 2 libraries do not need a `depends_on "python"` declaration; they will be built with the system Python, but should still be usable with any other Python 2.7. If this is not the case, it is an upstream bug; [here is some advice for resolving it](http://blog.tim-smith.us/2015/09/python-extension-modules-os-x/). Libraries built for Python 3 should include `depends_on "python3"`, which will bottle against Homebrew's Python 3.x. If a library supports both Python 2.x and Python 3.x, the `"python3"` dependency should be `:optional`. Python 2.x libraries must function when they are installed against either the system Python or brewed Python. +Libraries built for Python 3 should include `depends_on "python"`, which will bottle against Homebrew's Python 3.x. Python 2.x libraries must function when they are installed against either the system Python or brewed Python. + +Python 2 libraries do not need a `depends_on "python@2"` declaration; they will be built with the system Python, but should still be usable with any other Python 2.7. If this is not the case, it is an upstream bug; [here is some advice for resolving it](http://blog.tim-smith.us/2015/09/python-extension-modules-os-x/). ### Installing From 83fae62b4fdac790c0bb49460de4ddc365a41919 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 3 Mar 2018 10:22:37 +0000 Subject: [PATCH 14/47] Gemfile.lock: update testing gems. --- Library/Homebrew/test/Gemfile.lock | 32 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Library/Homebrew/test/Gemfile.lock b/Library/Homebrew/test/Gemfile.lock index a3f9c4c47e..0d43174e98 100644 --- a/Library/Homebrew/test/Gemfile.lock +++ b/Library/Homebrew/test/Gemfile.lock @@ -1,7 +1,7 @@ GEM remote: https://rubygems.org/ specs: - ast (2.3.0) + ast (2.4.0) codecov (0.1.10) json simplecov @@ -9,31 +9,31 @@ GEM diff-lcs (1.3) docile (1.1.5) json (2.1.0) - parallel (1.12.0) - parallel_tests (2.17.0) + parallel (1.12.1) + parallel_tests (2.21.2) parallel - parser (2.4.0.2) - ast (~> 2.3) + parser (2.5.0.2) + ast (~> 2.4.0) powerpack (0.1.1) rainbow (3.0.0) - rspec (3.6.0) - rspec-core (~> 3.6.0) - rspec-expectations (~> 3.6.0) - rspec-mocks (~> 3.6.0) - rspec-core (3.6.0) - rspec-support (~> 3.6.0) - rspec-expectations (3.6.0) + rspec (3.7.0) + rspec-core (~> 3.7.0) + rspec-expectations (~> 3.7.0) + rspec-mocks (~> 3.7.0) + rspec-core (3.7.1) + rspec-support (~> 3.7.0) + rspec-expectations (3.7.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.6.0) + rspec-support (~> 3.7.0) rspec-its (1.2.0) rspec-core (>= 3.0.0) rspec-expectations (>= 3.0.0) - rspec-mocks (3.6.0) + rspec-mocks (3.7.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.6.0) + rspec-support (~> 3.7.0) rspec-retry (0.5.6) rspec-core (> 3.3, < 3.8) - rspec-support (3.6.0) + rspec-support (3.7.1) rspec-wait (0.0.9) rspec (>= 3, < 4) rubocop (0.52.1) From ee004cb9c7592b52e2db77f82a551a41a92a62d1 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 4 Mar 2018 12:38:33 +0100 Subject: [PATCH 15/47] cmd/upgrade: Change `build.build_bottle?` to `build.bottle?` I received the following error when attempting to use the `upgrade` command on a tap: $ brew tap teddywing/passextract https://github.com/teddywing/Passextract.git $ brew upgrade --verbose teddywing/passextract/passextract Updating Homebrew... ==> Upgrading 1 outdated package, with result: teddywing/passextract/passextract 0.4.0 Error: Calling build.build_bottle? is disabled! Use build.bottle? instead. /usr/local/Homebrew/Library/Homebrew/cmd/upgrade.rb:121:in `upgrade_formula' Or, even better, submit a PR to fix it! Change the method call to use the (presumably) newer version. --- Library/Homebrew/cmd/upgrade.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index debd5eea2c..1446025805 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -118,7 +118,7 @@ module Homebrew fi = FormulaInstaller.new(f) fi.options = options - fi.build_bottle = ARGV.build_bottle? || (!f.bottled? && f.build.build_bottle?) + fi.build_bottle = ARGV.build_bottle? || (!f.bottled? && f.build.bottle?) fi.installed_on_request = !ARGV.named.empty? fi.link_keg ||= keg_was_linked if keg_had_linked_opt if tab From 1a51d7fb4480c9272c39b520283bfe93cd112151 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 5 Mar 2018 10:14:39 +0000 Subject: [PATCH 16/47] migrator: tweak more messaging. - Make it clearer what the migrator is doing and why - Recommend an unconditional brew upgrade --- Library/Homebrew/migrator.rb | 13 ++++++++----- Library/Homebrew/test/cmd/migrate_spec.rb | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/migrator.rb b/Library/Homebrew/migrator.rb index 7287a3c88c..503f889852 100644 --- a/Library/Homebrew/migrator.rb +++ b/Library/Homebrew/migrator.rb @@ -183,7 +183,7 @@ class Migrator end def migrate - oh1 "Migrating #{Formatter.identifier(oldname)} to #{Formatter.identifier(newname)}" + oh1 "Processing #{Formatter.identifier(oldname)} formula rename to #{Formatter.identifier(newname)}" lock unlink_oldname unlink_newname if new_cellar.exist? @@ -195,7 +195,10 @@ class Migrator update_tabs return unless formula.outdated? opoo <<~EOS - #{Formatter.identifier(newname)} is outdated! Please run as soon as possible: + #{Formatter.identifier(newname)} is outdated! + To avoid broken installations, as soon as possible please run: + brew upgrade + Or, if you're OK with a less reliable fix: brew upgrade #{newname} EOS rescue Interrupt @@ -231,7 +234,7 @@ class Migrator end end - oh1 "Moving #{Formatter.identifier(oldname)} children" + oh1 "Moving #{Formatter.identifier(oldname)} versions to #{new_cellar}" if new_cellar.exist? FileUtils.mv(old_cellar.children, new_cellar) else @@ -266,7 +269,7 @@ class Migrator end def unlink_newname - oh1 "Unlinking #{Formatter.identifier(newname)}" + oh1 "Temporarily unlinking #{Formatter.identifier(newname)}" new_cellar.subdirs.each do |d| keg = Keg.new(d) keg.unlink @@ -274,7 +277,7 @@ class Migrator end def link_newname - oh1 "Linking #{Formatter.identifier(newname)}" + oh1 "Relinking #{Formatter.identifier(newname)}" new_keg = Keg.new(new_linked_keg_record) # If old_keg wasn't linked then we just optlink a keg. diff --git a/Library/Homebrew/test/cmd/migrate_spec.rb b/Library/Homebrew/test/cmd/migrate_spec.rb index 18c94fa018..83dee0cb65 100644 --- a/Library/Homebrew/test/cmd/migrate_spec.rb +++ b/Library/Homebrew/test/cmd/migrate_spec.rb @@ -29,7 +29,7 @@ describe "brew migrate", :integration_test do install_and_rename_coretap_formula "testball1", "testball2" expect { brew "migrate", "testball1" } - .to output(/Migrating testball1 to testball2/).to_stdout + .to output(/Processing testball1 formula rename to testball2/).to_stdout .and not_to_output.to_stderr .and be_a_success end From fea9bc1e4291be19a64a0c7257387b35c00dd3ab Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 5 Mar 2018 10:36:39 +0000 Subject: [PATCH 17/47] Allow :test dependencies. These specify that they are needed by the test block. This can be combined with `:build` to ensure that this formula isn't uninstalled by `brew test-bot` when running `test do` blocks on our CI. --- Library/Homebrew/cmd/deps.rb | 21 +++++++++++++++++---- Library/Homebrew/dependable.rb | 8 ++++++-- Library/Homebrew/dev-cmd/test.rb | 9 +++++++++ docs/Manpage.md | 10 ++++++---- manpages/brew-cask.1 | 2 +- manpages/brew.1 | 8 ++++---- 6 files changed, 43 insertions(+), 15 deletions(-) diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb index 0627e84bdc..4ba438baac 100644 --- a/Library/Homebrew/cmd/deps.rb +++ b/Library/Homebrew/cmd/deps.rb @@ -17,7 +17,8 @@ #: #: By default, `deps` shows required and recommended dependencies for #: . To include the `:build` type dependencies, pass `--include-build`. -#: Similarly, pass `--include-optional` to include `:optional` dependencies. +#: Similarly, pass `--include-optional` to include `:optional` dependencies or +#: `--include-test` to include `:test` dependencies. #: To skip `:recommended` type dependencies, pass `--skip-recommended`. #: To include requirements in addition to dependencies, pass `--include-requirements`. #: @@ -30,8 +31,8 @@ #: If `--installed` is passed, output a tree for every installed formula. #: #: The placeholder is any combination of options `--include-build`, -#: `--include-optional`, `--skip-recommended`, and `--include-requirements` as -#: documented above. +#: `--include-optional`, `--include-test`, `--skip-recommended`, and +#: `--include-requirements` as documented above. #: #: If `--annotate` is passed, the build, optional, and recommended dependencies #: are marked as such in the output. @@ -42,7 +43,8 @@ #: dependencies of that formula. #: #: The placeholder is any combination of options `--include-build`, -#: `--include-optional`, and `--skip-recommended` as documented above. +#: `--include-optional`, `--include-test`, and `--skip-recommended` as +#: documented above. # The undocumented `--for-each` option will switch into the mode used by `deps --all`, # but only list dependencies for specified formula, one specified formula per line. @@ -111,6 +113,7 @@ module Homebrew end if ARGV.include?("--annotate") str = "#{str} [build]" if dep.build? + str = "#{str} [test]" if dep.test? str = "#{str} [optional" if dep.optional? str = "#{str} [recommended]" if dep.recommended? end @@ -125,6 +128,11 @@ module Homebrew else ignores << "build?" end + if ARGV.include?("--include-test") + includes << "test?" + else + ignores << "test?" + end if ARGV.include?("--include-optional") includes << "optional?" else @@ -140,6 +148,8 @@ module Homebrew Dependency.prune if !includes.include?("optional?") && !dependent.build.with?(dep) elsif dep.build? Dependency.prune unless includes.include?("build?") + elsif dep.test? + Dependency.prune unless includes.include?("test?") end end reqs = f.recursive_requirements do |dependent, req| @@ -149,6 +159,8 @@ module Homebrew Requirement.prune if !includes.include?("optional?") && !dependent.build.with?(req) elsif req.build? Requirement.prune unless includes.include?("build?") + elsif req.test? + Requirement.prune unless includes.include?("test?") end end else @@ -191,6 +203,7 @@ module Homebrew dependables = reqs + deps dependables = dependables.reject(&:optional?) unless ARGV.include?("--include-optional") dependables = dependables.reject(&:build?) unless ARGV.include?("--include-build") + dependables = dependables.reject(&:test) unless ARGV.include?("--include-test") dependables = dependables.reject(&:recommended?) if ARGV.include?("--skip-recommended") max = dependables.length - 1 @dep_stack.push f.name diff --git a/Library/Homebrew/dependable.rb b/Library/Homebrew/dependable.rb index 785eb94d8f..8722188388 100644 --- a/Library/Homebrew/dependable.rb +++ b/Library/Homebrew/dependable.rb @@ -1,7 +1,7 @@ require "options" module Dependable - RESERVED_TAGS = [:build, :optional, :recommended, :run, :linked].freeze + RESERVED_TAGS = [:build, :optional, :recommended, :run, :test, :linked].freeze def build? tags.include? :build @@ -19,8 +19,12 @@ module Dependable tags.include? :run end + def test? + tags.include? :test + end + def required? - !build? && !optional? && !recommended? + !build? && !test? && !optional? && !recommended? end def option_tags diff --git a/Library/Homebrew/dev-cmd/test.rb b/Library/Homebrew/dev-cmd/test.rb index 6622a8c257..6ff3b92014 100644 --- a/Library/Homebrew/dev-cmd/test.rb +++ b/Library/Homebrew/dev-cmd/test.rb @@ -45,6 +45,15 @@ module Homebrew next end + # Don't test formulae missing test dependencies + missing_test_deps = f.recursive_dependencies do |_, dependency| + Dependency.prune if !dependency.required? && !dependency.test? + end.map(&:to_s) + unless missing_test_deps.empty? + ofail "#{f.full_name} is missing test dependencies: #{missing_test_deps.join(" ")}" + next + end + puts "Testing #{f.full_name}" env = ENV.to_hash diff --git a/docs/Manpage.md b/docs/Manpage.md index ff33466856..05dc010d18 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -96,7 +96,8 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note By default, `deps` shows required and recommended dependencies for `formulae`. To include the `:build` type dependencies, pass `--include-build`. - Similarly, pass `--include-optional` to include `:optional` dependencies. + Similarly, pass `--include-optional` to include `:optional` dependencies or + `--include-test` to include `:test` dependencies. To skip `:recommended` type dependencies, pass `--skip-recommended`. To include requirements in addition to dependencies, pass `--include-requirements`. @@ -109,8 +110,8 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note If `--installed` is passed, output a tree for every installed formula. The `filters` placeholder is any combination of options `--include-build`, - `--include-optional`, `--skip-recommended`, and `--include-requirements` as - documented above. + `--include-optional`, `--include-test`, `--skip-recommended`, and + `--include-requirements` as documented above. If `--annotate` is passed, the build, optional, and recommended dependencies are marked as such in the output. @@ -121,7 +122,8 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note dependencies of that formula. The `filters` placeholder is any combination of options `--include-build`, - `--include-optional`, and `--skip-recommended` as documented above. + `--include-optional`, `--include-test`, and `--skip-recommended` as + documented above. * `desc` `formula`: Display `formula`'s name and one-line description. diff --git a/manpages/brew-cask.1 b/manpages/brew-cask.1 index 29905fcce1..6b32a90518 100644 --- a/manpages/brew-cask.1 +++ b/manpages/brew-cask.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BREW\-CASK" "1" "February 2018" "Homebrew" "brew-cask" +.TH "BREW\-CASK" "1" "March 2018" "Homebrew" "brew-cask" . .SH "NAME" \fBbrew\-cask\fR \- a friendly binary installer for macOS diff --git a/manpages/brew.1 b/manpages/brew.1 index 60cd7cc808..695bc122e1 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BREW" "1" "February 2018" "Homebrew" "brew" +.TH "BREW" "1" "March 2018" "Homebrew" "brew" . .SH "NAME" \fBbrew\fR \- The missing package manager for macOS @@ -107,7 +107,7 @@ If \fB\-\-full\-name\fR is passed, list dependencies by their full name\. If \fB\-\-installed\fR is passed, only list those dependencies that are currently installed\. . .IP -By default, \fBdeps\fR shows required and recommended dependencies for \fIformulae\fR\. To include the \fB:build\fR type dependencies, pass \fB\-\-include\-build\fR\. Similarly, pass \fB\-\-include\-optional\fR to include \fB:optional\fR dependencies\. To skip \fB:recommended\fR type dependencies, pass \fB\-\-skip\-recommended\fR\. To include requirements in addition to dependencies, pass \fB\-\-include\-requirements\fR\. +By default, \fBdeps\fR shows required and recommended dependencies for \fIformulae\fR\. To include the \fB:build\fR type dependencies, pass \fB\-\-include\-build\fR\. Similarly, pass \fB\-\-include\-optional\fR to include \fB:optional\fR dependencies or \fB\-\-include\-test\fR to include \fB:test\fR dependencies\. To skip \fB:recommended\fR type dependencies, pass \fB\-\-skip\-recommended\fR\. To include requirements in addition to dependencies, pass \fB\-\-include\-requirements\fR\. . .TP \fBdeps\fR \fB\-\-tree\fR [\fB\-\-1\fR] [\fIfilters\fR] [\fB\-\-annotate\fR] (\fIformulae\fR|\fB\-\-installed\fR) @@ -120,7 +120,7 @@ If \fB\-\-1\fR is passed, only one level of children is displayed\. If \fB\-\-installed\fR is passed, output a tree for every installed formula\. . .IP -The \fIfilters\fR placeholder is any combination of options \fB\-\-include\-build\fR, \fB\-\-include\-optional\fR, \fB\-\-skip\-recommended\fR, and \fB\-\-include\-requirements\fR as documented above\. +The \fIfilters\fR placeholder is any combination of options \fB\-\-include\-build\fR, \fB\-\-include\-optional\fR, \fB\-\-include\-test\fR, \fB\-\-skip\-recommended\fR, and \fB\-\-include\-requirements\fR as documented above\. . .IP If \fB\-\-annotate\fR is passed, the build, optional, and recommended dependencies are marked as such in the output\. @@ -130,7 +130,7 @@ If \fB\-\-annotate\fR is passed, the build, optional, and recommended dependenci Show dependencies for installed or all available formulae\. Every line of output starts with the formula name, followed by a colon and all direct dependencies of that formula\. . .IP -The \fIfilters\fR placeholder is any combination of options \fB\-\-include\-build\fR, \fB\-\-include\-optional\fR, and \fB\-\-skip\-recommended\fR as documented above\. +The \fIfilters\fR placeholder is any combination of options \fB\-\-include\-build\fR, \fB\-\-include\-optional\fR, \fB\-\-include\-test\fR, and \fB\-\-skip\-recommended\fR as documented above\. . .TP \fBdesc\fR \fIformula\fR From 4f1a3ee8dca1eb3e8ccfb116a5ffef6a654b8fd6 Mon Sep 17 00:00:00 2001 From: lboogaard Date: Mon, 5 Mar 2018 13:31:13 +0100 Subject: [PATCH 18/47] Update Homebrew-and-Python to describe install I believe the Homebrew-and-Python page could use a description on how to exactly install Python 2.X and 3.X with Homebrew. The syntax is written to my best knowledge (but likely wrong), please update this so that it is correct. Finding out the correct syntax is what actually motivated me to update this page in the first place. I'm hoping that this will clarify to the community (or at least me) on how to exactly install Python 2.X and 3.X with Homebrew. Keep up the amazing work! --- docs/Homebrew-and-Python.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/docs/Homebrew-and-Python.md b/docs/Homebrew-and-Python.md index 6d24b214f4..a50e2da52e 100644 --- a/docs/Homebrew-and-Python.md +++ b/docs/Homebrew-and-Python.md @@ -9,7 +9,26 @@ Homebrew provides formulae to brew 3.x and a more up-to-date Python 2.7.x. **Important:** If you choose to install a Python which isn't either of these two (system Python or brewed Python), the Homebrew team cannot support any breakage that may occur. ## Python 3.x or Python 2.x -Homebrew provides one formula for Python 2.7.x and another for Python 3.x. The executables are organized as follows so that Python 2 and Python 3 can both be installed without conflict: +Homebrew provides one formula for Python 2.7.x and another for Python 3.x. + +To install Python 3.X with Homebrew: + +`brew install python` +or +`brew install python3` + +To (optionally) install Python 2.X with Homebrew: + +`brew install python2` +or +`brew install python@2` + +For Python 2.X only: if you want to be able to call `python2` from the path, add the following line to your `~/.bash_profile` (or equivalent). For more information, see the formula's caveats. + +`export PATH="/usr/local/opt/python@2/libexec/bin:$PATH"` + + +The executables are organized as follows so that Python 2 and Python 3 can both be installed without conflict: * `python` and `python3` point to Homebrew's Python 3.x (if installed) otherwise the macOS system Python * `python2` points to Homebrew's Python 2.7.x (if installed) * `pip` and `pip3` point to Homebrew's Python 3.x's pip (if installed) From e08695028cd4d0c31c4c45c44003807247d119eb Mon Sep 17 00:00:00 2001 From: lboogaard Date: Mon, 5 Mar 2018 16:47:17 +0100 Subject: [PATCH 19/47] Update Homebrew-and-Python.md --- docs/Homebrew-and-Python.md | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/docs/Homebrew-and-Python.md b/docs/Homebrew-and-Python.md index a50e2da52e..4f72d0f81e 100644 --- a/docs/Homebrew-and-Python.md +++ b/docs/Homebrew-and-Python.md @@ -9,24 +9,7 @@ Homebrew provides formulae to brew 3.x and a more up-to-date Python 2.7.x. **Important:** If you choose to install a Python which isn't either of these two (system Python or brewed Python), the Homebrew team cannot support any breakage that may occur. ## Python 3.x or Python 2.x -Homebrew provides one formula for Python 2.7.x and another for Python 3.x. - -To install Python 3.X with Homebrew: - -`brew install python` -or -`brew install python3` - -To (optionally) install Python 2.X with Homebrew: - -`brew install python2` -or -`brew install python@2` - -For Python 2.X only: if you want to be able to call `python2` from the path, add the following line to your `~/.bash_profile` (or equivalent). For more information, see the formula's caveats. - -`export PATH="/usr/local/opt/python@2/libexec/bin:$PATH"` - +Homebrew provides one formula for Python 3.x (`python`) and another for Python 2.7.x (`python@2`) The executables are organized as follows so that Python 2 and Python 3 can both be installed without conflict: * `python` and `python3` point to Homebrew's Python 3.x (if installed) otherwise the macOS system Python From 776479845347195d222b3a7855d7fce83cd9e115 Mon Sep 17 00:00:00 2001 From: lboogaard Date: Mon, 5 Mar 2018 16:51:51 +0100 Subject: [PATCH 20/47] Update Homebrew-and-Python.md --- docs/Homebrew-and-Python.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Homebrew-and-Python.md b/docs/Homebrew-and-Python.md index 4f72d0f81e..3a4c0052ae 100644 --- a/docs/Homebrew-and-Python.md +++ b/docs/Homebrew-and-Python.md @@ -9,7 +9,7 @@ Homebrew provides formulae to brew 3.x and a more up-to-date Python 2.7.x. **Important:** If you choose to install a Python which isn't either of these two (system Python or brewed Python), the Homebrew team cannot support any breakage that may occur. ## Python 3.x or Python 2.x -Homebrew provides one formula for Python 3.x (`python`) and another for Python 2.7.x (`python@2`) +Homebrew provides one formula for Python 3.x (`python`) and another for Python 2.7.x (`python@2`). The executables are organized as follows so that Python 2 and Python 3 can both be installed without conflict: * `python` and `python3` point to Homebrew's Python 3.x (if installed) otherwise the macOS system Python From 4af8950f8b9b0ffd9a8a1a59ad21219a31947386 Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Mon, 5 Mar 2018 09:51:27 -0800 Subject: [PATCH 21/47] check_undeclared_deps: Fix for taps undeclared_deps reported all dependencies in taps as undeclared. --- Library/Homebrew/linkage_checker.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/linkage_checker.rb b/Library/Homebrew/linkage_checker.rb index cf6c12f22c..fb1aba067e 100644 --- a/Library/Homebrew/linkage_checker.rb +++ b/Library/Homebrew/linkage_checker.rb @@ -63,7 +63,7 @@ class LinkageChecker formula.build.without?(dep) end declared_deps = formula.deps.reject { |dep| filter_out.call(dep) }.map(&:name) - recursive_deps = keg.to_formula.runtime_dependencies.map { |dep| dep.to_formula.full_name } + recursive_deps = keg.to_formula.runtime_dependencies.map { |dep| dep.to_formula.name } declared_dep_names = declared_deps.map { |dep| dep.split("/").last } indirect_deps = [] undeclared_deps = [] From 5500c3b25ecea60029833c79b8c2a549f38176a0 Mon Sep 17 00:00:00 2001 From: Shaun Jackman Date: Sun, 4 Mar 2018 11:51:06 -0800 Subject: [PATCH 22/47] unzip_dep_if_needed: Needs unzip not zip [Linux] (#632) --- Library/Homebrew/dependency_collector.rb | 6 +++--- .../Homebrew/test/os/linux/dependency_collector_spec.rb | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Library/Homebrew/dependency_collector.rb b/Library/Homebrew/dependency_collector.rb index 7d3b90f9c6..74f42a6aaf 100644 --- a/Library/Homebrew/dependency_collector.rb +++ b/Library/Homebrew/dependency_collector.rb @@ -70,8 +70,8 @@ class DependencyCollector Dependency.new("xz", tags) unless which("xz") end - def zip_dep_if_needed(tags) - Dependency.new("zip", tags) unless which("zip") + def unzip_dep_if_needed(tags) + Dependency.new("unzip", tags) unless which("unzip") end def bzip2_dep_if_needed(tags) @@ -166,7 +166,7 @@ class DependencyCollector def parse_url_spec(url, tags) case File.extname(url) when ".xz" then xz_dep_if_needed(tags) - when ".zip" then zip_dep_if_needed(tags) + when ".zip" then unzip_dep_if_needed(tags) when ".bz2" then bzip2_dep_if_needed(tags) when ".lha", ".lzh" then Dependency.new("lha", tags) when ".lz" then Dependency.new("lzip", tags) diff --git a/Library/Homebrew/test/os/linux/dependency_collector_spec.rb b/Library/Homebrew/test/os/linux/dependency_collector_spec.rb index 543ed39b0b..a8f85b4cac 100644 --- a/Library/Homebrew/test/os/linux/dependency_collector_spec.rb +++ b/Library/Homebrew/test/os/linux/dependency_collector_spec.rb @@ -10,7 +10,7 @@ describe DependencyCollector do describe "#add" do resource = Resource.new - context "when xz, zip, and bzip2 are not available" do + context "when xz, unzip, and bzip2 are not available" do it "creates a resource dependency from a '.xz' URL" do resource.url("http://example.com/foo.xz") allow_any_instance_of(Object).to receive(:which).with("xz") @@ -19,8 +19,8 @@ describe DependencyCollector do it "creates a resource dependency from a '.zip' URL" do resource.url("http://example.com/foo.zip") - allow_any_instance_of(Object).to receive(:which).with("zip") - expect(subject.add(resource)).to eq(Dependency.new("zip", [:build])) + allow_any_instance_of(Object).to receive(:which).with("unzip") + expect(subject.add(resource)).to eq(Dependency.new("unzip", [:build])) end it "creates a resource dependency from a '.bz2' URL" do @@ -39,7 +39,7 @@ describe DependencyCollector do it "does not create a resource dependency from a '.zip' URL" do resource.url("http://example.com/foo.zip") - allow_any_instance_of(Object).to receive(:which).with("zip").and_return(Pathname.new("foo")) + allow_any_instance_of(Object).to receive(:which).with("unzip").and_return(Pathname.new("foo")) expect(subject.add(resource)).to be nil end From 11817fe1f7d9abf9960fc42598f13c12699d5889 Mon Sep 17 00:00:00 2001 From: Nikoli Dryden Date: Mon, 5 Mar 2018 19:44:11 -0600 Subject: [PATCH 23/47] Generalize the regex determining the Xcode version. The current regex only matches a single digit for each component of the version (e.g. 9.2). This modifies it to match multiple digits in each component, so that e.g. 10.42 will be matched. --- Library/Homebrew/os/mac/xcode.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/os/mac/xcode.rb b/Library/Homebrew/os/mac/xcode.rb index f977a066da..2e4ec63819 100644 --- a/Library/Homebrew/os/mac/xcode.rb +++ b/Library/Homebrew/os/mac/xcode.rb @@ -131,7 +131,7 @@ module OS xcodebuild_output = Utils.popen_read(xcodebuild_path, "-version") next unless $CHILD_STATUS.success? - xcode_version = xcodebuild_output[/Xcode (\d(\.\d)*)/, 1] + xcode_version = xcodebuild_output[/Xcode (\d+(\.\d+)*)/, 1] return xcode_version if xcode_version # Xcode 2.x's xcodebuild has a different version string From 7cb6ebf3fb2e76b4b2a9ebe15ae7af1f33e13ac1 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 6 Mar 2018 08:44:47 +0000 Subject: [PATCH 24/47] super: refactor LLVM path addition. --- Library/Homebrew/extend/ENV/super.rb | 31 ++++++++++------------------ 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb index c3806d421e..8d53436111 100644 --- a/Library/Homebrew/extend/ENV/super.rb +++ b/Library/Homebrew/extend/ENV/super.rb @@ -173,31 +173,22 @@ module Superenv end def determine_library_paths + paths = [ + keg_only_deps.map(&:opt_lib), + HOMEBREW_PREFIX/"lib", + ] + if compiler == :llvm_clang if MacOS::CLT.installed? - PATH.new( - keg_only_deps.map(&:opt_lib), - HOMEBREW_PREFIX/"lib", - "/usr/lib", - Formula["llvm"].opt_lib.to_s, - homebrew_extra_library_paths, - ).existing + paths << "/usr/lib" else - PATH.new( - keg_only_deps.map(&:opt_lib), - HOMEBREW_PREFIX/"lib", - "#{MacOS.sdk_path}/usr/lib", - Formula["llvm"].opt_lib.to_s, - homebrew_extra_library_paths, - ).existing + paths << "#{MacOS.sdk_path}/usr/lib" end - else - PATH.new( - keg_only_deps.map(&:opt_lib), - HOMEBREW_PREFIX/"lib", - homebrew_extra_library_paths, - ).existing + paths << Formula["llvm"].opt_lib.to_s end + + paths << homebrew_extra_library_paths + PATH.new(paths).existing end def determine_dependencies From 740e89d2f329d4d114defc3f286433fb802e7b64 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 7 Mar 2018 15:00:08 +0000 Subject: [PATCH 25/47] super: tweak LLVM refactoring. --- Library/Homebrew/extend/ENV/super.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb index 8d53436111..660b9b3a3c 100644 --- a/Library/Homebrew/extend/ENV/super.rb +++ b/Library/Homebrew/extend/ENV/super.rb @@ -187,7 +187,7 @@ module Superenv paths << Formula["llvm"].opt_lib.to_s end - paths << homebrew_extra_library_paths + paths += homebrew_extra_library_paths PATH.new(paths).existing end From 1f46c8edb560560fddbb1301261e1382a5c3c803 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 7 Mar 2018 15:09:08 +0000 Subject: [PATCH 26/47] brew: pass through `TRAVIS_` variables. --- bin/brew | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/brew b/bin/brew index b3a4d62720..4a874ab9a7 100755 --- a/bin/brew +++ b/bin/brew @@ -66,9 +66,9 @@ then FILTERED_ENV=() # Filter all but the specific variables. - for VAR in HOME SHELL PATH TERM LOGNAME USER CI TRAVIS TRAVIS_SUDO SSH_AUTH_SOCK SUDO_ASKPASS \ + for VAR in HOME SHELL PATH TERM LOGNAME USER CI TRAVIS SSH_AUTH_SOCK SUDO_ASKPASS \ http_proxy https_proxy ftp_proxy no_proxy all_proxy HTTPS_PROXY FTP_PROXY ALL_PROXY \ - "${!HOMEBREW_@}" + "${!HOMEBREW_@}" "${!TRAVIS_@}" do # Skip if variable value is empty. [[ -z "${!VAR}" ]] && continue From 3db033ca89bd86956bdaadaa515a079aee69d9e0 Mon Sep 17 00:00:00 2001 From: Chongyu Zhu Date: Thu, 8 Mar 2018 13:02:03 +0800 Subject: [PATCH 27/47] keg: `delete_pyc_files!` should also remove `__pycache__` --- Library/Homebrew/keg.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index e3b93fa728..550f657348 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -519,6 +519,7 @@ class Keg def delete_pyc_files! find { |pn| pn.delete if %w[.pyc .pyo].include?(pn.extname) } + find { |pn| pn.delete if pn.basename.to_s == "__pycache__" } end private From f87a5891298d60335042f2d0b4fd601c38bf619f Mon Sep 17 00:00:00 2001 From: ilovezfs Date: Wed, 7 Mar 2018 22:35:23 -0800 Subject: [PATCH 28/47] keg: don't delete main opt links of other formulae. If an old alias, according to the tab, of a formula being upgraded (e.g. python) has the same name as the main opt link of some other formula (e.g. python@2), don't remove the main opt link of that other formula. Specifically, brew install python@2 brew upgrade python should not accidentally delete /usr/local/opt/python@2 even though python@2 used to be an alias of python. --- Library/Homebrew/keg.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index e3b93fa728..d62304336b 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -256,7 +256,11 @@ class Keg aliases.each do |a| alias_symlink = opt/a - alias_symlink.delete if alias_symlink.symlink? || alias_symlink.exist? + if alias_symlink.symlink? && alias_symlink.exist? + alias_symlink.delete if alias_symlink.realpath == opt_record.realpath + elsif alias_symlink.symlink? || alias_symlink.exist? + alias_symlink.delete + end end Pathname.glob("#{opt_record}@*").each do |a| From 8e928992f5d2a1bbc39b295e2d2a9a2565ecec2a Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 8 Mar 2018 08:17:57 +0000 Subject: [PATCH 29/47] keg: tweak delete_pyc_files! --- Library/Homebrew/keg.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index 550f657348..cf42b8c797 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -518,8 +518,11 @@ class Keg end def delete_pyc_files! - find { |pn| pn.delete if %w[.pyc .pyo].include?(pn.extname) } - find { |pn| pn.delete if pn.basename.to_s == "__pycache__" } + find do |path| + if %w[.pyc .pyo].include?(pn.extname) || pn.basename.to_s == "__pycache__" + path.delete + end + end end private From 8860402f8fcb81e9f9630fd4fac19da7c7703f52 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 8 Mar 2018 08:22:47 +0000 Subject: [PATCH 30/47] utils: only try and replace tap or replaced methods. --- Library/Homebrew/utils.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 88abd53f89..3de0c8dfe2 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -109,11 +109,7 @@ def odeprecated(method, replacement = nil, disable: false, disable_on: nil, call if ARGV.homebrew_developer? || disable || Homebrew.raise_deprecation_exceptions? - if caller_message.match?(HOMEBREW_LIBRARY_PATH/"cmd") || - caller_message.match?(HOMEBREW_LIBRARY_PATH/"dev-cmd") && - replacement_message == "There is no replacement." - developer_message = message - else + if replacement || tap developer_message = message + "Or, even better, submit a PR to fix it!" end raise MethodDeprecatedError, developer_message From 36dadbee474cdb80e8a66a410d97179665d2bf64 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 8 Mar 2018 08:33:21 +0000 Subject: [PATCH 31/47] caveats: remove python caveats. These instructions are currently incorrect and need to be ported to `python` 3.x and `python@2` formulae. Until then it's better to not have them than have them be incorrect. Closes #3890. --- Library/Homebrew/caveats.rb | 48 --------------------------- Library/Homebrew/test/caveats_spec.rb | 40 ---------------------- 2 files changed, 88 deletions(-) diff --git a/Library/Homebrew/caveats.rb b/Library/Homebrew/caveats.rb index 8cd1053fbf..a289a12202 100644 --- a/Library/Homebrew/caveats.rb +++ b/Library/Homebrew/caveats.rb @@ -25,7 +25,6 @@ class Caveats caveats << function_completion_caveats(:zsh) caveats << function_completion_caveats(:fish) caveats << plist_caveats - caveats << python_caveats caveats << elisp_caveats caveats.compact.join("\n") end @@ -108,53 +107,6 @@ class Caveats end end - def python_caveats - return unless keg - return unless keg.python_site_packages_installed? - - s = nil - homebrew_site_packages = Language::Python.homebrew_site_packages - user_site_packages = Language::Python.user_site_packages "python" - pth_file = user_site_packages/"homebrew.pth" - instructions = <<~EOS.gsub(/^/, " ") - mkdir -p #{user_site_packages} - echo 'import site; site.addsitedir("#{homebrew_site_packages}")' >> #{pth_file} - EOS - - if f.keg_only? - keg_site_packages = f.opt_prefix/"lib/python2.7/site-packages" - unless Language::Python.in_sys_path?("python", keg_site_packages) - s = <<~EOS - If you need Python to find bindings for this keg-only formula, run: - echo #{keg_site_packages} >> #{homebrew_site_packages/f.name}.pth - EOS - s += instructions unless Language::Python.reads_brewed_pth_files?("python") - end - return s - end - - return if Language::Python.reads_brewed_pth_files?("python") - - if !Language::Python.in_sys_path?("python", homebrew_site_packages) - s = <<~EOS - Python modules have been installed and Homebrew's site-packages is not - in your Python sys.path, so you will not be able to import the modules - this formula installed. If you plan to develop with these modules, - please run: - EOS - s += instructions - elsif keg.python_pth_files_installed? - s = <<~EOS - This formula installed .pth files to Homebrew's site-packages and your - Python isn't configured to process them, so you will not be able to - import the modules this formula installed. If you plan to develop - with these modules, please run: - EOS - s += instructions - end - s - end - def elisp_caveats return if f.keg_only? return unless keg diff --git a/Library/Homebrew/test/caveats_spec.rb b/Library/Homebrew/test/caveats_spec.rb index 96ed7ea179..ec256f3e61 100644 --- a/Library/Homebrew/test/caveats_spec.rb +++ b/Library/Homebrew/test/caveats_spec.rb @@ -201,45 +201,5 @@ describe Caveats do expect(caveats).to include(HOMEBREW_PREFIX/"share/fish/vendor_completions.d") end end - - context "python caveats" do - before do - (f.prefix.resolved_path/"lib/python2.7/site-packages").mkpath - end - - context "when f is not keg_only" do - let(:f) { - formula do - url "foo-1.0" - end - } - let(:caveats) { described_class.new(f).caveats } - let(:user_site_packages) { Language::Python.user_site_packages("python") } - - it "give commands to run when Homebrew's site-packages is not in Python sys.path" do - expect(caveats).to include("Homebrew's site-packages is not\nin your Python sys.path") - expect(caveats).to include(user_site_packages) - expect(caveats).to include("import site") - end - - it "gives commands to run when python pth files are installed" do - allow(Homebrew).to receive(:_system).and_return(true) - allow(Dir).to receive(:[]).with(any_args).and_return(["blah.pth"]) - expect(caveats).to include(".pth files to Homebrew's site-packages and your\nPython isn't configured") - expect(caveats).to include(user_site_packages) - expect(caveats).to include("import site") - end - end - - it "gives commands to run when formula is keg_only" do - f = formula do - url "foo-1.0" - keg_only "some reason" - end - caveats = described_class.new(f).caveats - homebrew_site_packages = Language::Python.homebrew_site_packages - expect(caveats).to include("echo #{f.opt_prefix}/lib/python2.7/site-packages >> #{homebrew_site_packages/f.name}.pth") - end - end end end From d32fc4508fafd80665747083299fb9eb5700ea7d Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 8 Mar 2018 08:36:01 +0000 Subject: [PATCH 32/47] deps: fix test? typo. --- Library/Homebrew/cmd/deps.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb index 4ba438baac..8beb84e408 100644 --- a/Library/Homebrew/cmd/deps.rb +++ b/Library/Homebrew/cmd/deps.rb @@ -203,7 +203,7 @@ module Homebrew dependables = reqs + deps dependables = dependables.reject(&:optional?) unless ARGV.include?("--include-optional") dependables = dependables.reject(&:build?) unless ARGV.include?("--include-build") - dependables = dependables.reject(&:test) unless ARGV.include?("--include-test") + dependables = dependables.reject(&:test?) unless ARGV.include?("--include-test") dependables = dependables.reject(&:recommended?) if ARGV.include?("--skip-recommended") max = dependables.length - 1 @dep_stack.push f.name From 948b1b8dbeb7bce35d5b0ecc45b14ac50d4eee93 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 8 Mar 2018 08:37:34 +0000 Subject: [PATCH 33/47] keg: fix delete_pyc_files path typo. --- Library/Homebrew/keg.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index cf42b8c797..618c847a4c 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -519,7 +519,7 @@ class Keg def delete_pyc_files! find do |path| - if %w[.pyc .pyo].include?(pn.extname) || pn.basename.to_s == "__pycache__" + if %w[.pyc .pyo].include?(path.extname) || path.basename.to_s == "__pycache__" path.delete end end From 42fc339ee6b81e8b303eae388fe8016ae85e8d79 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 8 Mar 2018 08:56:31 +0000 Subject: [PATCH 34/47] test: correctly prune non-test dependencies. --- Library/Homebrew/dev-cmd/test.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/dev-cmd/test.rb b/Library/Homebrew/dev-cmd/test.rb index 6ff3b92014..56f439e3e0 100644 --- a/Library/Homebrew/dev-cmd/test.rb +++ b/Library/Homebrew/dev-cmd/test.rb @@ -47,7 +47,10 @@ module Homebrew # Don't test formulae missing test dependencies missing_test_deps = f.recursive_dependencies do |_, dependency| - Dependency.prune if !dependency.required? && !dependency.test? + Dependency.prune if dependency.installed? + next if dependency.test? + Dependency.prune if dependency.optional? + Dependency.prune if dependency.build? end.map(&:to_s) unless missing_test_deps.empty? ofail "#{f.full_name} is missing test dependencies: #{missing_test_deps.join(" ")}" From e906ec374bd8e18b38f977f19738a023cf038737 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 8 Mar 2018 09:18:49 +0000 Subject: [PATCH 35/47] Revert "keg: fix delete_pyc_files path typo." This reverts commit 948b1b8dbeb7bce35d5b0ecc45b14ac50d4eee93. --- Library/Homebrew/keg.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index 5c74cbd6a3..3e93cc6231 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -523,7 +523,7 @@ class Keg def delete_pyc_files! find do |path| - if %w[.pyc .pyo].include?(path.extname) || path.basename.to_s == "__pycache__" + if %w[.pyc .pyo].include?(pn.extname) || pn.basename.to_s == "__pycache__" path.delete end end From 6788e78c03af71f6ef3bebd06811517871573220 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 8 Mar 2018 09:18:52 +0000 Subject: [PATCH 36/47] Revert "keg: tweak delete_pyc_files!" This reverts commit 8e928992f5d2a1bbc39b295e2d2a9a2565ecec2a. --- Library/Homebrew/keg.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index 3e93cc6231..4c81de33aa 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -522,11 +522,8 @@ class Keg end def delete_pyc_files! - find do |path| - if %w[.pyc .pyo].include?(pn.extname) || pn.basename.to_s == "__pycache__" - path.delete - end - end + find { |pn| pn.delete if %w[.pyc .pyo].include?(pn.extname) } + find { |pn| pn.delete if pn.basename.to_s == "__pycache__" } end private From 924c4af3de99f1f7dfef3acdcb03de2bcc9af0ee Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Thu, 8 Mar 2018 09:46:53 +0000 Subject: [PATCH 37/47] dep*: fix more :test dependency resolution. --- Library/Homebrew/cmd/deps.rb | 10 ++++++---- Library/Homebrew/dependency.rb | 5 +++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb index 8beb84e408..40aa2f413d 100644 --- a/Library/Homebrew/cmd/deps.rb +++ b/Library/Homebrew/cmd/deps.rb @@ -144,23 +144,25 @@ module Homebrew deps = f.recursive_dependencies do |dependent, dep| if dep.recommended? Dependency.prune if ignores.include?("recommended?") || dependent.build.without?(dep) + elsif dep.test? + next if includes.include?("test?") + Dependency.prune elsif dep.optional? Dependency.prune if !includes.include?("optional?") && !dependent.build.with?(dep) elsif dep.build? Dependency.prune unless includes.include?("build?") - elsif dep.test? - Dependency.prune unless includes.include?("test?") end end reqs = f.recursive_requirements do |dependent, req| if req.recommended? Requirement.prune if ignores.include?("recommended?") || dependent.build.without?(req) + elsif req.test? + next if includes.include?("test?") + Requirement.prune elsif req.optional? Requirement.prune if !includes.include?("optional?") && !dependent.build.with?(req) elsif req.build? Requirement.prune unless includes.include?("build?") - elsif req.test? - Requirement.prune unless includes.include?("test?") end end else diff --git a/Library/Homebrew/dependency.rb b/Library/Homebrew/dependency.rb index 7f0e7fbffe..7ae0703609 100644 --- a/Library/Homebrew/dependency.rb +++ b/Library/Homebrew/dependency.rb @@ -143,8 +143,9 @@ class Dependency private def merge_tags(deps) - options = deps.flat_map(&:option_tags).uniq - merge_necessity(deps) + merge_temporality(deps) + options + other_tags = deps.flat_map(&:option_tags).uniq + other_tags << :test if deps.flat_map(&:tags).include?(:test) + merge_necessity(deps) + merge_temporality(deps) + other_tags end def merge_necessity(deps) From b165f5427f10872ba95f3fb152e68cbee28dd2f8 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 5 Mar 2018 11:09:24 +0000 Subject: [PATCH 38/47] RuboCop 0.53.0 --- Library/Homebrew/constants.rb | 4 ++-- Library/Homebrew/test/Gemfile.lock | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/constants.rb b/Library/Homebrew/constants.rb index 9514320abe..77c69f3e43 100644 --- a/Library/Homebrew/constants.rb +++ b/Library/Homebrew/constants.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true # RuboCop version used for `brew style` and `brew cask style` -HOMEBREW_RUBOCOP_VERSION = "0.52.1" -HOMEBREW_RUBOCOP_CASK_VERSION = "~> 0.16.0" # has to be updated when RuboCop version changes +HOMEBREW_RUBOCOP_VERSION = "0.53.0" +HOMEBREW_RUBOCOP_CASK_VERSION = "~> 0.17.0" # has to be updated when RuboCop version changes diff --git a/Library/Homebrew/test/Gemfile.lock b/Library/Homebrew/test/Gemfile.lock index 0d43174e98..b69a5f0a71 100644 --- a/Library/Homebrew/test/Gemfile.lock +++ b/Library/Homebrew/test/Gemfile.lock @@ -36,9 +36,9 @@ GEM rspec-support (3.7.1) rspec-wait (0.0.9) rspec (>= 3, < 4) - rubocop (0.52.1) + rubocop (0.53.0) parallel (~> 1.10) - parser (>= 2.4.0.2, < 3.0) + parser (>= 2.5) powerpack (~> 0.1) rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) @@ -62,7 +62,7 @@ DEPENDENCIES rspec-its rspec-retry rspec-wait - rubocop (= 0.52.1) + rubocop (= 0.53.0) simplecov BUNDLED WITH From 718a2112d7b7292c6a6017b4d5bcfd185b68baea Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 5 Mar 2018 11:46:38 +0000 Subject: [PATCH 39/47] rubocop.yml: adjust rules for 0.53.0. --- Library/.rubocop.yml | 15 +++++++++++---- Library/Homebrew/.rubocop.yml | 4 ++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml index f43fbe54c0..c94b248a3b 100644 --- a/Library/.rubocop.yml +++ b/Library/.rubocop.yml @@ -26,6 +26,9 @@ Layout/CaseIndentation: Layout/EmptyLineBetweenDefs: AllowAdjacentOneLineDefs: true +Layout/EndAlignment: + EnforcedStyleAlignWith: variable + Layout/IndentArray: EnforcedStyle: special_inside_parentheses @@ -52,9 +55,6 @@ Lint/AmbiguousBlockAssociation: Lint/AssignmentInCondition: Enabled: false -Lint/EndAlignment: - EnforcedStyleAlignWith: variable - # so many of these in formulae and can't be autocorrected Lint/ParenthesesAsGroupedExpression: Enabled: false @@ -205,7 +205,10 @@ Style/TernaryParentheses: EnforcedStyle: require_parentheses_when_complex # makes diffs nicer -Style/TrailingCommaInLiteral: +Style/TrailingCommaInArrayLiteral: + EnforcedStyleForMultiline: comma + +Style/TrailingCommaInHashLiteral: EnforcedStyleForMultiline: comma Style/TrailingCommaInArguments: @@ -215,6 +218,10 @@ Style/TrailingCommaInArguments: Naming/VariableNumber: Enabled: false +# doesn't make sense for Homebrew/brew but does for taps +Naming/UncommunicativeMethodParamName: + Enabled: true + Style/WordArray: MinSize: 4 diff --git a/Library/Homebrew/.rubocop.yml b/Library/Homebrew/.rubocop.yml index e0089e0500..58b911ca9f 100644 --- a/Library/Homebrew/.rubocop.yml +++ b/Library/Homebrew/.rubocop.yml @@ -68,6 +68,10 @@ Naming/PredicateName: - 'compat/**/*' NameWhitelist: is_32_bit?, is_64_bit? +# f meaning formulae is pretty standard +Naming/UncommunicativeMethodParamName: + Enabled: false + Style/BlockDelimiters: Exclude: - '**/*_spec.rb' From e03f07f302345a0cb0241e5288c361e6c0b55a1d Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 6 Mar 2018 09:36:49 +0000 Subject: [PATCH 40/47] Rubocop 0.53.0 automatic fixes. --- Library/Homebrew/cmd/install.rb | 2 +- Library/Homebrew/cmd/reinstall.rb | 2 +- Library/Homebrew/cmd/upgrade.rb | 2 +- Library/Homebrew/diagnostic.rb | 4 ++-- Library/Homebrew/extend/os/linux/system_config.rb | 2 +- Library/Homebrew/formula_versions.rb | 2 +- Library/Homebrew/tab.rb | 4 ++-- Library/Homebrew/test/support/lib/config.rb | 4 ++-- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index e1e4712ea1..bacdb18f02 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -344,7 +344,7 @@ module Homebrew rescue FormulaInstallationAlreadyAttemptedError # We already attempted to install f as part of the dependency tree of # another formula. In that case, don't generate an error, just move on. - return + nil rescue CannotInstallFormulaError => e ofail e.message end diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb index 7c62d8092a..420c08dfe8 100644 --- a/Library/Homebrew/cmd/reinstall.rb +++ b/Library/Homebrew/cmd/reinstall.rb @@ -47,7 +47,7 @@ module Homebrew fi.install fi.finish rescue FormulaInstallationAlreadyAttemptedError - return + nil rescue Exception # rubocop:disable Lint/RescueException ignore_interrupts { restore_backup(keg, keg_was_linked) } raise diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index 1446025805..4e6dd04631 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -139,7 +139,7 @@ module Homebrew rescue FormulaInstallationAlreadyAttemptedError # We already attempted to upgrade f as part of the dependency tree of # another formula. In that case, don't generate an error, just move on. - return + nil rescue CannotInstallFormulaError => e ofail e rescue BuildError => e diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 79f5b2f1d0..1b779f226b 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -966,7 +966,7 @@ module Homebrew Putting non-prefixed coreutils in your path can cause gmp builds to fail. EOS rescue FormulaUnavailableError - return + nil end def check_for_non_prefixed_findutils @@ -981,7 +981,7 @@ module Homebrew Putting non-prefixed findutils in your path can cause python builds to fail. EOS rescue FormulaUnavailableError - return + nil end def check_for_pydistutils_cfg_in_home diff --git a/Library/Homebrew/extend/os/linux/system_config.rb b/Library/Homebrew/extend/os/linux/system_config.rb index cf01765623..47eca7697e 100644 --- a/Library/Homebrew/extend/os/linux/system_config.rb +++ b/Library/Homebrew/extend/os/linux/system_config.rb @@ -31,7 +31,7 @@ class SystemConfig return "N/A" unless CoreTap.instance.installed? Formulary.factory(formula).linked_version || "N/A" rescue FormulaUnavailableError - return "N/A" + "N/A" end def dump_verbose_config(out = $stdout) diff --git a/Library/Homebrew/formula_versions.rb b/Library/Homebrew/formula_versions.rb index c10c69e674..67edba9c5e 100644 --- a/Library/Homebrew/formula_versions.rb +++ b/Library/Homebrew/formula_versions.rb @@ -44,7 +44,7 @@ class FormulaVersions # continue walking the history ohai "#{e} in #{name} at revision #{rev}", e.backtrace if ARGV.debug? rescue FormulaUnavailableError - return + nil ensure Homebrew.raise_deprecation_exceptions = false end diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb index aa0208d51a..0fed724a8d 100644 --- a/Library/Homebrew/tab.rb +++ b/Library/Homebrew/tab.rb @@ -326,8 +326,8 @@ class Tab < OpenStruct "time" => time, "source_modified_time" => source_modified_time.to_i, "HEAD" => self.HEAD, - "stdlib" => (stdlib.to_s if stdlib), - "compiler" => (compiler.to_s if compiler), + "stdlib" => (stdlib&.to_s), + "compiler" => (compiler&.to_s), "aliases" => aliases, "runtime_dependencies" => runtime_dependencies, "source" => source, diff --git a/Library/Homebrew/test/support/lib/config.rb b/Library/Homebrew/test/support/lib/config.rb index e54fc111fa..a59d80c995 100644 --- a/Library/Homebrew/test/support/lib/config.rb +++ b/Library/Homebrew/test/support/lib/config.rb @@ -16,9 +16,9 @@ TEST_TMPDIR = ENV.fetch("HOMEBREW_TEST_TMPDIR") do |k| end # Paths pointing into the Homebrew code base that persist across test runs -HOMEBREW_LIBRARY_PATH = Pathname.new(File.expand_path("../../../..", __FILE__)) +HOMEBREW_LIBRARY_PATH = Pathname.new(File.expand_path("../../..", __dir__)) HOMEBREW_SHIMS_PATH = HOMEBREW_LIBRARY_PATH.parent+"Homebrew/shims" -HOMEBREW_LOAD_PATH = [File.expand_path("..", __FILE__), HOMEBREW_LIBRARY_PATH].join(":") +HOMEBREW_LOAD_PATH = [File.expand_path(__dir__), HOMEBREW_LIBRARY_PATH].join(":") # Paths redirected to a temporary directory and wiped at the end of the test run HOMEBREW_PREFIX = Pathname.new(TEST_TMPDIR).join("prefix") From 83cca40fc9cd921af229e5861fa78b2388fbc344 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 7 Mar 2018 16:14:55 +0000 Subject: [PATCH 41/47] RuboCop 0.53.0 manual fixes. --- Library/Homebrew/cask/lib/hbc/cask_loader.rb | 2 ++ Library/Homebrew/cmd/gist-logs.rb | 4 ++-- Library/Homebrew/cmd/update-report.rb | 2 +- Library/Homebrew/download_strategy.rb | 2 +- Library/Homebrew/rubocops/extend/formula_cop.rb | 2 ++ Library/Homebrew/sandbox.rb | 8 ++++---- Library/Homebrew/test/cmd/search_remote_tap_spec.rb | 2 +- Library/Homebrew/test/download_strategies_spec.rb | 2 +- Library/Homebrew/test/utils/analytics_spec.rb | 4 ++-- Library/Homebrew/utils/analytics.rb | 8 ++++---- Library/Homebrew/utils/bottles.rb | 2 +- Library/Homebrew/utils/git.rb | 4 ++-- Library/Homebrew/utils/github.rb | 10 +++++----- 13 files changed, 28 insertions(+), 24 deletions(-) diff --git a/Library/Homebrew/cask/lib/hbc/cask_loader.rb b/Library/Homebrew/cask/lib/hbc/cask_loader.rb index 74c39176d3..640282ec36 100644 --- a/Library/Homebrew/cask/lib/hbc/cask_loader.rb +++ b/Library/Homebrew/cask/lib/hbc/cask_loader.rb @@ -1,3 +1,5 @@ +require "uri" + module Hbc module CaskLoader class FromContentLoader diff --git a/Library/Homebrew/cmd/gist-logs.rb b/Library/Homebrew/cmd/gist-logs.rb index ab81a017e2..c30ee85cd9 100644 --- a/Library/Homebrew/cmd/gist-logs.rb +++ b/Library/Homebrew/cmd/gist-logs.rb @@ -113,14 +113,14 @@ module Homebrew url = "https://api.github.com/gists" data = { "public" => true, "files" => files, "description" => description } scopes = GitHub::CREATE_GIST_SCOPES - GitHub.open(url, data: data, scopes: scopes)["html_url"] + GitHub.open_api(url, data: data, scopes: scopes)["html_url"] end def create_issue(repo, title, body) url = "https://api.github.com/repos/#{repo}/issues" data = { "title" => title, "body" => body } scopes = GitHub::CREATE_ISSUE_SCOPES - GitHub.open(url, data: data, scopes: scopes)["html_url"] + GitHub.open_api(url, data: data, scopes: scopes)["html_url"] end def gist_logs diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb index 2c4d3de0c5..d241d17b06 100644 --- a/Library/Homebrew/cmd/update-report.rb +++ b/Library/Homebrew/cmd/update-report.rb @@ -13,7 +13,7 @@ module Homebrew module_function def update_preinstall_header - @header_already_printed ||= begin + @update_preinstall_header ||= begin ohai "Auto-updated Homebrew!" if ARGV.include?("--preinstall") true end diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index e85661d76d..6e750806f0 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -604,7 +604,7 @@ class GitHubPrivateRepositoryReleaseDownloadStrategy < GitHubPrivateRepositoryDo def fetch_release_metadata release_url = "https://api.github.com/repos/#{@owner}/#{@repo}/releases/tags/#{@tag}" - GitHub.open(release_url) + GitHub.open_api(release_url) end end diff --git a/Library/Homebrew/rubocops/extend/formula_cop.rb b/Library/Homebrew/rubocops/extend/formula_cop.rb index e53c02a449..2c20e62dec 100644 --- a/Library/Homebrew/rubocops/extend/formula_cop.rb +++ b/Library/Homebrew/rubocops/extend/formula_cop.rb @@ -4,6 +4,8 @@ require_relative "../../extend/string" module RuboCop module Cop class FormulaCop < Cop + include RangeHelp + attr_accessor :file_path @registry = Cop.registry diff --git a/Library/Homebrew/sandbox.rb b/Library/Homebrew/sandbox.rb index ea74fae098..e59e2a5500 100644 --- a/Library/Homebrew/sandbox.rb +++ b/Library/Homebrew/sandbox.rb @@ -108,10 +108,10 @@ class Sandbox unless logs.empty? if @logfile - log = open(@logfile, "w") - log.write logs - log.write "\nWe use time to filter sandbox log. Therefore, unrelated logs may be recorded.\n" - log.close + File.open(@logfile, "w") do |log| + log.write logs + log.write "\nWe use time to filter sandbox log. Therefore, unrelated logs may be recorded.\n" + end end if @failed && ARGV.verbose? diff --git a/Library/Homebrew/test/cmd/search_remote_tap_spec.rb b/Library/Homebrew/test/cmd/search_remote_tap_spec.rb index eb256b9245..49678f3ace 100644 --- a/Library/Homebrew/test/cmd/search_remote_tap_spec.rb +++ b/Library/Homebrew/test/cmd/search_remote_tap_spec.rb @@ -16,7 +16,7 @@ describe Homebrew do ], } - allow(GitHub).to receive(:open).and_yield(json_response) + allow(GitHub).to receive(:open_api).and_yield(json_response) expect(described_class.search_taps("some-formula")) .to match(["homebrew/foo/some-formula"]) diff --git a/Library/Homebrew/test/download_strategies_spec.rb b/Library/Homebrew/test/download_strategies_spec.rb index 7ad070fc44..f1c64db717 100644 --- a/Library/Homebrew/test/download_strategies_spec.rb +++ b/Library/Homebrew/test/download_strategies_spec.rb @@ -116,7 +116,7 @@ describe GitHubPrivateRepositoryReleaseDownloadStrategy do describe "#fetch_release_metadata" do it "fetches release metadata from GitHub" do expected_release_url = "https://api.github.com/repos/owner/repo/releases/tags/tag" - expect(GitHub).to receive(:open).with(expected_release_url).and_return({}) + expect(GitHub).to receive(:open_api).with(expected_release_url).and_return({}) subject.send(:fetch_release_metadata) end end diff --git a/Library/Homebrew/test/utils/analytics_spec.rb b/Library/Homebrew/test/utils/analytics_spec.rb index bb6cda0b12..4526194d81 100644 --- a/Library/Homebrew/test/utils/analytics_spec.rb +++ b/Library/Homebrew/test/utils/analytics_spec.rb @@ -3,9 +3,9 @@ require "formula_installer" describe Utils::Analytics do describe "::os_prefix_ci" do - context "when anonymous_os_prefix_ci is not set" do + context "when os_prefix_ci is not set" do before(:each) do - described_class.clear_anonymous_os_prefix_ci_cache + described_class.clear_os_prefix_ci end it "returns OS_VERSION and prefix when HOMEBREW_PREFIX is not /usr/local" do diff --git a/Library/Homebrew/utils/analytics.rb b/Library/Homebrew/utils/analytics.rb index adef3e811d..7636789c53 100644 --- a/Library/Homebrew/utils/analytics.rb +++ b/Library/Homebrew/utils/analytics.rb @@ -3,13 +3,13 @@ require "erb" module Utils module Analytics class << self - def clear_anonymous_os_prefix_ci_cache - return unless instance_variable_defined?(:@anonymous_os_prefix_ci) - remove_instance_variable(:@anonymous_os_prefix_ci) + def clear_os_prefix_ci + return unless instance_variable_defined?(:@os_prefix_ci) + remove_instance_variable(:@os_prefix_ci) end def os_prefix_ci - @anonymous_os_prefix_ci ||= begin + @os_prefix_ci ||= begin os = OS_VERSION prefix = ", non-/usr/local" if HOMEBREW_PREFIX.to_s != "/usr/local" ci = ", CI" if ENV["CI"] diff --git a/Library/Homebrew/utils/bottles.rb b/Library/Homebrew/utils/bottles.rb index 3a61cf215e..f67ace4c19 100644 --- a/Library/Homebrew/utils/bottles.rb +++ b/Library/Homebrew/utils/bottles.rb @@ -5,7 +5,7 @@ module Utils class Bottles class << self def tag - @bottle_tag ||= "#{ENV["HOMEBREW_PROCESSOR"]}_#{ENV["HOMEBREW_SYSTEM"]}".downcase.to_sym + @tag ||= "#{ENV["HOMEBREW_PROCESSOR"]}_#{ENV["HOMEBREW_SYSTEM"]}".downcase.to_sym end def built_as?(f) diff --git a/Library/Homebrew/utils/git.rb b/Library/Homebrew/utils/git.rb index ac17967c53..0ffcab7b1d 100644 --- a/Library/Homebrew/utils/git.rb +++ b/Library/Homebrew/utils/git.rb @@ -27,7 +27,7 @@ end module Utils def self.git_available? - @git ||= quiet_system HOMEBREW_SHIMS_PATH/"scm/git", "--version" + @git_available ||= quiet_system HOMEBREW_SHIMS_PATH/"scm/git", "--version" end def self.git_path @@ -61,7 +61,7 @@ module Utils end def self.clear_git_available_cache - @git = nil + @git_available = nil @git_path = nil @git_version = nil end diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index 0166763234..b6a27b3283 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -94,7 +94,7 @@ module GitHub def api_credentials_error_message(response_headers, needed_scopes) return if response_headers.empty? - @api_credentials_error_message_printed ||= begin + @api_credentials_error_message ||= begin unauthorized = (response_headers["http/1.1"] == "401 Unauthorized") scopes = response_headers["x-accepted-oauth-scopes"].to_s.split(", ") needed_human_scopes = needed_scopes.join(", ") @@ -125,7 +125,7 @@ module GitHub end end - def open(url, data: nil, scopes: [].freeze) + def open_api(url, data: nil, scopes: [].freeze) # This is a no-op if the user is opting out of using the GitHub API. return block_given? ? yield({}) : {} if ENV["HOMEBREW_NO_GITHUB_API"] @@ -226,7 +226,7 @@ module GitHub end def repository(user, repo) - open(url_to("repos", user, repo)) + open_api(url_to("repos", user, repo)) end def search_code(**qualifiers) @@ -255,7 +255,7 @@ module GitHub def private_repo?(full_name) uri = url_to "repos", full_name - open(uri) { |json| json["private"] } + open_api(uri) { |json| json["private"] } end def query_string(*main_params, **qualifiers) @@ -275,6 +275,6 @@ module GitHub def search(entity, *queries, **qualifiers) uri = url_to "search", entity uri.query = query_string(*queries, **qualifiers) - open(uri) { |json| json.fetch("items", []) } + open_api(uri) { |json| json.fetch("items", []) } end end From 34bd99af8d16a3ce1238f32de3a1bb5fb9da4f7f Mon Sep 17 00:00:00 2001 From: ilovezfs Date: Thu, 8 Mar 2018 08:10:48 -0800 Subject: [PATCH 42/47] language/python: expect @ in python@2 Cellar paths The realpath of the python@2 Cellar contains "python@2" not "python2" so check for "python@2" when doing Cellar->opt robustifications. --- Library/Homebrew/language/python.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/language/python.rb b/Library/Homebrew/language/python.rb index c41e22b5ce..903e1317d5 100644 --- a/Library/Homebrew/language/python.rb +++ b/Library/Homebrew/language/python.rb @@ -184,7 +184,7 @@ module Language @venv_root.find do |f| next unless f.symlink? next unless (rp = f.realpath.to_s).start_with? HOMEBREW_CELLAR - python = rp.include?("python2") ? "python2" : "python" + python = rp.include?("python@2") ? "python@2" : "python" new_target = rp.sub %r{#{HOMEBREW_CELLAR}/#{python}/[^/]+}, Formula[python].opt_prefix f.unlink f.make_symlink new_target @@ -192,7 +192,7 @@ module Language Pathname.glob(@venv_root/"lib/python*/orig-prefix.txt").each do |prefix_file| prefix_path = prefix_file.read - python = prefix_path.include?("python2") ? "python2" : "python" + python = prefix_path.include?("python@2") ? "python@2" : "python" prefix_path.sub! %r{^#{HOMEBREW_CELLAR}/#{python}/[^/]+}, Formula[python].opt_prefix prefix_file.atomic_write prefix_path end From bdb86640e99bd9f6c9ebff1c0adb786ee29d69aa Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 9 Mar 2018 14:53:52 +0000 Subject: [PATCH 43/47] diagnostic: remove python pth check. This isn't an issue with Homebrew but an issue for users to configure themselves. It's also nonsensical with current Python configurations e.g. https://discourse.brew.sh/t/brew-doctor-warnings-about-python-3-6-site-packages-and-sitecustomize/1805/1 --- Library/Homebrew/diagnostic.rb | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 1b779f226b..706bb201a9 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -1016,24 +1016,6 @@ module Homebrew EOS end - def check_for_pth_support - homebrew_site_packages = Language::Python.homebrew_site_packages - return unless homebrew_site_packages.directory? - return if Language::Python.reads_brewed_pth_files?("python") != false - return unless Language::Python.in_sys_path?("python", homebrew_site_packages) - - user_site_packages = Language::Python.user_site_packages "python" - <<~EOS - Your default Python does not recognize the Homebrew site-packages - directory as a special site-packages directory, which means that .pth - files will not be followed. This means you will not be able to import - some modules after installing them with Homebrew, like wxpython. To fix - this for the current user, you can run: - mkdir -p #{user_site_packages} - echo 'import site; site.addsitedir("#{homebrew_site_packages}")' >> #{user_site_packages}/homebrew.pth - EOS - end - def check_for_external_cmd_name_conflict cmds = Tap.cmd_directories.flat_map { |p| Dir["#{p}/brew-*"] }.uniq cmds = cmds.select { |cmd| File.file?(cmd) && File.executable?(cmd) } From 776fec7f6ba30d1f33f3c71f89e070ddbfbb5ed8 Mon Sep 17 00:00:00 2001 From: ilovezfs Date: Fri, 9 Mar 2018 13:45:30 -0800 Subject: [PATCH 44/47] virtualenv_install_with_resources: invoke python with versioned name. The unversioned python executable no longer refers to python3. --- Library/Homebrew/language/python.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/language/python.rb b/Library/Homebrew/language/python.rb index 903e1317d5..de373efda4 100644 --- a/Library/Homebrew/language/python.rb +++ b/Library/Homebrew/language/python.rb @@ -135,9 +135,10 @@ module Language def virtualenv_install_with_resources(options = {}) python = options[:using] if python.nil? - wanted = %w[python python@2 python2 python3].select { |py| needs_python?(py) } + wanted = %w[python python@2 python2 python3 python@3].select { |py| needs_python?(py) } raise FormulaAmbiguousPythonError, self if wanted.size > 1 - python = wanted.first || "python" + python = wanted.first || "python2.7" + python = "python3" if python == "python" end venv = virtualenv_create(libexec, python.delete("@")) venv.pip_install resources From 371dd7feec38ffda3c140dc0afae1b10fc5311c4 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 10 Mar 2018 10:31:39 +0000 Subject: [PATCH 45/47] Homebrew-and-Python: update binary locations. Updated to comply with PEP 394: https://www.python.org/dev/peps/pep-0394/ --- docs/Homebrew-and-Python.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/Homebrew-and-Python.md b/docs/Homebrew-and-Python.md index 3a4c0052ae..38e2f42463 100644 --- a/docs/Homebrew-and-Python.md +++ b/docs/Homebrew-and-Python.md @@ -12,10 +12,11 @@ Homebrew provides formulae to brew 3.x and a more up-to-date Python 2.7.x. Homebrew provides one formula for Python 3.x (`python`) and another for Python 2.7.x (`python@2`). The executables are organized as follows so that Python 2 and Python 3 can both be installed without conflict: -* `python` and `python3` point to Homebrew's Python 3.x (if installed) otherwise the macOS system Python +* `python3` points to Homebrew's Python 3.x (if installed) * `python2` points to Homebrew's Python 2.7.x (if installed) -* `pip` and `pip3` point to Homebrew's Python 3.x's pip (if installed) -* `pip2` points to Homebrew's Python 2.7.x's pip (if installed) +* `python` points to Homebrew's Python 2.7.x (if installed) otherwise the macOS system Python. Check out `brew info python` if you wish to add Homebrew's 3.x `python` to your `PATH`. +* `pip3` points to Homebrew's Python 3.x's pip (if installed) +* `pip` and `pip2` point to Homebrew's Python 2.7.x's pip (if installed) ([Wondering which one to choose?](https://wiki.python.org/moin/Python2orPython3)) From e71b2d1737d768538b183c72132ebead9aa4eeb4 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sat, 10 Mar 2018 11:54:10 +0000 Subject: [PATCH 46/47] upgrade: fix the man page wrongly saying that it will upgrade pins. This is incorrect as in order to upgrade a pinned package it must first be unpinned. --- Library/Homebrew/cmd/upgrade.rb | 4 ++-- docs/Manpage.md | 4 ++-- manpages/brew.1 | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index 4e6dd04631..7cbbecbb25 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -10,8 +10,8 @@ #: repository's HEAD will be checked for updates when a new stable or devel #: version has been released. #: -#: If are given, upgrade only the specified brews (but do so even -#: if they are pinned; see `pin`, `unpin`). +#: If are given, upgrade only the specified brews (unless they +#: are pinned; see `pin`, `unpin`). require "cmd/install" require "cleanup" diff --git a/docs/Manpage.md b/docs/Manpage.md index 05dc010d18..388b886b45 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -561,8 +561,8 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note repository's HEAD will be checked for updates when a new stable or devel version has been released. - If `formulae` are given, upgrade only the specified brews (but do so even - if they are pinned; see `pin`, `unpin`). + If `formulae` are given, upgrade only the specified brews (unless they + are pinned; see `pin`, `unpin`). * `uses` [`--installed`] [`--recursive`] [`--include-build`] [`--include-optional`] [`--skip-recommended`] [`--devel`|`--HEAD`] `formulae`: Show the formulae that specify `formulae` as a dependency. When given diff --git a/manpages/brew.1 b/manpages/brew.1 index 695bc122e1..2ac999dd58 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -576,7 +576,7 @@ If \fB\-\-cleanup\fR is specified then remove previously installed \fIformula\fR If \fB\-\-fetch\-HEAD\fR is passed, fetch the upstream repository to detect if the HEAD installation of the formula is outdated\. Otherwise, the repository\'s HEAD will be checked for updates when a new stable or devel version has been released\. . .IP -If \fIformulae\fR are given, upgrade only the specified brews (but do so even if they are pinned; see \fBpin\fR, \fBunpin\fR)\. +If \fIformulae\fR are given, upgrade only the specified brews (unless they are pinned; see \fBpin\fR, \fBunpin\fR)\. . .TP \fBuses\fR [\fB\-\-installed\fR] [\fB\-\-recursive\fR] [\fB\-\-include\-build\fR] [\fB\-\-include\-optional\fR] [\fB\-\-skip\-recommended\fR] [\fB\-\-devel\fR|\fB\-\-HEAD\fR] \fIformulae\fR From 5e161252c99890d1ec14392e921fa7bc3fc75d3c Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sun, 11 Mar 2018 16:55:06 +0000 Subject: [PATCH 47/47] utils: check for tap_message in odeprecated. `tap` is not a method-wide variable. Fixes #3907 --- Library/Homebrew/utils.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 3de0c8dfe2..8d57c12d60 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -109,7 +109,7 @@ def odeprecated(method, replacement = nil, disable: false, disable_on: nil, call if ARGV.homebrew_developer? || disable || Homebrew.raise_deprecation_exceptions? - if replacement || tap + if replacement || tap_message developer_message = message + "Or, even better, submit a PR to fix it!" end raise MethodDeprecatedError, developer_message