From 78bf79bf4312575dc38c20912350c746b53b1808cdb36ff22ff77611f0dd81dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=C3=A9ta=20Machov=C3=A1?= Date: Tue, 4 Feb 2025 14:16:22 +0000 Subject: [PATCH] New package needed for python-Mathics upgrade to version 8.0.0 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-stopit?expand=0&rev=1 --- .gitattributes | 23 +++++++++++++++ .gitignore | 1 + LICENSE | 21 ++++++++++++++ python-stopit.changes | 15 ++++++++++ python-stopit.spec | 66 +++++++++++++++++++++++++++++++++++++++++++ stopit-1.1.2.tar.gz | 3 ++ tests.py | 30 ++++++++++++++++++++ 7 files changed, 159 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 python-stopit.changes create mode 100644 python-stopit.spec create mode 100644 stopit-1.1.2.tar.gz create mode 100644 tests.py diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..c384142 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Gilles Lenfant + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/python-stopit.changes b/python-stopit.changes new file mode 100644 index 0000000..041ee00 --- /dev/null +++ b/python-stopit.changes @@ -0,0 +1,15 @@ +------------------------------------------------------------------- +Tue Feb 4 11:50:34 UTC 2025 - Atri Bhattacharya + +- Switch to pyproject macros for build. +- Add LICENSE and tests.py as additional sources. +- Run tests as part of a %check section. +- Improved package Summary and Description. +- Fix License tag: MIT instead of GPL-3.0. +- Drop outdated macro redefintions. +- More fine-grained file list. + +------------------------------------------------------------------- +Thu Aug 13 09:54:14 AM UTC 2020 - John Vandenberg + +- Initial spec for v1.1.2 diff --git a/python-stopit.spec b/python-stopit.spec new file mode 100644 index 0000000..b13fd37 --- /dev/null +++ b/python-stopit.spec @@ -0,0 +1,66 @@ +# +# spec file for package python-stopit +# +# Copyright (c) 2025 SUSE LINUX GmbH, Nuernberg, Germany. +# +# 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 http://bugs.opensuse.org/ + + +%define modname stopit +Name: python-stopit +Version: 1.1.2 +Release: 0 +Summary: Timeout control decorator and context managers +License: MIT +URL: https://pypi.python.org/pypi/stopit +Source0: https://files.pythonhosted.org/packages/source/s/stopit/stopit-%{version}.tar.gz +Source1: https://raw.githubusercontent.com/glenfant/stopit/refs/tags/%{version}/tests.py +Source2: https://raw.githubusercontent.com/glenfant/stopit/refs/tags/%{version}/LICENSE +BuildRequires: %{python_module devel} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +BuildArch: noarch +%python_subpackages + +%description +%{name} is a python module that provides: +* a function that raises an exception in another thread, including the main thread. +* two context managers that may stop its inner block activity on timeout. +* two decorators that may stop its decorated callables on timeout. + +%prep +%autosetup -n %{modname}-%{version} +cp %{SOURCE1} %{SOURCE2} ./ + +%build +%pyproject_wheel + +%install +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +%{python_expand export PYTHONDONTWRITEBYTECODE=1 +export PYTHONPATH=%{buildroot}%{$python_sitelib} +$python tests.py +} + +%files %{python_files} +%license LICENSE +%doc CHANGES.rst README.rst +%{python_sitelib}/%{modname}/ +%{python_sitelib}/%{modname}-%{version}*.*-info + +%changelog diff --git a/stopit-1.1.2.tar.gz b/stopit-1.1.2.tar.gz new file mode 100644 index 0000000..a598d86 --- /dev/null +++ b/stopit-1.1.2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f7f39c583fd92027bd9d06127b259aee7a5b7945c1f1fa56263811e1e766996d +size 18281 diff --git a/tests.py b/tests.py new file mode 100644 index 0000000..1660899 --- /dev/null +++ b/tests.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +import doctest +import os +import unittest + +from stopit import ThreadingTimeout, threading_timeoutable, SignalTimeout, signal_timeoutable + +# We run twice the same doctest with two distinct sets of globs +# This one is for testing signals based timeout control +signaling_globs = { + 'Timeout': SignalTimeout, + 'timeoutable': signal_timeoutable +} + +# And this one is for testing threading based timeout control +threading_globs = { + 'Timeout': ThreadingTimeout, + 'timeoutable': threading_timeoutable +} + + +def suite(): # Func for setuptools.setup(test_suite=xxx) + test_suite = unittest.TestSuite() + test_suite.addTest(doctest.DocFileSuite('README.rst', globs=signaling_globs)) + if os.name == 'posix': # Other OS have no support for signal.SIGALRM + test_suite.addTest(doctest.DocFileSuite('README.rst', globs=threading_globs)) + return test_suite + +if __name__ == '__main__': + unittest.TextTestRunner(verbosity=2).run(suite())