Ondřej Sloup 5feeb6a
%global package_name	psycopg
Ondřej Sloup 5feeb6a
%global src_name	%{package_name}3
Ondřej Sloup 5feeb6a
%global _description %{expand:
Ondřej Sloup 5feeb6a
Psycopg 3 is a PostgreSQL database adapter for the Python programming language.
Ondřej Sloup 5feeb6a
Psycopg 3 presents a familiar interface for everyone who has used Psycopg 2 or
Ondřej Sloup 5feeb6a
any other DB-API 2.0 database adapter, but allows to use more modern PostgreSQL
Ondřej Sloup 5feeb6a
and Python features.}
Ondřej Sloup 5feeb6a
Ondřej Sloup 5feeb6a
Name:		python-%{src_name}
Ondřej Sloup a932804
Version:	3.0.16
b3afb4d
Release:	2%{?dist}
Ondřej Sloup 5feeb6a
Summary:	Psycopg 3 is a modern implementation of a PostgreSQL adapter for Python
Ondřej Sloup 5feeb6a
Ondřej Sloup 5feeb6a
License:	LGPLv3
Ondřej Sloup 5feeb6a
URL:		https://www.psycopg.org/%{src_name}/
Ondřej Sloup 5feeb6a
Source0:	https://github.com/%{package_name}/%{package_name}/archive/refs/tags/%{version}.tar.gz
Ondřej Sloup 5feeb6a
Ondřej Sloup a932804
# Patch remove packages not availible in Fedora (pproxy)
Ondřej Sloup a932804
# and removes specific version and code coverage
Ondřej Sloup a932804
# Remove specific version to ensure build on
Ondřej Sloup a932804
# Fedora 35 (pytest, pytest-randomly) + toml
Ondřej Sloup a932804
Patch0: python-psycopg3-3.0.16-setup.patch
Ondřej Sloup a932804
Patch1: python-psycopg3-3.0.16-toml.patch
Ondřej Sloup a932804
Ondřej Sloup 5feeb6a
BuildRequires:	python3-devel
Ondřej Sloup 5feeb6a
Ondřej Sloup 5feeb6a
# Required for running tests
Ondřej Sloup 5feeb6a
BuildRequires:	libpq
Ondřej Sloup 5feeb6a
Ondřej Sloup 5feeb6a
BuildArch:	noarch
Ondřej Sloup 5feeb6a
Ondřej Sloup 5feeb6a
%description %_description
Ondřej Sloup 5feeb6a
Ondřej Sloup 5feeb6a
%package -n python3-%{src_name}
Ondřej Sloup 5feeb6a
Requires:	libpq
Ondřej Sloup 5feeb6a
Summary:	%{SUMMARY}
Ondřej Sloup 5feeb6a
Ondřej Sloup 5feeb6a
%description -n python3-%{src_name} %_description
Ondřej Sloup 5feeb6a
Ondřej Sloup 5feeb6a
%prep
Ondřej Sloup a932804
%autosetup -p3 -n %{package_name}-%{version}/%{package_name}
Ondřej Sloup 5feeb6a
Ondřej Sloup 5feeb6a
%generate_buildrequires
Ondřej Sloup 5feeb6a
%pyproject_buildrequires -x test
Ondřej Sloup 5feeb6a
Ondřej Sloup 5feeb6a
%build
Ondřej Sloup 5feeb6a
%pyproject_wheel
Ondřej Sloup 5feeb6a
Ondřej Sloup 5feeb6a
%install
Ondřej Sloup 5feeb6a
%pyproject_install
Ondřej Sloup 5feeb6a
%pyproject_save_files %{package_name}
Ondřej Sloup 5feeb6a
Ondřej Sloup 5feeb6a
# Prepare the test folder for pytest
Ondřej Sloup 5feeb6a
pushd ../tests/
Ondřej Sloup 5feeb6a
Ondřej Sloup 5feeb6a
# Remove failing tests
Ondřej Sloup a932804
# The DNS package is not installed and therefore the test 
Ondřej Sloup a932804
# will not run. This is intented as there is no network in mock
Ondřej Sloup 5feeb6a
rm test_typing.py test_module.py
Ondřej Sloup 5feeb6a
# Remove all files in pool/ folder except the fix_pool.py.
Ondřej Sloup ec928f4
# The pool/fix_pool.py is in conftest.py as plugin
Ondřej Sloup 5feeb6a
find pool/ ! -name 'fix_pool.py' -type f -exec rm -f {} +
Ondřej Sloup 5feeb6a
Ondřej Sloup 5feeb6a
popd
Ondřej Sloup 5feeb6a
Ondřej Sloup 5feeb6a
%check
Ondřej Sloup ec928f4
Ondřej Sloup ec928f4
%if 0%{?fedora} > 36
Ondřej Sloup ec928f4
    # Launchs tests with correctly set pytest-asyncio which
Ondřej Sloup ec928f4
    # corrects the breaking change caused by the version
Ondřej Sloup ec928f4
    %pytest ../tests/ --asyncio-mode=auto
Ondřej Sloup ec928f4
%else
Ondřej Sloup ec928f4
    # Python 36 and lower do not have the version which breaks 
Ondřej Sloup ec928f4
    # the process available yet
Ondřej Sloup ec928f4
    %pytest ../tests/
Ondřej Sloup ec928f4
%endif
Ondřej Sloup 5feeb6a
Ondřej Sloup 5feeb6a
Ondřej Sloup 5feeb6a
%files -n python3-%{src_name} -f %{pyproject_files}
Ondřej Sloup 5feeb6a
%doc ../README.rst
Ondřej Sloup 5feeb6a
%license LICENSE.txt
Ondřej Sloup 5feeb6a
Ondřej Sloup 5feeb6a
Ondřej Sloup 5feeb6a
%changelog
b3afb4d
* Fri Oct 14 2022 Ondrej Sloup <osloup@redhat.com> - 3.0.16-2
b3afb4d
- Release bump
b3afb4d
Ondřej Sloup a932804
* Thu Aug 04 2022 Ondrej Sloup <osloup@redhat.com> - 3.0.16-1
Ondřej Sloup a932804
- Rebase to the latest upstream version
Ondřej Sloup a932804
- Create patch files instead of sed
Ondřej Sloup a932804
- Fix release numbering
Ondřej Sloup a932804
Ondřej Sloup a932804
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.11-4
4b5be72
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
4b5be72
Ondřej Sloup a932804
* Tue Jun 14 2022 Python Maint <python-maint@redhat.com> - 3.0.11-3
3ba7e4c
- Rebuilt for Python 3.11
3ba7e4c
Ondřej Sloup ec928f4
* Fri May 13 2022 Ondrej Sloup <osloup@redhat.com> - 3.0.11-2
Ondřej Sloup ec928f4
- Add support for Fedora 35 and 36
Ondřej Sloup ec928f4
- Remove spaces at the end of the file
Ondřej Sloup ec928f4
- Pray that Friday 13 will not break anything
Ondřej Sloup ec928f4
Ondřej Sloup 5feeb6a
* Thu Apr 28 2022 Ondrej Sloup <osloup@redhat.com> - 3.0.11-1
Ondřej Sloup ec928f4
- Create package from git source (#2079251)