From 9d1ca9383c9f3e18c3ce03b5fe55ad0764ad335e Mon Sep 17 00:00:00 2001 From: MSVSphere Packaging Team Date: Fri, 25 Oct 2024 18:40:20 +0300 Subject: [PATCH] import python-greenlet-3.0.3-4.el10 --- .gitignore | 1 + .python-greenlet.metadata | 1 + SOURCES/skip-leak-checks.patch | 293 ++++++++++++++++++++++++++++++++ SPECS/python-greenlet.spec | 302 +++++++++++++++++++++++++++++++++ 4 files changed, 597 insertions(+) create mode 100644 .gitignore create mode 100644 .python-greenlet.metadata create mode 100644 SOURCES/skip-leak-checks.patch create mode 100644 SPECS/python-greenlet.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..85ace70 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/greenlet-3.0.3.tar.gz diff --git a/.python-greenlet.metadata b/.python-greenlet.metadata new file mode 100644 index 0000000..7b77ebc --- /dev/null +++ b/.python-greenlet.metadata @@ -0,0 +1 @@ +93cdb28a276c3711fe75dac96d9cb97ed0b5c0d7 SOURCES/greenlet-3.0.3.tar.gz diff --git a/SOURCES/skip-leak-checks.patch b/SOURCES/skip-leak-checks.patch new file mode 100644 index 0000000..8492115 --- /dev/null +++ b/SOURCES/skip-leak-checks.patch @@ -0,0 +1,293 @@ +diff --git a/src/greenlet/tests/leakcheck.py b/src/greenlet/tests/leakcheck.py +index a5152fb..ebe12e5 100644 +--- a/src/greenlet/tests/leakcheck.py ++++ b/src/greenlet/tests/leakcheck.py +@@ -30,39 +30,7 @@ import gc + from functools import wraps + import unittest + +- +-import objgraph +- +-# graphviz 0.18 (Nov 7 2021), available only on Python 3.6 and newer, +-# has added type hints (sigh). It wants to use ``typing.Literal`` for +-# some stuff, but that's only available on Python 3.9+. If that's not +-# found, it creates a ``unittest.mock.MagicMock`` object and annotates +-# with that. These are GC'able objects, and doing almost *anything* +-# with them results in an explosion of objects. For example, trying to +-# compare them for equality creates new objects. This causes our +-# leakchecks to fail, with reports like: +-# +-# greenlet.tests.leakcheck.LeakCheckError: refcount increased by [337, 1333, 343, 430, 530, 643, 769] +-# _Call 1820 +546 +-# dict 4094 +76 +-# MagicProxy 585 +73 +-# tuple 2693 +66 +-# _CallList 24 +3 +-# weakref 1441 +1 +-# function 5996 +1 +-# type 736 +1 +-# cell 592 +1 +-# MagicMock 8 +1 +-# +-# To avoid this, we *could* filter this type of object out early. In +-# principle it could leak, but we don't use mocks in greenlet, so it +-# doesn't leak from us. However, a further issue is that ``MagicMock`` +-# objects have subobjects that are also GC'able, like ``_Call``, and +-# those create new mocks of their own too. So we'd have to filter them +-# as well, and they're not public. That's OK, we can workaround the +-# problem by being very careful to never compare by equality or other +-# user-defined operators, only using object identity or other builtin +-# functions. ++# Edited for Fedora to avoid missing dependency + + RUNNING_ON_GITHUB_ACTIONS = os.environ.get('GITHUB_ACTIONS') + RUNNING_ON_TRAVIS = os.environ.get('TRAVIS') or RUNNING_ON_GITHUB_ACTIONS +@@ -74,53 +42,15 @@ SKIP_FAILING_LEAKCHECKS = os.environ.get('GREENLET_SKIP_FAILING_LEAKCHECKS') + ONLY_FAILING_LEAKCHECKS = os.environ.get('GREENLET_ONLY_FAILING_LEAKCHECKS') + + def ignores_leakcheck(func): +- """ +- Ignore the given object during leakchecks. +- +- Can be applied to a method, in which case the method will run, but +- will not be subject to leak checks. +- +- If applied to a class, the entire class will be skipped during leakchecks. This +- is intended to be used for classes that are very slow and cause problems such as +- test timeouts; typically it will be used for classes that are subclasses of a base +- class and specify variants of behaviour (such as pool sizes). +- """ +- func.ignore_leakcheck = True + return func + + def fails_leakcheck(func): +- """ +- Mark that the function is known to leak. +- """ +- func.fails_leakcheck = True +- if SKIP_FAILING_LEAKCHECKS: +- func = unittest.skip("Skipping known failures")(func) + return func + + class LeakCheckError(AssertionError): + pass + +-if hasattr(sys, 'getobjects'): +- # In a Python build with ``--with-trace-refs``, make objgraph +- # trace *all* the objects, not just those that are tracked by the +- # GC +- class _MockGC(object): +- def get_objects(self): +- return sys.getobjects(0) # pylint:disable=no-member +- def __getattr__(self, name): +- return getattr(gc, name) +- objgraph.gc = _MockGC() +- fails_strict_leakcheck = fails_leakcheck +-else: +- def fails_strict_leakcheck(func): +- """ +- Decorator for a function that is known to fail when running +- strict (``sys.getobjects()``) leakchecks. +- +- This type of leakcheck finds all objects, even those, such as +- strings, which are not tracked by the garbage collector. +- """ +- return func ++fails_strict_leakcheck = fails_leakcheck + + class ignores_types_in_strict_leakcheck(object): + def __init__(self, types): +@@ -129,191 +59,5 @@ class ignores_types_in_strict_leakcheck(object): + func.leakcheck_ignore_types = self.types + return func + +-class _RefCountChecker(object): +- +- # Some builtin things that we ignore +- # XXX: Those things were ignored by gevent, but they're important here, +- # presumably. +- IGNORED_TYPES = () #(tuple, dict, types.FrameType, types.TracebackType) +- +- def __init__(self, testcase, function): +- self.testcase = testcase +- self.function = function +- self.deltas = [] +- self.peak_stats = {} +- self.ignored_types = () +- +- # The very first time we are called, we have already been +- # self.setUp() by the test runner, so we don't need to do it again. +- self.needs_setUp = False +- +- def _include_object_p(self, obj): +- # pylint:disable=too-many-return-statements +- # +- # See the comment block at the top. We must be careful to +- # avoid invoking user-defined operations. +- if obj is self: +- return False +- kind = type(obj) +- # ``self._include_object_p == obj`` returns NotImplemented +- # for non-function objects, which causes the interpreter +- # to try to reverse the order of arguments...which leads +- # to the explosion of mock objects. We don't want that, so we implement +- # the check manually. +- if kind == type(self._include_object_p): +- try: +- # pylint:disable=not-callable +- exact_method_equals = self._include_object_p.__eq__(obj) +- except AttributeError: +- # Python 2.7 methods may only have __cmp__, and that raises a +- # TypeError for non-method arguments +- # pylint:disable=no-member +- exact_method_equals = self._include_object_p.__cmp__(obj) == 0 +- +- if exact_method_equals is not NotImplemented and exact_method_equals: +- return False +- +- # Similarly, we need to check identity in our __dict__ to avoid mock explosions. +- for x in self.__dict__.values(): +- if obj is x: +- return False +- +- +- if kind in self.ignored_types or kind in self.IGNORED_TYPES: +- return False +- +- return True +- +- def _growth(self): +- return objgraph.growth(limit=None, peak_stats=self.peak_stats, +- filter=self._include_object_p) +- +- def _report_diff(self, growth): +- if not growth: +- return "" +- +- lines = [] +- width = max(len(name) for name, _, _ in growth) +- for name, count, delta in growth: +- lines.append('%-*s%9d %+9d' % (width, name, count, delta)) +- +- diff = '\n'.join(lines) +- return diff +- +- +- def _run_test(self, args, kwargs): +- gc_enabled = gc.isenabled() +- gc.disable() +- +- if self.needs_setUp: +- self.testcase.setUp() +- self.testcase.skipTearDown = False +- try: +- self.function(self.testcase, *args, **kwargs) +- finally: +- self.testcase.tearDown() +- self.testcase.doCleanups() +- self.testcase.skipTearDown = True +- self.needs_setUp = True +- if gc_enabled: +- gc.enable() +- +- def _growth_after(self): +- # Grab post snapshot +- # pylint:disable=no-member +- if 'urlparse' in sys.modules: +- sys.modules['urlparse'].clear_cache() +- if 'urllib.parse' in sys.modules: +- sys.modules['urllib.parse'].clear_cache() +- +- return self._growth() +- +- def _check_deltas(self, growth): +- # Return false when we have decided there is no leak, +- # true if we should keep looping, raises an assertion +- # if we have decided there is a leak. +- +- deltas = self.deltas +- if not deltas: +- # We haven't run yet, no data, keep looping +- return True +- +- if gc.garbage: +- raise LeakCheckError("Generated uncollectable garbage %r" % (gc.garbage,)) +- +- +- # the following configurations are classified as "no leak" +- # [0, 0] +- # [x, 0, 0] +- # [... a, b, c, d] where a+b+c+d = 0 +- # +- # the following configurations are classified as "leak" +- # [... z, z, z] where z > 0 +- +- if deltas[-2:] == [0, 0] and len(deltas) in (2, 3): +- return False +- +- if deltas[-3:] == [0, 0, 0]: +- return False +- +- if len(deltas) >= 4 and sum(deltas[-4:]) == 0: +- return False +- +- if len(deltas) >= 3 and deltas[-1] > 0 and deltas[-1] == deltas[-2] and deltas[-2] == deltas[-3]: +- diff = self._report_diff(growth) +- raise LeakCheckError('refcount increased by %r\n%s' % (deltas, diff)) +- +- # OK, we don't know for sure yet. Let's search for more +- if sum(deltas[-3:]) <= 0 or sum(deltas[-4:]) <= 0 or deltas[-4:].count(0) >= 2: +- # this is suspicious, so give a few more runs +- limit = 11 +- else: +- limit = 7 +- if len(deltas) >= limit: +- raise LeakCheckError('refcount increased by %r\n%s' +- % (deltas, +- self._report_diff(growth))) +- +- # We couldn't decide yet, keep going +- return True +- +- def __call__(self, args, kwargs): +- for _ in range(3): +- gc.collect() +- +- expect_failure = getattr(self.function, 'fails_leakcheck', False) +- if expect_failure: +- self.testcase.expect_greenlet_leak = True +- self.ignored_types = getattr(self.function, "leakcheck_ignore_types", ()) +- +- # Capture state before; the incremental will be +- # updated by each call to _growth_after +- growth = self._growth() +- +- try: +- while self._check_deltas(growth): +- self._run_test(args, kwargs) +- +- growth = self._growth_after() +- +- self.deltas.append(sum((stat[2] for stat in growth))) +- except LeakCheckError: +- if not expect_failure: +- raise +- else: +- if expect_failure: +- raise LeakCheckError("Expected %s to leak but it did not." % (self.function,)) +- + def wrap_refcount(method): +- if getattr(method, 'ignore_leakcheck', False) or SKIP_LEAKCHECKS: +- return method +- +- @wraps(method) +- def wrapper(self, *args, **kwargs): # pylint:disable=too-many-branches +- if getattr(self, 'ignore_leakcheck', False): +- raise unittest.SkipTest("This class ignored during leakchecks") +- if ONLY_FAILING_LEAKCHECKS and not getattr(method, 'fails_leakcheck', False): +- raise unittest.SkipTest("Only running tests that fail leakchecks.") +- return _RefCountChecker(self, method)(args, kwargs) +- +- return wrapper ++ return method diff --git a/SPECS/python-greenlet.spec b/SPECS/python-greenlet.spec new file mode 100644 index 0000000..83fe9c1 --- /dev/null +++ b/SPECS/python-greenlet.spec @@ -0,0 +1,302 @@ +%global modname greenlet + +Name: python-%{modname} +Version: 3.0.3 +Release: 4%{?dist} +Summary: Lightweight in-process concurrent programming +License: MIT AND PSF-2.0 +URL: https://github.com/python-greenlet/greenlet +Source0: %{url}/archive/%{version}/%{modname}-%{version}.tar.gz + +# Skip leak checking to avoid a missing dependency, `objgraph` +Patch: skip-leak-checks.patch + +BuildRequires: gcc-c++ + +%global _description \ +The greenlet package is a spin-off of Stackless, a version of CPython\ +that supports micro-threads called "tasklets". Tasklets run\ +pseudo-concurrently (typically in a single or a few OS-level threads)\ +and are synchronized with data exchanges on "channels". + +%description %{_description} + +%package -n python3-%{modname} +Summary: %{summary} +BuildRequires: python3-devel +# For tests +BuildRequires: python3-psutil + +%description -n python3-%{modname} %{_description} + +Python 3 version. + +%package -n python3-%{modname}-devel +Summary: C development headers for python3-%{modname} +Requires: python3-%{modname}%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release} + +%description -n python3-%{modname}-devel +%{summary}. + +Python 3 version. + +%prep +%autosetup -n %{modname}-%{version} -p1 + +%generate_buildrequires +%pyproject_buildrequires + +%build +%pyproject_wheel + +%install +%pyproject_install +%pyproject_save_files %{modname} + +%check +cd / +PYTHONPATH="%{buildroot}%{python3_sitearch}" \ + %{python3} -m unittest discover -v \ + -s "%{buildroot}%{python3_sitearch}/greenlet/tests" \ + -t "%{buildroot}%{python3_sitearch}" + +%files -n python3-%{modname} -f %{pyproject_files} +%doc AUTHORS README.rst + +%files -n python3-greenlet-devel +%{_includedir}/python%{python3_version}*/%{modname}/ + +%changelog +* Mon Jun 24 2024 Troy Dawson - 3.0.3-4 +- Bump release for June 2024 mass rebuild + +* Fri Jan 26 2024 Fedora Release Engineering - 3.0.3-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Mon Jan 22 2024 Fedora Release Engineering - 3.0.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Sat Jan 13 2024 Terje Rosten - 3.0.3-1 +- 3.0.3 + +* Mon Dec 11 2023 Terje Rosten - 3.0.2-1 +- 3.0.2 + +* Sat Nov 25 2023 Terje Rosten - 3.0.1-1 +- 3.0.1 + +* Sat Oct 14 2023 Terje Rosten - 3.0.0-1 +- 3.0.0 + +* Wed Sep 06 2023 Carl George - 3.0.0~rc1-1 +- Update to version 3.0.0rc1 +- Convert to pyproject macros + +* Sun Aug 13 2023 Orion Poplawski - 3.0.0~a1-1 +- Update to 3.0.0a1 + +* Sat Aug 05 2023 Ondřej Budai - 2.0.2-3 +- SPDX migration + +* Fri Jul 21 2023 Fedora Release Engineering - 2.0.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Wed Jun 14 2023 Petr Viktorin - 2.0.2-1 +- Update to upstream version 2.0.2 +- Update patch for Python 3.12 compatibility +- Skip leak checks for now + +* Tue Jun 13 2023 Python Maint - 1.1.3-3 +- Rebuilt for Python 3.12 + +* Fri Jan 20 2023 Fedora Release Engineering - 1.1.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Fri Oct 14 2022 Lumír Balhar - 1.1.3-1 +- Update to 1.1.3 + +* Fri Jul 22 2022 Fedora Release Engineering - 1.1.2-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Mon Jun 13 2022 Python Maint - 1.1.2-4 +- Rebuilt for Python 3.11 + +* Wed Jun 01 2022 Miro Hrončok - 1.1.2-3 +- Python 3.11 support +- Fixes: rhbz#2040186 + +* Fri Jan 21 2022 Fedora Release Engineering - 1.1.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Thu Sep 30 2021 Kevin Fenzi - 1.1.2-1 +- Update to 1.1.2. Fixes rhbz#2008848 + +* Sat Aug 07 2021 Kevin Fenzi - 1.1.1-1 +- Update to 1.1.1. +- Fixes rhbz#1990901 + +* Fri Jul 23 2021 Fedora Release Engineering - 1.1.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Thu Jun 03 2021 Python Maint - 1.1.0-2 +- Rebuilt for Python 3.10 + +* Mon May 10 2021 Nils Philippsen - 1.1.0-1 +- Update to 1.1.0 + +* Wed Jan 27 2021 Fedora Release Engineering - 0.4.17-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Sat Oct 31 2020 Kevin Fenzi - 0.4.17-1 +- Update to 0.4.17. Fixes bug #1881455 + +* Wed Jul 29 2020 Fedora Release Engineering - 0.4.16-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Sat Jun 06 2020 Orion Poplawski - 0.4.16-1 +- Update to 0.4.16 + +* Sat May 23 2020 Miro Hrončok - 0.4.14-8 +- Rebuilt for Python 3.9 + +* Thu May 21 2020 Miro Hrončok - 0.4.14-7 +- Fix Python 3.9 build + +* Thu Jan 30 2020 Fedora Release Engineering - 0.4.14-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Thu Sep 26 2019 Miro Hrončok - 0.4.14-5 +- Subpackages python2-greenlet, python2-greenlet-devel have been removed + See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal + +* Fri Aug 16 2019 Miro Hrončok - 0.4.14-4 +- Rebuilt for Python 3.8 + +* Fri Jul 26 2019 Fedora Release Engineering - 0.4.14-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Sat Feb 02 2019 Fedora Release Engineering - 0.4.14-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Wed Jul 18 2018 Kevin Fenzi - 0.4.14-1 +- Update to 0.4.14. +- Drop upstreamed/no longer needed patches. + +* Sat Jul 14 2018 Fedora Release Engineering - 0.4.13-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Tue Jul 03 2018 Miro Hrončok - 0.4.13-4 +- Add fix for Python 3.7 + +* Sat Jun 16 2018 Miro Hrončok - 0.4.13-3 +- Rebuilt for Python 3.7 + +* Fri Feb 09 2018 Fedora Release Engineering - 0.4.13-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Fri Feb 02 2018 Igor Gnatenko - 0.4.13-1 +- Update to 0.4.13 + +* Fri Jan 12 2018 Igor Gnatenko - 0.4.12-1 +- Update to 0.4.12 + +* Thu Aug 03 2017 Fedora Release Engineering - 0.4.11-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Thu Jul 27 2017 Fedora Release Engineering - 0.4.11-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Sat Feb 11 2017 Fedora Release Engineering - 0.4.11-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Tue Dec 20 2016 Miro Hrončok - 0.4.11-2 +- Rebuild for Python 3.6 + +* Sun Dec 11 2016 Kevin Fenzi - 0.4.11-1 +- Update to 0.4.11. Fixes bug #1403514 + +* Tue Nov 10 2015 Fedora Release Engineering - 0.4.9-2 +- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5 + +* Sun Oct 25 2015 Igor Gnatenko - 0.4.9-1 +- Update to 0.4.9 +- Use %license macro +- Follow new RPM Packaging guidelines +- Cleanups in spec + +* Fri Aug 21 2015 Kevin Fenzi 0.4.7-2 +- Re-enable tests on secondary arches. Fixes #1252899 +- Applied patch to build on ppc64le. Fixes #1252900 + +* Fri Jun 26 2015 Kevin Fenzi 0.4.7-1 +- Update to 0.4.7. Fixes bug #1235896 + +* Thu Jun 18 2015 Fedora Release Engineering - 0.4.5-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Sun Mar 29 2015 Terje Røsten - 0.4.5-1 +- 0.4.5 +- Add python3 subpackage +- Ship license files +- Some spec clean ups +- Update fixes FTBFS issue (bz#1106779) +- Add comment about issues on ppc64, s390 & s390x + +* Sun Aug 17 2014 Fedora Release Engineering - 0.4.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sat Jun 07 2014 Fedora Release Engineering - 0.4.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Thu Jan 23 2014 Orion Poplawski 0.4.2-1 +- Update to 0.4.2 + +* Mon Aug 05 2013 Kevin Fenzi 0.4.1-1 +- Update to 0.4.1 +- Fix FTBFS bug #993134 + +* Sun Aug 04 2013 Fedora Release Engineering - 0.4.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Thu Feb 14 2013 Fedora Release Engineering - 0.4.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Fri Jan 18 2013 Pádraig Brady - 0.4.0-1 +- Update to 0.4.0 + +* Thu Oct 11 2012 Pádraig Brady - 0.3.1-11 +- Add support for ppc64 + +* Sat Jul 21 2012 Fedora Release Engineering - 0.3.1-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Sat Jan 14 2012 Fedora Release Engineering - 0.3.1-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Fri Nov 25 2011 Dan Horák - 0.3.1-8 +- disable tests also for s390(x) + +* Thu Nov 17 2011 Pádraig Brady - 0.3.1-7 +- Fix %%check quoting in the previous comment which when + left with a single percent sign, pulled in "unset DISPLAY\n" + into the changelog + +* Mon Oct 24 2011 Pádraig Brady - 0.3.1-6 +- cherrypick 25bf29f4d3b7 from upstream (rhbz#746771) +- exclude the %%check from ppc where the tests segfault + +* Wed Oct 19 2011 David Malcolm - 0.3.1-5 +- add a %%check section +- cherrypick 2d5b17472757 from upstream (rhbz#746771) + +* Tue Feb 08 2011 Fedora Release Engineering - 0.3.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Thu Jul 22 2010 David Malcolm - 0.3.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild + +* Wed Apr 14 2010 Lev Shamardin - 0.3.1-2 +- Splitted headers into a -devel package. + +* Fri Apr 09 2010 Lev Shamardin - 0.3.1-1 +- Initial package version.