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