#
# spec file for package python-filelock
#
# Copyright (c) 2025 SUSE LLC
# Copyright (c) 2018 Matthias Fehring <buschmann23@opensuse.org>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%global flavor %{nil}
%if "%{flavor}" == "test"
%define pkg_suffix -test
%bcond_without test
%else
%define pkg_suffix %{nil}
%bcond_with test
%endif
%{?sle15_python_module_pythons}
Name:           python-filelock%{?pkg_suffix}
Version:        3.18.0
Release:        1.1
Summary:        Platform Independent File Lock in Python
License:        Unlicense
URL:            https://github.com/tox-dev/py-filelock
Source:         https://files.pythonhosted.org/packages/source/f/filelock/filelock-%{version}.tar.gz
BuildRequires:  %{python_module asyncio}
BuildRequires:  %{python_module hatch_vcs}
BuildRequires:  %{python_module hatchling}
BuildRequires:  %{python_module pip}
BuildRequires:  %{python_module wheel}
%if %{with test}
BuildRequires:  %{python_module pytest-asyncio}
BuildRequires:  %{python_module pytest-mock}
BuildRequires:  %{python_module pytest}
BuildRequires:  %{python_module virtualenv}
%endif
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
%if 0%{?python_version_nodots} < 311
Requires:       python-typing_extensions >= 4.7.1
%endif
Requires:       python-asyncio
BuildArch:      noarch
%python_subpackages

%description
This package contains a single module, which implements a platform
independent file lock in Python, which provides a simple way of
inter-process communication.

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

%build
%pyproject_wheel

%if !%{with test}
%install
%pyproject_install
%python_expand %fdupes %{buildroot}/%{$python_sitelib}

%files %{python_files}
%doc README.md
%license LICENSE
%{python_sitelib}/filelock
%{python_sitelib}/filelock-%{version}*-info
%else

%check
%pytest -rs
%endif

%changelog
* Wed Mar 19 2025 John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
- Update to 3.18.0
  * Indicate that locks are exclusive/write locks
  * Support fcntl check on Emscripten
* Thu Jan 30 2025 John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
- Update to 3.17.0
  * Drop support for Python 3.8
  * Update README.md
* Wed Oct  9 2024 John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
- Update to 3.16.1
  * CI improvements
* Sun Sep  8 2024 Dirk Müller <dmueller@suse.com>
- update to 3.16.0:
  * Test Python 3.13
  * Add 3.13 to CI
- update to 3.15.4:
  * Pass `file_lock` as positional argument
- update to 3.15.3:
  * Add test for virtualenv stability
  * Fix `TypeError: _CountedFileLock.__init__() got an unexpected
    keyword argument 'timeout'`
- update to 3.15.2:
  * Use a metaclass to implement the singleton pattern
- split into test multibuild to avoid cycle over virtualenv
* Mon Jun 17 2024 Dirk Müller <dmueller@suse.com>
- update to 3.15.1:
  * Hotfix: Restore __init__ method; more robust initialization
    for singleton locks
- update to 3.15.0:
  * asyncio support
  * Don't initialize BaseFileLock when just returning existing
    instance
* Fri May  3 2024 Dirk Müller <dmueller@suse.com>
- update to 3.14.0:
  * feat: `blocking` parameter on lock constructor with tests and
    docs
* Fri Apr 12 2024 Dirk Müller <dmueller@suse.com>
- update to 3.13.4:
  * Raise error on incompatible singleton timeout and mode args
- update to 3.13.3:
  * Make singleton class instance dict unique per subclass
* Mon Mar 25 2024 Dirk Müller <dmueller@suse.com>
- update to 3.13.2:
  * Fixed small typo in _unix.py
  * Update SECURITY.md to reflect Python 3.7 support dropoff
  * Update index.rst to improve the demo usage
  * [BugFix] fix permission denied error when lock file is placed
    in `/tmp`
* Mon Nov 27 2023 Dirk Müller <dmueller@suse.com>
- update to 3.13.1:
  * Allow users to subclass FileLock with custom keyword
    arguments
  * Support reentrant locking on lock file path via optional
    singleton instance
  * change typing-extensions to be installed only with the
    [typing] extra
* Fri Sep  8 2023 Steve Kowalik <steven.kowalik@suse.com>
- Add missing Requires on typing-extensions if < 3.11
* Thu Sep  7 2023 Dirk Müller <dmueller@suse.com>
- update to 3.12.3:
  * Fix import ordering
  * Exclude dependabot and pre-commit ci from release notes
  * Create parent directories if necessary
* Tue Jun 20 2023 Dirk Müller <dmueller@suse.com>
- update to 3.12.2:
  * Restore 'if TYPE_CHECKING' syntax for FileLock definition
