f8531d3
%global srcname filelock
97db316
97db316
%if 0%{?fedora}
3ba97dd
%bcond_without docs
97db316
%else
97db316
%bcond_with docs
97db316
%endif
7e28789
%bcond_without tests
f8531d3
f8531d3
Name:           python-%{srcname}
7ab93a9
Version:        3.13.4
1922737
Release:        %autorelease
65c2dd0
Summary:        A platform independent file lock
f8531d3
f8531d3
License:        Unlicense
f1a56bb
URL:            https://github.com/tox-dev/filelock
f1a56bb
Source0:        https://github.com/tox-dev/filelock/archive/%{version}/%{srcname}-%{version}.tar.gz
f8531d3
f8531d3
BuildArch:      noarch
f8531d3
3ba97dd
BuildRequires:  python3-devel
3ba97dd
BuildRequires:  pyproject-rpm-macros
7e28789
%if %{with tests}
3ba97dd
# We cannot install extra dependencies because there are some
3ba97dd
# we do not have in Fedora like covdefaults in testing or furo in docs.
3ba97dd
# Test dependencies
3ba97dd
BuildRequires:  python3-pytest
bc91500
BuildRequires:  python3-pytest-mock
3ba97dd
BuildRequires:  python3-pytest-timeout
7e28789
%endif
3ba97dd
%if %{with docs}
3ba97dd
# Doc dependencies
3ba97dd
BuildRequires:  python3-sphinx
3ba97dd
BuildRequires:  python3-sphinx-autodoc-typehints
3ba97dd
%endif
3ba97dd
f8531d3
%description
f8531d3
This package contains a single module, which implements a platform independent
f8531d3
file locking mechanism for Python.
f8531d3
f8531d3
The lock includes a lock counter and is thread safe. This means, when locking
f8531d3
the same lock object twice, it will not block.
f8531d3
a3bcda8
%package -n python%{python3_pkgversion}-%{srcname}
65c2dd0
Summary:        %{summary}
a3bcda8
a3bcda8
%if 0%{?fedora}
4e59779
Suggests:       %{name}-doc
c6dd43c
%endif
a3bcda8
a3bcda8
%description -n python%{python3_pkgversion}-%{srcname}
a3bcda8
This package contains a single module, which implements a platform independent
a3bcda8
file locking mechanism for Python.
a3bcda8
a3bcda8
The lock includes a lock counter and is thread safe. This means, when locking
a3bcda8
the same lock object twice, it will not block.
f8531d3
c6dd43c
%if %{with docs}
c6dd43c
%package doc
c6dd43c
Summary:        Documentation for %{srcname}, %{summary}
c6dd43c
c6dd43c
%description doc
c6dd43c
%{summary}
c6dd43c
%endif
c6dd43c
f8531d3
%prep
f1a56bb
%autosetup -p1 -n %{srcname}-%{version}
bc91500
%if %{with docs}
3ba97dd
# furo theme is not available in Fedora
3ba97dd
sed -i "/html_theme =.*/d" docs/conf.py
bc91500
%endif
2cf6c46
# setuptools 65.6.3 is not yet in Fedora
2cf6c46
sed -i 's/"\(setuptools\)>=.*"/"\1"/' pyproject.toml
f8531d3
3ba97dd
%generate_buildrequires
bc91500
SETUPTOOLS_SCM_PRETEND_VERSION=%{version}; export SETUPTOOLS_SCM_PRETEND_VERSION
3ba97dd
%pyproject_buildrequires -r
554f2de
f8531d3
%build
bc91500
SETUPTOOLS_SCM_PRETEND_VERSION=%{version}; export SETUPTOOLS_SCM_PRETEND_VERSION
3ba97dd
%pyproject_wheel
f8531d3
9bb6780
%if %{with docs}
3ba97dd
pushd docs
bc91500
PYTHONPATH=../src sphinx-build ./ html --color -b html -d doctrees
3ba97dd
rm html/.buildinfo
3ba97dd
popd
9bb6780
%endif
554f2de
f8531d3
%install
3ba97dd
%pyproject_install
7ab93a9
%pyproject_save_files -l %{srcname}
a3bcda8
f8531d3
%check
7e28789
%if %{with tests}
3ba97dd
%pytest
7e28789
%else
7e28789
%pyproject_check_import
7e28789
%endif
f8531d3
9bb6780
%if %{with docs}
f8531d3
%files doc
554f2de
%license LICENSE
3ba97dd
%doc docs/html
9bb6780
%endif
f8531d3
3ba97dd
%files -n python%{python3_pkgversion}-%{srcname} -f %{pyproject_files}
554f2de
%doc README.md
a3bcda8
f8531d3
f8531d3
%changelog
1922737
%autochangelog