games-board/freedoko: Drop old
[gentoo.git] / dev-python / jenkins-autojobs / jenkins-autojobs-0.14.3.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5
6 PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6} )
7
8 inherit distutils-r1
9
10 MERCURIAL_PV="1.41"
11 GIT_PV="1.1.21"
12
13 DESCRIPTION="Scripts for automatically creating Jenkins jobs from scm branches"
14 HOMEPAGE="https://github.com/gvalkov/jenkins-autojobs"
15 SRC_URI="https://github.com/gvalkov/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz
16                 http://updates.jenkins-ci.org/download/plugins/mercurial/${MERCURIAL_PV}/mercurial.hpi -> ${P}_mercurial_${MERCURIAL_PV}.hpi
17                 http://updates.jenkins-ci.org/download/plugins/git/${GIT_PV}/git.hpi -> ${P}_git_${GIT_PV}.hpi"
18
19 LICENSE="BSD"
20 SLOT="0"
21 KEYWORDS="~amd64"
22 IUSE="doc test"
23
24 RDEPEND=">dev-python/jenkins-webapi-0.3.2[${PYTHON_USEDEP}]
25         >=dev-python/lxml-3.2.3[${PYTHON_USEDEP}]
26         >=dev-python/pyyaml-3.11[${PYTHON_USEDEP}]
27         >=dev-python/requests-2.5.0[${PYTHON_USEDEP}]"
28
29 DEPEND="dev-python/setuptools[${PYTHON_USEDEP}]
30         test? ( ${RDEPEND}
31                         dev-util/jenkins-bin
32                         net-analyzer/netcat
33                         dev-python/pytest[${PYTHON_USEDEP}] )
34         doc? (  >=dev-python/sphinx-1.2.3[${PYTHON_USEDEP}]
35                         >=dev-python/alabaster-0.6.1[${PYTHON_USEDEP}] )"
36
37 PATCHES=( "${FILESDIR}/local_jenkins.patch" )
38
39 src_unpack() {
40         unpack ${P}.tar.gz
41         if use test; then
42           mkdir -p ${P}/tests/tmp/WEB-INF/plugins/
43
44           cp -v "${DISTDIR}"/${P}_mercurial_${MERCURIAL_PV}.hpi ${P}/tests/tmp/WEB-INF/plugins/mercurial.hpi
45           cp -v "${DISTDIR}"/${P}_git_${GIT_PV}.hpi ${P}/tests/tmp/WEB-INF/plugins/git.hpi
46         fi
47 }
48
49 python_test() {
50         # Test phase works with the limitation that it need be run as root in portage
51         # starts jenkins
52         ./tests/bin/start-jenkins.sh
53
54         py.test || die "Failed with ${EPYTHON}"
55
56         # kills jenkins
57         echo 0 | nc 127.0.0.1 60887
58 }
59
60 python_compile_all() {
61         use doc && emake -C doc html
62 }
63
64 python_install_all() {
65         use doc && local HTML_DOCS=( doc/_build/html/. )
66         distutils-r1_python_install_all
67 }