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,7,8} pypy3 )
7 PYTHON_REQ_USE="sqlite?"
9 inherit distutils-r1 eutils flag-o-matic
12 MY_P="${MY_PN}-${PV/_beta/b}"
14 DESCRIPTION="Python SQL toolkit and Object Relational Mapper"
15 HOMEPAGE="https://www.sqlalchemy.org/ https://pypi.org/project/SQLAlchemy/"
16 SRC_URI="mirror://pypi/${MY_P:0:1}/${MY_PN}/${MY_P}.tar.gz"
20 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris"
21 IUSE="doc examples +sqlite test"
23 REQUIRED_USE="test? ( sqlite )"
27 dev-python/mock[${PYTHON_USEDEP}]
28 dev-python/pytest-xdist[${PYTHON_USEDEP}]
32 S="${WORKDIR}/${MY_P}"
34 distutils_enable_tests pytest
36 python_prepare_all() {
38 "${FILESDIR}"/sqlalchemy-pytest-deprecation.patch
40 # Disable tests hardcoding function call counts specific to Python versions.
41 rm -r test/aaa_profiling || die
42 distutils-r1_python_prepare_all
46 if ! python_is_python3; then
47 local CFLAGS=${CFLAGS}
48 append-cflags -fno-strict-aliasing
50 distutils-r1_python_compile
53 python_install_all() {
54 use doc && HTML_DOCS=( doc/. )
55 use examples && dodoc -r examples
57 distutils-r1_python_install_all
61 optfeature "MySQL support" dev-python/mysql-python dev-python/mysql-connector-python
62 optfeature "mssql support" dev-python/pymssql
63 optfeature "postgresql support" dev-python/psycopg:2