summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2024-05-22 06:43:08 +0200
committerMichał Górny <mgorny@gentoo.org>2024-05-22 06:49:05 +0200
commit957e9a0df397d904138c9811cb64eec776d8c615 (patch)
tree90b24f5e4b03967f9d449a61db7a2b4a6b275747 /dev-python/pymysql
parentdev-python/sphinx-notfound-page: Bump to 1.0.1 (diff)
downloadgentoo-957e9a0df397d904138c9811cb64eec776d8c615.tar.gz
gentoo-957e9a0df397d904138c9811cb64eec776d8c615.tar.bz2
gentoo-957e9a0df397d904138c9811cb64eec776d8c615.zip
dev-python/pymysql: Bump to 1.1.1
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/pymysql')
-rw-r--r--dev-python/pymysql/Manifest1
-rw-r--r--dev-python/pymysql/pymysql-1.1.1.ebuild118
2 files changed, 119 insertions, 0 deletions
diff --git a/dev-python/pymysql/Manifest b/dev-python/pymysql/Manifest
index 2eb07e8831f4..df0e7ef47a7a 100644
--- a/dev-python/pymysql/Manifest
+++ b/dev-python/pymysql/Manifest
@@ -1 +1,2 @@
DIST PyMySQL-1.1.0.gh.tar.gz 90416 BLAKE2B b1f5d38edc1ec93ddbf9f841b3db6bddb8db13bd7a6100de2104f08152e2ce7813f6ea2d09c4bc301a6b83fb3eeb3e4ce0c3b4faf42cec25b5c157ea71d719a1 SHA512 c5b2cc1716707013d06146f22ff6e36ae1e54deb8864226a65c5325bafd476d7c53076ceb5cb35815c1baeb8e0ba8d03230366662f4abc0a304e849d8cb40d34
+DIST PyMySQL-1.1.1.gh.tar.gz 89986 BLAKE2B 0621a0cdf014418b7eaa7241146a370f91a3163ea9c0f2b5121f979580ae7f960a47aa13c12597c8d2c2ba3c9264914e40a21a96d6473e8ba2d053478a56cf05 SHA512 ef46ab189760b2d68bb7582b20a537bc68c2719241a4939bff9a6311ab64cb2df852d437ab4b8dd41a0fb5ff620a78c67aa96ccd037d44899dc2886d16218e2c
diff --git a/dev-python/pymysql/pymysql-1.1.1.ebuild b/dev-python/pymysql/pymysql-1.1.1.ebuild
new file mode 100644
index 000000000000..ff720c8b9194
--- /dev/null
+++ b/dev-python/pymysql/pymysql-1.1.1.ebuild
@@ -0,0 +1,118 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{10..13} pypy3 )
+
+inherit distutils-r1
+
+MY_P="PyMySQL-${PV}"
+DESCRIPTION="Pure-Python MySQL Driver"
+HOMEPAGE="
+ https://github.com/PyMySQL/PyMySQL/
+ https://pypi.org/project/pymysql/
+"
+SRC_URI="
+ https://github.com/PyMySQL/PyMySQL/archive/v${PV}.tar.gz
+ -> ${MY_P}.gh.tar.gz
+"
+S=${WORKDIR}/${MY_P}
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+
+# TODO: support other mysql variants
+BDEPEND="
+ test? (
+ dev-db/mariadb[server]
+ )
+"
+
+distutils_enable_tests pytest
+
+src_prepare() {
+ # Auth tests don't support socket auth
+ find tests/ -name '*_auth.py' -delete || die
+
+ distutils-r1_src_prepare
+}
+
+src_test() {
+ local -x USER=$(whoami)
+ local -x PATH="${BROOT}/usr/share/mariadb/scripts:${PATH}"
+
+ einfo "Creating mysql test instance ..."
+ mkdir -p "${T}"/mysql || die
+ mysql_install_db \
+ --no-defaults \
+ --auth-root-authentication-method=normal \
+ --basedir="${EPREFIX}/usr" \
+ --datadir="${T}"/mysql 1>"${T}"/mysqld_install.log || die
+
+ einfo "Starting mysql test instance ..."
+ # TODO: random port
+ mysqld \
+ --no-defaults \
+ --character-set-server=utf8 \
+ --bind-address=127.0.0.1 \
+ --port=43306 \
+ --pid-file="${T}"/mysqld.pid \
+ --socket="${T}"/mysqld.sock \
+ --datadir="${T}"/mysql 1>"${T}"/mysqld.log 2>&1 &
+
+ # wait for it to start
+ local i
+ for (( i = 0; i < 10; i++ )); do
+ [[ -S ${T}/mysqld.sock ]] && break
+ sleep 1
+ done
+ [[ ! -S ${T}/mysqld.sock ]] && die "mysqld failed to start"
+
+ einfo "Configuring test mysql instance ..."
+
+ # note: ed25519 was removed since it fails -- upstream README indicates
+ # it can fail if we used a different server version
+ mysql -uroot --socket="${T}"/mysqld.sock -s -e '
+ CREATE DATABASe test1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
+ CREATE DATABASE test2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
+ ' || die "Failed to create test databases"
+
+ cat > pymysql/tests/databases.json <<-EOF || die
+ [{
+ "host": "localhost",
+ "user": "root",
+ "password": "",
+ "database": "test1",
+ "use_unicode": true,
+ "local_infile": true,
+ "unix_socket": "${T}/mysqld.sock"
+ }, {
+ "host": "localhost",
+ "user": "root",
+ "password": "",
+ "database": "test2",
+ "unix_socket": "${T}/mysqld.sock"
+ }]
+ EOF
+
+ nonfatal distutils-r1_src_test
+ local ret=${?}
+
+ einfo "Stopping mysql test instance ..."
+ pkill -F "${T}"/mysqld.pid || die
+
+ [[ ${ret} -ne 0 ]] && die
+}
+
+python_test() {
+ local EPYTEST_DESELECT=(
+ # requires some dialog plugin
+ pymysql/tests/test_connection.py::TestAuthentication::testDialogAuthThreeAttemptsQuestionsInstallPlugin
+ pymysql/tests/test_connection.py::TestAuthentication::testDialogAuthTwoQuestionsInstallPlugin
+ )
+
+ epytest
+}