1 all: lazy-extractors yt-dlp doc pypi-files
2 clean: clean-test clean-dist
3 clean-all
: clean clean-cache
4 completions
: completion-bash completion-fish completion-zsh
5 doc
: README.md CONTRIBUTING.md CONTRIBUTORS issuetemplates supportedsites
9 # Keep this list in sync with pyproject.toml includes/artifacts
10 # intended use: when building a source distribution,
11 # make pypi-files && python3 -m build -sn .
12 pypi-files
: AUTHORS Changelog.md LICENSE README.md README.txt supportedsites \
13 completions yt-dlp
.1 pyproject.toml setup.cfg devscripts
/* test/*
15 .PHONY
: all clean clean-all clean-test clean-dist clean-cache \
16 completions completion-bash completion-fish completion-zsh \
17 doc issuetemplates supportedsites ot offlinetest codetest
test \
18 tar pypi-files lazy-extractors
install uninstall
21 rm -rf
test/testdata
/sigs
/player-
*.js tmp
/ *.annotations.xml
*.aria2
*.description
*.dump
*.frag \
22 *.frag.aria2
*.frag.urls
*.
info.json
*.live_chat.json
*.meta
*.part
* *.tmp
*.temp
*.unknown_video
*.ytdl \
23 *.3gp
*.ape
*.ass
*.avi
*.desktop
*.f4v
*.flac
*.flv
*.gif
*.jpeg
*.jpg
*.lrc
*.m4a
*.m4v
*.mhtml
*.mkv
*.mov
*.mp3
*.mp4 \
24 *.mpg
*.mpga
*.oga
*.ogg
*.opus
*.png
*.sbv
*.srt
*.ssa
*.swf
*.swp
*.tt
*.ttml
*.url
*.vtt
*.wav
*.webloc
*.webm
*.webp
26 rm -rf yt-dlp
.1.temp.md yt-dlp
.1 README.txt MANIFEST build
/ dist/ .coverage cover
/ yt-dlp.
tar.gz completions
/ \
27 yt_dlp
/extractor
/lazy_extractors.py
*.spec CONTRIBUTING.md.tmp yt-dlp yt-dlp.exe yt_dlp.egg-info
/ AUTHORS
30 -type d
-name .pytest_cache
-o
-type d
-name __pycache__
-o
-name
"*.pyc" -o
-name
"*.class" \
31 \
) -prune
-exec
rm -rf
{} \
;
33 completion-bash
: completions
/bash
/yt-dlp
34 completion-fish
: completions
/fish
/yt-dlp.fish
35 completion-zsh
: completions
/zsh
/_yt-dlp
36 lazy-extractors
: yt_dlp
/extractor
/lazy_extractors.py
39 BINDIR ?
= $(PREFIX
)/bin
40 MANDIR ?
= $(PREFIX
)/man
41 SHAREDIR ?
= $(PREFIX
)/share
42 PYTHON ?
= /usr
/bin
/env python3
45 # set markdown input format to "markdown-smart" for pandoc version 2+ and to "markdown" for pandoc prior to version 2
46 PANDOC_VERSION_CMD
= pandoc
-v
2>/dev
/null | head
-n1 | cut
-d
' ' -f2 | head
-c1
47 PANDOC_VERSION
!= $(PANDOC_VERSION_CMD
)
48 PANDOC_VERSION ?
= $(shell $(PANDOC_VERSION_CMD
))
49 MARKDOWN_CMD
= if
[ "$(PANDOC_VERSION)" = "1" -o
"$(PANDOC_VERSION)" = "0" ]; then echo markdown
; else echo markdown-smart
; fi
50 MARKDOWN
!= $(MARKDOWN_CMD
)
51 MARKDOWN ?
= $(shell $(MARKDOWN_CMD
))
53 install: lazy-extractors yt-dlp yt-dlp
.1 completions
54 mkdir
-p
$(DESTDIR
)$(BINDIR
)
55 install -m755 yt-dlp
$(DESTDIR
)$(BINDIR
)/yt-dlp
56 mkdir
-p
$(DESTDIR
)$(MANDIR
)/man1
57 install -m644 yt-dlp
.1 $(DESTDIR
)$(MANDIR
)/man1
/yt-dlp
.1
58 mkdir
-p
$(DESTDIR
)$(SHAREDIR
)/bash-completion
/completions
59 install -m644 completions
/bash
/yt-dlp
$(DESTDIR
)$(SHAREDIR
)/bash-completion
/completions
/yt-dlp
60 mkdir
-p
$(DESTDIR
)$(SHAREDIR
)/zsh
/site-functions
61 install -m644 completions
/zsh
/_yt-dlp
$(DESTDIR
)$(SHAREDIR
)/zsh
/site-functions
/_yt-dlp
62 mkdir
-p
$(DESTDIR
)$(SHAREDIR
)/fish
/vendor_completions.d
63 install -m644 completions
/fish
/yt-dlp.fish
$(DESTDIR
)$(SHAREDIR
)/fish
/vendor_completions.d
/yt-dlp.fish
66 rm -f
$(DESTDIR
)$(BINDIR
)/yt-dlp
67 rm -f
$(DESTDIR
)$(MANDIR
)/man1
/yt-dlp
.1
68 rm -f
$(DESTDIR
)$(SHAREDIR
)/bash-completion
/completions
/yt-dlp
69 rm -f
$(DESTDIR
)$(SHAREDIR
)/zsh
/site-functions
/_yt-dlp
70 rm -f
$(DESTDIR
)$(SHAREDIR
)/fish
/vendor_completions.d
/yt-dlp.fish
80 $(PYTHON
) -m pytest
-k
"not download"
82 CODE_FOLDERS_CMD
= find yt_dlp
-type f
-name
'__init__.py' | sed
's,/__init__.py,,' | grep
-v
'/__' |
sort
83 CODE_FOLDERS
!= $(CODE_FOLDERS_CMD
)
84 CODE_FOLDERS ?
= $(shell $(CODE_FOLDERS_CMD
))
85 CODE_FILES_CMD
= for f in
$(CODE_FOLDERS
) ; do echo
"$$f" | sed
's,$$,/*.py,' ; done
86 CODE_FILES
!= $(CODE_FILES_CMD
)
87 CODE_FILES ?
= $(shell $(CODE_FILES_CMD
))
90 for d in
$(CODE_FOLDERS
) ; do \
92 cp
-pPR
$$d/*.py zip
/$$d/ ;\
94 (cd zip
&& touch
-t
200001010101 $(CODE_FILES
))
95 mv zip
/yt_dlp
/__main__.py zip
/
96 (cd zip
&& zip
-q ..
/yt-dlp
$(CODE_FILES
) __main__.py
)
98 echo
'#!$(PYTHON)' > yt-dlp
99 cat yt-dlp.zip
>> yt-dlp
103 README.md
: $(CODE_FILES
) devscripts
/make_readme.py
104 COLUMNS
=80 $(PYTHON
) yt_dlp
/__main__.py
--ignore-config
--help |
$(PYTHON
) devscripts
/make_readme.py
106 CONTRIBUTING.md
: README.md devscripts
/make_contributing.py
107 $(PYTHON
) devscripts
/make_contributing.py README.md CONTRIBUTING.md
109 issuetemplates
: devscripts
/make_issue_template.py .github
/ISSUE_TEMPLATE_tmpl
/1_broken_site.yml .github
/ISSUE_TEMPLATE_tmpl
/2_site_support_request.yml .github
/ISSUE_TEMPLATE_tmpl
/3_site_feature_request.yml .github
/ISSUE_TEMPLATE_tmpl
/4_bug_report.yml .github
/ISSUE_TEMPLATE_tmpl
/5_feature_request.yml yt_dlp
/version.py
110 $(PYTHON
) devscripts
/make_issue_template.py .github
/ISSUE_TEMPLATE_tmpl
/1_broken_site.yml .github
/ISSUE_TEMPLATE
/1_broken_site.yml
111 $(PYTHON
) devscripts
/make_issue_template.py .github
/ISSUE_TEMPLATE_tmpl
/2_site_support_request.yml .github
/ISSUE_TEMPLATE
/2_site_support_request.yml
112 $(PYTHON
) devscripts
/make_issue_template.py .github
/ISSUE_TEMPLATE_tmpl
/3_site_feature_request.yml .github
/ISSUE_TEMPLATE
/3_site_feature_request.yml
113 $(PYTHON
) devscripts
/make_issue_template.py .github
/ISSUE_TEMPLATE_tmpl
/4_bug_report.yml .github
/ISSUE_TEMPLATE
/4_bug_report.yml
114 $(PYTHON
) devscripts
/make_issue_template.py .github
/ISSUE_TEMPLATE_tmpl
/5_feature_request.yml .github
/ISSUE_TEMPLATE
/5_feature_request.yml
115 $(PYTHON
) devscripts
/make_issue_template.py .github
/ISSUE_TEMPLATE_tmpl
/6_question.yml .github
/ISSUE_TEMPLATE
/6_question.yml
118 $(PYTHON
) devscripts
/make_supportedsites.py supportedsites.md
120 README.txt
: README.md
121 pandoc
-f
$(MARKDOWN
) -t plain README.md
-o README.txt
123 yt-dlp
.1: README.md devscripts
/prepare_manpage.py
124 $(PYTHON
) devscripts
/prepare_manpage.py yt-dlp
.1.temp.md
125 pandoc
-s
-f
$(MARKDOWN
) -t man yt-dlp
.1.temp.md
-o yt-dlp
.1
126 rm -f yt-dlp
.1.temp.md
128 completions
/bash
/yt-dlp
: $(CODE_FILES
) devscripts
/bash-completion.in
129 mkdir
-p completions
/bash
130 $(PYTHON
) devscripts
/bash-completion.py
132 completions
/zsh
/_yt-dlp
: $(CODE_FILES
) devscripts
/zsh-completion.in
133 mkdir
-p completions
/zsh
134 $(PYTHON
) devscripts
/zsh-completion.py
136 completions
/fish
/yt-dlp.fish
: $(CODE_FILES
) devscripts
/fish-completion.in
137 mkdir
-p completions
/fish
138 $(PYTHON
) devscripts
/fish-completion.py
140 _EXTRACTOR_FILES_CMD
= find yt_dlp
/extractor
-name
'*.py' -and
-not
-name
'lazy_extractors.py'
141 _EXTRACTOR_FILES
!= $(_EXTRACTOR_FILES_CMD
)
142 _EXTRACTOR_FILES ?
= $(shell $(_EXTRACTOR_FILES_CMD
))
143 yt_dlp
/extractor
/lazy_extractors.py
: devscripts
/make_lazy_extractors.py devscripts
/lazy_load_template.py
$(_EXTRACTOR_FILES
)
144 $(PYTHON
) devscripts
/make_lazy_extractors.py
$@
147 @
$(GNUTAR
) -czf yt-dlp.
tar.gz
--transform
"s|^|yt-dlp/|" --owner
0 --group
0 \
148 --exclude
'*.DS_Store' \
149 --exclude
'*.kate-swp' \
153 --exclude
'__pycache__' \
154 --exclude
'.pytest_cache' \
157 README.md supportedsites.md Changelog.md LICENSE \
158 CONTRIBUTING.md Collaborators.md CONTRIBUTORS AUTHORS \
159 Makefile yt-dlp
.1 README.txt completions .gitignore \
160 setup.cfg yt-dlp yt_dlp pyproject.toml devscripts
test
162 AUTHORS
: Changelog.md
163 @if
[ -d
'.git' ] && command
-v git
> /dev
/null
; then \
164 echo
'Generating $@ from git commit history' ; \
165 git shortlog
-s
-n HEAD | cut
-f2 |
sort > $@
; \
168 CONTRIBUTORS
: Changelog.md
169 @if
[ -d
'.git' ] && command
-v git
> /dev
/null
; then \
170 echo
'Updating $@ from git commit history' ; \
171 $(PYTHON
) devscripts
/make_changelog.py
-v
-c
> /dev
/null
; \