1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python2_7 python3_6 )
8 inherit distutils-r1 flag-o-matic
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"
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"
22 RDEPEND=">=dev-db/postgresql-8.1:*"
25 >=dev-python/pygments-2.2[${PYTHON_USEDEP}]
26 >=dev-python/sphinx-1.6[${PYTHON_USEDEP}]
31 # Avoid using mxdatetime: https://bugs.gentoo.org/452028
32 PATCHES=( "${FILESDIR}"/psycopg-2.7.3-avoid-mxdatetime.patch )
34 S="${WORKDIR}/${MY_P}"
37 local CFLAGS=${CFLAGS} CXXFLAGS=${CXXFLAGS}
39 ! python_is_python3 && append-flags -fno-strict-aliasing
41 distutils-r1_python_compile
44 python_prepare_all() {
46 sed -i 's/^\(define=\)/\1PSYCOPG_DEBUG,/' setup.cfg || die
49 distutils-r1_python_prepare_all
52 python_compile_all() {
53 use doc && emake -C doc/src -j1 html text
56 python_install_all() {
58 dodoc -r doc/src/_build/html
59 dodoc doc/src/_build/text/*
62 if use examples ; then
64 docompress -x /usr/share/doc/${PF}/examples
67 distutils-r1_python_install_all