From 9c4604ba6f2d48df4a656718fa464575527a257a Mon Sep 17 00:00:00 2001 From: pcpa Date: Tue, 2 May 2017 08:33:42 -0400 Subject: [PATCH] Initial import (#1445411). --- .gitignore | 1 + python-cysignals-emms.patch | 12 +++ python-cysignals-gdb.patch | 26 ++++++ python-cysignals.spec | 172 ++++++++++++++++++++++++++++++++++++ sources | 1 + 5 files changed, 212 insertions(+) create mode 100644 python-cysignals-emms.patch create mode 100644 python-cysignals-gdb.patch create mode 100644 python-cysignals.spec diff --git a/.gitignore b/.gitignore index e69de29..a3fc3bc 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/cysignals-1.3.2.tar.bz2 diff --git a/python-cysignals-emms.patch b/python-cysignals-emms.patch new file mode 100644 index 0000000..87c1c8b --- /dev/null +++ b/python-cysignals-emms.patch @@ -0,0 +1,12 @@ +diff -up src/cysignals/implementation.c.orig src/cysignals/implementation.c +--- src/cysignals/implementation.c.orig 2017-04-26 07:15:37.355125739 -0400 ++++ src/cysignals/implementation.c 2017-04-26 07:15:50.757126252 -0400 +@@ -85,7 +85,7 @@ static void print_backtrace(void); + */ + static inline void reset_CPU(void) + { +-#if HAVE_EMMS ++#if 0 + /* Clear FPU tag word */ + asm("emms"); + #endif diff --git a/python-cysignals-gdb.patch b/python-cysignals-gdb.patch new file mode 100644 index 0000000..8497e51 --- /dev/null +++ b/python-cysignals-gdb.patch @@ -0,0 +1,26 @@ +--- src/scripts/cysignals-CSI.orig 2016-11-08 07:06:48.000000000 -0700 ++++ src/scripts/cysignals-CSI 2017-04-03 15:38:46.018841319 -0600 +@@ -67,6 +67,7 @@ def gdb_commands(pid, color): + cmds = b('') + cmds += b('set prompt (cysignals-gdb-prompt)\n') + cmds += b('set verbose off\n') ++ cmds += b('set auto-load safe-path /\n') + cmds += b('attach {0}\n'.format(pid)) + cmds += b('python\n') + cmds += b('print("\\n")\n') +@@ -93,15 +94,7 @@ def run_gdb(pid, color): + """ + Execute gdb. + """ +- # Preload the right Python library +- libpython = os.path.join(sysconfig.get_config_var('exec_prefix'), 'lib', +- sysconfig.get_config_var('INSTSONAME')) + env = dict(os.environ) +- if sys.platform == 'macosx': +- env['DYLD_INSERT_LIBRARIES'] = libpython +- else: +- env['LD_PRELOAD'] = libpython +- + PIPE = subprocess.PIPE + try: + cmd = subprocess.Popen('gdb', stdin=PIPE, stdout=PIPE, diff --git a/python-cysignals.spec b/python-cysignals.spec new file mode 100644 index 0000000..9083729 --- /dev/null +++ b/python-cysignals.spec @@ -0,0 +1,172 @@ +%global modname cysignals + +Name: python-%{modname} +Version: 1.3.2 +Release: 3%{?dist} +Summary: Interrupt and signal handling for Cython +License: LGPLv3+ +URL: https://github.com/sagemath/%{modname} +Source0: https://github.com/sagemath/%{modname}/releases/download/%{version}/%{modname}-%{version}.tar.bz2 +BuildRequires: pari-devel +# https://bugzilla.redhat.com/show_bug.cgi?id=1445411#c2 +Patch0: python-cysignals-gdb.patch +Patch1: python-cysignals-emms.patch + +%global _description \ +When writing Cython code, special care must be taken to ensure that the\ +code can be interrupted with CTRL-C. Since Cython optimizes for speed,\ +Cython normally does not check for interrupts. For example, code like\ +the following cannot be interrupted in Cython:\ +\ +while True:\ + pass\ +\ +The cysignals package provides mechanisms to handle interrupts\ +(and other signals and errors) in Cython code.\ +\ +See http://cysignals.readthedocs.org/ for the full documentation. + +%description %{_description} + +%package -n python2-%{modname} +Summary: %{summary} +%{?python_provide:%python_provide python2-%{modname}} +BuildRequires: python2-devel +BuildRequires: python2-Cython +%description -n python2-%{modname} %{_description} + +%package -n python2-%{modname}-devel +Summary: %{summary} headers files +%{?python_provide:%python_provide python2-%{modname}-devel} +Requires: python2-%{modname} +%description -n python2-%{modname}-devel %{_description} + +%package -n python3-%{modname} +Summary: %{summary} +%{?python_provide:%python_provide python3-%{modname}} +BuildRequires: python3-devel +BuildRequires: python3-Cython +%description -n python3-%{modname} %{_description} + +%package -n python3-%{modname}-devel +Summary: %{summary} headers files +%{?python_provide:%python_provide python3-%{modname}-devel} +Requires: python3-%{modname} +%description -n python3-%{modname}-devel %{_description} + +%package doc +Summary: Documentation for %{name} +BuildRequires: python-sphinx +Requires: python-%{modname} +BuildArch: noarch +%description doc +Documentation and examples for %{name}. + +%prep +%setup -q -n %{modname}-%{version} +%patch0 +%patch1 + +%build +sed -i 's/"cysignals-CSI"/"cysignals-CSI-2"/' src/cysignals/implementation.c +%py2_build +sed -i 's/"cysignals-CSI-2"/"cysignals-CSI-3"/' src/cysignals/implementation.c +%py3_build +pushd docs + %__make html +popd + +%install +%py2_install +%py3_install +mkdir -p %{buildroot}%{_docdir}/%{name} +cp -farp docs/build/html %{buildroot}%{_docdir}/%{name} +rm %{buildroot}%{_docdir}/%{name}/html/.buildinfo + +cp -p %{buildroot}%{_bindir}/cysignals-CSI{,-3} +sed -i 's@^\(#!/usr/bin/python\)3\( -s\)@\12\2@' %{buildroot}%{_bindir}/cysignals-CSI +mv %{buildroot}%{_bindir}/cysignals-CSI{,-2} + +# Install missing files from python2 subpackage +cp -p build/src/cysignals/{debug.h,signals.h,signals_api.h} \ + %{buildroot}%{python2_sitearch}/cysignals + +%check +for check in src/cysignals/*.pyx; do + sed -i -e "s/Popen(\['python'/Popen(\['python2'/" $check +done +PATH=%{buildroot}%{_bindir}:$PATH +PYTHONPATH=%{buildroot}%{python2_sitearch} +export PATH PYTHONPATH +%{__python2} rundoctests.py src/cysignals/*.pyx +# FIXME - not interrupting the timer - not fully functional for python3? +#File "src/cysignals/pselect.pyx", line 243, in pselect.pyx +#Failed example: +# (0.2 <= t <= 0.9) or t +#Expected: +# True +#Got: +# 1.004807949066162 +for check in src/cysignals/*.pyx; do + sed -i -e "s/Popen(\['python2'/Popen(\['python3'/" $check +done +PYTHONPATH=%{buildroot}%{python3_sitearch} +export PYTHONPATH +%{__python3} rundoctests.py src/cysignals/*.pyx || : + +%files -n python2-%{modname} +%license LICENSE +%doc PKG-INFO README.rst +%{_bindir}/%{modname}-CSI-2 +%{_bindir}/%{modname}-CSI-helper.py +%{python2_sitearch}/%{modname} +%{python2_sitearch}/%{modname}-*.egg-info +%exclude %{python2_sitearch}/%{modname}/*.h +%exclude %{python2_sitearch}/%{modname}/*.pxd +%exclude %{python2_sitearch}/%{modname}/*.pxi + +%files -n python2-%{modname}-devel +%{python2_sitearch}/%{modname}/*.h +%{python2_sitearch}/%{modname}/*.pxd +%{python2_sitearch}/%{modname}/*.pxi + +%files -n python3-%{modname} +%license LICENSE +%doc PKG-INFO README.rst +%{_bindir}/%{modname}-CSI-3 +%{_bindir}/%{modname}-CSI-helper.py +%{python3_sitearch}/%{modname} +%{python3_sitearch}/%{modname}-*.egg-info +%exclude %{python3_sitearch}/%{modname}/*.h +%exclude %{python3_sitearch}/%{modname}/*.pxd +%exclude %{python3_sitearch}/%{modname}/*.pxi + +%files -n python3-%{modname}-devel +%{python3_sitearch}/%{modname}/*.h +%{python3_sitearch}/%{modname}/*.pxd +%{python3_sitearch}/%{modname}/*.pxi + +%files doc +%dir %{_docdir}/%{name} +%{_docdir}/%{name}/html + +%changelog +* Thu Apr 27 2017 pcpa - 1.3.2-3 +- Correct mixed tabs and spaces in the spec (#1445411#c5) + +* Wed Apr 26 2017 pcpa - 1.3.2-2 +- Remove python preloading (#1445411#c2) +- Add python provides to python3 subpackage (#1445411#c3) +- Add changelog section (#1445411#c3) +- Add URL tag (#1445411#c3) +- Correct license to LGPLv3+ (#1445411#c3) +- Change doc subpackage to noarch +- Correct owner of documentation directory (#1445411#c3) +- Do not call the emms instruction on x86 (#1445411#c3) +- Do not install .buildinfo file in doc subpackage (#1445411#c3) +- Correct problems in python3 tests in %%check due to Popen python +- Install a python 2 or 3 specific cysignals-CSI +- Add requires to the LICENSE file in the doc subpackage (#1445411#c3) + +* Wed Apr 26 2017 pcpa - 1.3.2-1 +- Initial python-cysignals spec. diff --git a/sources b/sources index e69de29..48fe8b4 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +SHA512 (cysignals-1.3.2.tar.bz2) = 4cf9a370cb331cd2a4e61bb635670de991e6d215a4b17b814dfeb35a3dd3983bb8ef5fca76adc2dbbacad9bf9b9a72052bf525a719c8116e9050d94f7853d2af