Diff psycopg-2.9.9 with a psycopg-3.1.8

/usr/portage/dev-python/psycopg/psycopg-3.1.8.ebuild 2023-10-09 14:52:30.332368371 +0300
3 3

  
4 4
EAPI=8
5 5

  
6
DISTUTILS_EXT=1
7 6
DISTUTILS_USE_PEP517=setuptools
8
PYPI_PN="psycopg2"
9
PYTHON_COMPAT=( python3_{10..12} )
7
PYTHON_COMPAT=( python3_{10..11} )
10 8

  
11
inherit distutils-r1 pypi
9
inherit distutils-r1
12 10

  
13 11
DESCRIPTION="PostgreSQL database adapter for Python"
14 12
HOMEPAGE="
15
	https://www.psycopg.org/
16
	https://pypi.org/project/psycopg2/
17
	https://pypi.org/project/psycopg2/
13
	https://www.psycopg.org/psycopg3/
14
	https://github.com/psycopg/psycopg/
15
	https://pypi.org/project/psycopg/
18 16
"
17
SRC_URI="
18
	https://github.com/psycopg/psycopg/archive/${PV}.tar.gz
19
		-> ${P}.gh.tar.gz
20
"
21
S=${WORKDIR}/${P}/psycopg
19 22

  
20 23
LICENSE="LGPL-3+"
21
SLOT="2"
22
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
23
IUSE="debug test"
24
RESTRICT="!test? ( test )"
24
SLOT="0"
25
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
25 26

  
26
RDEPEND=">=dev-db/postgresql-8.1:*"
27
DEPEND="${RDEPEND}"
27
DEPEND="
28
	>=dev-db/postgresql-8.1:*
29
"
30
RDEPEND="
31
	${DEPEND}
32
	>=dev-python/typing-extensions-4.1[${PYTHON_USEDEP}]
33
"
28 34
BDEPEND="
29
	test? ( >=dev-db/postgresql-8.1[server] )
35
	test? (
36
		>=dev-db/postgresql-8.1[server]
37
		dev-python/pytest-asyncio[${PYTHON_USEDEP}]
38
		dev-python/dnspython[${PYTHON_USEDEP}]
39
	)
30 40
"
31 41

  
32
python_prepare_all() {
33
	if use debug; then
34
		sed -i 's/^\(define=\)/\1PSYCOPG_DEBUG,/' setup.cfg || die
35
	fi
36

  
37
	distutils-r1_python_prepare_all
38
}
42
distutils_enable_tests pytest
39 43

  
40 44
src_test() {
45
	# tests are lurking in top-level directory
46
	cd .. || die
47

  
41 48
	initdb -D "${T}"/pgsql || die
42 49
	# TODO: random port
43 50
	pg_ctl -w -D "${T}"/pgsql start \
44 51
		-o "-h '' -k '${T}'" || die
45
	createdb -h "${T}" psycopg2_test || die
52
	createdb -h "${T}" test || die
46 53

  
47
	local -x PSYCOPG2_TESTDB_HOST="${T}"
54
	local -x PSYCOPG_TEST_DSN="host=${T} dbname=test"
48 55
	distutils-r1_src_test
49 56

  
50 57
	pg_ctl -w -D "${T}"/pgsql stop || die
51 58
}
52 59

  
53 60
python_test() {
54
	"${EPYTHON}" -c "
55
import tests
56
tests.unittest.main(defaultTest='tests.test_suite')
57
" --verbose || die "Tests fail with ${EPYTHON}"
61
	local EPYTEST_DESELECT=(
62
		# tests for the psycopg_pool package
63
		tests/pool
64
		# some broken mypy magic
65
		tests/test_module.py::test_version
66
		tests/test_module.py::test_version_c
67
		tests/test_typing.py
68
		tests/crdb/test_typing.py
69
		# TODO, relying on undefined ordering in Python?
70
		tests/test_dns_srv.py::test_srv
71
	)
72

  
73
	# leak tests seem to be brittle
74
	epytest -p no:django -k "not leak"
58 75
}
Thank you!