1 |
commit: 67e582f13e839c74759b4338a9e008e7212e09e4 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Jan 8 09:19:05 2021 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Jan 8 09:29:56 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=67e582f1 |
7 |
|
8 |
dev-python/pymysql: Bump to 1.0.1 |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
dev-python/pymysql/Manifest | 1 + |
13 |
dev-python/pymysql/pymysql-1.0.1.ebuild | 143 ++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 144 insertions(+) |
15 |
|
16 |
diff --git a/dev-python/pymysql/Manifest b/dev-python/pymysql/Manifest |
17 |
index f72aad94927..13451b9c27b 100644 |
18 |
--- a/dev-python/pymysql/Manifest |
19 |
+++ b/dev-python/pymysql/Manifest |
20 |
@@ -1,2 +1,3 @@ |
21 |
DIST pymysql-0.10.1.tar.gz 86441 BLAKE2B 8e33fbba0544dad68c3eeb5bd538c4bce121222b4660ad06c3c0224b5db6a6c9f45d6697a98d5f0ba20429afa204d46c9ce57a4d9696dbc2a35649c6253a645b SHA512 edc702c54a33350f75648765c60d4cf455449e88818948b018585d557bea280e626d23b1279a410765f2de8e35b3c22ea5c8e0ef3dc72588b674c93a2124a224 |
22 |
DIST pymysql-1.0.0.tar.gz 85033 BLAKE2B 792b472c2a230e823cca9deed5adc03a004e34b09594d998c1df332769b93dde3f0b84a11f1b1ac83b6be34fe661194d3c780d6a5bb0facf193d2f46a807a7b8 SHA512 52c4ad45f31725bcbb313d4d1bea52bb52c82ad9573a58dd8cca14e844ff9d7e3831debb3bd08d00a07cc32625b15692138947ccd9ad3bed7f869a7bd69357b3 |
23 |
+DIST pymysql-1.0.1.tar.gz 84902 BLAKE2B b6a84f288c016849897d05ce97b87e3d58dc7b08acc8f66df16142d645f70a990c8a0acae9f57ff9f00f5cb58ff77e72c7f2d7ccf76af1c12e694d54b0daa080 SHA512 0c8ca8e3ee3fd1515621875117884120d33e18b36c90b71a6923aa01f482423a47c55ea333169c77e3cceaa2577805f2ebe387acf7f80dc525f605f3b4328906 |
24 |
|
25 |
diff --git a/dev-python/pymysql/pymysql-1.0.1.ebuild b/dev-python/pymysql/pymysql-1.0.1.ebuild |
26 |
new file mode 100644 |
27 |
index 00000000000..fb5e6f2df41 |
28 |
--- /dev/null |
29 |
+++ b/dev-python/pymysql/pymysql-1.0.1.ebuild |
30 |
@@ -0,0 +1,143 @@ |
31 |
+# Copyright 1999-2021 Gentoo Authors |
32 |
+# Distributed under the terms of the GNU General Public License v2 |
33 |
+ |
34 |
+EAPI=7 |
35 |
+ |
36 |
+PYTHON_COMPAT=( python3_{7..9} pypy3 ) |
37 |
+ |
38 |
+inherit distutils-r1 |
39 |
+ |
40 |
+MY_PN="PyMySQL" |
41 |
+MY_P="${MY_PN}-${PV}" |
42 |
+ |
43 |
+DESCRIPTION="Pure-Python MySQL Driver" |
44 |
+HOMEPAGE="https://github.com/PyMySQL/PyMySQL" |
45 |
+SRC_URI="https://github.com/${MY_PN}/${MY_PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" |
46 |
+S=${WORKDIR}/${MY_P} |
47 |
+ |
48 |
+LICENSE="MIT" |
49 |
+SLOT="0" |
50 |
+KEYWORDS="~amd64 ~arm ~arm64 ~x86" |
51 |
+ |
52 |
+# TODO: support other mysql variants |
53 |
+BDEPEND=" |
54 |
+ test? ( |
55 |
+ dev-db/mariadb[server] |
56 |
+ )" |
57 |
+ |
58 |
+distutils_enable_tests pytest |
59 |
+ |
60 |
+src_prepare() { |
61 |
+ # Auth tests don't support socket auth |
62 |
+ find tests/ -name '*_auth.py' -delete || die |
63 |
+ |
64 |
+ distutils-r1_src_prepare |
65 |
+} |
66 |
+ |
67 |
+src_test() { |
68 |
+ if [[ -z "${USER}" ]] ; then |
69 |
+ # Tests require system user |
70 |
+ local -x USER="$(whoami)" |
71 |
+ einfo "USER set to '${USER}'" |
72 |
+ fi |
73 |
+ |
74 |
+ local PIDFILE="${T}/mysqld.pid" |
75 |
+ if pkill -0 -F "${PIDFILE}" &>/dev/null ; then |
76 |
+ einfo "Killing already running mysqld process ..." |
77 |
+ pkill -F "${PIDFILE}" |
78 |
+ fi |
79 |
+ |
80 |
+ if [[ -d "${T}/mysql" ]] ; then |
81 |
+ einfo "Removing already existing mysqld data dir ..." |
82 |
+ rm -rf "${T}/mysql" || die |
83 |
+ fi |
84 |
+ |
85 |
+ einfo "Creating mysql test instance ..." |
86 |
+ mkdir -p "${T}"/mysql || die |
87 |
+ "${BROOT}"/usr/share/mariadb/scripts/mysql_install_db \ |
88 |
+ --no-defaults \ |
89 |
+ --auth-root-authentication-method=normal \ |
90 |
+ --basedir="${BROOT}/usr" \ |
91 |
+ --datadir="${T}"/mysql 1>"${T}"/mysqld_install.log \ |
92 |
+ || die |
93 |
+ |
94 |
+ einfo "Starting mysql test instance ..." |
95 |
+ # TODO: random port |
96 |
+ mysqld \ |
97 |
+ --no-defaults \ |
98 |
+ --character-set-server=utf8 \ |
99 |
+ --bind-address=127.0.0.1 \ |
100 |
+ --port=43306 \ |
101 |
+ --pid-file="${T}"/mysqld.pid \ |
102 |
+ --socket="${T}"/mysqld.sock \ |
103 |
+ --datadir="${T}"/mysql 1>"${T}"/mysqld.log 2>&1 & |
104 |
+ |
105 |
+ # wait for it to start |
106 |
+ local i |
107 |
+ for (( i = 0; i < 10; i++)); do |
108 |
+ [[ -S ${T}/mysqld.sock ]] && break |
109 |
+ sleep 1 |
110 |
+ done |
111 |
+ [[ -S ${T}/mysqld.sock ]] || die "mysqld failed to start" |
112 |
+ |
113 |
+ einfo "Configuring test mysql instance ..." |
114 |
+ |
115 |
+ # create test user for auth tests |
116 |
+ mysql -uroot --socket="${T}"/mysqld.sock -s -e ' |
117 |
+ INSTALL SONAME "auth_ed25519"; |
118 |
+ CREATE FUNCTION ed25519_password RETURNS STRING SONAME "auth_ed25519.so"; |
119 |
+ ' || die "Failed to set up auth_ed25519" |
120 |
+ |
121 |
+ mysql -uroot --socket="${T}"/mysqld.sock -s -e " |
122 |
+ SELECT CONCAT('CREATE USER nopass_ed25519 IDENTIFIED VIA ed25519 USING \"',ed25519_password(\"\"),'\";'); |
123 |
+ SELECT CONCAT('CREATE USER user_ed25519 IDENTIFIED VIA ed25519 USING \"',ed25519_password(\"pass_ed25519\"),'\";'); |
124 |
+ " || die "Failed to create ed25519 test users" |
125 |
+ |
126 |
+ # create test databases |
127 |
+ mysql -uroot --socket="${T}"/mysqld.sock -s -e ' |
128 |
+ create database test1 DEFAULT CHARACTER SET utf8mb4; |
129 |
+ create database test2 DEFAULT CHARACTER SET utf8mb4; |
130 |
+ |
131 |
+ create user test2 identified by "some password"; |
132 |
+ grant all on test2.* to test2; |
133 |
+ |
134 |
+ create user test2@localhost identified by "some password"; |
135 |
+ grant all on test2.* to test2@localhost; |
136 |
+ ' || die "Failed to create test databases" |
137 |
+ |
138 |
+ cat > pymysql/tests/databases.json <<-EOF || die |
139 |
+ [{ |
140 |
+ "host": "localhost", |
141 |
+ "user": "root", |
142 |
+ "password": "", |
143 |
+ "database": "test1", |
144 |
+ "use_unicode": true, |
145 |
+ "local_infile": true, |
146 |
+ "unix_socket": "${T}/mysqld.sock" |
147 |
+ }, { |
148 |
+ "host": "localhost", |
149 |
+ "user": "root", |
150 |
+ "password": "", |
151 |
+ "database": "test2", |
152 |
+ "unix_socket": "${T}/mysqld.sock" |
153 |
+ }] |
154 |
+ EOF |
155 |
+ |
156 |
+ distutils-r1_src_test |
157 |
+ |
158 |
+ if pkill -0 -F "${PIDFILE}" &>/dev/null ; then |
159 |
+ einfo "Stopping mysql test instance ..." |
160 |
+ pkill -F "${PIDFILE}" |
161 |
+ fi |
162 |
+} |
163 |
+ |
164 |
+python_test() { |
165 |
+ local excludes=( |
166 |
+ # requires some dialog plugin |
167 |
+ pymysql/tests/test_connection.py::TestAuthentication::testDialogAuthThreeAttemptsQuestionsInstallPlugin |
168 |
+ pymysql/tests/test_connection.py::TestAuthentication::testDialogAuthTwoQuestionsInstallPlugin |
169 |
+ ) |
170 |
+ |
171 |
+ PYTHONPATH=. pytest -vv ${excludes[@]/#/--deselect } || |
172 |
+ die "Tests failed with ${EPYTHON}" |
173 |
+} |