diff options
29 files changed, 594 insertions, 99 deletions
| diff --git a/.gitignore b/.gitignore index b70874d2f..4d78ef02d 100644 --- a/.gitignore +++ b/.gitignore @@ -45,7 +45,6 @@  /docs/.bundle  /docs/bin  /docs/vendor -/docs/Gemfile.lock  /docs/.jekyll-metadata  # Unignore our shell completion diff --git a/Library/Homebrew/cask/lib/hbc/artifact/moved.rb b/Library/Homebrew/cask/lib/hbc/artifact/moved.rb index f5ef790eb..856ab2766 100644 --- a/Library/Homebrew/cask/lib/hbc/artifact/moved.rb +++ b/Library/Homebrew/cask/lib/hbc/artifact/moved.rb @@ -65,7 +65,7 @@ module Hbc          ohai "Moving #{self.class.english_name} '#{target.basename}' back to '#{source}'."          source.dirname.mkpath -        if source.parent.writable? +        if target.parent.writable?            FileUtils.move(target, source)          else            command.run("/bin/mv", args: [target, source], sudo: true) diff --git a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb index d7bcf1537..5aef2c420 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb @@ -12,6 +12,7 @@ module Hbc        def run          ohai "Homebrew-Cask Version", Hbc.full_version          ohai "macOS", MacOS.full_version +        ohai "SIP", self.class.check_sip          ohai "Java", SystemConfig.describe_java          ohai "Homebrew-Cask Install Location", self.class.render_install_location          ohai "Homebrew-Cask Staging Location", self.class.render_staging_location(Hbc.caskroom) @@ -37,6 +38,15 @@ module Hbc          (self.class.locale_variables + environment_variables).sort.each(&self.class.method(:render_env_var))        end +      def self.check_sip +        csrutil = "/usr/bin/csrutil" +        return "N/A" unless File.executable?(csrutil) +        Open3.capture2(csrutil, "status")[0] +             .gsub("This is an unsupported configuration, likely to break in the future and leave your machine in an unknown state.", "") +             .gsub("System Integrity Protection status: ", "") +             .delete("\t\.").capitalize.strip +      end +        def self.locale_variables          ENV.keys.grep(/^(?:LC_\S+|LANG|LANGUAGE)\Z/).sort        end diff --git a/Library/Homebrew/cmd/reinstall.rb b/Library/Homebrew/cmd/reinstall.rb index a4629025a..53c923d91 100644 --- a/Library/Homebrew/cmd/reinstall.rb +++ b/Library/Homebrew/cmd/reinstall.rb @@ -39,7 +39,7 @@ module Homebrew      fi.build_bottle         = ARGV.build_bottle? || (!f.bottled? && f.build.bottle?)      fi.interactive          = ARGV.interactive?      fi.git                  = ARGV.git? -    fi.link_keg             = keg_was_linked if keg_had_linked_opt +    fi.link_keg           ||= keg_was_linked if keg_had_linked_opt      fi.prelude      oh1 "Reinstalling #{f.full_name} #{options.to_a.join " "}" diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index 1c9c89d76..4b03e8080 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -133,7 +133,7 @@ module Homebrew      fi.options = options      fi.build_bottle = ARGV.build_bottle? || (!f.bottled? && f.build.build_bottle?)      fi.installed_on_request = !ARGV.named.empty? -    fi.link_keg             = keg_was_linked if keg_had_linked_opt +    fi.link_keg           ||= keg_was_linked if keg_had_linked_opt      if tab        fi.installed_as_dependency = tab.installed_as_dependency        fi.installed_on_request  ||= tab.installed_on_request diff --git a/Library/Homebrew/cmd/vendor-install.sh b/Library/Homebrew/cmd/vendor-install.sh index bf6fe0c59..3b91dae5c 100644 --- a/Library/Homebrew/cmd/vendor-install.sh +++ b/Library/Homebrew/cmd/vendor-install.sh @@ -8,26 +8,26 @@ source "$HOMEBREW_LIBRARY/Homebrew/utils/lock.sh"  VENDOR_DIR="$HOMEBREW_LIBRARY/Homebrew/vendor" -# Built from https://github.com/Homebrew/homebrew-portable. +# Built from https://github.com/Homebrew/homebrew-portable-ruby.  if [[ -n "$HOMEBREW_MACOS" ]]  then    if [[ "$HOMEBREW_PROCESSOR" = "Intel" ]]    then -    ruby_URL="https://homebrew.bintray.com/bottles-portable/portable-ruby-2.3.3.leopard_64.bottle.1.tar.gz" +    ruby_URL="https://homebrew.bintray.com/bottles-portable-ruby/portable-ruby-2.3.3.leopard_64.bottle.1.tar.gz" +    ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.3.3/portable-ruby-2.3.3.leopard_64.bottle.1.tar.gz"      ruby_SHA="34ce9e4c9c1be28db564d744165aa29291426f8a3d2ef806ba4f0b9175aedb2b" -  else -    ruby_URL="" -    ruby_SHA=""    fi  elif [[ -n "$HOMEBREW_LINUX" ]]  then    case "$HOMEBREW_PROCESSOR" in      armv7l) -      ruby_URL="https://homebrew.bintray.com/bottles-portable/portable-ruby-2.3.3.armv7l_linux.bottle.1.tar.gz" +      ruby_URL="https://homebrew.bintray.com/bottles-portable-ruby/portable-ruby-2.3.3.armv7l_linux.bottle.1.tar.gz" +      ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.3.3/portable-ruby-2.3.3.armv7l_linux.bottle.1.tar.gz"        ruby_SHA="d26affe6f6ac299557a9044b311b4066b554874fc828ebc323d2705d3f4a8249"        ;;      x86_64) -      ruby_URL="https://homebrew.bintray.com/bottles-portable/portable-ruby-2.3.3.x86_64_linux.bottle.1.tar.gz" +      ruby_URL="https://homebrew.bintray.com/bottles-portable-ruby/portable-ruby-2.3.3.x86_64_linux.bottle.1.tar.gz" +      ruby_URL2="https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.3.3/portable-ruby-2.3.3.x86_64_linux.bottle.1.tar.gz"        ruby_SHA="33643b1ca6f860d6df01686636326785763e5e81cf0cef37d8a7ab96a6ca1fa1"        ;;    esac @@ -90,7 +90,20 @@ fetch() {      if [[ ! -f "$temporary_path" ]]      then -      odie "Download failed: $VENDOR_URL" +      [[ -n "$HOMEBREW_QUIET" ]] || echo "==> Downloading $VENDOR_URL2" >&2 +      "$HOMEBREW_CURL" "${curl_args[@]}" "$VENDOR_URL2" -o "$temporary_path" +    fi + +    if [[ ! -f "$temporary_path" ]] +    then +      odie <<EOS +Failed to download $VENDOR_URL and $VENDOR_URL2! + +Do not file an issue on GitHub about this: you will need to figure out for +yourself what issue with your internet connection restricts your access to +both Bintray (used for Homebrew bottles/binary packages) and GitHub +(used for Homebrew updates). +EOS      fi      trap '' SIGINT @@ -211,8 +224,10 @@ homebrew-vendor-install() {    [[ -n "$HOMEBREW_DEBUG" ]] && set -x    url_var="${VENDOR_NAME}_URL" +  url2_var="${VENDOR_NAME}_URL2"    sha_var="${VENDOR_NAME}_SHA"    VENDOR_URL="${!url_var}" +  VENDOR_URL2="${!url2_var}"    VENDOR_SHA="${!sha_var}"    if [[ -z "$VENDOR_URL" || -z "$VENDOR_SHA" ]] diff --git a/Library/Homebrew/compat/requirements.rb b/Library/Homebrew/compat/requirements.rb index 48911b52b..304dd2504 100644 --- a/Library/Homebrew/compat/requirements.rb +++ b/Library/Homebrew/compat/requirements.rb @@ -44,6 +44,18 @@ class GPG2Requirement < Requirement    satisfy { which "gpg" }  end +class GitRequirement < Requirement +  fatal true +  default_formula "git" +  satisfy { Utils.git_available? } +end + +class SubversionRequirement < Requirement +  fatal true +  default_formula "subversion" +  satisfy { Utils.svn_available? } +end +  XcodeDependency            = XcodeRequirement  MysqlDependency            = MysqlRequirement  PostgresqlDependency       = PostgresqlRequirement diff --git a/Library/Homebrew/dependency_collector.rb b/Library/Homebrew/dependency_collector.rb index 9ad93c268..03a86d661 100644 --- a/Library/Homebrew/dependency_collector.rb +++ b/Library/Homebrew/dependency_collector.rb @@ -52,6 +52,16 @@ class DependencyCollector      parse_spec(spec, Array(tags))    end +  def git_dep_if_needed(tags) +    return if Utils.git_available? +    Dependency.new("git", tags) +  end + +  def subversion_dep_if_needed(tags) +    return if Utils.svn_available? +    Dependency.new("subversion", tags) +  end +    def cvs_dep_if_needed(tags)      Dependency.new("cvs", tags)    end @@ -126,9 +136,9 @@ class DependencyCollector      if strategy <= CurlDownloadStrategy        parse_url_spec(spec.url, tags)      elsif strategy <= GitDownloadStrategy -      GitRequirement.new(tags) +      git_dep_if_needed(tags)      elsif strategy <= SubversionDownloadStrategy -      SubversionRequirement.new(tags) +      subversion_dep_if_needed(tags)      elsif strategy <= MercurialDownloadStrategy        Dependency.new("mercurial", tags)      elsif strategy <= FossilDownloadStrategy diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 16eb03dbc..9d0ed3c59 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -304,7 +304,7 @@ class FormulaAuditor    def audit_formula_name      return unless @strict      # skip for non-official taps -    return if formula.tap.nil? || !formula.tap.official? +    return unless formula.tap&.official?      name = formula.name @@ -718,7 +718,13 @@ class FormulaAuditor      return unless @strict -    problem "`#{Regexp.last_match(1)}` in formulae is deprecated" if line =~ /(env :(std|userpaths))/ +    if formula.tap&.official? && line.include?("env :std") +      problem "`env :std` in official tap formulae is deprecated" +    end + +    if line.include?("env :userpaths") +      problem "`env :userpaths` in formulae is deprecated" +    end      if line =~ /system ((["'])[^"' ]*(?:\s[^"' ]*)+\2)/        bad_system = Regexp.last_match(1) diff --git a/Library/Homebrew/extend/os/mac/dependency_collector.rb b/Library/Homebrew/extend/os/mac/dependency_collector.rb index d25d90261..108b6ccb2 100644 --- a/Library/Homebrew/extend/os/mac/dependency_collector.rb +++ b/Library/Homebrew/extend/os/mac/dependency_collector.rb @@ -1,6 +1,13 @@  require "os/mac/ld64_dependency"  class DependencyCollector +  def git_dep_if_needed(tags) +    return if MacOS.version >= :lion +    Dependency.new("git", tags) +  end + +  def subversion_dep_if_needed(tags); end +    def cvs_dep_if_needed(tags)      return if MacOS.version < :lion      Dependency.new("cvs", tags) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 8e4f80260..7b1d94eb2 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -2194,32 +2194,24 @@ class Formula      # <pre># If a dependency is only needed in certain cases:      # depends_on "sqlite" if MacOS.version == :leopard      # depends_on :xcode # If the formula really needs full Xcode. -    # depends_on :tex # Homebrew does not provide a Tex Distribution. -    # depends_on :fortran # Checks that `gfortran` is available or `FC` is set. -    # depends_on :mpi => :cc # Needs MPI with `cc` -    # depends_on :mpi => [:cc, :cxx, :optional] # Is optional. MPI with `cc` and `cxx`.      # depends_on :macos => :lion # Needs at least OS X Lion (10.7). -    # depends_on :apr # If a formula requires the CLT-provided apr library to exist.      # depends_on :arch => :intel # If this formula only builds on Intel architecture.      # depends_on :arch => :x86_64 # If this formula only builds on Intel x86 64-bit.      # depends_on :arch => :ppc # Only builds on PowerPC?      # depends_on :ld64 # Sometimes ld fails on `MacOS.version < :leopard`. Then use this. -    # depends_on :x11 # X11/XQuartz components. +    # depends_on :x11 => :optional # X11/XQuartz components.      # depends_on :osxfuse # Permits the use of the upstream signed binary or our source package.      # depends_on :tuntap # Does the same thing as above. This is vital for Yosemite and above. -    # depends_on :mysql => :recommended</pre>      # <pre># It is possible to only depend on something if      # # `build.with?` or `build.without? "another_formula"`: -    # depends_on :mysql # allows brewed or external mysql to be used -    # depends_on :postgresql if build.without? "sqlite" -    # depends_on :hg # Mercurial (external or brewed) is needed</pre> +    # depends_on "postgresql" if build.without? "sqlite"      # -    # <pre># If any Python >= 2.7 < 3.x is okay (either from macOS or brewed): -    # depends_on :python</pre> -    # <pre># to depend on Python >= 2.7 but use system Python where possible -    # depends_on :python if MacOS.version <= :snow_leopard</pre> +    # <pre># Python 2.7: +    # depends_on "python"</pre> +    # <pre># Python 2.7 but use system Python where possible +    # depends_on "python" if MacOS.version <= :snow_leopard</pre>      # <pre># Python 3.x if the `--with-python3` is given to `brew install example` -    # depends_on :python3 => :optional</pre> +    # depends_on "python3" => :optional</pre>      def depends_on(dep)        specs.each { |spec| spec.depends_on(dep) }      end diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 1e2d77b2c..4f8708a4d 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -32,11 +32,11 @@ class FormulaInstaller    attr_reader :formula    attr_accessor :options, :build_bottle, :invalid_option_names -  attr_accessor :installed_as_dependency, :installed_on_request +  attr_accessor :installed_as_dependency, :installed_on_request, :link_keg    mode_attr_accessor :show_summary_heading, :show_header    mode_attr_accessor :build_from_source, :force_bottle    mode_attr_accessor :ignore_deps, :only_deps, :interactive, :git -  mode_attr_accessor :verbose, :debug, :quieter, :link_keg +  mode_attr_accessor :verbose, :debug, :quieter    def initialize(formula)      @formula = formula @@ -149,7 +149,7 @@ class FormulaInstaller      recursive_deps = formula.recursive_dependencies      recursive_formulae = recursive_deps.map(&:to_formula) -    recursive_runtime_deps = formula.recursive_dependencies.reject(&:build?) +    recursive_runtime_deps = formula.runtime_dependencies      recursive_runtime_formulae = recursive_runtime_deps.map(&:to_formula)      recursive_dependencies = [] @@ -553,18 +553,18 @@ class FormulaInstaller      end      fi = FormulaInstaller.new(df) -    fi.options           |= tab.used_options -    fi.options           |= Tab.remap_deprecated_options(df.deprecated_options, dep.options) -    fi.options           |= inherited_options -    fi.options           &= df.options -    fi.build_from_source  = ARGV.build_formula_from_source?(df) -    fi.force_bottle       = false -    fi.verbose            = verbose? -    fi.quieter            = quieter? -    fi.debug              = debug? -    fi.link_keg           = keg_was_linked if keg_had_linked_keg +    fi.options                |= tab.used_options +    fi.options                |= Tab.remap_deprecated_options(df.deprecated_options, dep.options) +    fi.options                |= inherited_options +    fi.options                &= df.options +    fi.build_from_source       = ARGV.build_formula_from_source?(df) +    fi.force_bottle            = false +    fi.verbose                 = verbose? +    fi.quieter                 = quieter? +    fi.debug                   = debug? +    fi.link_keg              ||= keg_was_linked if keg_had_linked_keg      fi.installed_as_dependency = true -    fi.installed_on_request = false +    fi.installed_on_request    = df.any_version_installed? && tab.installed_on_request      fi.prelude      oh1 "Installing #{formula.full_name} dependency: #{Formatter.identifier(dep.name)}"      fi.install diff --git a/Library/Homebrew/requirements.rb b/Library/Homebrew/requirements.rb index e8c33465b..6128db516 100644 --- a/Library/Homebrew/requirements.rb +++ b/Library/Homebrew/requirements.rb @@ -9,15 +9,3 @@ require "requirements/unsigned_kext_requirement"  require "requirements/x11_requirement"  require "requirements/arch_requirement"  require "requirements/xcode_requirement" - -class GitRequirement < Requirement -  fatal true -  default_formula "git" -  satisfy { Utils.git_available? } -end - -class SubversionRequirement < Requirement -  fatal true -  default_formula "subversion" -  satisfy { Utils.svn_available? } -end diff --git a/Library/Homebrew/rubocops/extend/formula_cop.rb b/Library/Homebrew/rubocops/extend/formula_cop.rb index 71a5caf74..de369a0aa 100644 --- a/Library/Homebrew/rubocops/extend/formula_cop.rb +++ b/Library/Homebrew/rubocops/extend/formula_cop.rb @@ -214,7 +214,7 @@ module RuboCop        EOS        def_node_search :dependency_name_hash_match?, <<~EOS -        (hash (pair ({str sym} %1) ({str sym array} _))) +        (hash (pair ({str sym} %1) (...)))        EOS        # To compare node with appropriate Ruby variable diff --git a/Library/Homebrew/test/dependency_collector_spec.rb b/Library/Homebrew/test/dependency_collector_spec.rb index cfbd260b3..216bbf316 100644 --- a/Library/Homebrew/test/dependency_collector_spec.rb +++ b/Library/Homebrew/test/dependency_collector_spec.rb @@ -78,24 +78,12 @@ describe DependencyCollector do        expect(spec).to eq(copy)      end -    it "creates a resource dependency from a '.git' URL" do -      resource = Resource.new -      resource.url("git://example.com/foo/bar.git") -      expect(subject.add(resource)).to be_an_instance_of(GitRequirement) -    end -      it "creates a resource dependency from a CVS URL" do        resource = Resource.new        resource.url(":pserver:anonymous:@example.com:/cvsroot/foo/bar", using: :cvs)        expect(subject.add(resource)).to eq(Dependency.new("cvs", [:build]))      end -    it "creates a resource dependency from a Subversion URL" do -      resource = Resource.new -      resource.url("svn://example.com/foo/bar") -      expect(subject.add(resource)).to be_an_instance_of(SubversionRequirement) -    end -      it "creates a resource dependency from a '.7z' URL" do        resource = Resource.new        resource.url("http://example.com/foo.7z") diff --git a/Library/Homebrew/test/os/mac/dependency_collector_spec.rb b/Library/Homebrew/test/os/mac/dependency_collector_spec.rb index 357c35c2d..5d260ebf7 100644 --- a/Library/Homebrew/test/os/mac/dependency_collector_spec.rb +++ b/Library/Homebrew/test/os/mac/dependency_collector_spec.rb @@ -35,4 +35,16 @@ describe DependencyCollector do      resource.url("http://example.com/foo.tar.xz")      expect(subject.add(resource)).to be nil    end + +  specify "Resource dependency from a '.git' URL" do +    resource = Resource.new +    resource.url("git://example.com/foo/bar.git") +    expect(subject.add(resource)).to be nil +  end + +  specify "Resource dependency from a Subversion URL" do +    resource = Resource.new +    resource.url("svn://example.com/foo/bar") +    expect(subject.add(resource)).to be nil +  end  end diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index c6e7d22df..a1fb0d235 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -101,7 +101,8 @@ def odeprecated(method, replacement = nil, disable: false, disable_on: nil, call    if ARGV.homebrew_developer? || disable ||       Homebrew.raise_deprecation_exceptions? -    raise MethodDeprecatedError, message +    developer_message = message + "Or, even better, submit a PR to fix it!" +    raise MethodDeprecatedError, developer_message    elsif !Homebrew.auditing?      opoo "#{message}\n"    end diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb index cf1735576..65edd85df 100644 --- a/Library/Homebrew/utils/curl.rb +++ b/Library/Homebrew/utils/curl.rb @@ -2,10 +2,13 @@ require "pathname"  require "open3"  def curl_executable -  curl = Pathname.new ENV["HOMEBREW_CURL"] -  curl = which("curl") unless curl.exist? -  return curl if curl.executable? -  raise "#{curl} is not executable" +  @curl ||= [ +    ENV["HOMEBREW_CURL"], +    which("curl"), +    "/usr/bin/curl", +  ].map { |c| Pathname(c) }.find(&:executable?) +  raise "curl is not executable" unless @curl +  @curl  end  def curl_args(*extra_args, show_output: false, user_agent: :default) @@ -93,10 +93,10 @@ Our bottles (binary packages) are hosted by [Bintray](https://bintray.com/homebr  [](https://www.netlify.com) -Secure password storage and syncing provided by [1Password for Teams](https://1password.com/teams/) by [AgileBits](https://agilebits.com) +Secure password storage and syncing provided by [1Password for Teams](https://1password.com/teams/) by [AgileBits](https://agilebits.com).  [](https://agilebits.com) -Homebrew is a member of the [Software Freedom Conservancy](https://sfconservancy.org) +Homebrew is a member of the [Software Freedom Conservancy](https://sfconservancy.org).  [](https://sfconservancy.org) diff --git a/completions/bash/brew b/completions/bash/brew index 60c272f73..f885b808d 100644 --- a/completions/bash/brew +++ b/completions/bash/brew @@ -1,5 +1,10 @@  # Bash completion script for brew(1) +# Indicates there are no completions +__brewcomp_null() { +  COMPREPLY="" +} +  __brewcomp_words_include() {    local i=1    while [[ "$i" -lt "$COMP_CWORD" ]] @@ -46,7 +51,7 @@ __brewcomp() {  __brew_complete_formulae() {    local cur="${COMP_WORDS[COMP_CWORD]}"    local formulas="$(brew search)" -  local shortnames="$(echo "$formulas" | grep / | cut -d / -f 3)" +  local shortnames="$(echo "$formulas" | \grep / | \cut -d / -f 3)"    COMPREPLY=($(compgen -W "$formulas $shortnames" -- "$cur"))  } @@ -399,6 +404,7 @@ _brew_search() {        return        ;;    esac +  __brewcomp_null  }  _brew_style() { @@ -539,6 +545,227 @@ _brew_uses() {    __brew_complete_formulae  } +__brew_caskcomp_words_include () +{ +    local i=1 +    while [[ $i -lt $COMP_CWORD ]]; do +        if [[ "${COMP_WORDS[i]}" = "$1" ]]; then +            return 0 +        fi +        i=$((++i)) +    done +    return 1 +} + +# Find the previous non-switch word +__brew_caskcomp_prev () +{ +    local idx=$((COMP_CWORD - 1)) +    local prv="${COMP_WORDS[idx]}" +    while [[ $prv == -* ]]; do +        idx=$((--idx)) +        prv="${COMP_WORDS[idx]}" +    done +    echo "$prv" +} + +__brew_caskcomp () +{ +    # break $1 on space, tab, and newline characters, +    # and turn it into a newline separated list of words +    local list s sep=$'\n' IFS=$' '$'\t'$'\n' +    local cur="${COMP_WORDS[COMP_CWORD]}" + +    for s in $1; do +        __brew_caskcomp_words_include "$s" && continue +        list="$list$s$sep" +    done + +    IFS=$sep +    COMPREPLY=($(compgen -W "$list" -- "$cur")) +} + +# Don't use __brew_caskcomp() in any of the __brew_cask_complete_foo functions, as +# it is too slow and is not worth it just for duplicate elimination. +__brew_cask_complete_formulae () +{ +    local cur="${COMP_WORDS[COMP_CWORD]}" +    local lib=$(brew --repository)/Library +    local taps=${lib}/Taps +    local casks=${lib}/Taps/caskroom/homebrew-cask/Casks +    local ff=$(\ls ${casks} 2>/dev/null | \sed 's/\.rb//g') + +    COMPREPLY=($(compgen -W "$ff" -- "$cur")) +} + +__brew_cask_complete_installed () +{ +    local cur="${COMP_WORDS[COMP_CWORD]}" +    local inst=$(brew cask list -1) +    COMPREPLY=($(compgen -W "$inst" -- "$cur")) +} + +__brew_cask_complete_caskroom () +{ +    local cur="${COMP_WORDS[COMP_CWORD]}" +    local caskroom_dir=/opt/homebrew-cask/Caskroom/ +    local files=$(\ls ${caskroom_dir} 2>/dev/null) +    COMPREPLY=($(compgen -W "$files" -- "$cur")) +} + +_brew_cask_cleanup () +{ +    local cur="${COMP_WORDS[COMP_CWORD]}" +    case "$cur" in +    -*) +        __brew_caskcomp "--force" +        return +        ;; +    esac +    __brew_cask_complete_installed +} + +_brew_cask_fetch () +{ +    local cur="${COMP_WORDS[COMP_CWORD]}" +    local prv=$(__brew_caskcomp_prev) +    case "$cur" in +    -*) +        __brew_caskcomp "--force" +        return +        ;; +    esac +    __brew_cask_complete_formulae +} + +_brew_cask_install () +{ +    local cur="${COMP_WORDS[COMP_CWORD]}" +    local prv=$(__brew_caskcomp_prev) +    case "$cur" in +    -*) +        __brew_caskcomp "--force --skip-cask-deps --require-sha --language" +        return +        ;; +    esac +    __brew_cask_complete_formulae +} + +_brew_cask_list () +{ +    local cur="${COMP_WORDS[COMP_CWORD]}" +    case "$cur" in +    -*) +        __brew_caskcomp "-1 --versions" +        return +        ;; +    esac + +    __brew_cask_complete_installed +} + +_brew_cask_outdated () +{ +    local cur="${COMP_WORDS[COMP_CWORD]}" +    case "$cur" in +    -*) +        __brew_caskcomp "--greedy --verbose --quiet" +        return +        ;; +    esac +    __brew_cask_complete_installed +} + +_brew_cask_style () +{ +    local cur="${COMP_WORDS[COMP_CWORD]}" +    case "$cur" in +    -*) +        __brew_caskcomp "--fix" +        return +        ;; +    esac +    __brew_cask_complete_installed +} + +_brew_cask_uninstall () +{ +    local cur="${COMP_WORDS[COMP_CWORD]}" +    case "$cur" in +    -*) +        __brew_caskcomp "--force" +        return +        ;; +    esac +    __brew_cask_complete_installed +} + +_brew_cask_upgrade () +{ +    local cur="${COMP_WORDS[COMP_CWORD]}" +    case "$cur" in +    -*) +        __brew_caskcomp "--force --greedy" +        return +        ;; +    esac +    __brew_cask_complete_installed     +} + +_brew_cask () +{ +    local i=1 cmd + +    # find the subcommand +    while [[ $i -lt $COMP_CWORD ]]; do +        local s="${COMP_WORDS[i]}" +        case "$s" in +        --*) +            cmd="$s" +            break +            ;; +        -*) +            ;; +        cask) +            ;; +        *) +            cmd="$s" +            break +            ;; +        esac +        i=$((++i)) +    done + +    if [[ $i -eq $COMP_CWORD ]]; then +        __brew_caskcomp "abv audit cat cleanup create doctor edit fetch home info install list ls outdated reinstall remove rm search style uninstall upgrade zap -S --force --caskroom --verbose --appdir --colorpickerdir --prefpanedir --qlplugindir --fontdir --servicedir --input_methoddir --internet_plugindir --screen_saverdir --no-binaries --debug --version" +        return +    fi + +    # subcommands have their own completion functions +    case "$cmd" in +      --version)              __brewcomp_null ;; +      audit)                  __brew_cask_complete_formulae ;; +      cat)                    __brew_cask_complete_formulae ;; +      cleanup)                _brew_cask_cleanup ;; +      create)                 ;; +      doctor)                 __brewcomp_null ;; +      edit)                   __brew_cask_complete_formulae ;; +      fetch)                  _brew_cask_fetch ;; +      home)                   __brew_cask_complete_formulae ;; +      info|abv)               __brew_cask_complete_formulae ;; +      install|instal)         _brew_cask_install ;; +      list|ls)                _brew_cask_list ;; +      outdated)               _brew_cask_outdated ;; +      reinstall)              __brew_cask_complete_installed ;; +      search)                 __brewcomp_null ;; +      style)                  _brew_cask_style ;; +      uninstall|remove|rm)    _brew_cask_uninstall ;; +      upgrade)                _brew_cask_upgrade ;; +      zap)                    __brew_cask_complete_caskroom ;; +      *)                      ;; +    esac +} +  _brew() {    local i=1 cmd @@ -565,7 +792,7 @@ _brew() {    then      # Do not auto-complete "*instal" or "*uninstal" aliases for "*install" commands.      # Prefix newline to prevent not checking the first command. -    local cmds=$'\n'"$(brew commands --quiet --include-aliases | grep -v instal$)" +    local cmds=$'\n'"$(brew commands --quiet --include-aliases | \grep -v instal$)"      __brewcomp "${cmds}"      return    fi @@ -578,6 +805,7 @@ _brew() {      analytics)                  _brew_analytics ;;      audit)                      __brew_complete_formulae ;;      bottle)                     _brew_bottle ;; +    cask)                       _brew_cask ;;      cat)                        __brew_complete_formulae ;;      cleanup)                    _brew_cleanup ;;      create)                     _brew_create ;; diff --git a/completions/zsh/_brew b/completions/zsh/_brew index 22792860d..e4f874bfb 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -711,7 +711,7 @@ _brew_uninstall() {  # brew unlink [--dry-run] formula:  _brew_unlink() {    _arguments \ -    '(--dry-run =n)'{--dry-run,=n}'[don''t unlink or delete any files]' \ +    '(--dry-run -n)'{--dry-run,-n}'[don''t unlink or delete any files]' \      ':formula:__brew_installed_formulae'  } @@ -719,7 +719,7 @@ _brew_unlink() {  _brew_unlinkapps() {    _arguments \      '(--local)--local[remove symlinks from ~/Applications instead of the system directory]' \ -    '(--dry-run =n)'{--dry-run,-n}'[don''t unlink or delete any files]' \ +    '(--dry-run -n)'{--dry-run,-n}'[don''t unlink or delete any files]' \      ':formula:__brew_installed_formulae'  } diff --git a/completions/zsh/_brew_cask b/completions/zsh/_brew_cask index ff277ea60..d702ea093 100644 --- a/completions/zsh/_brew_cask +++ b/completions/zsh/_brew_cask @@ -12,17 +12,21 @@  zstyle -T ':completion:*:*:*:brew-cask:*' tag-order && \  	zstyle ':completion:*:*:*:brew-cask:*' tag-order 'commands' +__brew_cask() { +  [ -d "$(brew --repo caskroom/cask)" ] && brew cask $@ +} +  __brew_all_casks() {    local -a list    local expl -  list=( $(brew cask search) ) +  list=( $(__brew_cask search) )    _wanted list expl 'all casks' compadd -a list  }  __brew_installed_casks() {    local -a list    local expl -  list=( $(brew cask list|sed 's/(!)//') ) +  list=( $(__brew_cask list|sed 's/(!)//') )    _wanted list expl 'installed casks' compadd -a list  } diff --git a/docs/.ruby-version b/docs/.ruby-version index bec3a35ee..005119baa 100644 --- a/docs/.ruby-version +++ b/docs/.ruby-version @@ -1 +1 @@ -system +2.4.1 diff --git a/docs/Gemfile b/docs/Gemfile index fac2f802d..0c8671cde 100644 --- a/docs/Gemfile +++ b/docs/Gemfile @@ -1,6 +1,3 @@  source "https://rubygems.org"  gem "github-pages", group: :jekyll_plugins - -# Nokogiri >=1.7 requires Ruby >=2.1 -gem "nokogiri", "<1.7" diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock new file mode 100644 index 000000000..b5fc90306 --- /dev/null +++ b/docs/Gemfile.lock @@ -0,0 +1,219 @@ +GEM +  remote: https://rubygems.org/ +  specs: +    activesupport (4.2.8) +      i18n (~> 0.7) +      minitest (~> 5.1) +      thread_safe (~> 0.3, >= 0.3.4) +      tzinfo (~> 1.1) +    addressable (2.5.2) +      public_suffix (>= 2.0.2, < 4.0) +    coffee-script (2.4.1) +      coffee-script-source +      execjs +    coffee-script-source (1.12.2) +    colorator (1.1.0) +    concurrent-ruby (1.0.5) +    ethon (0.11.0) +      ffi (>= 1.3.0) +    execjs (2.7.0) +    faraday (0.13.1) +      multipart-post (>= 1.2, < 3) +    ffi (1.9.18) +    forwardable-extended (2.6.0) +    gemoji (3.0.0) +    github-pages (158) +      activesupport (= 4.2.8) +      github-pages-health-check (= 1.3.5) +      jekyll (= 3.5.2) +      jekyll-avatar (= 0.4.2) +      jekyll-coffeescript (= 1.0.1) +      jekyll-default-layout (= 0.1.4) +      jekyll-feed (= 0.9.2) +      jekyll-gist (= 1.4.1) +      jekyll-github-metadata (= 2.9.1) +      jekyll-mentions (= 1.2.0) +      jekyll-optional-front-matter (= 0.2.0) +      jekyll-paginate (= 1.1.0) +      jekyll-readme-index (= 0.1.0) +      jekyll-redirect-from (= 0.12.1) +      jekyll-relative-links (= 0.4.1) +      jekyll-sass-converter (= 1.5.0) +      jekyll-seo-tag (= 2.3.0) +      jekyll-sitemap (= 1.0.0) +      jekyll-swiss (= 0.4.0) +      jekyll-theme-architect (= 0.1.0) +      jekyll-theme-cayman (= 0.1.0) +      jekyll-theme-dinky (= 0.1.0) +      jekyll-theme-hacker (= 0.1.0) +      jekyll-theme-leap-day (= 0.1.0) +      jekyll-theme-merlot (= 0.1.0) +      jekyll-theme-midnight (= 0.1.0) +      jekyll-theme-minimal (= 0.1.0) +      jekyll-theme-modernist (= 0.1.0) +      jekyll-theme-primer (= 0.5.2) +      jekyll-theme-slate (= 0.1.0) +      jekyll-theme-tactile (= 0.1.0) +      jekyll-theme-time-machine (= 0.1.0) +      jekyll-titles-from-headings (= 0.4.0) +      jemoji (= 0.8.0) +      kramdown (= 1.13.2) +      liquid (= 4.0.0) +      listen (= 3.0.6) +      mercenary (~> 0.3) +      minima (= 2.1.1) +      rouge (= 1.11.1) +      terminal-table (~> 1.4) +    github-pages-health-check (1.3.5) +      addressable (~> 2.3) +      net-dns (~> 0.8) +      octokit (~> 4.0) +      public_suffix (~> 2.0) +      typhoeus (~> 0.7) +    html-pipeline (2.7.1) +      activesupport (>= 2) +      nokogiri (>= 1.4) +    i18n (0.9.1) +      concurrent-ruby (~> 1.0) +    jekyll (3.5.2) +      addressable (~> 2.4) +      colorator (~> 1.0) +      jekyll-sass-converter (~> 1.0) +      jekyll-watch (~> 1.1) +      kramdown (~> 1.3) +      liquid (~> 4.0) +      mercenary (~> 0.3.3) +      pathutil (~> 0.9) +      rouge (~> 1.7) +      safe_yaml (~> 1.0) +    jekyll-avatar (0.4.2) +      jekyll (~> 3.0) +    jekyll-coffeescript (1.0.1) +      coffee-script (~> 2.2) +    jekyll-default-layout (0.1.4) +      jekyll (~> 3.0) +    jekyll-feed (0.9.2) +      jekyll (~> 3.3) +    jekyll-gist (1.4.1) +      octokit (~> 4.2) +    jekyll-github-metadata (2.9.1) +      jekyll (~> 3.1) +      octokit (~> 4.0, != 4.4.0) +    jekyll-mentions (1.2.0) +      activesupport (~> 4.0) +      html-pipeline (~> 2.3) +      jekyll (~> 3.0) +    jekyll-optional-front-matter (0.2.0) +      jekyll (~> 3.0) +    jekyll-paginate (1.1.0) +    jekyll-readme-index (0.1.0) +      jekyll (~> 3.0) +    jekyll-redirect-from (0.12.1) +      jekyll (~> 3.3) +    jekyll-relative-links (0.4.1) +      jekyll (~> 3.3) +    jekyll-sass-converter (1.5.0) +      sass (~> 3.4) +    jekyll-seo-tag (2.3.0) +      jekyll (~> 3.3) +    jekyll-sitemap (1.0.0) +      jekyll (~> 3.3) +    jekyll-swiss (0.4.0) +    jekyll-theme-architect (0.1.0) +      jekyll (~> 3.5) +      jekyll-seo-tag (~> 2.0) +    jekyll-theme-cayman (0.1.0) +      jekyll (~> 3.5) +      jekyll-seo-tag (~> 2.0) +    jekyll-theme-dinky (0.1.0) +      jekyll (~> 3.5) +      jekyll-seo-tag (~> 2.0) +    jekyll-theme-hacker (0.1.0) +      jekyll (~> 3.5) +      jekyll-seo-tag (~> 2.0) +    jekyll-theme-leap-day (0.1.0) +      jekyll (~> 3.5) +      jekyll-seo-tag (~> 2.0) +    jekyll-theme-merlot (0.1.0) +      jekyll (~> 3.5) +      jekyll-seo-tag (~> 2.0) +    jekyll-theme-midnight (0.1.0) +      jekyll (~> 3.5) +      jekyll-seo-tag (~> 2.0) +    jekyll-theme-minimal (0.1.0) +      jekyll (~> 3.5) +      jekyll-seo-tag (~> 2.0) +    jekyll-theme-modernist (0.1.0) +      jekyll (~> 3.5) +      jekyll-seo-tag (~> 2.0) +    jekyll-theme-primer (0.5.2) +      jekyll (~> 3.5) +      jekyll-github-metadata (~> 2.9) +      jekyll-seo-tag (~> 2.2) +    jekyll-theme-slate (0.1.0) +      jekyll (~> 3.5) +      jekyll-seo-tag (~> 2.0) +    jekyll-theme-tactile (0.1.0) +      jekyll (~> 3.5) +      jekyll-seo-tag (~> 2.0) +    jekyll-theme-time-machine (0.1.0) +      jekyll (~> 3.5) +      jekyll-seo-tag (~> 2.0) +    jekyll-titles-from-headings (0.4.0) +      jekyll (~> 3.3) +    jekyll-watch (1.5.1) +      listen (~> 3.0) +    jemoji (0.8.0) +      activesupport (~> 4.0) +      gemoji (~> 3.0) +      html-pipeline (~> 2.2) +      jekyll (>= 3.0) +    kramdown (1.13.2) +    liquid (4.0.0) +    listen (3.0.6) +      rb-fsevent (>= 0.9.3) +      rb-inotify (>= 0.9.7) +    mercenary (0.3.6) +    mini_portile2 (2.3.0) +    minima (2.1.1) +      jekyll (~> 3.3) +    minitest (5.11.1) +    multipart-post (2.0.0) +    net-dns (0.8.0) +    nokogiri (1.8.1) +      mini_portile2 (~> 2.3.0) +    octokit (4.8.0) +      sawyer (~> 0.8.0, >= 0.5.3) +    pathutil (0.16.1) +      forwardable-extended (~> 2.6) +    public_suffix (2.0.5) +    rb-fsevent (0.10.2) +    rb-inotify (0.9.10) +      ffi (>= 0.5.0, < 2) +    rouge (1.11.1) +    safe_yaml (1.0.4) +    sass (3.5.5) +      sass-listen (~> 4.0.0) +    sass-listen (4.0.0) +      rb-fsevent (~> 0.9, >= 0.9.4) +      rb-inotify (~> 0.9, >= 0.9.7) +    sawyer (0.8.1) +      addressable (>= 2.3.5, < 2.6) +      faraday (~> 0.8, < 1.0) +    terminal-table (1.8.0) +      unicode-display_width (~> 1.1, >= 1.1.1) +    thread_safe (0.3.6) +    typhoeus (0.8.0) +      ethon (>= 0.8.0) +    tzinfo (1.2.4) +      thread_safe (~> 0.1) +    unicode-display_width (1.3.0) + +PLATFORMS +  ruby + +DEPENDENCIES +  github-pages + +BUNDLED WITH +   1.16.0 diff --git a/docs/Homebrew-and-Python.md b/docs/Homebrew-and-Python.md index 740e973d2..eb96e5758 100644 --- a/docs/Homebrew-and-Python.md +++ b/docs/Homebrew-and-Python.md @@ -69,7 +69,7 @@ Homebrew builds bindings against the first `python` (and `python-config`) in you  **Warning!** Python may crash (see [Common Issues](Common-Issues.md)) if you `import <module>` from a brewed Python if you ran `brew install <formula_with_python_bindings>` 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`).  ## Policy for non-brewed Python bindings -These should be installed via `pip install <package>`. To discover, you can use `pip search` or <https://pypi.python.org/pypi>. (**Note:** System Python does not provide `pip`. Follow the instructions at <https://pip.readthedocs.io/en/stable/installing/#install-pip> to install it for your system Python if you would like it.) +These should be installed via `pip install <package>`. To discover, you can use `pip search` or <https://pypi.python.org/pypi>. (**Note:** System Python does not provide `pip`. Follow the [pip documentation](https://pip.readthedocs.io/en/stable/installing/#install-pip) to install it for your system Python if you would like it.)  ## Brewed Python modules  For brewed Python, modules installed with `pip` or `python setup.py install` will be installed to the `$(brew --prefix)/lib/pythonX.Y/site-packages` directory (explained above). Executable Python scripts will be in `$(brew --prefix)/bin`. @@ -89,4 +89,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 depend on the special `:python` target are bottled against the Homebrew Python and require it to be installed. You can avoid installing Homebrew's Python by building these formulae with `--build-from-source`. +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. diff --git a/docs/Interesting-Taps-and-Forks.md b/docs/Interesting-Taps-and-Forks.md index 20fe0efde..5115fd9d5 100644 --- a/docs/Interesting-Taps-and-Forks.md +++ b/docs/Interesting-Taps-and-Forks.md @@ -29,6 +29,10 @@ You can be added as a maintainer for one of the Homebrew organization taps and a  *   [osrf/simulation](https://github.com/osrf/homebrew-simulation): Tools for robotics simulation. +*   [brewsci/bio](https://github.com/brewsci/homebrew-bio): Bioinformatics formulae. + +*   [brewsci/science](https://github.com/brewsci/homebrew-science): Software tailored to scientific endeavours. +  ## Interesting forks  *   [mistydemeo/tigerbrew](https://github.com/mistydemeo/tigerbrew): Experimental Tiger PowerPC version diff --git a/docs/Node-for-Formula-Authors.md b/docs/Node-for-Formula-Authors.md index f1a50a8c3..4053706c1 100644 --- a/docs/Node-for-Formula-Authors.md +++ b/docs/Node-for-Formula-Authors.md @@ -34,10 +34,10 @@ If your formula requires being executed with an older Node version you should us  ### Special requirements for native addons -If your Node module is a native addon or has a native addon somewhere in its dependency tree you have to declare an additional dependency. Since the compilation of the native addon results in an invocation of `node-gyp` we need an additional build time dependency on `:python` (because gyp depends on Python 2.7). +If your Node module is a native addon or has a native addon somewhere in its dependency tree you have to declare an additional dependency. Since the compilation of the native addon results in an invocation of `node-gyp` we need an additional build time dependency on `"python"` (because GYP depends on Python 2.7).  ```ruby -depends_on :python => :build +depends_on "python" => :build  ```  Also note that such a formula would only be compatible with the same Node major version it originally was compiled with. This means that we need to revision every formula with a Node native addon with every major version bump of the `node` formula. To make sure we don't overlook your formula on a Node major version bump, write a meaningful test which would fail in such a case (invoked with an ABI-incompatible Node version). @@ -99,7 +99,7 @@ class Foo < Formula    depends_on "node"    # uncomment if there is a native addon inside the dependency tree -  # depends_on :python => :build +  # depends_on "python" => :build    def install      system "npm", "install", *Language::Node.std_npm_install_args(libexec) diff --git a/docs/Python-for-Formula-Authors.md b/docs/Python-for-Formula-Authors.md index 723601afe..a530dbef7 100644 --- a/docs/Python-for-Formula-Authors.md +++ b/docs/Python-for-Formula-Authors.md @@ -19,12 +19,12 @@ Applications should unconditionally bundle all of their Python-language dependen  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" 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 is installed. +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`, which will cause the formula to use the first python3 discovered in `PATH` at install time (or install Homebrew's if there isn't one). These apps **must** work with the current Homebrew python3 formula. +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 @@ -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 "python3"` is declared, and use `virtualenv_create(libexec, "python3")`.    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 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/). +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 :python3 => :optional` and make the bindings conditional on `build.with?("python3")`. +To add bindings for Python 3, please add `depends_on "python3" => :optional` and make the bindings conditional on `build.with?("python3")`.  ### Dependencies @@ -153,7 +153,7 @@ 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 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 python3, and use the first python3 discovered in `PATH` at build time when installing from source with `brew install --build-from-source`. 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 Homebrew Python. +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.  ### Installing | 
