Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pymongo/
Date: Mon, 28 Sep 2020 15:53:33
Message-Id: 1601308369.514f850d1e0017c20f497608819d8782fe5949fb.mgorny@gentoo
1 commit: 514f850d1e0017c20f497608819d8782fe5949fb
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sun Sep 27 21:47:45 2020 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Mon Sep 28 15:52:49 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=514f850d
7
8 dev-python/pymongo: Remove py2.7 in revbump
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-python/pymongo/pymongo-3.11.0-r1.ebuild | 112 ++++++++++++++++++++++++++++
13 1 file changed, 112 insertions(+)
14
15 diff --git a/dev-python/pymongo/pymongo-3.11.0-r1.ebuild b/dev-python/pymongo/pymongo-3.11.0-r1.ebuild
16 new file mode 100644
17 index 00000000000..985536ffbab
18 --- /dev/null
19 +++ b/dev-python/pymongo/pymongo-3.11.0-r1.ebuild
20 @@ -0,0 +1,112 @@
21 +# Copyright 1999-2020 Gentoo Authors
22 +# Distributed under the terms of the GNU General Public License v2
23 +
24 +EAPI=7
25 +
26 +PYTHON_COMPAT=( python3_{6..9} )
27 +inherit check-reqs distutils-r1
28 +
29 +DESCRIPTION="Python driver for MongoDB"
30 +HOMEPAGE="https://github.com/mongodb/mongo-python-driver https://pypi.org/project/pymongo/"
31 +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
32 +
33 +LICENSE="Apache-2.0"
34 +SLOT="0"
35 +KEYWORDS="amd64 ~arm64 ~hppa x86"
36 +IUSE="doc kerberos test"
37 +RESTRICT="!test? ( test )"
38 +
39 +RDEPEND="
40 + kerberos? ( dev-python/pykerberos[${PYTHON_USEDEP}] )
41 +"
42 +BDEPEND="
43 + test? (
44 + >=dev-db/mongodb-2.6.0
45 + dev-python/nose[${PYTHON_USEDEP}]
46 + )
47 +"
48 +DISTUTILS_IN_SOURCE_BUILD=1
49 +
50 +distutils_enable_sphinx doc
51 +
52 +reqcheck() {
53 + if use test; then
54 + # During the tests, database size reaches 1.5G.
55 + local CHECKREQS_DISK_BUILD=1536M
56 +
57 + check-reqs_${1}
58 + fi
59 +}
60 +
61 +pkg_pretend() {
62 + reqcheck pkg_pretend
63 +}
64 +
65 +pkg_setup() {
66 + reqcheck pkg_setup
67 +}
68 +
69 +src_prepare() {
70 + # network-sandbox probably
71 + rm test/test_srv_polling.py || die
72 + sed -e 's:test_connection_timeout_ms_propagates_to_DNS_resolver:_&:' \
73 + -i test/test_client.py || die
74 + # relies on exact exception message
75 + sed -e 's:abstract methods:abstract:' \
76 + -i test/test_custom_types.py || die
77 + distutils-r1_src_prepare
78 +}
79 +
80 +python_test() {
81 + # Yes, we need TCP/IP for that...
82 + local DB_IP=127.0.0.1
83 + local DB_PORT=27000
84 +
85 + export DB_IP DB_PORT
86 +
87 + local dbpath=${TMPDIR}/mongo.db
88 + local logpath=${TMPDIR}/mongod.log
89 +
90 + # Now, the hard part: we need to find a free port for mongod.
91 + # We're just trying to run it random port numbers and check the log
92 + # for bind errors. It shall be noted that 'mongod --fork' does not
93 + # return failure when it fails to bind.
94 +
95 + mkdir -p "${dbpath}" || die
96 + while true; do
97 + ebegin "Trying to start mongod on port ${DB_PORT}"
98 +
99 + LC_ALL=C \
100 + mongod --dbpath "${dbpath}" --nojournal \
101 + --bind_ip ${DB_IP} --port ${DB_PORT} \
102 + --unixSocketPrefix "${TMPDIR}" \
103 + --logpath "${logpath}" --fork \
104 + && sleep 2
105 +
106 + # Now we need to check if the server actually started...
107 + if [[ ${?} -eq 0 && -S "${TMPDIR}"/mongodb-${DB_PORT}.sock ]]; then
108 + # yay!
109 + eend 0
110 + break
111 + elif grep -q 'Address already in use' "${logpath}"; then
112 + # ay, someone took our port!
113 + eend 1
114 + : $(( DB_PORT += 1 ))
115 + continue
116 + else
117 + eend 1
118 + eerror "Unable to start mongod for tests. See the server log:"
119 + eerror " ${logpath}"
120 + die "Unable to start mongod for tests."
121 + fi
122 + done
123 +
124 + local failed
125 + DB_PORT2=$(( DB_PORT + 1 )) DB_PORT3=$(( DB_PORT + 2 )) esetup.py test || failed=1
126 +
127 + mongod --dbpath "${dbpath}" --shutdown || die
128 +
129 + [[ ${failed} ]] && die "Tests fail with ${EPYTHON}"
130 +
131 + rm -rf "${dbpath}" || die
132 +}