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