128 lines
3.5 KiB
RPMSpec
128 lines
3.5 KiB
RPMSpec
%global python3_pkgversion 3.14
|
|
|
|
%bcond tests 1
|
|
|
|
%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.
|
|
|
|
|
|
Summary: %{sum}
|
|
Name: python%{python3_pkgversion}-%{srcname}
|
|
Version: 2.9.10
|
|
Release: 3%{?dist}
|
|
# The exceptions allow linking to OpenSSL and PostgreSQL's libpq
|
|
License: LGPL-3.0-or-later WITH openvpn-openssl-exception
|
|
Url: https://www.psycopg.org/
|
|
|
|
Source: https://github.com/psycopg/psycopg2/archive/%{version}/psycopg2-%{version}.tar.gz
|
|
|
|
BuildRequires: python%{python3_pkgversion}-devel
|
|
BuildRequires: python%{python3_pkgversion}-setuptools
|
|
|
|
BuildRequires: gcc
|
|
BuildRequires: libpq-devel
|
|
|
|
# For testsuite
|
|
%if %{with tests}
|
|
BuildRequires: postgresql-test-rpm-macros
|
|
%endif
|
|
|
|
# Remove test 'test_from_tables' for s390 architecture
|
|
# from ./tests/test_types_extras.py
|
|
Patch0: test_types_extras-2.9.3-test_from_tables.patch
|
|
|
|
%description
|
|
%{desc}
|
|
|
|
%package -n python%{python3_pkgversion}-%{srcname}-tests
|
|
Summary: A testsuite for %sum %{python3_pkgversion}
|
|
Requires: python%{python3_pkgversion}-%{srcname} = %version-%release
|
|
|
|
%description -n python%{python3_pkgversion}-%{srcname}-tests
|
|
%desc
|
|
This sub-package delivers set of tests for the adapter.
|
|
|
|
|
|
%prep
|
|
%setup -q -n psycopg2-%{version}
|
|
|
|
# The patch is applied only for s390 architecture as
|
|
# on other architectures the test works
|
|
%ifarch s390x s390
|
|
%patch -P0 -p0
|
|
%endif
|
|
|
|
|
|
%generate_buildrequires
|
|
%pyproject_buildrequires
|
|
|
|
|
|
%build
|
|
%pyproject_wheel
|
|
|
|
%check
|
|
%if %{with tests}
|
|
export PGTESTS_LOCALE=C.UTF-8
|
|
%postgresql_tests_run
|
|
|
|
export PSYCOPG2_TESTDB=${PGTESTS_DATABASES##*:}
|
|
export PSYCOPG2_TESTDB_HOST=$PGHOST
|
|
export PSYCOPG2_TESTDB_PORT=$PGPORT
|
|
|
|
cmd="import tests; tests.unittest.main(defaultTest='tests.test_suite')"
|
|
|
|
%py3_test_envvars %python3 -c "$cmd" --verbose
|
|
%endif
|
|
|
|
|
|
%install
|
|
%pyproject_install
|
|
%pyproject_save_files -l psycopg2
|
|
|
|
# Upstream removed tests from the package so we need to add them manually
|
|
cp -r tests/ %{buildroot}%{python3_sitearch}/%{srcname}/tests/
|
|
%py3_shebang_fix %{buildroot}%{python3_sitearch}/%{srcname}/tests/
|
|
|
|
|
|
%files -n python%{python3_pkgversion}-psycopg2 -f %{pyproject_files}
|
|
%doc AUTHORS NEWS README.rst
|
|
|
|
|
|
%files -n python%{python3_pkgversion}-%{srcname}-tests
|
|
%{python3_sitearch}/psycopg2/tests
|
|
|
|
|
|
%changelog
|
|
* Tue Sep 9 2025 Tomáš Hrnčiar <thrnciar@redhat.com> - 2.9.10-3
|
|
- Initial package
|
|
Fedora contributions by:
|
|
Ales Nezbeda <anezbeda@redhat.com>
|
|
Bill Nottingham <notting@fedoraproject.org>
|
|
Bohuslav Kabrda <bkabrda@redhat.com>
|
|
Charalampos Stratakis <cstratak@redhat.com>
|
|
David Malcolm <dmalcolm@redhat.com>
|
|
Dennis Gilmore <dennis@ausil.us>
|
|
Devrim Gündüz <devrim@gunduz.org>
|
|
Filip Januš <fjanus@redhat.com>
|
|
Honza Horak <hhorak@redhat.com>
|
|
Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com>
|
|
Igor Gnatenko <ignatenkobrain@fedoraproject.org>
|
|
Jason L Tibbitts III <tibbs@math.uh.edu>
|
|
Jesse Keating <jkeating@fedoraproject.org>
|
|
Jozef Mlich <jmlich@redhat.com>
|
|
Lumír Balhar <lbalhar@redhat.com>
|
|
Miro Hrončok <mhroncok@redhat.com>
|
|
Ondřej Sloup <ondrej.sloup@protonmail.com>
|
|
Patrik Novotný <panovotn@redhat.com>
|
|
Pavel Raiskup <praiskup@redhat.com>
|
|
Petr Kubat <pkubat@redhat.com>
|
|
Peter Robinson <pbrobinson@fedoraproject.org>
|
|
Todd Zullinger <tmz@pobox.com>
|
|
Tomas Hrnciar <thrnciar@redhat.com>
|
|
Tom Lane <tgl@redhat.com>
|
|
|