From 5feeb6afc0baff6e9916a61e4f758e46e49be692 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sloup?= Date: Wed, 11 May 2022 10:20:47 +0200 Subject: [PATCH] Initial import (fedora#2079251). --- .gitignore | 1 + python-psycopg3.spec | 86 ++++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 88 insertions(+) create mode 100644 .gitignore create mode 100644 python-psycopg3.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4a22ac5 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/3.0.11.tar.gz diff --git a/python-psycopg3.spec b/python-psycopg3.spec new file mode 100644 index 0000000..74a078b --- /dev/null +++ b/python-psycopg3.spec @@ -0,0 +1,86 @@ +%global package_name psycopg +%global src_name %{package_name}3 +%global _description %{expand: +Psycopg 3 is a PostgreSQL database adapter for the Python programming language. +Psycopg 3 presents a familiar interface for everyone who has used Psycopg 2 or +any other DB-API 2.0 database adapter, but allows to use more modern PostgreSQL +and Python features.} + +Name: python-%{src_name} +Version: 3.0.11 +Release: 1%{?dist} +Summary: Psycopg 3 is a modern implementation of a PostgreSQL adapter for Python + +License: LGPLv3 +URL: https://www.psycopg.org/%{src_name}/ +Source0: https://github.com/%{package_name}/%{package_name}/archive/refs/tags/%{version}.tar.gz + +BuildRequires: python3-devel + +# Required for running tests +BuildRequires: libpq + +BuildArch: noarch + +%description %_description + +%package -n python3-%{src_name} +Requires: libpq +Summary: %{SUMMARY} + +%description -n python3-%{src_name} %_description + +%prep +%autosetup -p1 -n %{package_name}-%{version}/%{package_name} + +# Remove unused packages for tests and versions not available +# in Fedora +sed -i '/pproxy/d' setup.py + +# This package is removed as the code coverage does not have +# to be tested +sed -i '/pytest-cov/d' setup.py + +# This line removes the version, since it is not supported +# in Fedora, introduces breaking changes in package +sed -i -r 's/(pytest-asyncio).*",/\1",/' setup.py + +# Tests fail when installed since DNS configuration is not +# available +sed -i '/dnspython/d' setup.py + +%generate_buildrequires +%pyproject_buildrequires -x test + +%build +%pyproject_wheel + +%install +%pyproject_install +%pyproject_save_files %{package_name} + +# Prepare the test folder for pytest +pushd ../tests/ + +# Remove failing tests +rm test_typing.py test_module.py +# Remove all files in pool/ folder except the fix_pool.py. +# The pool/fix_pool.py is in conftest.py as plugin +find pool/ ! -name 'fix_pool.py' -type f -exec rm -f {} + + +popd + +%check +# Launchs tests with correctly set pytest-asyncio which +# corrects the breaking change caused by the version +%pytest ../tests/ --asyncio-mode=auto + + +%files -n python3-%{src_name} -f %{pyproject_files} +%doc ../README.rst +%license LICENSE.txt + + +%changelog +* Thu Apr 28 2022 Ondrej Sloup - 3.0.11-1 +- Create package from git source (#2079251) diff --git a/sources b/sources new file mode 100644 index 0000000..63e2daa --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (3.0.11.tar.gz) = dc4afbf866c274e5feabb2bf74c81a3ea17b216c82a0c75770f9699578ceb098b33b3af5ad43c3683be5123f6fd4767ab5a848ca091f4731911ac32e5409fe98