6bdd001c81decf239018e053a32d5b29409c66ac
[gentoo.git] / dev-python / mysql-connector-python / mysql-connector-python-8.0.19.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 PYTHON_COMPAT=( python3_{6,7,8} )
7 inherit distutils-r1
8
9 DESCRIPTION="Python client library for MariaDB/MySQL"
10 HOMEPAGE="https://dev.mysql.com/downloads/connector/python/"
11 SRC_URI="https://dev.mysql.com/get/Downloads/Connector-Python/${P}.tar.gz"
12
13 KEYWORDS="~amd64 ~arm ~x86"
14 LICENSE="GPL-2"
15 SLOT="0"
16 IUSE="examples test"
17
18 BDEPEND=">=dev-libs/protobuf-3.6.1"
19
20 RDEPEND="
21         >=dev-db/mysql-connector-c-8.0
22         >=dev-python/protobuf-python-3.6.1[${PYTHON_USEDEP}]
23 "
24 # tests/mysqld.py does not like MariaDB version strings.
25 # See the regex MySQLServerBase._get_version.
26 DEPEND="${RDEPEND} test? ( dev-db/mysql[server(+)] )"
27
28 # Tests currently fail.
29 # mysql.connector.errors.DatabaseError: 1300 (HY000): Invalid utf8 character string: ''
30 RESTRICT="test"
31
32 DOCS=( README.txt CHANGES.txt README.rst )
33
34 python_test() {
35         "${EPYTHON}" unittests.py --with-mysql="${EPREFIX}/usr" --unix-socket="${T}" --mysql-topdir="${T}"
36 }
37
38 # Yeah, this is really broken, but the extension will only build this way during "install"
39 python_install() {
40         distutils-r1_python_install \
41                 --with-mysql-capi="${EPREFIX}/usr" \
42                 --with-protobuf-include-dir="${EPREFIX}/usr/include/google/protobuf/" \
43                 --with-protobuf-lib-dir="${EPREFIX}/usr/$(get_libdir)" \
44                 --with-protoc="${EPREFIX}/usr/bin/protoc"
45 }
46
47 python_install_all(){
48         distutils-r1_python_install_all
49         if use examples ; then
50                 dodoc -r examples
51         fi
52 }