portage-overlay

personal portage ebuild repository
git clone anongit@rnpnr.xyz:portage-overlay.git
Log | Files | Refs | Feed | README

yt-dlp-9999.ebuild (1814B)


      1 # Copyright 1999-2023 Gentoo Authors
      2 # Distributed under the terms of the GNU General Public License v2
      3 
      4 EAPI=8
      5 
      6 DISTUTILS_USE_PEP517=setuptools
      7 PYTHON_COMPAT=( python3_{9..11} )
      8 inherit distutils-r1 git-r3 optfeature
      9 
     10 DESCRIPTION="youtube-dl fork with additional features and fixes"
     11 HOMEPAGE="https://github.com/yt-dlp/yt-dlp/"
     12 EGIT_REPO_URI="https://github.com/yt-dlp/yt-dlp.git"
     13 
     14 LICENSE="Unlicense"
     15 SLOT="0"
     16 KEYWORDS=""
     17 IUSE="man"
     18 
     19 RDEPEND="
     20 	dev-python/pycryptodome[${PYTHON_USEDEP}]
     21 	!net-misc/youtube-dl[-yt-dlp(-)]"
     22 BDEPEND="man? ( virtual/pandoc )"
     23 
     24 distutils_enable_tests pytest
     25 
     26 src_prepare() {
     27 	distutils-r1_src_prepare
     28 
     29 	# adjust requires for pycryptodome and optional dependencies (bug #828466)
     30 	sed -ri requirements.txt \
     31 		-e "s/^(pycryptodome)x/\1/" \
     32 		-e "/^(brotli.*|certifi|mutagen|websockets)/d" || die
     33 }
     34 
     35 python_compile() {
     36 	# generate missing files in live, not in compile_all nor prepare
     37 	# given need lazy before compile and it needs a usable ${PYTHON}
     38 	emake completions lazy-extractors $(usev man yt-dlp.1)
     39 
     40 	distutils-r1_python_compile
     41 }
     42 
     43 python_test() {
     44 	epytest -m 'not download'
     45 }
     46 
     47 python_install_all() {
     48 	dodoc README.md Changelog.md supportedsites.md
     49 	use man && doman yt-dlp.1
     50 
     51 	make_wrapper youtube-dl "yt-dlp --compat-options youtube-dl"
     52 }
     53 
     54 pkg_postinst() {
     55 	optfeature "various features (merging tracks, streamed content)" media-video/ffmpeg
     56 	has_version media-video/atomicparsley || # allow fallback but don't advertise
     57 		optfeature "embedding metadata thumbnails in MP4/M4A files" media-libs/mutagen
     58 
     59 	if [[ ! ${REPLACING_VERSIONS} ]]; then
     60 		elog 'A wrapper using "yt-dlp --compat-options youtube-dl" was installed'
     61 		elog 'as "youtube-dl". This is strictly for compatibility and it is'
     62 		elog 'recommended to use "yt-dlp" directly, it may be removed in the future.'
     63 	fi
     64 }