Lines 2-14
Link Here
|
2 |
# Distributed under the terms of the GNU General Public License v2 |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Header: /var/cvsroot/gentoo-x86/dev-python/pymongo/pymongo-2.4.2.ebuild,v 1.1 2013/01/25 10:45:44 ultrabug Exp $ |
3 |
# $Header: /var/cvsroot/gentoo-x86/dev-python/pymongo/pymongo-2.4.2.ebuild,v 1.1 2013/01/25 10:45:44 ultrabug Exp $ |
4 |
|
4 |
|
5 |
EAPI="3" |
5 |
EAPI=5 |
6 |
PYTHON_DEPEND="2" |
6 |
|
7 |
SUPPORT_PYTHON_ABIS="1" |
7 |
PYTHON_COMPAT=( python{2_5,2_6,2_7} pypy{1_9,2_0} ) |
8 |
PYTHON_TESTS_FAILURES_TOLERANT_ABIS="*-jython" |
8 |
|
9 |
DISTUTILS_SRC_TEST="nosetests" |
9 |
inherit check-reqs distutils-r1 |
10 |
PYTHON_TESTS_RESTRICTED_ABIS="3.*" |
|
|
11 |
inherit distutils |
12 |
|
10 |
|
13 |
DESCRIPTION="Python driver for MongoDB" |
11 |
DESCRIPTION="Python driver for MongoDB" |
14 |
HOMEPAGE="http://github.com/mongodb/mongo-python-driver http://pypi.python.org/pypi/pymongo" |
12 |
HOMEPAGE="http://github.com/mongodb/mongo-python-driver http://pypi.python.org/pypi/pymongo" |
Lines 17-38
SRC_URI="mirror://pypi/${PN:0:1}/${PN}/$
Link Here
|
17 |
LICENSE="Apache-2.0" |
15 |
LICENSE="Apache-2.0" |
18 |
SLOT="0" |
16 |
SLOT="0" |
19 |
KEYWORDS="~amd64 ~x86" |
17 |
KEYWORDS="~amd64 ~x86" |
20 |
IUSE="doc mod_wsgi" |
18 |
IUSE="doc mod_wsgi test" |
21 |
|
19 |
|
22 |
RDEPEND="dev-db/mongodb" |
20 |
RDEPEND="dev-db/mongodb" |
23 |
DEPEND="${RDEPEND} |
21 |
DEPEND="${RDEPEND} |
24 |
dev-python/setuptools |
22 |
dev-python/setuptools[${PYTHON_USEDEP}] |
25 |
doc? ( dev-python/sphinx )" |
23 |
doc? ( dev-python/sphinx[${PYTHON_USEDEP}] ) |
|
|
24 |
test? ( dev-python/nose[${PYTHON_USEDEP}] )" |
26 |
|
25 |
|
27 |
PYTHON_MODNAME="bson gridfs pymongo" |
26 |
reqcheck() { |
|
|
27 |
if use test; then |
28 |
# During the tests, database size reaches 1.5G. |
29 |
local CHECKREQS_DISK_BUILD=1536M |
28 |
|
30 |
|
29 |
src_compile() { |
31 |
check-reqs_${1} |
30 |
distutils_src_compile |
32 |
fi |
|
|
33 |
} |
34 |
|
35 |
pkg_pretend() { |
36 |
reqcheck pkg_pretend |
37 |
} |
38 |
|
39 |
pkg_setup() { |
40 |
reqcheck pkg_setup |
41 |
} |
42 |
|
43 |
python_compile_all() { |
44 |
distutils-r1_python_compile_all |
31 |
|
45 |
|
32 |
if use doc; then |
46 |
if use doc; then |
33 |
einfo "Generation of documentation" |
47 |
mkdir html || die |
34 |
mkdir html |
48 |
sphinx-build doc html || die |
35 |
sphinx-build doc html || die "Generation of documentation failed" |
|
|
36 |
fi |
49 |
fi |
37 |
} |
50 |
} |
38 |
|
51 |
|
Lines 42-61
distutils_src_test_pre_hook() {
Link Here
|
42 |
} |
55 |
} |
43 |
|
56 |
|
44 |
src_test() { |
57 |
src_test() { |
45 |
distutils_src_test |
58 |
# Yes, we need TCP/IP for that... |
46 |
killall -u "$(id -nu)" mongod |
59 |
local DB_IP=127.0.0.1 |
|
|
60 |
local DB_PORT=27017 |
61 |
|
62 |
export DB_IP DB_PORT |
63 |
|
64 |
# 1.5G of disk space per run. |
65 |
local DISTUTILS_NO_PARALLEL_BUILD=1 |
66 |
|
67 |
distutils-r1_src_test |
47 |
} |
68 |
} |
48 |
|
69 |
|
49 |
src_install() { |
70 |
python_test() { |
|
|
71 |
local dbpath=${TMPDIR}/mongo.db |
72 |
local logpath=${TMPDIR}/mongod.log |
73 |
|
74 |
# Now, the hard part: we need to find a free port for mongod. |
75 |
# We're just trying to run it random port numbers and check the log |
76 |
# for bind errors. It shall be noted that 'mongod --fork' does not |
77 |
# return failure when it fails to bind. |
78 |
|
79 |
mkdir -p "${dbpath}" || die |
80 |
while true; do |
81 |
LC_ALL=C \ |
82 |
mongod --dbpath "${dbpath}" --smallfiles --nojournal \ |
83 |
--bind_ip ${DB_IP} --port ${DB_PORT} --nounixsocket \ |
84 |
--logpath "${logpath}" --fork \ |
85 |
|| die "Unable to start mongod for tests." |
86 |
|
87 |
# Now we need to check if the server actually started... |
88 |
if mongo --norc --host ${DB_IP} --port ${DB_PORT} </dev/null &>/dev/null; then |
89 |
# yay! |
90 |
break |
91 |
elif grep -q 'Address already in use' "${logpath}"; then |
92 |
# ay, someone took our port! |
93 |
: $(( DB_PORT += 1 )) |
94 |
continue |
95 |
else |
96 |
eerror "Unable to start mongod for tests. See the server log:" |
97 |
eerror " ${logpath}" |
98 |
die "Unable to start mongod for tests." |
99 |
fi |
100 |
done |
101 |
|
102 |
local failed |
103 |
nosetests || failed=1 |
104 |
|
105 |
mongod --dbpath "${dbpath}" --shutdown |
106 |
|
107 |
[[ ${failed} ]] && die "Tests fail with ${EPYTHON}" |
108 |
|
109 |
rm -rf "${dbpath}" |
110 |
} |
111 |
|
112 |
python_install() { |
50 |
# Maintainer note: |
113 |
# Maintainer note: |
51 |
# In order to work with mod_wsgi, we need to disable the C extension. |
114 |
# In order to work with mod_wsgi, we need to disable the C extension. |
52 |
# See [1] for more information. |
115 |
# See [1] for more information. |
53 |
# [1] http://api.mongodb.org/python/current/faq.html#does-pymongo-work-with-mod-wsgi |
116 |
# [1] http://api.mongodb.org/python/current/faq.html#does-pymongo-work-with-mod-wsgi |
54 |
distutils_src_install $(use mod_wsgi && echo --no_ext) |
117 |
distutils-r1_python_install $(use mod_wsgi && echo --no_ext) |
|
|
118 |
} |
55 |
|
119 |
|
56 |
if use doc; then |
120 |
python_install_all() { |
57 |
dohtml -r html/* || die "Error installing docs" |
121 |
use doc && local HTML_DOCS=( html/. ) |
58 |
fi |
122 |
|
|
|
123 |
distutils-r1_python_install_all |
59 |
} |
124 |
} |
60 |
|
125 |
|
61 |
pkg_postinst() { |
126 |
pkg_postinst() { |