]>
Commit | Line | Data |
---|---|---|
1 | all: 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 | |
5 | ot: offlinetest | |
6 | tar: yt-dlp.tar.gz | |
7 | ||
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/* | |
12 | ||
13 | .PHONY: all clean install test tar pypi-files completions ot offlinetest codetest supportedsites | |
14 | ||
15 | clean-test: | |
16 | rm -rf *.dump *.part* *.ytdl *.info.json *.mp4 *.m4a *.flv *.mp3 *.avi *.mkv *.webm *.3gp *.wav *.ape *.swf *.jpg *.png *.frag *.frag.urls *.frag.aria2 test/testdata/player-*.js *.opus *.webp *.ttml *.vtt *.jpeg | |
17 | clean-dist: | |
18 | 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 | |
19 | clean-cache: | |
20 | find . -name "*.pyc" -o -name "*.class" -delete | |
21 | ||
22 | completion-bash: completions/bash/yt-dlp | |
23 | completion-fish: completions/fish/yt-dlp.fish | |
24 | completion-zsh: completions/zsh/_yt-dlp | |
25 | lazy-extractors: yt_dlp/extractor/lazy_extractors.py | |
26 | ||
27 | PREFIX ?= /usr/local | |
28 | DESTDIR ?= . | |
29 | BINDIR ?= $(PREFIX)/bin | |
30 | MANDIR ?= $(PREFIX)/man | |
31 | SHAREDIR ?= $(PREFIX)/share | |
32 | # make_supportedsites.py doesnot work correctly in python2 | |
33 | PYTHON ?= /usr/bin/env python3 | |
34 | ||
35 | # set SYSCONFDIR to /etc if PREFIX=/usr or PREFIX=/usr/local | |
36 | SYSCONFDIR = $(shell if [ $(PREFIX) = /usr -o $(PREFIX) = /usr/local ]; then echo /etc; else echo $(PREFIX)/etc; fi) | |
37 | ||
38 | # set markdown input format to "markdown-smart" for pandoc version 2 and to "markdown" for pandoc prior to version 2 | |
39 | MARKDOWN = $(shell if [ `pandoc -v | head -n1 | cut -d" " -f2 | head -c1` = "2" ]; then echo markdown-smart; else echo markdown; fi) | |
40 | ||
41 | install: yt-dlp yt-dlp.1 completions | |
42 | install -Dm755 yt-dlp $(DESTDIR)$(BINDIR) | |
43 | install -Dm644 yt-dlp.1 $(DESTDIR)$(MANDIR)/man1 | |
44 | install -Dm644 completions/bash/yt-dlp $(DESTDIR)$(SHAREDIR)/bash-completion/completions/yt-dlp | |
45 | install -Dm644 completions/zsh/_yt-dlp $(DESTDIR)$(SHAREDIR)/zsh/site-functions/_yt-dlp | |
46 | install -Dm644 completions/fish/yt-dlp.fish $(DESTDIR)$(SHAREDIR)/fish/vendor_completions.d/yt-dlp.fish | |
47 | ||
48 | codetest: | |
49 | flake8 . | |
50 | ||
51 | test: | |
52 | $(PYTHON) -m pytest | |
53 | $(MAKE) codetest | |
54 | ||
55 | offlinetest: codetest | |
56 | $(PYTHON) -m pytest -k "not download" | |
57 | ||
58 | yt-dlp: yt_dlp/*.py yt_dlp/*/*.py | |
59 | mkdir -p zip | |
60 | for d in yt_dlp yt_dlp/downloader yt_dlp/extractor yt_dlp/postprocessor ; do \ | |
61 | mkdir -p zip/$$d ;\ | |
62 | cp -pPR $$d/*.py zip/$$d/ ;\ | |
63 | done | |
64 | touch -t 200001010101 zip/yt_dlp/*.py zip/yt_dlp/*/*.py | |
65 | mv zip/yt_dlp/__main__.py zip/ | |
66 | cd zip ; zip -q ../yt-dlp yt_dlp/*.py yt_dlp/*/*.py __main__.py | |
67 | rm -rf zip | |
68 | echo '#!$(PYTHON)' > yt-dlp | |
69 | cat yt-dlp.zip >> yt-dlp | |
70 | rm yt-dlp.zip | |
71 | chmod a+x yt-dlp | |
72 | ||
73 | README.md: yt_dlp/*.py yt_dlp/*/*.py | |
74 | COLUMNS=80 $(PYTHON) yt_dlp/__main__.py --help | $(PYTHON) devscripts/make_readme.py | |
75 | ||
76 | CONTRIBUTING.md: README.md | |
77 | $(PYTHON) devscripts/make_contributing.py README.md CONTRIBUTING.md | |
78 | ||
79 | issuetemplates: devscripts/make_issue_template.py .github/ISSUE_TEMPLATE_tmpl/1_broken_site.md .github/ISSUE_TEMPLATE_tmpl/2_site_support_request.md .github/ISSUE_TEMPLATE_tmpl/3_site_feature_request.md .github/ISSUE_TEMPLATE_tmpl/4_bug_report.md .github/ISSUE_TEMPLATE_tmpl/5_feature_request.md yt_dlp/version.py | |
80 | $(PYTHON) devscripts/make_issue_template.py .github/ISSUE_TEMPLATE_tmpl/1_broken_site.md .github/ISSUE_TEMPLATE/1_broken_site.md | |
81 | $(PYTHON) devscripts/make_issue_template.py .github/ISSUE_TEMPLATE_tmpl/2_site_support_request.md .github/ISSUE_TEMPLATE/2_site_support_request.md | |
82 | $(PYTHON) devscripts/make_issue_template.py .github/ISSUE_TEMPLATE_tmpl/3_site_feature_request.md .github/ISSUE_TEMPLATE/3_site_feature_request.md | |
83 | $(PYTHON) devscripts/make_issue_template.py .github/ISSUE_TEMPLATE_tmpl/4_bug_report.md .github/ISSUE_TEMPLATE/4_bug_report.md | |
84 | $(PYTHON) devscripts/make_issue_template.py .github/ISSUE_TEMPLATE_tmpl/5_feature_request.md .github/ISSUE_TEMPLATE/5_feature_request.md | |
85 | ||
86 | supportedsites: | |
87 | $(PYTHON) devscripts/make_supportedsites.py supportedsites.md | |
88 | ||
89 | README.txt: README.md | |
90 | pandoc -f $(MARKDOWN) -t plain README.md -o README.txt | |
91 | ||
92 | yt-dlp.1: README.md | |
93 | $(PYTHON) devscripts/prepare_manpage.py yt-dlp.1.temp.md | |
94 | pandoc -s -f $(MARKDOWN) -t man yt-dlp.1.temp.md -o yt-dlp.1 | |
95 | rm -f yt-dlp.1.temp.md | |
96 | ||
97 | completions/bash/yt-dlp: yt_dlp/*.py yt_dlp/*/*.py devscripts/bash-completion.in | |
98 | mkdir -p completions/bash | |
99 | $(PYTHON) devscripts/bash-completion.py | |
100 | ||
101 | completions/zsh/_yt-dlp: yt_dlp/*.py yt_dlp/*/*.py devscripts/zsh-completion.in | |
102 | mkdir -p completions/zsh | |
103 | $(PYTHON) devscripts/zsh-completion.py | |
104 | ||
105 | completions/fish/yt-dlp.fish: yt_dlp/*.py yt_dlp/*/*.py devscripts/fish-completion.in | |
106 | mkdir -p completions/fish | |
107 | $(PYTHON) devscripts/fish-completion.py | |
108 | ||
109 | _EXTRACTOR_FILES = $(shell find yt_dlp/extractor -iname '*.py' -and -not -iname 'lazy_extractors.py') | |
110 | yt_dlp/extractor/lazy_extractors.py: devscripts/make_lazy_extractors.py devscripts/lazy_load_template.py $(_EXTRACTOR_FILES) | |
111 | $(PYTHON) devscripts/make_lazy_extractors.py $@ | |
112 | ||
113 | yt-dlp.tar.gz: README.md yt-dlp.1 completions Changelog.md AUTHORS | |
114 | @tar -czf $(DESTDIR)/yt-dlp.tar.gz --transform "s|^|yt-dlp/|" --owner 0 --group 0 \ | |
115 | --exclude '*.DS_Store' \ | |
116 | --exclude '*.kate-swp' \ | |
117 | --exclude '*.pyc' \ | |
118 | --exclude '*.pyo' \ | |
119 | --exclude '*~' \ | |
120 | --exclude '__pycache__' \ | |
121 | --exclude '.git' \ | |
122 | --exclude 'docs/_build' \ | |
123 | -- \ | |
124 | devscripts test \ | |
125 | Changelog.md AUTHORS LICENSE README.md supportedsites.md \ | |
126 | Makefile MANIFEST.in yt-dlp.1 completions \ | |
127 | setup.py setup.cfg yt-dlp | |
128 | ||
129 | AUTHORS: .mailmap | |
130 | git shortlog -s -n | cut -f2 | sort > AUTHORS | |
131 | ||
132 | .mailmap: | |
133 | git shortlog -s -e -n | awk '!(out[$$NF]++) { $$1="";sub(/^[ \t]+/,""); print}' > .mailmap |