1{ lib
2, python3
3, fetchFromGitHub
4, groff
5, less
6}:
7let
8 py = python3.override {
9 packageOverrides = self: super: {
10 pyyaml = super.pyyaml.overridePythonAttrs (oldAttrs: rec {
11 version = "5.4.1";
12 src = fetchFromGitHub {
13 owner = "yaml";
14 repo = "pyyaml";
15 rev = version;
16 hash = "sha256-VUqnlOF/8zSOqh6JoEYOsfQ0P4g+eYqxyFTywgCS7gM=";
17 };
18 checkPhase = ''
19 runHook preCheck
20 PYTHONPATH="tests/lib3:$PYTHONPATH" ${self.python.interpreter} -m test_all
21 runHook postCheck
22 '';
23 });
24 };
25 self = py;
26 };
27
28in
29with py.pkgs; buildPythonApplication rec {
30 pname = "awscli";
31 version = "1.25.76"; # N.B: if you change this, change botocore and boto3 to a matching version too
32
33 src = fetchPypi {
34 inherit pname version;
35 hash = "sha256-PSr0zZEGXFxcFSN7QQ5Ux0Z4aCwwm9na+2hIv/gR6+s=";
36 };
37
38 # https://github.com/aws/aws-cli/issues/4837
39 postPatch = ''
40 substituteInPlace setup.py \
41 --replace "docutils>=0.10,<0.17" "docutils>=0.10" \
42 --replace "colorama>=0.2.5,<0.4.5" "colorama>=0.2.5,<0.5" \
43 --replace "rsa>=3.1.2,<4.8" "rsa<5,>=3.1.2"
44 '';
45
46 propagatedBuildInputs = [
47 botocore
48 bcdoc
49 s3transfer
50 six
51 colorama
52 docutils
53 rsa
54 pyyaml
55 groff
56 less
57 ];
58
59 postInstall = ''
60 mkdir -p $out/share/bash-completion/completions
61 echo "complete -C $out/bin/aws_completer aws" > $out/share/bash-completion/completions/awscli
62
63 mkdir -p $out/share/zsh/site-functions
64 mv $out/bin/aws_zsh_completer.sh $out/share/zsh/site-functions
65
66 rm $out/bin/aws.cmd
67 '';
68
69 passthru = {
70 python = py; # for aws_shell
71 };
72
73 doInstallCheck = true;
74 installCheckPhase = ''
75 runHook preInstallCheck
76
77 $out/bin/aws --version | grep "${py.pkgs.botocore.version}"
78 $out/bin/aws --version | grep "${version}"
79
80 runHook postInstallCheck
81 '';
82
83 meta = with lib; {
84 homepage = "https://aws.amazon.com/cli/";
85 description = "Unified tool to manage your AWS services";
86 license = licenses.asl20;
87 mainProgram = "aws";
88 maintainers = with maintainers; [ ];
89 };
90}