From 57d6534f59b31e94b5a37b1a8634562a42e86983b1af63a309db563016474165 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Thu, 18 Jan 2018 13:30:58 +0000 Subject: [PATCH 1/2] OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cffi?expand=0&rev=41 --- python-cffi.spec | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/python-cffi.spec b/python-cffi.spec index 91ed805..19568b7 100644 --- a/python-cffi.spec +++ b/python-cffi.spec @@ -1,7 +1,7 @@ # # spec file for package python-cffi # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 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 @@ -25,19 +25,17 @@ Summary: Foreign Function Interface for Python calling C code License: MIT Group: Development/Languages/Python Url: http://%{modname}.readthedocs.org -Source0: https://files.pythonhosted.org/packages/source/c/%{modname}/%{modname}-%{version}.tar.gz +Source0: https://files.pythonhosted.org/packages/source/c/cffi/%{modname}-%{version}.tar.gz Source1: python-cffi-rpmlintrc BuildRequires: %{python_module devel} -BuildRequires: %{python_module setuptools} -BuildRequires: gcc-c++ -BuildRequires: python-rpm-macros -# Documentation requirements: BuildRequires: %{python_module pycparser} BuildRequires: %{python_module pytest} -Requires: python-pycparser -BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildRequires: %{python_module setuptools} +BuildRequires: gcc-c++ +BuildRequires: pkgconfig +BuildRequires: python-rpm-macros BuildRequires: pkgconfig(libffi) - +Requires: python-pycparser %python_subpackages %description @@ -58,7 +56,6 @@ export CFLAGS="%{optflags}" %python_expand PYTHONPATH=%{buildroot}%{$python_sitearch} py.test-%$python_bin_suffix -k "not test_init_once_multithread" c/ testing/ %files %{python_files} -%defattr(-,root,root,-) %doc LICENSE %{python_sitearch}/* From 60ed6141640d70f3bc419e7d671a7c21ae0c9dffed5d0538029970d01a2944eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Thu, 18 Jan 2018 13:44:02 +0000 Subject: [PATCH 2/2] - Add patch cffi-loader.patch to fix bsc#1070737 - Sort out with spec-cleaner OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cffi?expand=0&rev=42 --- cffi-loader.patch | 45 +++++++++++++++++++++++++++++++++++++++++++++ python-cffi.changes | 6 ++++++ python-cffi.spec | 2 ++ 3 files changed, 53 insertions(+) create mode 100644 cffi-loader.patch diff --git a/cffi-loader.patch b/cffi-loader.patch new file mode 100644 index 0000000..16b447a --- /dev/null +++ b/cffi-loader.patch @@ -0,0 +1,45 @@ +# HG changeset patch +# User Armin Rigo +# Date 1515619092 -3600 +# Node ID d16706e3c2da4ff29729c312b96af5cc251f82c4 +# Parent a570b34ac8a60becdbc4a3404c737d03b4691353 +Issue #352 + +Oops. + +diff --git a/c/lib_obj.c b/c/lib_obj.c +--- a/c/lib_obj.c ++++ b/c/lib_obj.c +@@ -505,6 +505,7 @@ + return x; + + missing: ++ /*** ATTRIBUTEERROR IS SET HERE ***/ + p = PyText_AsUTF8(name); + if (p == NULL) + return NULL; +@@ -534,6 +535,7 @@ + #if PY_MAJOR_VERSION >= 3 + if (strcmp(p, "__loader__") == 0 || strcmp(p, "__spec__") == 0) { + /* some more module-like behavior hacks */ ++ PyErr_Clear(); + Py_INCREF(Py_None); + return Py_None; + } +diff --git a/testing/cffi1/test_recompiler.py b/testing/cffi1/test_recompiler.py +--- a/testing/cffi1/test_recompiler.py ++++ b/testing/cffi1/test_recompiler.py +@@ -2287,3 +2287,13 @@ + + def test_char16_char32_plain_c(): + test_char16_char32_type(no_cpp=True) ++ ++def test_loader_spec(): ++ ffi = FFI() ++ lib = verify(ffi, "test_loader_spec", "") ++ if sys.version_info < (3,): ++ assert not hasattr(lib, '__loader__') ++ assert not hasattr(lib, '__spec__') ++ else: ++ assert lib.__loader__ is None ++ assert lib.__spec__ is None diff --git a/python-cffi.changes b/python-cffi.changes index 5b057f6..8c548fb 100644 --- a/python-cffi.changes +++ b/python-cffi.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Jan 18 13:35:08 UTC 2018 - tchvatal@suse.com + +- Add patch cffi-loader.patch to fix bsc#1070737 +- Sort out with spec-cleaner + ------------------------------------------------------------------- Fri Nov 3 15:56:32 UTC 2017 - arun@gmx.de diff --git a/python-cffi.spec b/python-cffi.spec index 19568b7..1eaabe7 100644 --- a/python-cffi.spec +++ b/python-cffi.spec @@ -27,6 +27,7 @@ Group: Development/Languages/Python Url: http://%{modname}.readthedocs.org Source0: https://files.pythonhosted.org/packages/source/c/cffi/%{modname}-%{version}.tar.gz Source1: python-cffi-rpmlintrc +Patch0: cffi-loader.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module pycparser} BuildRequires: %{python_module pytest} @@ -44,6 +45,7 @@ is to provide a convenient and reliable way of calling C code from Python. %prep %setup -q -n %{modname}-%{version} +%patch0 -p1 %build export CFLAGS="%{optflags}"