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/elasticsearch-py/
Date: Fri, 28 Sep 2018 10:46:02
Message-Id: 1538131553.4dc503ff9de3310bac408df49f9f48ba6e4a558e.mgorny@gentoo
1 commit: 4dc503ff9de3310bac408df49f9f48ba6e4a558e
2 Author: Tomas Mozes <tmozes <AT> sygic <DOT> com>
3 AuthorDate: Thu Sep 20 11:11:17 2018 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Fri Sep 28 10:45:53 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4dc503ff
7
8 dev-python/elasticsearch-py: allow using newer dev-python/urllib3
9
10 Signed-off-by: Tomáš Mózes <hydrapolic <AT> gmail.com>
11 Package-Manager: Portage-2.3.49, Repoman-2.3.10
12 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
13
14 .../elasticsearch-py-6.3.1-r1.ebuild | 94 ++++++++++++++++++++++
15 1 file changed, 94 insertions(+)
16
17 diff --git a/dev-python/elasticsearch-py/elasticsearch-py-6.3.1-r1.ebuild b/dev-python/elasticsearch-py/elasticsearch-py-6.3.1-r1.ebuild
18 new file mode 100644
19 index 00000000000..9b3ffe1e36b
20 --- /dev/null
21 +++ b/dev-python/elasticsearch-py/elasticsearch-py-6.3.1-r1.ebuild
22 @@ -0,0 +1,94 @@
23 +# Copyright 1999-2018 Gentoo Foundation
24 +# Distributed under the terms of the GNU General Public License v2
25 +
26 +EAPI=7
27 +
28 +PYTHON_COMPAT=( python2_7 python3_{4,5,6} pypy )
29 +ES_VERSION="6.4.0"
30 +
31 +inherit distutils-r1
32 +
33 +MY_PN=${PN/-py/}
34 +DESCRIPTION="official Python low-level client for Elasticsearch"
35 +HOMEPAGE="https://github.com/elastic/elasticsearch-py"
36 +SRC_URI="https://github.com/elasticsearch/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz
37 + test? ( https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-oss-${ES_VERSION}.tar.gz )"
38 +
39 +LICENSE="Apache-2.0"
40 +SLOT="0"
41 +KEYWORDS="~amd64 ~x86"
42 +IUSE="examples doc test"
43 +
44 +# tests fail in chroot
45 +# https://github.com/elastic/elasticsearch/issues/12018
46 +RESTRICT="test"
47 +
48 +RDEPEND=">=dev-python/urllib3-1.21.1[${PYTHON_USEDEP}]"
49 +
50 +DEPEND="dev-python/setuptools[${PYTHON_USEDEP}]
51 + >=dev-python/sphinx-1.3.1-r1[${PYTHON_USEDEP}]
52 + test? ( ${RDEPEND}
53 + >=dev-python/requests-2.0.0[${PYTHON_USEDEP}]
54 + <dev-python/requests-3.0.0[${PYTHON_USEDEP}]
55 + dev-python/nose[${PYTHON_USEDEP}]
56 + dev-python/coverage[${PYTHON_USEDEP}]
57 + dev-python/mock[${PYTHON_USEDEP}]
58 + dev-python/pretty-yaml[${PYTHON_USEDEP}]
59 + dev-python/nosexcover[${PYTHON_USEDEP}]
60 + virtual/jre:1.8 )"
61 +
62 +python_compile_all() {
63 + emake -C docs -j1 man $(usex doc html "")
64 +}
65 +
66 +# FEATURES="test -usersandbox" emerge dev-python/elasticsearch-py
67 +python_test() {
68 + ES="${WORKDIR}/elasticsearch-${ES_VERSION}"
69 + ES_PORT="25124"
70 + ES_INSTANCE="gentoo-es-py-test"
71 + ES_LOG="${ES}/logs/${ES_INSTANCE}.log"
72 + PID="${ES}/elasticsearch.pid"
73 +
74 + # run Elasticsearch instance on custom port
75 + sed -i "s/#http.port: 9200/http.port: ${ES_PORT}/g; \
76 + s/#cluster.name: my-application/cluster.name: ${ES_INSTANCE}/g" \
77 + "${ES}/config/elasticsearch.yml" || die
78 +
79 + # start local instance of elasticsearch
80 + "${ES}"/bin/elasticsearch -d -p "${PID}" -Epath.repo=/ || die
81 +
82 + local i
83 + local es_started=0
84 + for i in {1..20}; do
85 + grep -q "started" ${ES_LOG} 2> /dev/null
86 + if [[ $? -eq 0 ]]; then
87 + einfo "Elasticsearch started"
88 + es_started=1
89 + eend 0
90 + break
91 + elif grep -q 'BindException\[Address already in use\]' "${ES_LOG}" 2>/dev/null; then
92 + eend 1
93 + eerror "Elasticsearch already running"
94 + die "Cannot start Elasticsearch for tests"
95 + else
96 + einfo "Waiting for Elasticsearch"
97 + eend 1
98 + sleep 2
99 + continue
100 + fi
101 + done
102 +
103 + [[ $es_started -eq 0 ]] && die "Elasticsearch failed to start"
104 +
105 + export TEST_ES_SERVER="localhost:${ES_PORT}"
106 + esetup.py test || die
107 +
108 + pkill -F ${PID}
109 +}
110 +
111 +python_install_all() {
112 + use doc && HTML_DOCS=( docs/_build/html/. )
113 + use examples && dodoc -r example
114 + doman docs/_build/man/*
115 + distutils-r1_python_install_all
116 +}