Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 23.11-beta 143 lines 3.6 kB view raw
1{ lib 2, stdenv 3, python3 4, groff 5, less 6, fetchFromGitHub 7, installShellFiles 8, nix-update-script 9, testers 10, awscli2 11}: 12 13let 14 py = python3 // { 15 pkgs = python3.pkgs.overrideScope (final: prev: { 16 ruamel-yaml = prev.ruamel-yaml.overridePythonAttrs (prev: { 17 src = prev.src.override { 18 version = "0.17.21"; 19 hash = "sha256-i3zml6LyEnUqNcGsQURx3BbEJMlXO+SSa1b/P10jt68="; 20 }; 21 }); 22 urllib3 = prev.urllib3.overridePythonAttrs (prev: { 23 format = "setuptools"; 24 src = prev.src.override { 25 version = "1.26.18"; 26 hash = "sha256-+OzBu6VmdBNFfFKauVW/jGe0XbeZ0VkGYmFxnjKFgKA="; 27 }; 28 }); 29 }); 30 }; 31 32in 33with py.pkgs; buildPythonApplication rec { 34 pname = "awscli2"; 35 version = "2.13.33"; # N.B: if you change this, check if overrides are still up-to-date 36 format = "pyproject"; 37 38 src = fetchFromGitHub { 39 owner = "aws"; 40 repo = "aws-cli"; 41 rev = "refs/tags/${version}"; 42 hash = "sha256-5ANfMa7b72z5E1EH9+dJ9avLDBnSEFGqvDOFFzLbZcM="; 43 }; 44 45 postPatch = '' 46 substituteInPlace pyproject.toml \ 47 --replace 'cryptography>=3.3.2,<40.0.2' 'cryptography>=3.3.2' \ 48 --replace 'flit_core>=3.7.1,<3.8.1' 'flit_core>=3.7.1' \ 49 --replace 'awscrt>=0.16.4,<=0.19.6' 'awscrt>=0.16.4' \ 50 --replace 'docutils>=0.10,<0.20' 'docutils>=0.10' \ 51 --replace 'prompt-toolkit>=3.0.24,<3.0.39' 'prompt-toolkit>=3.0.24' 52 53 substituteInPlace requirements-base.txt \ 54 --replace "wheel==0.38.4" "wheel>=0.38.4" \ 55 --replace "flit_core==3.8.0" "flit_core>=3.8.0" 56 57 # Upstream needs pip to build and install dependencies and validates this 58 # with a configure script, but we don't as we provide all of the packages 59 # through PYTHONPATH 60 sed -i '/pip>=/d' requirements/bootstrap.txt 61 ''; 62 63 nativeBuildInputs = [ 64 installShellFiles 65 flit-core 66 ]; 67 68 propagatedBuildInputs = [ 69 awscrt 70 bcdoc 71 botocore 72 colorama 73 cryptography 74 distro 75 docutils 76 groff 77 jmespath 78 less 79 prompt-toolkit 80 python-dateutil 81 pyyaml 82 ruamel-yaml 83 urllib3 84 ]; 85 86 nativeCheckInputs = [ 87 jsonschema 88 mock 89 pytestCheckHook 90 ]; 91 92 postInstall = '' 93 installShellCompletion --cmd aws \ 94 --bash <(echo "complete -C $out/bin/aws_completer aws") \ 95 --zsh $out/bin/aws_zsh_completer.sh 96 '' + lib.optionalString (!stdenv.hostPlatform.isWindows) '' 97 rm $out/bin/aws.cmd 98 ''; 99 100 preCheck = '' 101 export PATH=$PATH:$out/bin 102 export HOME=$(mktemp -d) 103 ''; 104 105 pytestFlagsArray = [ 106 "-Wignore::DeprecationWarning" 107 ]; 108 109 disabledTestPaths = [ 110 # Integration tests require networking 111 "tests/integration" 112 113 # Disable slow tests (only run unit tests) 114 "tests/backends" 115 "tests/functional" 116 ]; 117 118 pythonImportsCheck = [ 119 "awscli" 120 ]; 121 122 passthru = { 123 python = py; # for aws_shell 124 updateScript = nix-update-script { 125 # Excludes 1.x versions from the Github tags list 126 extraArgs = [ "--version-regex" "^(2\.(.*))" ]; 127 }; 128 tests.version = testers.testVersion { 129 package = awscli2; 130 command = "aws --version"; 131 inherit version; 132 }; 133 }; 134 135 meta = with lib; { 136 description = "Unified tool to manage your AWS services"; 137 homepage = "https://docs.aws.amazon.com/cli/latest/userguide/"; 138 changelog = "https://github.com/aws/aws-cli/blob/${version}/CHANGELOG.rst"; 139 license = licenses.asl20; 140 maintainers = with maintainers; [ bhipple davegallant bryanasdev000 devusb anthonyroussel ]; 141 mainProgram = "aws"; 142 }; 143}