public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Thomas Deutschmann" <whissi@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pymysql/files/, dev-python/pymysql/
Date: Tue, 11 Aug 2020 14:43:47 +0000 (UTC)	[thread overview]
Message-ID: <1597157011.0d6cd2bbb6a72bab54432507faa2ecf7b90b9ab9.whissi@gentoo> (raw)

commit:     0d6cd2bbb6a72bab54432507faa2ecf7b90b9ab9
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 11 10:57:12 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Tue Aug 11 14:43:31 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0d6cd2bb

dev-python/pymysql: bump to v0.10.0

Package-Manager: Portage-3.0.2, Repoman-2.3.23
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 dev-python/pymysql/Manifest                        |   1 +
 .../files/pymysql-0.10.0-add-missing-import.patch  |  22 ++++
 .../pymysql/files/pymysql-0.10.0-fix-tests.patch   |  30 +++++
 dev-python/pymysql/pymysql-0.10.0.ebuild           | 139 +++++++++++++++++++++
 4 files changed, 192 insertions(+)

diff --git a/dev-python/pymysql/Manifest b/dev-python/pymysql/Manifest
index d36aed3393e..28175fb1844 100644
--- a/dev-python/pymysql/Manifest
+++ b/dev-python/pymysql/Manifest
@@ -1 +1,2 @@
+DIST pymysql-0.10.0.tar.gz 86137 BLAKE2B bcd4746d3e3947c2598b875d46678984beedfa0d9161a1aefb1f7f4b5314e084f5292206435b0a2621fb100744194fd1e2963228e37b41c289c5c4021f475371 SHA512 7d322c526634380cf4d3216f666a7d1f38e120390aab525cb8806bcea3f2fd7eab82e744a0be7270eae47ab1f79be5b5f7409e7e5dc9aaabf1e3c0c8853f578f
 DIST pymysql-0.9.3.tar.gz 86715 BLAKE2B 0ed09f7f5c47bd1fae52dd9d0ff0790367962d8e4b89d3933704b8b8d838e1f48b68455a9a3916318bf3c1c1f102fa11b4e1e3401d021f8a2d6137612a4affb9 SHA512 d906b7a6612d91db7d4f7f2d85a9375477e6655c568e0d1e7281ad0263d4a78f0ac4e80263605723f99e12db04c80f51c5c8ed79ed6f209a7afeb4b45bf40648

