Blob Blame History Raw
%bcond_without  tests

%global         srcname     google-cloud-storage

Name:           python-%{srcname}
Version:        2.13.0
Release:        %autorelease
Summary:        Python Client for Google Cloud Storage

License:        Apache-2.0
Source0:        %{url}/archive/refs/tags/v%{version}.tar.gz

BuildArch:      noarch

BuildRequires:  python3-devel

%if %{with tests}
BuildRequires:  python3dist(pytest)
BuildRequires:  python3dist(pytest-asyncio)

%global _description %{expand:
Google Cloud Storage allows you to store data on Google infrastructure with
very high reliability, performance and availability, and can be used to
distribute large data objects to users via direct download.}

%description %{_description}

%package -n python3-%{srcname}
Summary:        %{summary}
%description -n python3-%{srcname} %{_description}

%autosetup -n python-storage-%{version} -p1

# Replace mock imports with unittest.mock.
grep -rl "^[[:space:]]*import mock" tests | \
    xargs sed -i -E 's/^([[:space:]]*)import mock/\1from unittest import mock/'



%pyproject_save_files google


%if %{with tests}
# NOTE(mhayden): Setting PYTHONUSERBASE as a hack for PEP 420 namespaces.
# Thanks to churchyard for the fix.
PYTHONUSERBASE=%{buildroot}%{_prefix} \
    %pytest tests/unit \
        -k "not test_create_bucket_w_custom_endpoint \
            and not test_ctor_w_custom_endpoint_use_auth \
            and not test_list_buckets_w_custom_endpoint \
            and not test_seek_fails \
            and not test_downloads_w_client_custom_headers"

%files -n python3-%{srcname} -f %{pyproject_files}
%doc README.rst