1 all: lazy-extractors yt-dlp doc pypi-files
2 clean: clean-test clean-dist clean-cache
3 completions: completion-bash completion-fish completion-zsh
4 doc: README.md CONTRIBUTING.md issuetemplates supportedsites
8 # Keep this list in sync with MANIFEST.in
9 # intended use: when building a source distribution,
10 # make pypi-files && python setup.py sdist
11 pypi-files: AUTHORS Changelog.md LICENSE README.md README.txt supportedsites completions yt-dlp.1 devscripts/* test/*
13 .PHONY: all clean install test tar pypi-files completions ot offlinetest codetest supportedsites
16 rm -rf *.3gp *.annotations.xml *.ape *.avi *.description *.dump *.flac *.flv *.frag *.frag.aria2 *.frag.urls \
17 *.info.json *.jpeg *.jpg *.live_chat.json *.m4a *.m4v *.mkv *.mp3 *.mp4 *.ogg *.opus *.part* *.png *.sbv *.srt \
18 *.swf *.swp *.ttml *.vtt *.wav *.webm *.webp *.ytdl test/testdata/player-*.js
20 rm -rf yt-dlp.1.temp.md yt-dlp.1 README.txt MANIFEST build/ dist/ .coverage cover/ yt-dlp.tar.gz completions/ yt_dlp/extractor/lazy_extractors.py *.spec CONTRIBUTING.md.tmp yt-dlp yt-dlp.exe yt_dlp.egg-info/ AUTHORS .mailmap
22 find . -name "*.pyc" -o -name "*.class" -delete
24 completion-bash: completions/bash/yt-dlp
25 completion-fish: completions/fish/yt-dlp.fish
26 completion-zsh: completions/zsh/_yt-dlp
27 lazy-extractors: yt_dlp/extractor/lazy_extractors.py
31 BINDIR ?= $(PREFIX)/bin
32 MANDIR ?= $(PREFIX)/man
33 SHAREDIR ?= $(PREFIX)/share
34 # make_supportedsites.py doesnot work correctly in python2
35 PYTHON ?= /usr/bin/env python3
37 # set SYSCONFDIR to /etc if PREFIX=/usr or PREFIX=/usr/local
38 SYSCONFDIR = $(shell if [ $(PREFIX) = /usr -o $(PREFIX) = /usr/local ]; then echo /etc; else echo $(PREFIX)/etc; fi)
40 # set markdown input format to "markdown-smart" for pandoc version 2 and to "markdown" for pandoc prior to version 2
41 MARKDOWN = $(shell if [ `pandoc -v | head -n1 | cut -d" " -f2 | head -c1` = "2" ]; then echo markdown-smart; else echo markdown; fi)
43 install: lazy_extractors yt-dlp yt-dlp.1 completions
44 install -Dm755 yt-dlp $(DESTDIR)$(BINDIR)
45 install -Dm644 yt-dlp.1 $(DESTDIR)$(MANDIR)/man1
46 install -Dm644 completions/bash/yt-dlp $(DESTDIR)$(SHAREDIR)/bash-completion/completions/yt-dlp
47 install -Dm644 completions/zsh/_yt-dlp $(DESTDIR)$(SHAREDIR)/zsh/site-functions/_yt-dlp
48 install -Dm644 completions/fish/yt-dlp.fish $(DESTDIR)$(SHAREDIR)/fish/vendor_completions.d/yt-dlp.fish
58 $(PYTHON) -m pytest -k "not download"
60 yt-dlp: yt_dlp/*.py yt_dlp/*/*.py
62 for d in yt_dlp yt_dlp/downloader yt_dlp/extractor yt_dlp/postprocessor ; do \
64 cp -pPR $$d/*.py zip/$$d/ ;\
66 touch -t 200001010101 zip/yt_dlp/*.py zip/yt_dlp/*/*.py
67 mv zip/yt_dlp/__main__.py zip/
68 cd zip ; zip -q ../yt-dlp yt_dlp/*.py yt_dlp/*/*.py __main__.py
70 echo '#!$(PYTHON)' > yt-dlp
71 cat yt-dlp.zip >> yt-dlp
75 README.md: yt_dlp/*.py yt_dlp/*/*.py
76 COLUMNS=80 $(PYTHON) yt_dlp/__main__.py --help | $(PYTHON) devscripts/make_readme.py
78 CONTRIBUTING.md: README.md
79 $(PYTHON) devscripts/make_contributing.py README.md CONTRIBUTING.md
81 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
82 $(PYTHON) devscripts/make_issue_template.py .github/ISSUE_TEMPLATE_tmpl/1_broken_site.yml .github/ISSUE_TEMPLATE/1_broken_site.yml
83 $(PYTHON) devscripts/make_issue_template.py .github/ISSUE_TEMPLATE_tmpl/2_site_support_request.yml .github/ISSUE_TEMPLATE/2_site_support_request.yml
84 $(PYTHON) devscripts/make_issue_template.py .github/ISSUE_TEMPLATE_tmpl/3_site_feature_request.yml .github/ISSUE_TEMPLATE/3_site_feature_request.yml
85 $(PYTHON) devscripts/make_issue_template.py .github/ISSUE_TEMPLATE_tmpl/4_bug_report.yml .github/ISSUE_TEMPLATE/4_bug_report.yml
86 $(PYTHON) devscripts/make_issue_template.py .github/ISSUE_TEMPLATE_tmpl/5_feature_request.yml .github/ISSUE_TEMPLATE/5_feature_request.yml
87 $(PYTHON) devscripts/make_issue_template.py .github/ISSUE_TEMPLATE_tmpl/6_question.yml .github/ISSUE_TEMPLATE/6_question.yml
90 $(PYTHON) devscripts/make_supportedsites.py supportedsites.md
93 pandoc -f $(MARKDOWN) -t plain README.md -o README.txt
96 $(PYTHON) devscripts/prepare_manpage.py yt-dlp.1.temp.md
97 pandoc -s -f $(MARKDOWN) -t man yt-dlp.1.temp.md -o yt-dlp.1
98 rm -f yt-dlp.1.temp.md
100 completions/bash/yt-dlp: yt_dlp/*.py yt_dlp/*/*.py devscripts/bash-completion.in
101 mkdir -p completions/bash
102 $(PYTHON) devscripts/bash-completion.py
104 completions/zsh/_yt-dlp: yt_dlp/*.py yt_dlp/*/*.py devscripts/zsh-completion.in
105 mkdir -p completions/zsh
106 $(PYTHON) devscripts/zsh-completion.py
108 completions/fish/yt-dlp.fish: yt_dlp/*.py yt_dlp/*/*.py devscripts/fish-completion.in
109 mkdir -p completions/fish
110 $(PYTHON) devscripts/fish-completion.py
112 _EXTRACTOR_FILES = $(shell find yt_dlp/extractor -iname '*.py' -and -not -iname 'lazy_extractors.py')
113 yt_dlp/extractor/lazy_extractors.py: devscripts/make_lazy_extractors.py devscripts/lazy_load_template.py $(_EXTRACTOR_FILES)
114 $(PYTHON) devscripts/make_lazy_extractors.py $@
117 @tar -czf $(DESTDIR)/yt-dlp.tar.gz --transform "s|^|yt-dlp/|" --owner 0 --group 0 \
118 --exclude '*.DS_Store' \
119 --exclude '*.kate-swp' \
123 --exclude '__pycache__' \
126 README.md supportedsites.md Changelog.md LICENSE \
127 CONTRIBUTING.md Collaborators.md CONTRIBUTORS AUTHORS \
128 Makefile MANIFEST.in yt-dlp.1 README.txt completions \
129 setup.py setup.cfg yt-dlp yt_dlp requirements.txt \
130 devscripts test tox.ini pytest.ini
133 git shortlog -s -n | cut -f2 | sort > AUTHORS
136 git shortlog -s -e -n | awk '!(out[$$NF]++) { $$1="";sub(/^[ \t]+/,""); print}' > .mailmap