archrelease: copy trunk to community-x86_64
[ArchLinux/community.git] / aws-cli-v2 / repos / community-any / PKGBUILD
blob80cafa58282bb1b8c76e650c2442641dcf052e53
1 # Maintainer: Chih-Hsuan Yen <yan12125@archlinux.org>
2 # Contributor: Marcel Campello <marcel.campello@prafrentex.com.br>
3 # Contributor: David Birks <david@birks.dev>
5 pkgname=aws-cli-v2
6 pkgver=2.11.18
7 pkgrel=1
8 pkgdesc='Unified command line interface for Amazon Web Services (version 2)'
9 arch=(any)
10 url='https://github.com/aws/aws-cli/tree/v2'
11 license=(Apache)
12 depends=(python python-awscrt python-certifi python-colorama python-cryptography python-dateutil
13          python-distro python-docutils python-jmespath python-prompt_toolkit python-ruamel-yaml
14          python-urllib3)
15 makedepends=(python-build python-wheel python-flit-core python-installer)
16 # Tests need the 'ps' binary
17 checkdepends=(python-pytest python-pytest-xdist python-jsonschema python-mock procps-ng)
18 provides=(aws-cli)
19 conflicts=(aws-cli)
20 source=("https://awscli.amazonaws.com/awscli-$pkgver.tar.gz"{,.sig}
21         build-ac.index-in-tmp.diff
22         fix-env.diff
23         "$pkgname-tz-fix.patch::https://github.com/aws/aws-cli/pull/7762.patch")
24 sha256sums=('b09bee1a52a1dc8c3f5e904195933fd27583f867276dd0deefc53358b9074b9d'
25             'SKIP'
26             '0267e41561ab2c46a97ebfb024f0b047aabc9e6b9866f204b2c1a84ee5810d63'
27             '893d61d7e958c3c02bfa1e03bf58f6f6abd98849d248cc661f1c56423df9f312'
28             '4fc614b8550d7363bb2d578c6b49326c9255203eb2f933fd0551f96ed5fb1f30')
29 validpgpkeys=(
30   'FB5DB77FD5C118B80511ADA8A6310ACC4672475C'  # the key mentioned on https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
33 prepare() {
34   cd awscli-$pkgver
36   # Don't treat warnings as errors
37   sed -i '/"error::/d' pyproject.toml
39   # ac.index is an SQLite database, and building it on copy-on-write filesystems (ex: BTRFS) takes ages
40   patch -Np1 -i ../build-ac.index-in-tmp.diff
42   # Fix conflicts between tests/functional/test_clidriver.py::TestSession and tests/functional/botocore/leak/test_resource_leaks.py
43   patch -Np1 -i ../fix-env.diff
45   # Fix possible test failure with a non-UTC time zone (https://bugs.archlinux.org/task/77919)
46   patch -Np1 -i ../$pkgname-tz-fix.patch
49 build() {
50   cd awscli-$pkgver
52   # flit-core adds runtime dependencies to reported build-time dependencies [1],
53   # and upstream often lags behind the latest dependencies [2], thus --skip-dependency-check
54   # [1] https://github.com/pypa/flit/issues/354
55   # [2] https://github.com/aws/aws-cli/issues/5943
56   python -m build --wheel --no-isolation --skip-dependency-check
57   # Copy the built ac.index for tests
58   cp -v build/unpacked_wheel/awscli/data/ac.index awscli/data/ac.index
61 check() {
62   cd awscli-$pkgver
64   export AWS_SECRET_ACCESS_KEY=fake_key
65   export AWS_ACCESS_KEY_ID=fake_id
67   export PYTHONPATH="$PWD"
69   # * Use --dist=loadfile following upstream. The default --dist=load may cause test failures and is not faster
70   # * Disable backend tests - those tests check if aws-cli can be installed or not, and are not compatible with all kinds of environments
71   pytest tests -n auto --dist loadfile --ignore=tests/backends --ignore=tests/integration
74 package() {
75   cd awscli-$pkgver
76   python -m installer --destdir="$pkgdir" dist/*.whl
77   install -Dm 644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
78   install -Dm 644 bin/aws_bash_completer "$pkgdir/usr/share/bash-completion/completions/aws"