diff options
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/doctor.rb | 10 | ||||
| -rw-r--r-- | completions/bash/brew | 70 | ||||
| -rw-r--r-- | completions/zsh/_brew | 4 | ||||
| -rw-r--r-- | completions/zsh/_brew_cask | 8 | ||||
| -rw-r--r-- | docs/Homebrew-and-Python.md | 4 | ||||
| -rw-r--r-- | docs/Node-for-Formula-Authors.md | 6 | ||||
| -rw-r--r-- | docs/Python-for-Formula-Authors.md | 14 |
7 files changed, 92 insertions, 24 deletions
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/completions/bash/brew b/completions/bash/brew index 3bde8f926..f885b808d 100644 --- a/completions/bash/brew +++ b/completions/bash/brew @@ -51,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")) } @@ -593,7 +593,7 @@ __brew_cask_complete_formulae () 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') + local ff=$(\ls ${casks} 2>/dev/null | \sed 's/\.rb//g') COMPREPLY=($(compgen -W "$ff" -- "$cur")) } @@ -638,17 +638,53 @@ _brew_cask_fetch () __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 "-1 -l --versions" + __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 } @@ -664,6 +700,18 @@ _brew_cask_uninstall () __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 @@ -689,24 +737,30 @@ _brew_cask () done if [[ $i -eq $COMP_CWORD ]]; then - __brew_caskcomp "abv audit cat cleanup create doctor edit fetch home info install list ls remove rm search uninstall zap -S --force --caskroom --verbose --appdir --colorpickerdir --prefpanedir --qlplugindir --fontdir --servicedir --input_methoddir --internet_plugindir --screen_saverdir --no-binaries --binarydir --debug" + __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 ;; - doctor) ;; + 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_complete_formulae ;; + install|instal) _brew_cask_install ;; list|ls) _brew_cask_list ;; - search) ;; + 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 @@ -738,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 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/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/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 |