diff --git a/dev-python/pymysql/files/pymysql-0.10.0-add-missing-import.patch b/dev-python/pymysql/files/pymysql-0.10.0-add-missing-import.patch
new file mode 100644
index 00000000000..f850c9be726
--- /dev/null
+++ b/dev-python/pymysql/files/pymysql-0.10.0-add-missing-import.patch
@@ -0,0 +1,22 @@
+From 3e71dd32e8ce868b090c282759eebdeabc960f58 Mon Sep 17 00:00:00 2001
+From: Inada Naoki <songofacandy@gmail.com>
+Date: Tue, 28 Jul 2020 13:06:07 +0900
+Subject: [PATCH] Add missing import (#879)
+
+Fixes #878
+---
+ pymysql/converters.py | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/pymysql/converters.py b/pymysql/converters.py
+index b084ed2f..1b582904 100644
+--- a/pymysql/converters.py
++++ b/pymysql/converters.py
+@@ -5,6 +5,7 @@
+ import re
+ import time
+ 
++from .err import ProgrammingError
+ from .constants import FIELD_TYPE
+ 
+ 

diff --git a/dev-python/pymysql/files/pymysql-0.10.0-fix-tests.patch b/dev-python/pymysql/files/pymysql-0.10.0-fix-tests.patch
new file mode 100644
index 00000000000..aa9bc53b035
--- /dev/null
+++ b/dev-python/pymysql/files/pymysql-0.10.0-fix-tests.patch
@@ -0,0 +1,30 @@
+--- a/pymysql/tests/test_connection.py
++++ b/pymysql/tests/test_connection.py
+@@ -70,6 +70,9 @@ class TestAuthentication(base.PyMySQLTestCase):
+     for r in cur:
+         if (r[1], r[2]) !=  (u'ACTIVE', u'AUTHENTICATION'):
+             continue
++        if r[0] == u'unix_socket':
++            socket_plugin_name = r[0]
++            socket_found = True
+         if r[3] ==  u'auth_socket.so':
+             socket_plugin_name = r[0]
+             socket_found = True
+@@ -188,7 +191,7 @@ class TestAuthentication(base.PyMySQLTestCase):
+             cur.execute("install plugin two_questions soname 'dialog_examples.so'")
+             TestAuthentication.two_questions_found = True
+             self.realTestDialogAuthTwoQuestions()
+-        except pymysql.err.InternalError:
++        except pymysql.err.OperationalError:
+             pytest.skip('we couldn\'t install the two_questions plugin')
+         finally:
+             if TestAuthentication.two_questions_found:
+@@ -218,7 +221,7 @@ class TestAuthentication(base.PyMySQLTestCase):
+             cur.execute("install plugin three_attempts soname 'dialog_examples.so'")
+             TestAuthentication.three_attempts_found = True
+             self.realTestDialogAuthThreeAttempts()
+-        except pymysql.err.InternalError:
++        except pymysql.err.OperationalError:
+             pytest.skip('we couldn\'t install the three_attempts plugin')
+         finally:
+             if TestAuthentication.three_attempts_found:

diff --git a/dev-python/pymysql/pymysql-0.10.0.ebuild b/dev-python/pymysql/pymysql-0.10.0.ebuild
new file mode 100644
index 00000000000..f4313870195
--- /dev/null
+++ b/dev-python/pymysql/pymysql-0.10.0.ebuild
@@ -0,0 +1,139 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6..9} pypy3 )
+
+inherit distutils-r1
+
+MY_PN="PyMySQL"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="Pure-Python MySQL Driver"
+HOMEPAGE="https://github.com/PyMySQL/PyMySQL"
+SRC_URI="https://github.com/${MY_PN}/${MY_PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+S=${WORKDIR}/${MY_P}
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~x86"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+# TODO: support other mysql variants
+BDEPEND="
+	test? ( dev-db/mariadb[server] )"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-0.10.0-fix-tests.patch
+	"${FILESDIR}"/${PN}-0.10.0-add-missing-import.patch
+)
+
+src_prepare() {
+	find -name '*.py' -exec sed -i -e 's:unittest2:unittest:' {} + || die
+
+	# Auth tests don't support socket auth
+	find tests/ -name '*_auth.py' -delete || die
+
+	distutils-r1_src_prepare
+}
+
+src_test() {
+	if [[ -z "${USER}" ]] ; then
+		# Tests require system user
+		local -x USER="$(whoami)"
+		einfo "USER set to '${USER}'"
+	fi
+
+	local PIDFILE="${T}/mysqld.pid"
+	if pkill -0 -F "${PIDFILE}" &>/dev/null ; then
+		einfo "Killing already running mysqld process ..."
+		pkill -F "${PIDFILE}"
+	fi
+
+	if [[ -d "${T}/mysql" ]] ; then
+		einfo "Removing already existing mysqld data dir ..."
+		rm -rf "${T}/mysql" || die
+	fi
+
+	einfo "Creating mysql test instance ..."
+	mkdir -p "${T}"/mysql || die
+	"${BROOT}"/usr/share/mariadb/scripts/mysql_install_db \
+		--no-defaults \
+		--auth-root-authentication-method=normal \
+		--basedir="${BROOT}/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 "Preparing test mysql instance ..."
+
+	# create test user for auth tests
+	mysql -uroot --socket="${T}"/mysqld.sock -s -e '
+		INSTALL SONAME "auth_ed25519";
+		CREATE FUNCTION ed25519_password RETURNS STRING SONAME "auth_ed25519.so";
+	' || die "Failed to set up auth_ed25519"
+
+	mysql -uroot --socket="${T}"/mysqld.sock -s -e "
+		SELECT CONCAT('CREATE USER nopass_ed25519 IDENTIFIED VIA ed25519 USING \"',ed25519_password(\"\"),'\";');
+		SELECT CONCAT('CREATE USER user_ed25519 IDENTIFIED VIA ed25519 USING \"',ed25519_password(\"pass_ed25519\"),'\";');
+	" || die "Failed to create ed25519 test users"
+
+	# create test databases
+	mysql -uroot --socket="${T}"/mysqld.sock -s -e '
+		create database test1 DEFAULT CHARACTER SET utf8mb4;
+		create database test2 DEFAULT CHARACTER SET utf8mb4;
+
+		create user test2 identified by "some password";
+		grant all on test2.* to test2;
+
+		create user test2@localhost identified by "some password";
+		grant all on test2.* to test2@localhost;
+	' || die "Failed to create test databases"
+
+	cat > pymysql/tests/databases.json <<-EOF || die
+		[{
+			"host": "localhost",
+			"user": "root",
+			"passwd": "",
+			"db": "test1",
+			"use_unicode": true,
+			"local_infile": true,
+			"unix_socket": "${T}/mysqld.sock"
+		}, {
+			"host": "localhost",
+			"user": "root",
+			"passwd": "",
+			"db": "test2",
+			"unix_socket": "${T}/mysqld.sock"
+		}]
+	EOF
+
+	distutils-r1_src_test
+
+	if pkill -0 -F "${PIDFILE}" &>/dev/null ; then
+		einfo "Stopping mysql test instance ..."
+		pkill -F "${PIDFILE}"
+	fi
+}
+
+distutils_enable_tests pytest


                 reply	other threads:[~2020-08-11 14:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1597157011.0d6cd2bbb6a72bab54432507faa2ecf7b90b9ab9.whissi@gentoo \
    --to=whissi@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox