From f6d89ae9c4ca998e78a0a2b88f0223f3b9d12677 Mon Sep 17 00:00:00 2001 From: Petr Kubat Date: Fri, 12 Apr 2019 09:57:07 +0200 Subject: [PATCH] Backport fix from umerged PR#3 By pkubat@redhat.com: https://src.fedoraproject.org/rpms/python-psycopg2/pull-request/3 --- python-psycopg2.spec | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/python-psycopg2.spec b/python-psycopg2.spec index 906fdb4..bcf1db3 100644 --- a/python-psycopg2.spec +++ b/python-psycopg2.spec @@ -192,7 +192,7 @@ export PSYCOPG2_TESTDB=${PGTESTS_DATABASES##*:} export PSYCOPG2_TESTDB_HOST=$PGHOST export PSYCOPG2_TESTDB_PORT=$PGPORT -cmd="from psycopg2 import tests; tests.unittest.main(defaultTest='tests.test_suite')" +cmd="import tests; tests.unittest.main(defaultTest='tests.test_suite')" %if %{with python2} PYTHONPATH=%buildroot%python2_sitearch %__python2 -c "$cmd" --verbose @@ -209,6 +209,20 @@ for python in %{python_runtimes} ; do $python setup.py install --no-compile --root %{buildroot} done +# Upstream removed tests from the package so we need to add them manually +%if %{with python2} +cp -r tests/ %{buildroot}%{python2_sitearch}/%{srcname}/tests/ +for i in `find %{buildroot}%{python2_sitearch}/%{srcname}/tests/ -iname "*.py"`; do + sed -i 's|#!/usr/bin/env python|#!/usr/bin/python2|' $i +done +%endif +%if %{with python3} +cp -r tests/ %{buildroot}%{python3_sitearch}/%{srcname}/tests/ +for i in `find %{buildroot}%{python3_sitearch}/%{srcname}/tests/ -iname "*.py"`; do + sed -i 's|#!/usr/bin/env python|#!/usr/bin/python3|' $i +done +%endif + %if %zope %{__install} -d %{buildroot}%{ZPsycopgDAdir} %{__cp} -pr ZPsycopgDA/* %{buildroot}%{ZPsycopgDAdir} @@ -267,7 +281,7 @@ done %files doc %license LICENSE -%doc doc examples/ +%doc doc %if %zope