nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 202 lines 5.2 kB view raw
1{ 2 lib, 3 stdenv, 4 python3, 5 groff, 6 less, 7 fetchFromGitHub, 8 fetchpatch, 9 installShellFiles, 10 nix-update-script, 11 testers, 12 awscli2, 13 addBinToPathHook, 14 writableTmpDirAsHomeHook, 15}: 16 17let 18 py = python3 // { 19 pkgs = python3.pkgs.overrideScope ( 20 final: prev: { 21 # https://github.com/NixOS/nixpkgs/issues/449266 22 prompt-toolkit = prev.prompt-toolkit.overridePythonAttrs (prev: rec { 23 version = "3.0.51"; 24 src = prev.src.override { 25 tag = version; 26 hash = "sha256-pNYmjAgnP9nK40VS/qvPR3g+809Yra2ISASWJDdQKrU="; 27 }; 28 }); 29 30 # backends/build_system/utils.py cannot parse PEP 440 version 31 # for python-dateutil 2.9.0.post0 (eg. post0) 32 python-dateutil = prev.python-dateutil.overridePythonAttrs (prev: rec { 33 version = "2.8.2"; 34 format = "setuptools"; 35 pyproject = null; 36 src = prev.src.override { 37 inherit version; 38 hash = "sha256-ASPKzBYnrhnd88J6XeW9Z+5FhvvdZEDZdI+Ku0g9PoY="; 39 }; 40 patches = [ 41 # https://github.com/dateutil/dateutil/pull/1285 42 (fetchpatch { 43 url = "https://github.com/dateutil/dateutil/commit/f2293200747fb03d56c6c5997bfebeabe703576f.patch"; 44 relative = "src"; 45 hash = "sha256-BVEFGV/WGUz9H/8q+l62jnyN9VDnoSR71DdL+LIkb0o="; 46 }) 47 ]; 48 postPatch = null; 49 }); 50 } 51 ); 52 }; 53 54in 55py.pkgs.buildPythonApplication rec { 56 pname = "awscli2"; 57 version = "2.33.2"; # N.B: if you change this, check if overrides are still up-to-date 58 pyproject = true; 59 60 src = fetchFromGitHub { 61 owner = "aws"; 62 repo = "aws-cli"; 63 tag = version; 64 hash = "sha256-dAtcYDdrZASrwBjQfnZ4DUR4F5WhY59/UX92QcILavs="; 65 }; 66 67 postPatch = '' 68 substituteInPlace pyproject.toml \ 69 --replace-fail 'flit_core>=3.7.1,<3.9.1' 'flit_core>=3.7.1' \ 70 --replace-fail 'awscrt==' 'awscrt>=' \ 71 --replace-fail 'distro>=1.5.0,<1.9.0' 'distro>=1.5.0' \ 72 --replace-fail 'docutils>=0.10,<0.20' 'docutils>=0.10' \ 73 --replace-fail 'prompt-toolkit>=3.0.24,<3.0.52' 'prompt-toolkit>=3.0.24' \ 74 --replace-fail 'ruamel.yaml>=0.15.0,<=0.17.21' 'ruamel.yaml>=0.15.0' \ 75 --replace-fail 'ruamel.yaml.clib>=0.2.0,<=0.2.12' 'ruamel.yaml.clib>=0.2.0' 76 77 substituteInPlace requirements-base.txt \ 78 --replace-fail "wheel==0.43.0" "wheel>=0.43.0" 79 80 # Upstream needs pip to build and install dependencies and validates this 81 # with a configure script, but we don't as we provide all of the packages 82 # through PYTHONPATH 83 sed -i '/pip>=/d' requirements/bootstrap.txt 84 ''; 85 86 nativeBuildInputs = [ 87 installShellFiles 88 ]; 89 90 build-system = with py.pkgs; [ 91 flit-core 92 ]; 93 94 dependencies = with py.pkgs; [ 95 awscrt 96 colorama 97 distro 98 docutils 99 jmespath 100 prompt-toolkit 101 python-dateutil 102 ruamel-yaml 103 urllib3 104 ]; 105 106 propagatedBuildInputs = [ 107 groff 108 less 109 ]; 110 111 # Prevent breakage when running in a Python environment: https://github.com/NixOS/nixpkgs/issues/47900 112 makeWrapperArgs = [ 113 "--unset" 114 "NIX_PYTHONPATH" 115 "--unset" 116 "PYTHONPATH" 117 ]; 118 119 nativeCheckInputs = with py.pkgs; [ 120 addBinToPathHook 121 jsonschema 122 mock 123 pytestCheckHook 124 writableTmpDirAsHomeHook 125 ]; 126 127 postInstall = '' 128 installShellCompletion --cmd aws \ 129 --bash <(echo "complete -C $out/bin/aws_completer aws") \ 130 --zsh $out/bin/aws_zsh_completer.sh 131 '' 132 + lib.optionalString (!stdenv.hostPlatform.isWindows) '' 133 rm $out/bin/aws.cmd 134 ''; 135 136 # Propagating dependencies leaks them through $PYTHONPATH which causes issues 137 # when used in nix-shell. 138 postFixup = '' 139 rm $out/nix-support/propagated-build-inputs 140 ''; 141 142 # tests/unit/customizations/sso/test_utils.py uses sockets 143 __darwinAllowLocalNetworking = true; 144 145 pytestFlags = [ 146 "-Wignore::DeprecationWarning" 147 ]; 148 149 disabledTestPaths = [ 150 "tests/dependencies" 151 "tests/unit/botocore" 152 153 # Integration tests require networking 154 "tests/integration" 155 156 # Disable slow tests (only run unit tests) 157 "tests/backends" 158 "tests/functional" 159 ]; 160 161 disabledTests = [ 162 # Requires networking (socket binding not possible in sandbox) 163 "test_is_socket" 164 "test_is_special_file_warning" 165 166 # Disable slow tests 167 "test_details_disabled_for_choice_wo_details" 168 ]; 169 170 pythonImportsCheck = [ 171 "awscli" 172 ]; 173 174 passthru = { 175 python = py; # for aws_shell 176 updateScript = nix-update-script { 177 # Excludes 1.x versions from the Github tags list 178 extraArgs = [ 179 "--version-regex" 180 "^(2\\.(.*))" 181 ]; 182 }; 183 tests.version = testers.testVersion { 184 package = awscli2; 185 command = "aws --version"; 186 inherit version; 187 }; 188 }; 189 190 meta = { 191 description = "Unified tool to manage your AWS services"; 192 homepage = "https://aws.amazon.com/cli/"; 193 changelog = "https://github.com/aws/aws-cli/blob/${version}/CHANGELOG.rst"; 194 license = lib.licenses.asl20; 195 maintainers = with lib.maintainers; [ 196 davegallant 197 devusb 198 anthonyroussel 199 ]; 200 mainProgram = "aws"; 201 }; 202}