From b4819b460e93fd6eef19d11d145de032e61df125 Mon Sep 17 00:00:00 2001 From: eabdullin Date: Mon, 1 Apr 2024 07:56:49 +0000 Subject: [PATCH] import CS python3.12-Cython-0.29.35-3.el8 --- .gitignore | 1 + .python3.12-Cython.metadata | 1 + SOURCES/emacs-docstring-wrap.patch | 26 ++++ SOURCES/py3.12-tracing.patch | 43 +++++++ SPECS/python3.12-Cython.spec | 189 +++++++++++++++++++++++++++++ 5 files changed, 260 insertions(+) create mode 100644 .gitignore create mode 100644 .python3.12-Cython.metadata create mode 100644 SOURCES/emacs-docstring-wrap.patch create mode 100644 SOURCES/py3.12-tracing.patch create mode 100644 SPECS/python3.12-Cython.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f56c5f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/Cython-0.29.35.tar.gz diff --git a/.python3.12-Cython.metadata b/.python3.12-Cython.metadata new file mode 100644 index 0000000..a89dc6a --- /dev/null +++ b/.python3.12-Cython.metadata @@ -0,0 +1 @@ +9ecfb5e77f737eb7e92b023bfe9c08f49fb22983 SOURCES/Cython-0.29.35.tar.gz diff --git a/SOURCES/emacs-docstring-wrap.patch b/SOURCES/emacs-docstring-wrap.patch new file mode 100644 index 0000000..792d6e2 --- /dev/null +++ b/SOURCES/emacs-docstring-wrap.patch @@ -0,0 +1,26 @@ +From 38339b8598b5cfaef324650368581f6967b024a0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Tue, 20 Dec 2022 01:08:58 +0100 +Subject: [PATCH] Wrap the docstring of cython-default-compile-format to 80 + characters + +This should avoid a warning as reported in: +https://bugzilla.redhat.com/show_bug.cgi?id=2155090 +--- + Tools/cython-mode.el | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/Tools/cython-mode.el b/Tools/cython-mode.el +index 2d9fbae..970a765 100644 +--- a/Tools/cython-mode.el ++++ b/Tools/cython-mode.el +@@ -108,7 +108,8 @@ + ;;;###autoload + (defcustom cython-default-compile-format "cython -a %s" + "Format for the default command to compile a Cython file. +-It will be passed to `format' with `buffer-file-name' as the only other argument." ++It will be passed to `format' with `buffer-file-name' ++as the only other argument." + :group 'cython + :type 'string) + diff --git a/SOURCES/py3.12-tracing.patch b/SOURCES/py3.12-tracing.patch new file mode 100644 index 0000000..9d46643 --- /dev/null +++ b/SOURCES/py3.12-tracing.patch @@ -0,0 +1,43 @@ +From 03c498d3142ccee2da258c540e96f12c863159fc Mon Sep 17 00:00:00 2001 +From: Stefan Behnel +Date: Mon, 29 May 2023 22:08:50 +0200 +Subject: [PATCH] Avoid using the thread state attribute "use_tracing" in + Python 3.12 where it was removed from the struct. + +See PEP-669 (https://peps.python.org/pep-0669/) and the implementation in https://github.com/python/cpython/pull/103083. +There is more to be done to properly support PEP-669, but this makes it compile. + +See https://github.com/cython/cython/issues/5450 +--- + Cython/Utility/Profile.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/Cython/Utility/Profile.c b/Cython/Utility/Profile.c +index 20b599e7979..2b8564b226f 100644 +--- a/Cython/Utility/Profile.c ++++ b/Cython/Utility/Profile.c +@@ -61,15 +61,21 @@ + #define __Pyx_TraceFrameInit(codeobj) \ + if (codeobj) $frame_code_cname = (PyCodeObject*) codeobj; + ++ + #if PY_VERSION_HEX >= 0x030b00a2 ++ #if PY_VERSION_HEX >= 0x030C00b1 ++ #define __Pyx_IsTracing(tstate, check_tracing, check_funcs) \ ++ ((!(check_tracing) || !(tstate)->tracing) && \ ++ (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc))) ++ #else + #define __Pyx_IsTracing(tstate, check_tracing, check_funcs) \ + (unlikely((tstate)->cframe->use_tracing) && \ + (!(check_tracing) || !(tstate)->tracing) && \ + (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc))) ++ #endif + +- #define __Pyx_EnterTracing(tstate) PyThreadState_EnterTracing(tstate) +- +- #define __Pyx_LeaveTracing(tstate) PyThreadState_LeaveTracing(tstate) ++ #define __Pyx_EnterTracing(tstate) PyThreadState_EnterTracing(tstate) ++ #define __Pyx_LeaveTracing(tstate) PyThreadState_LeaveTracing(tstate) + + #elif PY_VERSION_HEX >= 0x030a00b1 + #define __Pyx_IsTracing(tstate, check_tracing, check_funcs) \ diff --git a/SPECS/python3.12-Cython.spec b/SPECS/python3.12-Cython.spec new file mode 100644 index 0000000..0272e96 --- /dev/null +++ b/SPECS/python3.12-Cython.spec @@ -0,0 +1,189 @@ +%global __python3 /usr/bin/python3.12 +%global python3_pkgversion 3.12 + +# RHEL: Tests disabled during build due to missing dependencies +%bcond_with tests + +# This bcond allows to ship a non-compiled version +# Slower, but sometimes necessary with alpha Python versions +%bcond_without cython_compile + +# We don't ship emacs-cython-mode in EL. +%bcond_with emacs + +Name: python%{python3_pkgversion}-Cython +Version: 0.29.35 +Release: 3%{?dist} +Summary: Language for writing Python extension modules + +License: ASL 2.0 +URL: http://www.cython.org +Source: https://github.com/cython/cython/archive/%{version}/Cython-%{version}.tar.gz + +# Wrap the docstring of cython-default-compile-format to 80 characters +# Upstream PR: https://github.com/cython/emacs-cython-mode/pull/1 +# Fixes https://bugzilla.redhat.com/2155090 +Patch0: emacs-docstring-wrap.patch + +# Compile-time Python 3.12 compatibility for CYTHON_TRACE support +# Taken from the 3.x branch upstream. +# See: https://github.com/cython/cython/issues/5450 +Patch1: https://github.com/cython/cython/commit/03c498d3142ccee2da258c540e96f12c863159fc.patch?/py3.12-tracing.patch + +BuildRequires: python%{python3_pkgversion}-devel +BuildRequires: python%{python3_pkgversion}-rpm-macros +BuildRequires: python%{python3_pkgversion}-setuptools + +%if %{with tests} +BuildRequires: gcc-c++ +BuildRequires: python3-numpy +# The tests requiring jedi are optional and skipped when jedi is not installed. +# Note that the jedi tests were forcefully disabled a long time ago, +# in https://github.com/cython/cython/issues/1845 far, far away. +# We keep the dependency here so we don't forget to re-add it once the balance is restored. +# We don't want to pull in jedi to RHEL just to potentially run more tests. +%if %{undefined rhel} +BuildRequires: python3-jedi +%endif +%endif + +%if %{with cython_compile} +BuildRequires: gcc +%global python3_site %{python3_sitearch} +%else +BuildArch: noarch +%global python3_site %{python3_sitelib} +%endif + +%py_provides python%{python3_pkgversion}-cython + +# A small templating library is bundled in Cython/Tempita +# Upstream version 0.5.2 is available from https://pypi.org/project/Tempita +# but the bundled copy is patched and reorganized. +# Upstream homepage is inaccessible. +Provides: bundled(python%{python3_pkgversion}dist(tempita)) + +%global _description %{expand: +The Cython language makes writing C extensions for the Python language as easy +as Python itself. Cython is a source code translator based on Pyrex, +but supports more cutting edge functionality and optimizations. + +The Cython language is a superset of the Python language (almost all Python +code is also valid Cython code), but Cython additionally supports optional +static typing to natively call C functions, operate with C++ classes and +declare fast C types on variables and class attributes. +This allows the compiler to generate very efficient C code from Cython code. + +This makes Cython the ideal language for writing glue code for external C/C++ +libraries, and for fast C modules that speed up the execution of Python code.} + +%description %{_description} + + +%if %{with emacs} +%package -n emacs-cython-mode +Summary: A major mode for editing Cython source files in Emacs +BuildArch: noarch +BuildRequires: emacs +%{?_emacs_version: +Requires: emacs(bin) >= %{_emacs_version} +} + +%description -n emacs-cython-mode +cython-mode is an Emacs major mode for editing Cython source files. +%endif + + +%prep +%autosetup -n cython-%{version} -p1 + + +%build +%py3_build -- %{!?with_cython_compile:--no-cython-compile} + +%if %{with emacs} +# emacs-cython-mode build +echo ";; +(require 'cython-mode)" > cython-mode-init.el +cp -p Tools/cython-mode.el . +%{_emacs_bytecompile} *.el +%endif + + +%install +%py3_install -- %{!?with_cython_compile:--no-cython-compile} + +# Rename unversioned binaries +mv %{buildroot}%{_bindir}/cython{,-%{python3_version}} +mv %{buildroot}%{_bindir}/cygdb{,-%{python3_version}} +mv %{buildroot}%{_bindir}/cythonize{,-%{python3_version}} + +%if %{with emacs} +# emacs-cython-mode install +mkdir -p %{buildroot}%{_emacs_sitelispdir}/ +cp -p cython-mode.el cython-mode.elc %{buildroot}%{_emacs_sitelispdir}/ +mkdir -p %{buildroot}%{_emacs_sitestartdir}/ +cp -p cython-mode-init.el cython-mode-init.elc %{buildroot}%{_emacs_sitestartdir}/ +%endif + + +%if %{with tests} +%check +%{python3} runtests.py -vv --no-pyregr %{?_smp_mflags} \ + %ifarch %{ix86} + --exclude run.parallel # https://github.com/cython/cython/issues/2807 + %endif + +%endif + + +%files -n python%{python3_pkgversion}-Cython +%license LICENSE.txt +%doc *.txt Demos Doc Tools +%{_bindir}/cython-%{python3_version} +%{_bindir}/cygdb-%{python3_version} +%{_bindir}/cythonize-%{python3_version} +%{python3_site}/Cython-*.egg-info/ +%{python3_site}/Cython/ +%{python3_site}/pyximport/ +%pycached %{python3_site}/cython.py + +%if %{with emacs} +%files -n emacs-cython-mode +%license LICENSE.txt +%{_emacs_sitelispdir}/cython*.el* +%{_emacs_sitestartdir}/cython*.el* +%endif + + +%changelog +* Tue Jan 23 2024 Miro Hrončok - 0.29.35-3 +- Rebuilt for timestamp .pyc invalidation mode + +* Thu Jan 11 2024 Tomáš Hrnčiar - 0.29.35-2 +- Initial package +- Fedora contributions by: + Alex Cobb + Bill Nottingham + Charalampos Stratakis + David Malcolm + Dennis Gilmore + Gwyn Ciesla + Ignacio Vazquez-Abrams + Igor Gnatenko + Jesse Keating + Kevin Fenzi + Marcel Plch + Miro Hrončok + Neal D. Becker + Orion Poplawski + Peter Robinson + Petr Viktorin + Robert Kuska + Scott Talbert + serge-sans-paille + Thomas Spura + Tomáš Hrnčiar + Toshio くらとみ + Yaakov Selkowitz +