1{ lib
2, python3
3, fetchPypi
4, groff
5, less
6}:
7
8python3.pkgs.buildPythonApplication rec {
9 pname = "awscli";
10 version = "1.29.9"; # N.B: if you change this, change botocore and boto3 to a matching version too
11
12 src = fetchPypi {
13 inherit pname version;
14 hash = "sha256-8SmOu79FZESL1Hd15wdd1m1Uewswqaum2y8LOZAl9P8=";
15 };
16
17 # https://github.com/aws/aws-cli/issues/4837
18 postPatch = ''
19 substituteInPlace setup.py \
20 --replace "docutils>=0.10,<0.17" "docutils>=0.10" \
21 --replace "colorama>=0.2.5,<0.4.5" "colorama>=0.2.5,<0.5" \
22 --replace "rsa>=3.1.2,<4.8" "rsa<5,>=3.1.2"
23 '';
24
25 propagatedBuildInputs = with python3.pkgs; [
26 botocore
27 bcdoc
28 s3transfer
29 colorama
30 docutils
31 rsa
32 pyyaml
33 groff
34 less
35 ];
36
37 postInstall = ''
38 mkdir -p $out/share/bash-completion/completions
39 echo "complete -C $out/bin/aws_completer aws" > $out/share/bash-completion/completions/awscli
40
41 mkdir -p $out/share/zsh/site-functions
42 mv $out/bin/aws_zsh_completer.sh $out/share/zsh/site-functions
43
44 rm $out/bin/aws.cmd
45 '';
46
47 passthru = {
48 python = python3; # for aws_shell
49 };
50
51 doInstallCheck = true;
52
53 installCheckPhase = ''
54 runHook preInstallCheck
55
56 $out/bin/aws --version | grep "${python3.pkgs.botocore.version}"
57 $out/bin/aws --version | grep "${version}"
58
59 runHook postInstallCheck
60 '';
61
62 meta = with lib; {
63 homepage = "https://aws.amazon.com/cli/";
64 changelog = "https://github.com/aws/aws-cli/blob/${version}/CHANGELOG.rst";
65 description = "Unified tool to manage your AWS services";
66 license = licenses.asl20;
67 mainProgram = "aws";
68 maintainers = with maintainers; [ ];
69 };
70}