*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / dev-python / psycopg / psycopg-2.7.4.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 PYTHON_COMPAT=( python2_7 python3_6 )
7
8 inherit distutils-r1 flag-o-matic
9
10 MY_PN="${PN}2"
11 MY_P="${MY_PN}-${PV}"
12
13 DESCRIPTION="PostgreSQL database adapter for Python"
14 HOMEPAGE="http://initd.org/psycopg/ https://pypi.org/project/psycopg2/"
15 SRC_URI="mirror://pypi/${MY_PN:0:1}/${MY_PN}/${MY_P}.tar.gz"
16
17 LICENSE="LGPL-3+"
18 SLOT="2"
19 KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ppc ppc64 ~s390 ~sh sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x86-solaris"
20 IUSE="debug doc examples"
21
22 RDEPEND=">=dev-db/postgresql-8.1:*"
23 DEPEND="${RDEPEND}
24         doc? (
25                 >=dev-python/pygments-2.2[${PYTHON_USEDEP}]
26                 >=dev-python/sphinx-1.6[${PYTHON_USEDEP}]
27         )"
28
29 RESTRICT="test"
30
31 # Avoid using mxdatetime: https://bugs.gentoo.org/452028
32 PATCHES=( "${FILESDIR}"/psycopg-2.7.3-avoid-mxdatetime.patch )
33
34 S="${WORKDIR}/${MY_P}"
35
36 python_compile() {
37         local CFLAGS=${CFLAGS} CXXFLAGS=${CXXFLAGS}
38
39         ! python_is_python3 && append-flags -fno-strict-aliasing
40
41         distutils-r1_python_compile
42 }
43
44 python_prepare_all() {
45         if use debug; then
46                 sed -i 's/^\(define=\)/\1PSYCOPG_DEBUG,/' setup.cfg || die
47         fi
48
49         distutils-r1_python_prepare_all
50 }
51
52 python_compile_all() {
53         use doc && emake -C doc/src -j1 html text
54 }
55
56 python_install_all() {
57         if use doc; then
58                 dodoc -r doc/src/_build/html
59                 dodoc doc/src/_build/text/*
60         fi
61
62         if use examples ; then
63            dodoc -r examples
64            docompress -x /usr/share/doc/${PF}/examples
65         fi
66
67         distutils-r1_python_install_all
68 }