Revert "- Update to 2.8.3"

This reverts commit 21b3c37541.
This commit is contained in:
Devrim Gündüz 2019-09-09 15:14:57 +01:00
parent 6ac3d6f29b
commit 6eb594a4f9
3 changed files with 155 additions and 20 deletions

View File

@ -1,29 +1,52 @@
%if 0%{?fedora}
%bcond_without python3
%bcond_without python2
%else
%if 0%{?rhel} > 7
%bcond_with python2
%bcond_without python3
%else
%bcond_without python2
%bcond_with python3
%endif
%endif
%bcond_with python3
%bcond_without check
%bcond_without debugrpms
%bcond_without check
%bcond_without debugrpms
%global srcname psycopg2
%global sum A PostgreSQL database adapter for Python
%global desc Psycopg is the most popular PostgreSQL adapter for the Python \
%global srcname psycopg2
%global sum A PostgreSQL database adapter for Python
%global desc Psycopg is the most popular PostgreSQL adapter for the Python \
programming language. At its core it fully implements the Python DB \
API 2.0 specifications. Several extensions allow access to many of the \
features offered by PostgreSQL.
%global python_runtimes \\\
%global python_runtimes \\\
%{?with_python2:python2 %{?with_debugrpms:python2-debug}} \\\
%{?with_python3:python3 %{?with_debugrpms:python3-debug}}
%{!?with_python2:%{!?with_python3:%{error:one python version needed}}}
# Python 2.5+ is not supported by Zope, so it does not exist in
# recent Fedora releases. That's why zope subpackage is disabled.
%global zope 0
%if %zope
%global ZPsycopgDAdir %{_localstatedir}/lib/zope/Products/ZPsycopgDA
%endif
Summary: %{sum}
Name: python3-%{srcname}
Version: 2.8.3
Release: 1%{?dist}
Name: python-%{srcname}
Version: 2.7.7
Release: 4%{?dist}
# The exceptions allow linking to OpenSSL and PostgreSQL's libpq
License: LGPLv3+ with exceptions
Url: http://www.psycopg.org/psycopg/
Source0: http://initd.org/psycopg/tarballs/PSYCOPG-2-8/psycopg2-%{version}.tar.gz
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}
BuildRequires: gcc
@ -39,6 +62,39 @@ Conflicts: python-psycopg2-zope < %{version}
%description
%{desc}
%if %{with python2}
%package -n python2-%{srcname}
%{?python_provide:%python_provide python2-%{srcname}}
Summary: %{sum} 2
%description -n python2-%{srcname}
%{desc}
%package -n python2-%{srcname}-tests
Summary: A testsuite for %sum 2
Requires: python2-%srcname = %version-%release
%description -n python2-%{srcname}-tests
%desc
This sub-package delivers set of tests for the adapter.
%if %{with debugrpms}
%package -n python2-%{srcname}-debug
Summary: A PostgreSQL database adapter for Python 2 (debug build)
# Require the base package, as we're sharing .py/.pyc files:
Requires: python2-%{srcname} = %{version}-%{release}
%{?python_provide:%python_provide python2-%{srcname}-debug}
%description -n python2-%{srcname}-debug
This is a build of the psycopg PostgreSQL database adapter for the debug
build of Python 2.
%endif # debugrpms
%endif # python2
%if %{with python3}
%package -n python3-psycopg2
Summary: %{sum} 3
@ -72,10 +128,26 @@ build of Python 3.
%package doc
Summary: Documentation for psycopg python PostgreSQL database adapter
%{?with_python2:Provides: python2-%{srcname}-doc = %{version}-%{release}}
%{?with_python3:Provides: python3-%{srcname}-doc = %{version}-%{release}}
%description doc
Documentation for the psycopg python PostgreSQL database adapter.
Documentation and example files for the psycopg python PostgreSQL
database adapter.
%if %zope
%package zope
Summary: Zope Database Adapter ZPsycopgDA
# The exceptions allow linking to OpenSSL and PostgreSQL's libpq
License: GPLv2+ with exceptions or ZPLv1.0
Requires: %{name} = %{version}-%{release}
Requires: zope
%description zope
Zope Database Adapter for PostgreSQL, called ZPsycopgDA
%endif
%prep
%autosetup -p1 -n psycopg2-%{version}
@ -110,20 +182,53 @@ export PSYCOPG2_TESTDB_PORT=$PGPORT
cmd="from psycopg2 import tests; tests.unittest.main(defaultTest='tests.test_suite')"
%if %{with python2}
PYTHONPATH=%buildroot%python2_sitearch %__python2 -c "$cmd" --verbose
%endif
%if %{with python3}
PYTHONPATH=%buildroot%python3_sitearch %__python3 -c "$cmd" --verbose
%endif
%endif # check
%install
export CFLAGS=${RPM_OPT_FLAGS} LDFLAGS=${RPM_LD_FLAGS}
for python in %{python_runtimes} ; do
$python setup.py install --no-compile --root %{buildroot}
done
%if %zope
install -d %{buildroot}%{ZPsycopgDAdir}
cp -pr ZPsycopgDA/* %{buildroot}%{ZPsycopgDAdir}
%endif
# This test is skipped on 3.7 and has a syntax error so brp-python-bytecompile would choke on it
%{?with_python3:rm -r %{buildroot}%{python3_sitearch}/%{srcname}/tests/test_async_keyword.py}
%if %{with python2}
%files -n python2-psycopg2
%license LICENSE
%doc AUTHORS NEWS README.rst
%dir %{python2_sitearch}/psycopg2
%{python2_sitearch}/psycopg2/*.py
%{python2_sitearch}/psycopg2/*.pyc
%{python2_sitearch}/psycopg2/_psycopg.so
%{python2_sitearch}/psycopg2/*.pyo
%{python2_sitearch}/psycopg2-%{version}-py2*.egg-info
%files -n python2-%{srcname}-tests
%{python2_sitearch}/psycopg2/tests
%if %{with debugrpms}
%files -n python2-%{srcname}-debug
%license LICENSE
%{python2_sitearch}/psycopg2/_psycopg_d.so
%endif # debugrpms
%endif # python2
%if %{with python3}
%files -n python3-psycopg2
%license LICENSE
@ -150,15 +255,22 @@ done
%files doc
%license LICENSE
%doc doc
%doc doc examples/
%if %zope
%files zope
%license LICENSE
%dir %{ZPsycopgDAdir}
%{ZPsycopgDAdir}/*.py
%{ZPsycopgDAdir}/*.pyo
%{ZPsycopgDAdir}/*.pyc
%{ZPsycopgDAdir}/dtml/*
%{ZPsycopgDAdir}/icons/*
%endif
%changelog
* Mon Sep 9 2019 Devrim Gündüz <devrim@gunduz.org> - 2.8.3-1
- Update to 2.8.3
- Remove Python 3.8 patch -- already in upstream (in utils.c)
- Remove all Python2 stuff from the spec file. Fixes #1747670
(and does more)
* Fri Aug 16 2019 Miro Hrončok <mhroncok@redhat.com> - 2.7.7-4
- Rebuilt for Python 3.8

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
}

View File

@ -1 +1 @@
SHA512 (psycopg2-2.8.3.tar.gz) = 74268f6d05922c968d46ad62a49b4af54dc30463daa67cc0f32d5930c366596f9a1b2f368f2b38c8a9d45bfdcffb13be469a5cbf3911c62d163bea5c7a3ad928
SHA512 (psycopg2-2.7.7.tar.gz) = 032344957c00bf659ca5e46f54f827a6d79809e370d661cd349e2ce935873359bcc4f440b74c6f14658bf1cd9598b6d884abae507fd33db9e07b01fc87967fb0