From 7772d1fd031951172e6172a000957a2196f95ea4 Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Wed, 31 May 2023 07:04:37 +0000 Subject: automatic import of python-locks --- .gitignore | 1 + python-locks.spec | 256 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 258 insertions(+) create mode 100644 python-locks.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..789e1ae 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/locks-0.1.1.tar.gz diff --git a/python-locks.spec b/python-locks.spec new file mode 100644 index 0000000..ab62913 --- /dev/null +++ b/python-locks.spec @@ -0,0 +1,256 @@ +%global _empty_manifest_terminate_build 0 +Name: python-locks +Version: 0.1.1 +Release: 1 +Summary: POSIX file system locking using flock +License: MIT +URL: https://github.com/rossmacarthur/locks +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/29/7c/94a8e0b91c0b9cec5adf7cd7dc871b215835ca1ba9e3f595fee8a0fb9e49/locks-0.1.1.tar.gz +BuildArch: noarch + +Requires: python3-monotonic + +%description +# locks + +[![PyPI version](https://img.shields.io/pypi/v/locks.svg?style=flat-square)](https://pypi.org/project/locks/) +[![Build status](https://img.shields.io/travis/rossmacarthur/locks/master.svg?style=flat-square)](https://travis-ci.org/rossmacarthur/locks) + +POSIX file system locking using [flock](https://linux.die.net/man/2/flock). + +## Getting started + +Install this package with + +```sh +pip install locks +``` + +## Usage + +The simplest usage is to block indefinitely until the lock is acquired + +```python +from locks import Mutex + +with Mutex('/tmp/file.lock'): + # do exclusive stuff here +``` + +Alternatively, block until a timeout is reached + +```python +from locks import Mutex + +try: + with Mutex('/tmp/file.lock', timeout=0.5): + # do exclusive stuff here +except BlockingIOError: + # handle the failure to acquire the lock +``` + +Finally, a common paradigm is to attempt to acquire the lock without blocking, +do something, and then block indefinitely. Here `callback` will be called once +if we cannot immediately acquire the lock, and then we will block indefinitely. + +```python +def callback(): + print("Blocking: waiting for file lock on '/tmp/file.lock'") + +with Mutex('/tmp/file.lock', callback=callback): + # do exclusive stuff here +``` + +If both `callback` and `timeout` are used then we will attempt to +acquire the lock until the `timeout` is reached, and then we will block +indefinitely. + +## License + +This project is licensed under the MIT License. See the [LICENSE] file. + +[LICENSE]: LICENSE + + + + +%package -n python3-locks +Summary: POSIX file system locking using flock +Provides: python-locks +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-locks +# locks + +[![PyPI version](https://img.shields.io/pypi/v/locks.svg?style=flat-square)](https://pypi.org/project/locks/) +[![Build status](https://img.shields.io/travis/rossmacarthur/locks/master.svg?style=flat-square)](https://travis-ci.org/rossmacarthur/locks) + +POSIX file system locking using [flock](https://linux.die.net/man/2/flock). + +## Getting started + +Install this package with + +```sh +pip install locks +``` + +## Usage + +The simplest usage is to block indefinitely until the lock is acquired + +```python +from locks import Mutex + +with Mutex('/tmp/file.lock'): + # do exclusive stuff here +``` + +Alternatively, block until a timeout is reached + +```python +from locks import Mutex + +try: + with Mutex('/tmp/file.lock', timeout=0.5): + # do exclusive stuff here +except BlockingIOError: + # handle the failure to acquire the lock +``` + +Finally, a common paradigm is to attempt to acquire the lock without blocking, +do something, and then block indefinitely. Here `callback` will be called once +if we cannot immediately acquire the lock, and then we will block indefinitely. + +```python +def callback(): + print("Blocking: waiting for file lock on '/tmp/file.lock'") + +with Mutex('/tmp/file.lock', callback=callback): + # do exclusive stuff here +``` + +If both `callback` and `timeout` are used then we will attempt to +acquire the lock until the `timeout` is reached, and then we will block +indefinitely. + +## License + +This project is licensed under the MIT License. See the [LICENSE] file. + +[LICENSE]: LICENSE + + + + +%package help +Summary: Development documents and examples for locks +Provides: python3-locks-doc +%description help +# locks + +[![PyPI version](https://img.shields.io/pypi/v/locks.svg?style=flat-square)](https://pypi.org/project/locks/) +[![Build status](https://img.shields.io/travis/rossmacarthur/locks/master.svg?style=flat-square)](https://travis-ci.org/rossmacarthur/locks) + +POSIX file system locking using [flock](https://linux.die.net/man/2/flock). + +## Getting started + +Install this package with + +```sh +pip install locks +``` + +## Usage + +The simplest usage is to block indefinitely until the lock is acquired + +```python +from locks import Mutex + +with Mutex('/tmp/file.lock'): + # do exclusive stuff here +``` + +Alternatively, block until a timeout is reached + +```python +from locks import Mutex + +try: + with Mutex('/tmp/file.lock', timeout=0.5): + # do exclusive stuff here +except BlockingIOError: + # handle the failure to acquire the lock +``` + +Finally, a common paradigm is to attempt to acquire the lock without blocking, +do something, and then block indefinitely. Here `callback` will be called once +if we cannot immediately acquire the lock, and then we will block indefinitely. + +```python +def callback(): + print("Blocking: waiting for file lock on '/tmp/file.lock'") + +with Mutex('/tmp/file.lock', callback=callback): + # do exclusive stuff here +``` + +If both `callback` and `timeout` are used then we will attempt to +acquire the lock until the `timeout` is reached, and then we will block +indefinitely. + +## License + +This project is licensed under the MIT License. See the [LICENSE] file. + +[LICENSE]: LICENSE + + + + +%prep +%autosetup -n locks-0.1.1 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-locks -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 31 2023 Python_Bot - 0.1.1-1 +- Package Spec generated diff --git a/sources b/sources new file mode 100644 index 0000000..1ee4127 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +0595f0298ace6535db1f1b42605e2f96 locks-0.1.1.tar.gz -- cgit v1.2.3