diff --git a/.gitignore b/.gitignore index 31ec56d..dd2033c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,7 @@ /3.1.9.tar.gz /3.1.10.tar.gz /3.1.12.tar.gz +/3.1.13.tar.gz +/3.1.17.tar.gz +/3.1.18.tar.gz +/pool-3.2.1.tar.gz diff --git a/python-psycopg3.spec b/python-psycopg3.spec index c3f6d14..6faa897 100644 --- a/python-psycopg3.spec +++ b/python-psycopg3.spec @@ -1,79 +1,148 @@ %global package_name psycopg -%global src_name %{package_name}3 -%global _description %{expand: +%global src_name %{package_name}3 + +%global pool_version 3.2.1 +%global pool_name pool-%{pool_version} + +%bcond_without tests + +Name: python-%{src_name} +Version: 3.1.18 +Release: 1%{?dist} +Summary: Psycopg 3 is a modern implementation of a PostgreSQL adapter for Python + +License: LGPL-3.0-only +URL: https://www.psycopg.org/%{src_name}/ +Source0: https://github.com/%{package_name}/%{package_name}/archive/refs/tags/%{version}.tar.gz +Source1: https://github.com/%{package_name}/%{package_name}/archive/refs/tags/%{pool_name}.tar.gz + +# https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval +ExcludeArch: %{ix86} + +BuildRequires: python3-devel +BuildRequires: libpq openssl +BuildRequires: postgresql-static postgresql-server-devel +BuildRequires: python3-pip python3-wheel pypy python3-tomli + +# Required for running tests +BuildRequires: postgresql-test-rpm-macros +BuildRequires: python3-anyio python3-mypy pytest python3-pytest-cov python3-pytest-randomly + +# Required for Cython +BuildRequires: cython gcc + +%description 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.1.12 -Release: 3%{?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 -BuildRequires: postgresql-test-rpm-macros - -BuildArch: noarch - -%description %_description +and Python features. %package -n python3-%{src_name} -Requires: libpq -Summary: %{SUMMARY} -%description -n python3-%{src_name} %_description +Summary: %{Summary} + +%description -n python3-%{src_name} +%{description} + +%package -n python3-%{src_name}_pool +Summary: Connection pooling for Psycopg 3 +Requires: python-%{src_name} + +%description -n python3-%{src_name}_pool +This package contains the pooling functionality for Psycopg 3. + +%package -n python3-%{src_name}_c +Summary: C extensions for Psycopg 3 + +%description -n python3-%{src_name}_c +This package contains the C extensions for enhanced performance in Psycopg 3. %prep -%autosetup -p3 -n %{package_name}-%{version}/%{package_name} +%autosetup -p1 -n %{package_name}-%{version} -# disable remove deps for typechecking and linting -sed -r -i 's/("(black|flake8|pytest-cov)\b.*",)/# \1/' setup.py -# remove pproxy dep, only used for tests -sed -r -i 's/("(pproxy)\b.*",)/# \1/' setup.py +# Remove old psycopg_pool folder +rm -rf psycopg_pool/* -# remove version for anyio -sed -i 's/\(anyio\).*$/\1",/' setup.py - -%generate_buildrequires -%pyproject_buildrequires -x test +# Unpack upstream psycopg_pool +tar -xzf %{SOURCE1} -C psycopg_pool/ --strip-components=2 %{package_name}-%{pool_name}/psycopg_pool/ %build +pushd psycopg %pyproject_wheel +popd + +pushd psycopg_pool +%pyproject_wheel +popd + +pushd psycopg_c +%pyproject_wheel +popd %install +pushd psycopg %pyproject_install -%pyproject_save_files %{package_name} +popd -# Prepare the test folder for pytest -pushd ../tests/ - -# 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 {} + +pushd psycopg_pool +%pyproject_install +popd +pushd psycopg_c +%pyproject_install popd %check export PGTESTS_LOCALE=C.UTF-8 %postgresql_tests_run -export PSYCOPG_TEST_DSN="host=$PGHOST port=$PGPORT dbname=${PGTESTS_DATABASES##*:}" -%pytest ../tests/ -k "not test_typing and not test_module" +export PSYCOPG_TEST_DSN="host=$PGHOST port=$PGPORT dbname=${PGTESTS_DATABASES##*:} sslmode=disable" -%files -n python3-%{src_name} -f %{pyproject_files} -%doc ../README.rst -%license LICENSE.txt +# Remove tests that need to use internet or specific settings +%pytest tests/ -k "not (\ + test_typing or \ + test_module or \ + test_conninfo_attempts_async or \ + test_connection_async or \ + test_connection or \ + test_conninfo_attempts or \ + test_pool_async or \ + test_null_pool_async or \ + test_pool or \ + test_null_pool or \ + test_client_cursor_async or \ + test_cursor_async or \ + sched_async or \ + test_pipeline_async or \ + test_copy_async or \ + test_pipeline\ +)" +%files -n python3-%{src_name} +%{python3_sitelib}/psycopg/ +%{python3_sitelib}/psycopg-%{version}.dist-info/ +%license psycopg/LICENSE.txt +%doc psycopg/README.rst + +%files -n python3-%{src_name}_pool +%{python3_sitelib}/psycopg_pool/ +%{python3_sitelib}/psycopg_pool-%{pool_version}.dist-info/ +%license psycopg_pool/LICENSE.txt +%doc psycopg_pool/README.rst + +%files -n python3-%{src_name}_c +%{python3_sitearch}/psycopg_c/ +%{python3_sitearch}/psycopg_c-%{version}.dist-info/ +%license psycopg_c/LICENSE.txt +%doc psycopg_c/README.rst + %changelog +* Wed Jan 31 2024 Ondrej Sloup - 3.1.18-1 +- Add Cython version of psycopg and psycopg_pool as subpackages +- Rebase to the latest upstream version (rhbz#2250316) +- Update license tag to the SPDX format (LGPL-3.0-only) + * Fri Jan 26 2024 Fedora Release Engineering - 3.1.12-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild diff --git a/sources b/sources index 10149a4..82fed0f 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ -SHA512 (3.1.12.tar.gz) = 52489337ee4bfc4fe3070a731661264238646f50c86ecf9b4c902da1ab050b2ba6a8f8d1322b0f57f368d3c93f7ec3dd59f7970319e2df8eb52c728a5d7fecc1 +SHA512 (3.1.18.tar.gz) = 1e27eec49f3ae99f1fec68816dff3974aa9b1f526df45ccca295c7c6703cc309ca4f8f65d7e3450b628906a938c65f8cbd1a1f3cb6a41b6e51dc5e220985af39 +SHA512 (pool-3.2.1.tar.gz) = 1a2ba80a6164f8c1b0d0d07481d4d8019c2ce047f8eb4fde0c65de38e200ee9f53f6f9e0851a73b4eb69c7d60355400af318cf30d342f5021728ca7a9ddd0c5f