* Sun Jun 11 2023 Dirk Müller <dmueller@suse.com>
- update to 3.12.1:
  * Add 3.12 support
  * Fix test_bad_lock_file for other OSes
* Tue Apr 25 2023 John Vandenberg <jayvdb@gmail.com>
- Update to v3.12.0
  * Make the thread local behaviour something the caller can
    enable/disable via a flag during the lock creation. on by default.
  * Better error handling on Windows.
- from v3.11.0
  * Make the lock thread local.
- from v3.10.7
  * Use fchmod instead of chmod to work around bug in PyPy via Anaconda.
- from v3.10.6
  * Enhance the robustness of the try/catch block in _soft.py.
- from v3.10.5
  * Add explicit error check as certain UNIX filesystems do not support
    flock.
- from v3.10.4
  * Update os.open to preserve mode= for certain edge cases.
- from v3.10.3
  * Fix permission issue
- from v3.10.2
  * Bug fix for using filelock with threaded programs causing undesired
    file permissions
- from v3.10.1
  * Handle pickle for :class:`filelock.Timeout`
- from v3.10.0
  * Add support for explicit file modes for lockfiles
* Fri Apr 21 2023 Dirk Müller <dmueller@suse.com>
- add sle15_python_module_pythons (jsc#PED-68)
* Thu Apr 13 2023 Matej Cepl <mcepl@suse.com>
- Make calling of %%{sle15modernpython} optional.
* Tue Mar 14 2023 Dirk Müller <dmueller@suse.com>
- update to 3.9.1:
  * use time.perf_counter instead of time.monotonic
* Wed Jan  4 2023 Dirk Müller <dmueller@suse.com>
- update to 3.9.0:
  * move to hatchling build backend
* Wed Dec 14 2022 Daniel Garcia <daniel.garcia@suse.com>
- Remove python_module macro definition
- More specific python_sitelib in %%files
* Tue Dec 13 2022 Yogalakshmi Arunachalam <yarunachalam@suse.com>
- Update to version 3.8.2
  * What's Changed
    Bump pypa/gh-action-pypi-publish from 1.5.1 to 1.6.1 by @dependabot in #178
    Update the license classifier to "Unlicense" by @jond01 in #180
- Update to version 3.8.1
  * What's Changed
    [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in #166
    link to flufl.lock by @dholth in #167
    [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in #168
    [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in #169
    [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in #170
    fix BaseFileLock.timeout's getter/setter being obscured by itself by @dearfl in #172
    Fix mypy fails understanding FileLock by @gaborbernat in #177
* Wed Oct 12 2022 Yogalakshmi Arunachalam <yarunachalam@suse.com>
- Update to version 3.8.0
  * [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in #149
  * Bump actions/upload-artifact from 2 to 3 by @dependabot in #154
  * Bump actions/download-artifact from 2 to 3 by @dependabot in #152
  * Bump pre-commit/action from 2.0.3 to 3.0.0 by @dependabot in #151
  * Bump actions/checkout from 2 to 3 by @dependabot in #153
  * Bump actions/setup-python from 2 to 4 by @dependabot in #150
  * Add timeout unit to docstrings by @jnordberg in #148
  * Unify badges style by @DeadNews in #155
  * [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in #156
  * [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in #157
  * Check 3.11 support by @gaborbernat in #158
  * [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in #159
  * Bump dependencies by @gaborbernat in #160
  * [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in #162
* Fri Jun  3 2022 Markéta Machová <mmachova@suse.com>
- Update to 3.7.1
  * Ownership moved from @benediktschmitt to the tox-dev organization
    (new primary maintainer @gaborbernat)
  * Raise when trying to acquire in R/O or missing folder
  * Drop python 2.7, 3.5 and 3.6 support, add type hints
  * Document asyncio support
  * Accept path types (like pathlib.Path and pathlib.PurePath) in the
    constructor for FileLock objects.
  * Add correct spelling of poll interval parameter for acquire method
  * Enable use as context decorator
  * More changes, see upstream changelog
- Use PyPI tarball, switch to wheel for build (testsuite expects it)
* Mon Oct 14 2019 Matej Cepl <mcepl@suse.com>
- Replace %%fdupes -s with plain %%fdupes; hardlinks are better.
* Fri Jun  7 2019 Marketa Calabkova <mcalabkova@suse.com>
- Update to 3.0.12
  * fixed python2 setup error
  * fixed documentation
  * other small fixes
* Tue Mar 12 2019 Tomáš Chvátal <tchvatal@suse.com>
- Update to 3.0.10:
  * No upstream changelog
* Wed Aug  1 2018 tchvatal@suse.com
- Switch to github tarball
- Enable tests
* Tue May  8 2018 buschmann23@opensuse.org
- initial package