homebrew-core/Formula/awscli.rb

64 lines
2.2 KiB
Ruby

class Awscli < Formula
include Language::Python::Virtualenv
desc "Official Amazon AWS command-line interface"
homepage "https://aws.amazon.com/cli/"
url "https://github.com/aws/aws-cli/archive/2.2.6.tar.gz"
sha256 "67698c4f10b87314414c72f26b5f9a4df48676227417f30055d44d3a89306ed9"
license "Apache-2.0"
head "https://github.com/aws/aws-cli.git", branch: "v2"
bottle do
sha256 cellar: :any, arm64_big_sur: "f65d37773d7dfe5f55fae8e148685a782734cdffcf3ab289d1701546d02a3872"
sha256 big_sur: "e07dd2c84588472206c9468098d630aae70787568ddc57142597503f175a1ca1"
sha256 catalina: "bb1c3016d8e1c50c852b181ca1be94ef07bc8f18e4123456fa73c7451830b8ef"
sha256 mojave: "4d033760d036e57aa62861d45d7439e37fc9e27824864f841f8850db328272c8"
end
depends_on "cmake" => :build
depends_on "python@3.9"
uses_from_macos "groff"
on_linux do
depends_on "libyaml"
end
def install
venv = virtualenv_create(libexec, "python3")
system libexec/"bin/pip", "install", "-v", "-r", "requirements.txt",
"--ignore-installed", buildpath
system libexec/"bin/pip", "uninstall", "-y", "awscli"
venv.pip_install_and_link buildpath
system libexec/"bin/pip", "uninstall", "-y", "pyinstaller"
pkgshare.install "awscli/examples"
rm Dir["#{bin}/{aws.cmd,aws_bash_completer,aws_zsh_completer.sh}"]
bash_completion.install "bin/aws_bash_completer"
zsh_completion.install "bin/aws_zsh_completer.sh"
(zsh_completion/"_aws").write <<~EOS
#compdef aws
_aws () {
local e
e=$(dirname ${funcsourcetrace[1]%:*})/aws_zsh_completer.sh
if [[ -f $e ]]; then source $e; fi
}
EOS
system libexec/"bin/python3", "scripts/gen-ac-index", "--include-builtin-index"
end
def caveats
<<~EOS
The "examples" directory has been installed to:
#{HOMEBREW_PREFIX}/share/awscli/examples
EOS
end
test do
assert_match "topics", shell_output("#{bin}/aws help")
assert_includes Dir["#{libexec}/lib/python3.9/site-packages/awscli/data/*"],
"#{libexec}/lib/python3.9/site-packages/awscli/data/ac.index"
end
end