diff options
| author | Misty De Meo | 2013-01-09 17:04:02 -0600 |
|---|---|---|
| committer | Misty De Meo | 2013-01-09 17:09:28 -0600 |
| commit | 9643ba6014783e3e055f4cf3af8a30a40c78d3d4 (patch) | |
| tree | ea9121ddeba1437945576c45150f9d9f0dad43b3 /Library | |
| parent | 21fa09cebb15685ece5f571f7c45ff357708d55a (diff) | |
| download | homebrew-9643ba6014783e3e055f4cf3af8a30a40c78d3d4.tar.bz2 | |
doctor: use -V for python version
`python --version` doesn't work in some (very) old versions of
python. While I doubt this is going to come up very often, it's
theoretically possible someone has an old python first in their
path. (python -V works on all versions I'm aware of, including
python3, and comes before --version in the --help anyway.)
Also skips the warning in case the regexp matches nothing, which
probably shouldn't happen. But if it does we shouldn't produce the
wrong warning.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/doctor.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index 76f35bb12..9ab3c46f8 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -890,8 +890,10 @@ end def check_for_bad_python_symlink return unless which "python" - # Indeed Python --version outputs to stderr (WTF?) - `python --version 2>&1` =~ /Python (\d+)\./ + # Indeed Python -V outputs to stderr (WTF?) + `python -V 2>&1` =~ /Python (\d+)\./ + # This won't be the right warning if we matched nothing at all + return if $1.nil? unless $1 == "2" then <<-EOS.undent python is symlinked to python#$1 This will confuse build scripts and in general lead to subtle breakage. |
