app-editors/kakoune: drop old 0_pre20160620
[gentoo.git] / net-misc / youtube-dl / youtube-dl-2017.11.26-r1.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 PYTHON_COMPAT=(python{2_7,3_4,3_5,3_6})
6 inherit bash-completion-r1 distutils-r1 readme.gentoo-r1
7
8 DESCRIPTION="Download videos from YouTube.com (and more sites...)"
9 HOMEPAGE="https://rg3.github.com/youtube-dl/"
10 SRC_URI="http://youtube-dl.org/downloads/${PV}/${P}.tar.gz"
11
12 LICENSE="public-domain"
13 SLOT="0"
14 KEYWORDS="~amd64 ~arm ~hppa ~ppc ~ppc64 ~x86 ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x86-solaris"
15 IUSE="+offensive test"
16
17 RDEPEND="
18         dev-python/setuptools[${PYTHON_USEDEP}]
19 "
20 DEPEND="
21         ${RDEPEND}
22         test? ( dev-python/nose[coverage(+)] )
23 "
24
25 S="${WORKDIR}/${PN}"
26
27 python_prepare_all() {
28         if ! use offensive; then
29                 sed -i -e "/..version../s|'$|+gentoo.no.offensive.sites'|g" \
30                         youtube_dl/version.py || die
31                 # these have single line import statements
32                 local xxx=(
33                         alphaporno anysex behindkink camwithher chaturbate eporner
34                         eroprofile extremetube foxgay goshgay hellporno hentaistigma
35                         hornbunny keezmovies lovehomeporn mofosex motherless myvidster
36                         porn91 porncom pornflip pornhd pornotube pornovoisines pornoxo
37                         ruleporn sexu slutload spankbang spankwire sunporno thisav tube8
38                         vporn watchindianporn xbef xnxx xtube xvideos xxxymovies youjizz
39                         youporn
40                 )
41                 # these have multi-line import statements
42                 local mxxx=(
43                         drtuber fourtube pornhub redtube tnaflix xhamster
44                 )
45                 # do single line imports
46                 sed -i \
47                         -e $( printf '/%s/d;' ${xxx[@]} ) \
48                         youtube_dl/extractor/extractors.py \
49                         || die
50
51                 # do multiple line imports
52                 sed -i \
53                         -e $( printf '/%s/,/)/d;' ${mxxx[@]} ) \
54                         youtube_dl/extractor/extractors.py \
55                         || die
56
57                 sed -i \
58                         -e $( printf '/%s/d;' ${mxxx[@]} ) \
59                         youtube_dl/extractor/generic.py \
60                         || die
61
62                 rm \
63                         $( printf 'youtube_dl/extractor/%s.py ' ${xxx[@]} ) \
64                         $( printf 'youtube_dl/extractor/%s.py ' ${mxxx[@]} ) \
65                         test/test_age_restriction.py \
66                         || die
67         fi
68
69         eapply_user
70
71         distutils-r1_python_prepare_all
72 }
73
74 src_compile() {
75         distutils-r1_src_compile
76 }
77
78 python_test() {
79         emake test
80 }
81
82 python_install_all() {
83         dodoc README.txt
84         doman ${PN}.1
85
86         newbashcomp ${PN}.bash-completion ${PN}
87
88         insinto /usr/share/zsh/site-functions
89         newins youtube-dl.zsh _youtube-dl
90
91         insinto /usr/share/fish/completions
92         doins youtube-dl.fish
93
94         distutils-r1_python_install_all
95
96         rm -r "${ED}"/usr/etc || die
97         rm -r "${ED}"/usr/share/doc/youtube_dl || die
98
99         elog "youtube-dl(1) / https://bugs.gentoo.org/355661 /"
100         elog "https://github.com/rg3/youtube-dl/blob/master/README.md#faq :"
101         elog
102         elog "${PN} works fine on its own on most sites. However, if you want"
103         elog "to convert video/audio, you'll need avconf (media-video/libav) or"
104         elog "ffmpeg (media-video/ffmpeg). On some sites - most notably YouTube -"
105         elog "videos can be retrieved in a higher quality format without sound."
106         elog "${PN} will detect whether avconv/ffmpeg is present and"
107         elog "automatically pick the best option."
108
109         elog
110         elog "Videos or video formats streamed via RTMP protocol can only be"
111         elog "downloaded when rtmpdump (media-video/rtmpdump) is installed."
112         elog "Downloading MMS and RTSP videos requires either mplayer"
113         elog "(media-video/mplayer) or mpv (media-video/mpv) to be installed."
114 }