net-misc/youtube-dl: Version bump.
[gentoo.git] / net-misc / youtube-dl / youtube-dl-2017.08.13.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 inherit bash-completion-r1 distutils-r1 eutils
8
9 DESCRIPTION="Download videos from YouTube.com (and more sites...)"
10 HOMEPAGE="https://rg3.github.com/youtube-dl/"
11 SRC_URI="http://youtube-dl.org/downloads/${PV}/${P}.tar.gz"
12
13 LICENSE="public-domain"
14 SLOT="0"
15 KEYWORDS="~amd64 ~arm ~hppa ~ppc ~ppc64 ~x86 ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x86-solaris"
16 IUSE="+offensive test"
17
18 RDEPEND="
19         dev-python/setuptools[${PYTHON_USEDEP}]
20 "
21 DEPEND="
22         ${RDEPEND}
23         test? ( dev-python/nose[coverage(+)] )
24 "
25
26 S="${WORKDIR}/${PN}"
27
28 python_prepare_all() {
29         if ! use offensive; then
30                 sed -i -e "/..version../s|'$|+gentoo.no.offensive.sites'|g" \
31                         youtube_dl/version.py || die
32                 # these have single line import statements
33                 local xxx=(
34                         alphaporno anysex behindkink camwithher chaturbate eporner
35                         eroprofile extremetube foxgay goshgay hellporno hentaistigma
36                         hornbunny keezmovies lovehomeporn mofosex motherless myvidster
37                         porn91 porncom pornflip pornhd pornotube pornovoisines pornoxo
38                         ruleporn sexu slutload spankbang spankwire sunporno thisav tube8
39                         vporn watchindianporn xbef xnxx xtube xvideos xxxymovies youjizz
40                         youporn
41                 )
42                 # these have multi-line import statements
43                 local mxxx=(
44                         drtuber fourtube pornhub redtube tnaflix xhamster
45                 )
46                 # do single line imports
47                 sed -i \
48                         -e $( printf '/%s/d;' ${xxx[@]} ) \
49                         youtube_dl/extractor/extractors.py \
50                         || die
51
52                 # do multiple line imports
53                 sed -i \
54                         -e $( printf '/%s/,/)/d;' ${mxxx[@]} ) \
55                         youtube_dl/extractor/extractors.py \
56                         || die
57
58                 sed -i \
59                         -e $( printf '/%s/d;' ${mxxx[@]} ) \
60                         youtube_dl/extractor/generic.py \
61                         || die
62
63                 rm \
64                         $( printf 'youtube_dl/extractor/%s.py ' ${xxx[@]} ) \
65                         $( printf 'youtube_dl/extractor/%s.py ' ${mxxx[@]} ) \
66                         test/test_age_restriction.py \
67                         || die
68         fi
69
70         epatch_user
71
72         distutils-r1_python_prepare_all
73 }
74
75 src_compile() {
76         distutils-r1_src_compile
77 }
78
79 python_test() {
80         emake test
81 }
82
83 python_install_all() {
84         dodoc README.txt
85         doman ${PN}.1
86
87         newbashcomp ${PN}.bash-completion ${PN}
88
89         insinto /usr/share/zsh/site-functions
90         newins youtube-dl.zsh _youtube-dl
91
92         insinto /usr/share/fish/completions
93         doins youtube-dl.fish
94
95         distutils-r1_python_install_all
96
97         rm -r "${ED}"/usr/etc || die
98 }