Ticket #58638: ytdl.diff
File ytdl.diff, 7.1 KB (added by RJVB (René Bertin), 5 years ago) |
---|
-
net/youtube-dl/Portfile
diff --git a/net/youtube-dl/Portfile b/net/youtube-dl/Portfile index d5521a64dde..a7bfcf4f0cb 100644
a b 3 3 PortSystem 1.0 4 4 5 5 name youtube-dl 6 version 2019.06.08 7 revision 0 8 checksums rmd160 bccdfbfeccbd820dbc6af9157dd3558a0c4faa38 \ 9 sha256 275a8506ecd6c72589bfc66b749cd80847e7393df1d6e1becd1d11ba90980837 \ 10 size 3169571 6 version 2019.06.21 7 checksums rmd160 2034f79f88cebc47db00e66e34c831d862f873a0 \ 8 sha256 85872e23add44409711bd0eb5620c663d67c578a3df663578ff07f944212470d \ 9 size 3169975 11 10 12 11 categories net 13 12 platforms darwin 14 13 maintainers {ryandesign @ryandesign} openmaintainer 15 14 supported_archs noarch 15 installs_libs no 16 16 license public-domain 17 17 18 18 description command-line program to download videos from YouTube.com and other sites … … worksrcdir ${name} 29 29 post-extract { 30 30 # Force the script to be regenerated by `make`. 31 31 delete ${worksrcpath}/${name} 32 system -W ${worksrcpath} "chmod +x devscripts/make_contributing.py devscripts/make_supportedsites.py" 32 33 } 33 34 34 patchfiles patch-config-location.diff \35 patch-youtube_dl-update.py.diff36 35 patch.args --backup 37 36 38 37 post-patch { … … post-patch { 43 42 44 43 # Restore original mtimes of files changed by the patch so that `make` doesn't try to regenerate the documentation with `pandoc`. 45 44 foreach f {youtube_dl/update.py youtube_dl/options.py README.md youtube-dl.1} { 46 file mtime ${worksrcpath}/${f} [file mtime ${worksrcpath}/${f}.orig] 45 if {[file exists ${worksrcpath}/${f}.orig]} { 46 file mtime ${worksrcpath}/${f} [file mtime ${worksrcpath}/${f}.orig] 47 file delete ${worksrcpath}/${f}.orig 48 } 47 49 } 48 50 } 49 51 50 52 use_configure no 51 53 52 pre-build {53 build.args-append PYTHON=${configure.python}54 }55 56 54 destroot.args PREFIX=${prefix} \ 57 55 MANDIR=${prefix}/share/man \ 58 56 SYSCONFDIR=${prefix}/etc … … variant ffmpeg description {Add ffmpeg dependency, used to extract audio} { 68 66 path:bin/ffmpeg:ffmpeg 69 67 } 70 68 71 default_variants +ffmpeg 69 default_variants +ffmpeg 70 71 variant stock conflicts python27 python35 python36 python37 description {pure stock version} {} 72 72 73 variant python27 conflicts python35 python36 python37 description {Use Python 2.7} {73 variant python27 conflicts python35 python36 python37 stock description {Use Python 2.7 from MacPorts} { 74 74 depends_run-append port:python27 75 75 depends_build-append port:python27 76 76 configure.python ${prefix}/bin/python2.7 77 77 } 78 78 79 variant python35 conflicts python27 python36 python37 description {Use Python 3.5} {79 variant python35 conflicts python27 python36 python37 stock description {Use Python 3.5 from MacPorts} { 80 80 depends_run-append port:python35 81 81 depends_build-append port:python35 82 82 configure.python ${prefix}/bin/python3.5 83 83 } 84 84 85 variant python36 conflicts python27 python35 python37 description {Use Python 3.6} {85 variant python36 conflicts python27 python35 python37 stock description {Use Python 3.6 from MacPorts} { 86 86 depends_run-append port:python36 87 87 depends_build-append port:python36 88 88 configure.python ${prefix}/bin/python3.6 89 89 } 90 90 91 variant python37 conflicts python27 python35 python36 description {Use Python 3.7} {91 variant python37 conflicts python27 python35 python36 stock description {Use Python 3.7 from MacPorts} { 92 92 depends_run-append port:python37 93 93 depends_build-append port:python37 94 94 configure.python ${prefix}/bin/python3.7 95 95 } 96 96 97 if {![variant_isset stock]} { 98 default_variants +python37 99 } 100 97 101 if {![variant_isset python27] && ![variant_isset python35] && ![variant_isset python36] && ![variant_isset python37]} { 98 default_variants +python37 102 # There isn't actually a need to use a MacPorts Python interpreter; the system one will do just fine. 103 # When using the system interpreter (or whichever python is on the path) there is also no hard reason to 104 # ban in-app upgrading; this will only replace ${prefix}/bin/youtube-dl with a new version (= not introduce 105 # new files). 106 # NB: python 2.7 runs this significantly faster. 107 if {[variant_isset stock]} { 108 configure.python python 109 } else { 110 ui_error "You need to select either one of the +python variants or the +stock variant" 111 return -code error "A variant must be selected" 112 } 113 } else { 114 patchfiles patch-config-location.diff \ 115 patch-youtube_dl-update.py.diff 116 pre-build { 117 build.args-append PYTHON=${configure.python} 118 } 119 } 120 121 variant unpacked description {improve startup performance by installing as a bundle of uncompressed scripts} {} 122 123 if {[variant_isset unpacked]} { 124 # unpack the compressed script that was just created. This ensures that we get the exact 125 # same behaviour. In-app upgrading is not supported when installing this way. 126 post-destroot { 127 set catchval [catch {system -W ${destroot} "unzip ${destroot}${prefix}/bin/youtube-dl"} rval optval] 128 # we will probably get an exit code 1 from unzip because of the 129 if {(${catchval} == 0 || [lindex ${::errorCode} 2] == 1) 130 && [file exists ${destroot}/__main__.py] 131 } { 132 file delete ${destroot}${prefix}/bin/youtube-dl 133 file rename ${destroot}/__main__.py ${destroot}${prefix}/bin/youtube-dl 134 system "chmod 755 ${destroot}${prefix}/bin/youtube-dl" 135 file rename ${destroot}/youtube_dl ${destroot}${prefix}/libexec/youtube_dl 136 # force a compilation by invoking the script once 137 system -W ${destroot} "env PYTHONPATH=${destroot}${prefix}/libexec \ 138 ${configure.python} -v ${destroot}${prefix}/bin/youtube-dl --version" 139 # make certain the wrapper script will load the correct programme 140 reinplace "s|__file__|'${prefix}/libexec/youtube_dl/version.py'|g" ${destroot}${prefix}/bin/youtube-dl 141 if {${configure.python} ne "python"} { 142 reinplace "s|#!/usr/bin/env python|#!${configure.python}|g" ${destroot}${prefix}/bin/youtube-dl 143 } 144 } else { 145 ui_error "Unpacking youtube-dl failed (${rval})" 146 return -code error "Unpacking failed" 147 } 148 } 149 pre-activate { 150 # remove the bytecode cache directory 151 if {[file exists ${prefix}/libexec/youtube_dl]} { 152 ui_warn "Purging any existing youtube_dl bytecode cache files" 153 file delete -force {*}[glob -nocomplain -directory ${prefix}/libexec/youtube_dl *.pyc *.pyo] 154 } 155 if {[file exists ${prefix}/libexec/youtube_dl/__pycache__]} { 156 ui_warn "Purging the youtube_dl bytecode cache directory" 157 file delete -force ${prefix}/libexec/youtube_dl/__pycache__ 158 } 159 } 99 160 } 100 161 101 162 livecheck.type regex