awscli2/awscli2.spec
Major Hayden 53e1810c55
Initial package
Resolves: RHEL-14523

Signed-off-by: Major Hayden <major@redhat.com>
2024-05-01 09:10:37 -05:00

127 lines
3.8 KiB
RPMSpec

%bcond tests 1
%global pkgname aws-cli
Name: awscli2
Version: 2.15.31
Release: 1%{?dist}
Summary: Universal Command Line Environment for AWS, version 2
# all files are licensed under Apache-2.0, except:
# - awscli/topictags.py is MIT
# - awscli/botocore/vendored/six.py is MIT
License: Apache-2.0 AND MIT
URL: https://github.com/aws/aws-cli/tree/v2
Source0: https://github.com/aws/aws-cli/archive/%{version}/%{pkgname}-%{version}.tar.gz
# Remove colorama dependency.
Patch: awscli2-remove-colorama.patch
BuildArch: noarch
BuildRequires: pyproject-rpm-macros
BuildRequires: python3-devel
BuildRequires: python3-pip
BuildRequires: python-unversioned-command
BuildRequires: procps-ng
BuildRequires: python3dist(awscrt)
BuildRequires: python3dist(cryptography)
BuildRequires: python3dist(distro)
BuildRequires: python3dist(docutils)
BuildRequires: python3dist(flit-core)
BuildRequires: python3dist(jmespath)
BuildRequires: python3dist(prompt-toolkit)
BuildRequires: python3dist(python-dateutil)
BuildRequires: python3dist(ruamel-yaml-clib)
BuildRequires: python3dist(urllib3)
%if %{with tests}
BuildRequires: python3dist(pytest)
%endif
Recommends: groff
# python-awscrt does not build on s390x
ExcludeArch: s390x
%description
This package provides version 2 of the unified command line
interface to Amazon Web Services.
%prep
%autosetup -p1 -n %{pkgname}-%{version}
# fix permissions
find awscli/examples/ -type f -name '*.rst' -executable -exec chmod -x '{}' +
# use unittest.mock
find -type f -name '*.py' -exec sed \
-e 's/^\( *\)import mock$/\1from unittest import mock/' \
-e 's/^\( *\)from mock import mock/\1from unittest import mock/' \
-e 's/^\( *\)from mock import/\1from unittest.mock import/' \
-i '{}' +
%build
%pyproject_wheel
%install
%pyproject_install
%pyproject_save_files awscli
# remove unnecessary scripts
rm -vf %{buildroot}%{_bindir}/{aws_bash_completer,aws_zsh_completer.sh,aws.cmd}
# install shell completion
install -Dpm0644 bin/aws_bash_completer \
%{buildroot}%{_datadir}/bash-completion/completions/aws
install -Dpm0644 bin/aws_zsh_completer.sh \
%{buildroot}%{_datadir}/zsh/site-functions/_awscli
%check
export OPENSSL_ENABLE_SHA1_SIGNATURES=yes
%pyproject_check_import
%if %{with tests}
# Upstream also treats some warnings, such as DeprecationWarning, as a failure, but the
# code has deprecation warnings in it. So, we disable warnings as errors for both
# sets of tests below. Also skip tests that depend on colorama.
%pytest tests/unit \
--disable-pytest-warnings -Wd \
-k "not test_non_aggregate_keys and not test_can_use_color" \
--ignore tests/unit/output/test_yaml_output.py \
--ignore tests/unit/customizations/logs/test_tail.py
# awscli has some command runners built into tests and some of them eat the environment
# variables, especially PYTHONPATH, and cause awscli to fail to import. Also skip tests
# that depend on colorama.
%pytest tests/functional \
--disable-pytest-warnings -Wd \
--ignore tests/functional/autocomplete/test_completion_files.py \
--ignore tests/functional/botocore/test_waiter_config.py \
--ignore tests/functional/botocore/leak/test_resource_leaks.py \
--ignore tests/functional/dependencies/test_colorama.py \
--ignore tests/functional/logs/test_tail.py \
-k "not test_smoke_test_completer and not test_pipe_color"
%endif
%files -f %{pyproject_files}
%license LICENSE.txt
%doc README.rst
%{_bindir}/aws
%{_bindir}/aws_completer
%{_datadir}/bash-completion/completions/aws
%{_datadir}/zsh/site-functions/_awscli
%changelog
* Wed Jan 31 2024 Major Hayden <major@redhat.com> - 2.15.31-1
- Initial RHEL 9 package.