Fixes for 3.8.0a4 rebuild

Resolves: #1693641
This commit is contained in:
Honza Horak 2019-05-30 22:13:33 +02:00
parent f689205c2f
commit 26a4b14700
2 changed files with 31 additions and 3 deletions

View File

@ -38,12 +38,13 @@ features offered by PostgreSQL.
Summary: %{sum}
Name: python-%{srcname}
Version: 2.7.7
Release: 1%{?dist}
Release: 2%{?dist}
# The exceptions allow linking to OpenSSL and PostgreSQL's libpq
License: LGPLv3+ with exceptions
Url: http://www.psycopg.org/psycopg/
Source0: http://www.psycopg.org/psycopg/tarballs/PSYCOPG-2-7/psycopg2-%{version}.tar.gz
patch0: python38.patch
%{?with_python2:BuildRequires: %{?with_debugrpms:/usr/bin/python2-debug} python2-devel}
%{?with_python3:BuildRequires: %{?with_debugrpms:/usr/bin/python3-debug} python3-devel}
@ -234,7 +235,7 @@ cp -pr ZPsycopgDA/* %{buildroot}%{ZPsycopgDAdir}
%doc AUTHORS NEWS README.rst
%dir %{python3_sitearch}/psycopg2
%{python3_sitearch}/psycopg2/*.py
%{python3_sitearch}/psycopg2/_psycopg.cpython-3?m*.so
%{python3_sitearch}/psycopg2/_psycopg.cpython-3?[!d]*.so
%dir %{python3_sitearch}/psycopg2/__pycache__
%{python3_sitearch}/psycopg2/__pycache__/*.py{c,o}
%{python3_sitearch}/psycopg2-%{version}-py3*.egg-info
@ -247,7 +248,7 @@ cp -pr ZPsycopgDA/* %{buildroot}%{ZPsycopgDAdir}
%if %{with debugrpms}
%files -n python3-psycopg2-debug
%license LICENSE
%{python3_sitearch}/psycopg2/_psycopg.cpython-3?dm*.so
%{python3_sitearch}/psycopg2/_psycopg.cpython-3?d*.so
%endif # debugrpms
%endif # python3
@ -270,6 +271,10 @@ cp -pr ZPsycopgDA/* %{buildroot}%{ZPsycopgDAdir}
%changelog
* Tue May 14 2019 Miro Hrončok <mhroncok@redhat.com> - 2.7.7-2
- Fixes for 3.8.0a4 rebuild
Resolves: 1693641
* Tue Feb 05 2019 Pavel Raiskup <praiskup@redhat.com> - 2.7.7-1
- update to the latest upstream release

23
python38.patch Normal file
View File

@ -0,0 +1,23 @@
diff --git a/psycopg/psycopgmodule.c b/psycopg/psycopgmodule.c
index 5deaa16..f35d574 100644
--- a/psycopg/psycopgmodule.c
+++ b/psycopg/psycopgmodule.c
@@ -677,6 +677,10 @@ psyco_set_error(PyObject *exc, cursorObject *curs, const char *msg)
static int
psyco_is_main_interp(void)
{
+#if PY_VERSION_HEX >= 0x03080000
+ /* tested with Python 3.8.0a2 */
+ return _PyInterpreterState_Get() == PyInterpreterState_Main();
+#else
static PyInterpreterState *main_interp = NULL; /* Cached reference */
PyInterpreterState *interp;
@@ -692,6 +696,7 @@ psyco_is_main_interp(void)
main_interp = interp;
assert (main_interp);
return psyco_is_main_interp();
+#endif
}