Blame awscli2.spec

Nikola Forró 677050
%global pkgname aws-cli
Nikola Forró 677050
Nikola Forró 677050
Name:               awscli2
Nikola Forró 2f8f83
Version:            2.12.0
Nikola Forró 677050
Release:            %autorelease
Nikola Forró 677050
Nikola Forró 677050
Summary:            Universal Command Line Environment for AWS, version 2
Nikola Forró 677050
# all files are licensed under Apache-2.0, except:
Nikola Forró 677050
# - awscli/topictags.py is MIT
Nikola Forró 677050
# - awscli/botocore/vendored/six.py is MIT
Nikola Forró 677050
License:            Apache-2.0 AND MIT
Nikola Forró 677050
URL:                https://github.com/aws/aws-cli/tree/v2
Nikola Forró 677050
Nikola Forró 677050
Source0:            https://github.com/aws/aws-cli/archive/%{version}/%{pkgname}-%{version}.tar.gz
Nikola Forró 677050
Nikola Forró 677050
# ruamel-yaml 0.17.22 changed whitespace formatting, breaking some TestUpdateKubeconfig tests
Nikola Forró 677050
# add a workaround for that until upstream comes with a proper fix
Nikola Forró 677050
Patch0:             ruamel-yaml-0.17.22.patch
Nikola Forró 677050
Nikola Forró 677050
BuildArch:          noarch
Nikola Forró 677050
Nikola Forró 677050
BuildRequires:      python%{python3_pkgversion}-devel
Nikola Forró 677050
BuildRequires:      python-unversioned-command
Nikola Forró 677050
BuildRequires:      procps-ng
Nikola Forró 677050
Nikola Forró 677050
Recommends:         groff
Nikola Forró 677050
Nikola Forró 9c0250
Provides:           bundled(python3dist(botocore)) = 2.0.0
Nikola Forró 9c0250
Provides:           bundled(python3dist(s3transfer)) = 0.5.1
Nikola Forró 9c0250
Nikola Forró 677050
Provides:           awscli = %{version}-%{release}
Nikola Forró 677050
Obsoletes:          awscli < 2
Nikola Forró 677050
Nikola Forró 677050
# provide an upgrade path from awscli-2 (Amazon Linux)
Nikola Forró 677050
Provides:           awscli-2 = %{version}-%{release}
Nikola Forró 677050
Obsoletes:          awscli-2 < %{version}-%{release}
Nikola Forró 677050
Nikola Forró 677050
# python-awscrt does not build on s390x
Nikola Forró 677050
ExcludeArch:        s390x
Nikola Forró 677050
Nikola Forró 677050
Nikola Forró 677050
%description
Nikola Forró 677050
This package provides version 2 of the unified command line
Nikola Forró 677050
interface to Amazon Web Services.
Nikola Forró 677050
Nikola Forró 677050
Nikola Forró 677050
%prep
Nikola Forró 677050
%autosetup -p1 -n %{pkgname}-%{version}
Nikola Forró 677050
Nikola Forró 677050
# fix permissions
Nikola Forró 677050
find awscli/examples/ -type f -name '*.rst' -executable -exec chmod -x '{}' +
Nikola Forró 677050
Nikola Forró 9c0250
# remove version caps on dependencies
Nikola Forró 9c0250
sed -i 's/,<=\?[^"]*"/"/' pyproject.toml
Nikola Forró 9c0250
Nikola Forró 677050
# use unittest.mock
Nikola Forró 677050
find -type f -name '*.py' -exec sed \
Nikola Forró 677050
    -e 's/^\( *\)import mock$/\1from unittest import mock/' \
Nikola Forró 677050
    -e 's/^\( *\)from mock import mock/\1from unittest import mock/' \
Nikola Forró 677050
    -e 's/^\( *\)from mock import/\1from unittest.mock import/' \
Nikola Forró 677050
    -i '{}' +
Nikola Forró 677050
b00a80
# Fedora does not run coverage tests.
b00a80
# mock is deprecated in Fedora. We use unittest.mock.
0683b1
# pip-tools is not used directly by the unit tests.
b00a80
sed \
b00a80
    -e 's|==.*||' \
b00a80
    -e '/coverage/d' \
b00a80
    -e '/mock/d' \
b00a80
    -e '/pip-tools/d' \
b00a80
    -e '/pytest-cov/d' \
b00a80
    requirements-test.txt > _requirements-test.txt
b00a80
Nikola Forró 677050
Nikola Forró 677050
%generate_buildrequires
b00a80
%pyproject_buildrequires _requirements-test.txt
Nikola Forró 677050
Nikola Forró 677050
Nikola Forró 677050
%build
Nikola Forró 677050
%pyproject_wheel
Nikola Forró 677050
Nikola Forró 677050
Nikola Forró 677050
%install
Nikola Forró 677050
%pyproject_install
Nikola Forró 677050
%pyproject_save_files awscli
Nikola Forró 677050
Nikola Forró 677050
# remove unnecessary scripts
Nikola Forró 677050
rm -vf %{buildroot}%{_bindir}/{aws_bash_completer,aws_zsh_completer.sh,aws.cmd}
Nikola Forró 677050
Nikola Forró 677050
# install shell completion
Nikola Forró 677050
install -Dpm0644 bin/aws_bash_completer \
3a8ae5
  %{buildroot}%{bash_completions_dir}/aws
Nikola Forró 677050
install -Dpm0644 bin/aws_zsh_completer.sh \
3a8ae5
  %{buildroot}%{zsh_completions_dir}/_awscli
Nikola Forró 677050
Nikola Forró 677050
Nikola Forró 677050
%check
Nikola Forró 677050
# it appears that some tests modify the environment and remove PYTHONPATH
Nikola Forró 677050
# so it's not passed to botocore cmd-runner, inject it here
Nikola Forró 677050
sed -i '/self.driver.start(env=env)/i \ \ \ \ \ \ \ \ env["PYTHONPATH"] = "%{buildroot}%{python3_sitelib}"' \
Nikola Forró 677050
    tests/utils/botocore/__init__.py
Nikola Forró 677050
Nikola Forró 677050
export TESTS_REMOVE_REPO_ROOT_FROM_PATH=1 TZ=UTC
Nikola Forró 677050
%pytest --verbose --numprocesses=auto --dist=loadfile tests/unit tests/functional
Nikola Forró 677050
Nikola Forró 677050
Nikola Forró 677050
%files -f %{pyproject_files}
Nikola Forró 677050
%license LICENSE.txt
Nikola Forró 677050
%doc README.rst
Nikola Forró 677050
%{_bindir}/aws
Nikola Forró 677050
%{_bindir}/aws_completer
3a8ae5
%{bash_completions_dir}/aws
3a8ae5
%{zsh_completions_dir}/_awscli
Nikola Forró 677050
Nikola Forró 677050
Nikola Forró 677050
%changelog
Nikola Forró 677050
%autochangelog