Blob Blame History Raw
%bcond_without tests
# The xvfb tests sometimes hang in koji.
%bcond_with xvfb_tests

Name:           python-keyring
Version:        23.11.0
Release:        %autorelease
Summary:        Store and access your passwords safely

# Upstream was asked to clarify the applicability of the Python-2.0.1 license.
# In summary, the license was meant to be OR rather than AND, and the Python
# license was applied with the intent of possibly contributing the package to
# the Python standard library, which is no longer planned. In later releases,
# the license will be simply MIT. See:
#   https://github.com/jaraco/keyring/issues/607#issuecomment-1341618763
License:        MIT OR Python-2.0.1
URL:            https://github.com/jaraco/keyring
Source:         %{pypi_source keyring}

BuildArch:      noarch

BuildRequires:  python3-devel

%if %{with tests}
# The “testing” extra mostly brings in linters and similar, which we would have
# to patch out. Instead, we BR pytest manually. See:
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters
BuildRequires:  python3dist(pytest)
%if %{with xvfb_tests}
# Run graphical tests in non-graphical build environment.
BuildRequires:  xorg-x11-server-Xvfb
# Enable libsecret backend
BuildRequires:  python3-gobject
BuildRequires:  libsecret
BuildRequires:  gnome-keyring
BuildRequires:  /usr/bin/dbus-launch
%endif
%endif

%global desc %{expand:
The Python keyring library provides an easy way to access the system keyring
service from python. It can be used in any application that needs safe password
storage.

These recommended keyring backends are supported:

  • macOS Keychain
  • Freedesktop Secret Service supports many DE including GNOME (requires
    secretstorage)
  • KDE4 & KDE5 KWallet (requires dbus)
  • Windows Credential Locker

Other keyring implementations are available through third-party backends.}


%description %desc


%package -n     python3-keyring
Summary:        Python 3 library to access the system keyring service

%description -n python3-keyring %desc


%prep
%setup -q -n keyring-%{version}

# This will be installed in site-packages without the executable bit set, so
# the shebang should be removed.
sed -r -i '1{/^#!/d}' keyring/cli.py


%generate_buildrequires
%pyproject_buildrequires


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files keyring
# For compatibility with historical versions of this package, when there were
# both python2 and python3 packages:
ln -s keyring %{buildroot}%{_bindir}/keyring-python3


%check
%if %{with tests}
%if %{with xvfb_tests}
%global __pytest /usr/bin/xvfb-run -a /usr/bin/pytest
%endif
%pytest
%endif


%files -n python3-keyring -f %{pyproject_files}
# pyproject_files handles LICENSE; verify with “rpm -qL -p …”
%doc CHANGES.rst README.rst

%{_bindir}/keyring-python3
%{_bindir}/keyring


%changelog
%autochangelog