Cask: add doctor check for xattr

CC: Homebrew/homebrew-cask#69660
This commit is contained in:
L. E. Segovia 2019-10-01 11:17:27 +00:00
parent 0c26e032c4
commit caf7df5840
No known key found for this signature in database
GPG Key ID: D5D1DC48B52B7AD5

View File

@ -25,6 +25,7 @@ module Cask
def run
check_software_versions
check_xattr
check_quarantine_support
check_install_location
check_staging_location
@ -121,6 +122,29 @@ module Cask
(locale_variables + environment_variables).sort.each(&method(:render_env_var))
end
def check_xattr
ohai "xattr issues"
result = system_command "/usr/bin/xattr"
if result.status.success?
puts none_string
elsif result.stderr.match? "ImportError: No module named pkg_resources"
result = system_command "/usr/bin/python", "--version"
if result.stdout.match? "Python 2.7"
add_error "Your Python installation has a broken version of setuptools."
add_error "To fix, reinstall macOS or run 'sudo /usr/bin/python -m pip install -I setuptools'."
else
add_error "The system Python version is wrong."
add_error "To fix, run 'defaults write com.apple.versioner.python Version 2.7'."
end
elsif result.stderr.match? "pkg_resources.DistributionNotFound"
add_error "Your Python installation is unable to find xattr."
else
add_error "unknown xattr error: #{result.stderr.first}"
end
end
def check_quarantine_support
ohai "Gatekeeper support"