%if 0%{?rhel} # some tests fail on EL9 %bcond_with all_tests %else %bcond_without all_tests %endif %global pkgname aws-cli Name: awscli2 Version: 2.13.4 Release: 1%{?dist}.1 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 # adapt to whitespace formatting changes and removal of OrderedDict in ruamel-yaml Patch0: ruamel-yaml-0.17.32.patch BuildArch: noarch BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python-unversioned-command BuildRequires: procps-ng Recommends: groff Provides: bundled(python3dist(botocore)) = 2.0.0 Provides: bundled(python3dist(s3transfer)) = 0.5.1 Provides: awscli = %{version}-%{release} Obsoletes: awscli < 2 # provide an upgrade path from awscli-2 (Amazon Linux) Provides: awscli-2 = %{version}-%{release} Obsoletes: awscli-2 < %{version}-%{release} # 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 '{}' + # remove version caps on dependencies sed -i 's/,<=\?[^"]*"/"/' pyproject.toml # 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 '{}' + # Fedora does not run coverage tests. # mock is deprecated in Fedora. We use unittest.mock. # pip-tools is not used directly by the unit tests. sed \ -e 's|==.*||' \ -e '/coverage/d' \ -e '/mock/d' \ -e '/pip-tools/d' \ -e '/pytest-cov/d' \ requirements-test.txt > _requirements-test.txt %generate_buildrequires %pyproject_buildrequires _requirements-test.txt %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}%{bash_completions_dir}/aws install -Dpm0644 bin/aws_zsh_completer.sh \ %{buildroot}%{zsh_completions_dir}/_awscli %check # it appears that some tests modify the environment and remove PYTHONPATH # so it's not passed to botocore cmd-runner, inject it here sed -i '/self.driver.start(env=env)/i \ \ \ \ \ \ \ \ env["PYTHONPATH"] = "%{buildroot}%{python3_sitelib}"' \ tests/utils/botocore/__init__.py export TESTS_REMOVE_REPO_ROOT_FROM_PATH=1 TZ=UTC %if %{with all_tests} %pytest --verbose --numprocesses=auto --dist=loadfile tests/unit tests/functional %else # these tests fail either in local mock, in COPR, or in CBS EXCLUDES="not test_canned_policy and not test_custom_policy" EXCLUDES+=" and not test_start_session_fails and not test_start_session_success" EXCLUDES+=" and not test_ctrl_c_is_ignored and not test_start_session_when_no_profile_is_passed" EXCLUDES+=" and not test_execute_command_success" EXCLUDES+=" and not test_no_event_stream_unless_allowed" EXCLUDES+=" and not test_yaml_stream_paginated_response and not test_yaml_stream_removes_response_metadata_for_all_responses" EXCLUDES+=" and not test_can_specify_zero_marker and not test_repeated_build_full_results" EXCLUDES+=" and not test_token_with_triple_underscore" %pytest --verbose --numprocesses=auto --dist=loadfile tests/unit tests/functional \ -k "$EXCLUDES" \ %ifarch x86_64 --ignore=tests/unit/output/test_yaml_output.py \ --ignore=tests/functional/autocomplete/test_generator.py \ --ignore=tests/functional/botocore/test_route53.py \ --ignore=tests/functional/cloudformation/test_describe_stacks.py \ --ignore=tests/functional/configured_endpoint_urls/test_configured_endpoint_url.py \ --ignore=tests/functional/ddb/test_select.py \ --ignore=tests/functional/ec2/test_describe_instances.py \ --ignore=tests/functional/ec2/test_describe_snapshots.py \ --ignore=tests/functional/ec2/test_describe_volumes.py \ --ignore=tests/functional/ec2instanceconnect/test_opentunnel.py \ --ignore=tests/functional/ecs/test_deploy.py \ --ignore=tests/functional/eks/test_get_token.py \ --ignore=tests/functional/iot/test_outfile.py \ --ignore=tests/functional/logs/test_tail.py \ --ignore=tests/functional/opsworkscm/test_alias.py \ --ignore=tests/functional/rds/test_describe_db_log_files.py \ --ignore=tests/functional/route53/test_list_resource_record_sets.py \ --ignore=tests/functional/route53domains/test_view_billing.py \ --ignore=tests/functional/sqs/test_list_queues.py \ %endif --ignore=tests/functional/autocomplete/test_completion_files.py \ --ignore=tests/functional/botocore/test_waiter_config.py \ --ignore=tests/functional/datapipeline/test_list_runs.py \ --ignore=tests/functional/datapipeline/test_query_objects.py \ --ignore=tests/functional/lightsail/test_push_container_image.py \ --ignore=tests/functional/test_shadowing.py %endif %files -f %{pyproject_files} %license LICENSE.txt %doc README.rst %{_bindir}/aws %{_bindir}/aws_completer %{bash_completions_dir}/aws %{zsh_completions_dir}/_awscli %changelog * Mon Nov 20 2023 Michel Lind - 2.13.4-1.1 - Initial Hyperscale release, adapted from 2.13.4-1.fc38