Backport fix from umerged PR#3

By pkubat@redhat.com:
https://src.fedoraproject.org/rpms/python-psycopg2/pull-request/3
This commit is contained in:
Petr Kubat 2019-04-12 09:57:07 +02:00 committed by Pavel Raiskup
parent e392449689
commit f6d89ae9c4

View File

@ -192,7 +192,7 @@ export PSYCOPG2_TESTDB=${PGTESTS_DATABASES##*:}
export PSYCOPG2_TESTDB_HOST=$PGHOST export PSYCOPG2_TESTDB_HOST=$PGHOST
export PSYCOPG2_TESTDB_PORT=$PGPORT 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} %if %{with python2}
PYTHONPATH=%buildroot%python2_sitearch %__python2 -c "$cmd" --verbose 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} $python setup.py install --no-compile --root %{buildroot}
done 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 %if %zope
%{__install} -d %{buildroot}%{ZPsycopgDAdir} %{__install} -d %{buildroot}%{ZPsycopgDAdir}
%{__cp} -pr ZPsycopgDA/* %{buildroot}%{ZPsycopgDAdir} %{__cp} -pr ZPsycopgDA/* %{buildroot}%{ZPsycopgDAdir}
@ -267,7 +281,7 @@ done
%files doc %files doc
%license LICENSE %license LICENSE
%doc doc examples/ %doc doc
%if %zope %if %zope