]>
Commit | Line | Data |
---|---|---|
6e21fdd2 | 1 | all: lazy-extractors yt-dlp doc pypi-files |
9e907ebd | 2 | clean: clean-test clean-dist |
3 | clean-all: clean clean-cache | |
da7f321e | 4 | completions: completion-bash completion-fish completion-zsh |
a26c99ac | 5 | doc: README.md CONTRIBUTING.md issuetemplates supportedsites |
da7f321e | 6 | ot: offlinetest |
7 | tar: yt-dlp.tar.gz | |
8 | ||
775cde82 | 9 | # Keep this list in sync with pyproject.toml includes/artifacts |
da7f321e | 10 | # intended use: when building a source distribution, |
775cde82 | 11 | # make pypi-files && python3 -m build -sn . |
b5899f4f | 12 | pypi-files: AUTHORS Changelog.md LICENSE README.md README.txt supportedsites \ |
775cde82 | 13 | completions yt-dlp.1 pyproject.toml setup.cfg devscripts/* test/* |
298f597b | 14 | |
da7f321e | 15 | .PHONY: all clean install test tar pypi-files completions ot offlinetest codetest supportedsites |
4618f3da | 16 | |
da7f321e | 17 | clean-test: |
d5a39898 | 18 | rm -rf test/testdata/sigs/player-*.js tmp/ *.annotations.xml *.aria2 *.description *.dump *.frag \ |
6970b600 | 19 | *.frag.aria2 *.frag.urls *.info.json *.live_chat.json *.meta *.part* *.tmp *.temp *.unknown_video *.ytdl \ |
08e29b9f | 20 | *.3gp *.ape *.ass *.avi *.desktop *.f4v *.flac *.flv *.gif *.jpeg *.jpg *.m4a *.m4v *.mhtml *.mkv *.mov *.mp3 \ |
21 | *.mp4 *.mpga *.oga *.ogg *.opus *.png *.sbv *.srt *.swf *.swp *.tt *.ttml *.url *.vtt *.wav *.webloc *.webm *.webp | |
da7f321e | 22 | clean-dist: |
f304da8a | 23 | rm -rf yt-dlp.1.temp.md yt-dlp.1 README.txt MANIFEST build/ dist/ .coverage cover/ yt-dlp.tar.gz completions/ \ |
868d2f60 | 24 | yt_dlp/extractor/lazy_extractors.py *.spec CONTRIBUTING.md.tmp yt-dlp yt-dlp.exe yt_dlp.egg-info/ AUTHORS |
da7f321e | 25 | clean-cache: |
c1714454 | 26 | find . \( \ |
27 | -type d -name .pytest_cache -o -type d -name __pycache__ -o -name "*.pyc" -o -name "*.class" \ | |
28 | \) -prune -exec rm -rf {} \; | |
da7f321e | 29 | |
30 | completion-bash: completions/bash/yt-dlp | |
31 | completion-fish: completions/fish/yt-dlp.fish | |
32 | completion-zsh: completions/zsh/_yt-dlp | |
33 | lazy-extractors: yt_dlp/extractor/lazy_extractors.py | |
4618f3da | 34 | |
df866e7f | 35 | PREFIX ?= /usr/local |
36 | BINDIR ?= $(PREFIX)/bin | |
37 | MANDIR ?= $(PREFIX)/man | |
24f7fb5e | 38 | SHAREDIR ?= $(PREFIX)/share |
65156eba | 39 | PYTHON ?= /usr/bin/env python3 |
e79e8b7d | 40 | |
beaa1a44 | 41 | # $(shell) and $(error) are no-ops in BSD Make and the != variable assignment operator is not supported by GNU Make <4.0 |
42 | VERSION_CHECK != echo supported | |
43 | VERSION_CHECK ?= $(error GNU Make 4+ or BSD Make is required) | |
44 | CHECK_VERSION := $(VERSION_CHECK) | |
5738240e | 45 | |
beaa1a44 | 46 | # set markdown input format to "markdown-smart" for pandoc version 2+ and to "markdown" for pandoc prior to version 2 |
47 | MARKDOWN != if [ "`pandoc -v | head -n1 | cut -d' ' -f2 | head -c1`" -ge "2" ]; then echo markdown-smart; else echo markdown; fi | |
af751350 | 48 | |
733d8e8f | 49 | install: lazy-extractors yt-dlp yt-dlp.1 completions |
6534298b | 50 | mkdir -p $(DESTDIR)$(BINDIR) |
51 | install -m755 yt-dlp $(DESTDIR)$(BINDIR)/yt-dlp | |
52 | mkdir -p $(DESTDIR)$(MANDIR)/man1 | |
53 | install -m644 yt-dlp.1 $(DESTDIR)$(MANDIR)/man1/yt-dlp.1 | |
54 | mkdir -p $(DESTDIR)$(SHAREDIR)/bash-completion/completions | |
55 | install -m644 completions/bash/yt-dlp $(DESTDIR)$(SHAREDIR)/bash-completion/completions/yt-dlp | |
56 | mkdir -p $(DESTDIR)$(SHAREDIR)/zsh/site-functions | |
57 | install -m644 completions/zsh/_yt-dlp $(DESTDIR)$(SHAREDIR)/zsh/site-functions/_yt-dlp | |
58 | mkdir -p $(DESTDIR)$(SHAREDIR)/fish/vendor_completions.d | |
59 | install -m644 completions/fish/yt-dlp.fish $(DESTDIR)$(SHAREDIR)/fish/vendor_completions.d/yt-dlp.fish | |
dce10884 | 60 | |
b4d37383 M |
61 | uninstall: |
62 | rm -f $(DESTDIR)$(BINDIR)/yt-dlp | |
63 | rm -f $(DESTDIR)$(MANDIR)/man1/yt-dlp.1 | |
64 | rm -f $(DESTDIR)$(SHAREDIR)/bash-completion/completions/yt-dlp | |
65 | rm -f $(DESTDIR)$(SHAREDIR)/zsh/site-functions/_yt-dlp | |
66 | rm -f $(DESTDIR)$(SHAREDIR)/fish/vendor_completions.d/yt-dlp.fish | |
67 | ||
a0ab29f8 | 68 | codetest: |
dc9a441b | 69 | flake8 . |
a0ab29f8 | 70 | |
a7b5c8d6 | 71 | test: |
060ac762 | 72 | $(PYTHON) -m pytest |
a0ab29f8 PH |
73 | $(MAKE) codetest |
74 | ||
a0ab29f8 | 75 | offlinetest: codetest |
060ac762 | 76 | $(PYTHON) -m pytest -k "not download" |
a7b5c8d6 | 77 | |
beaa1a44 | 78 | CODE_FOLDERS != find yt_dlp -type f -name '__init__.py' -exec dirname {} \+ | grep -v '/__' | sort |
79 | CODE_FILES != for f in $(CODE_FOLDERS) ; do echo "$$f" | sed 's,$$,/*.py,' ; done | |
868d2f60 | 80 | yt-dlp: $(CODE_FILES) |
305d99f0 | 81 | mkdir -p zip |
6f638d32 | 82 | for d in $(CODE_FOLDERS) ; do \ |
305d99f0 | 83 | mkdir -p zip/$$d ;\ |
c75c384f | 84 | cp -pPR $$d/*.py zip/$$d/ ;\ |
305d99f0 | 85 | done |
beaa1a44 | 86 | (cd zip && touch -t 200001010101 $(CODE_FILES)) |
7a5c1cfe | 87 | mv zip/yt_dlp/__main__.py zip/ |
beaa1a44 | 88 | (cd zip && zip -q ../yt-dlp $(CODE_FILES) __main__.py) |
305d99f0 | 89 | rm -rf zip |
7a5c1cfe P |
90 | echo '#!$(PYTHON)' > yt-dlp |
91 | cat yt-dlp.zip >> yt-dlp | |
92 | rm yt-dlp.zip | |
93 | chmod a+x yt-dlp | |
dce10884 | 94 | |
868d2f60 | 95 | README.md: $(CODE_FILES) devscripts/make_readme.py |
9e491463 | 96 | COLUMNS=80 $(PYTHON) yt_dlp/__main__.py --ignore-config --help | $(PYTHON) devscripts/make_readme.py |
4618f3da | 97 | |
c487cf00 | 98 | CONTRIBUTING.md: README.md devscripts/make_contributing.py |
8639f89f | 99 | $(PYTHON) devscripts/make_contributing.py README.md CONTRIBUTING.md |
e56190b3 | 100 | |
27f817a8 AG |
101 | 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 |
102 | $(PYTHON) devscripts/make_issue_template.py .github/ISSUE_TEMPLATE_tmpl/1_broken_site.yml .github/ISSUE_TEMPLATE/1_broken_site.yml | |
103 | $(PYTHON) devscripts/make_issue_template.py .github/ISSUE_TEMPLATE_tmpl/2_site_support_request.yml .github/ISSUE_TEMPLATE/2_site_support_request.yml | |
104 | $(PYTHON) devscripts/make_issue_template.py .github/ISSUE_TEMPLATE_tmpl/3_site_feature_request.yml .github/ISSUE_TEMPLATE/3_site_feature_request.yml | |
105 | $(PYTHON) devscripts/make_issue_template.py .github/ISSUE_TEMPLATE_tmpl/4_bug_report.yml .github/ISSUE_TEMPLATE/4_bug_report.yml | |
106 | $(PYTHON) devscripts/make_issue_template.py .github/ISSUE_TEMPLATE_tmpl/5_feature_request.yml .github/ISSUE_TEMPLATE/5_feature_request.yml | |
107 | $(PYTHON) devscripts/make_issue_template.py .github/ISSUE_TEMPLATE_tmpl/6_question.yml .github/ISSUE_TEMPLATE/6_question.yml | |
7710bdf4 | 108 | |
416c7fcb | 109 | supportedsites: |
b9650873 | 110 | $(PYTHON) devscripts/make_supportedsites.py supportedsites.md |
416c7fcb | 111 | |
cc51a7d4 | 112 | README.txt: README.md |
af751350 | 113 | pandoc -f $(MARKDOWN) -t plain README.md -o README.txt |
cc51a7d4 | 114 | |
c487cf00 | 115 | yt-dlp.1: README.md devscripts/prepare_manpage.py |
7a5c1cfe P |
116 | $(PYTHON) devscripts/prepare_manpage.py yt-dlp.1.temp.md |
117 | pandoc -s -f $(MARKDOWN) -t man yt-dlp.1.temp.md -o yt-dlp.1 | |
118 | rm -f yt-dlp.1.temp.md | |
cfcec693 | 119 | |
868d2f60 | 120 | completions/bash/yt-dlp: $(CODE_FILES) devscripts/bash-completion.in |
359d6d86 | 121 | mkdir -p completions/bash |
8639f89f | 122 | $(PYTHON) devscripts/bash-completion.py |
23109d6a | 123 | |
868d2f60 | 124 | completions/zsh/_yt-dlp: $(CODE_FILES) devscripts/zsh-completion.in |
359d6d86 | 125 | mkdir -p completions/zsh |
8639f89f | 126 | $(PYTHON) devscripts/zsh-completion.py |
24f7fb5e | 127 | |
868d2f60 | 128 | completions/fish/yt-dlp.fish: $(CODE_FILES) devscripts/fish-completion.in |
359d6d86 | 129 | mkdir -p completions/fish |
8639f89f | 130 | $(PYTHON) devscripts/fish-completion.py |
56d1912f | 131 | |
beaa1a44 | 132 | _EXTRACTOR_FILES != find yt_dlp/extractor -name '*.py' -and -not -name 'lazy_extractors.py' |
7a5c1cfe | 133 | yt_dlp/extractor/lazy_extractors.py: devscripts/make_lazy_extractors.py devscripts/lazy_load_template.py $(_EXTRACTOR_FILES) |
779822d9 JMF |
134 | $(PYTHON) devscripts/make_lazy_extractors.py $@ |
135 | ||
804ca01c | 136 | yt-dlp.tar.gz: all |
50a39932 | 137 | @tar -czf yt-dlp.tar.gz --transform "s|^|yt-dlp/|" --owner 0 --group 0 \ |
039dc61b PH |
138 | --exclude '*.DS_Store' \ |
139 | --exclude '*.kate-swp' \ | |
140 | --exclude '*.pyc' \ | |
141 | --exclude '*.pyo' \ | |
142 | --exclude '*~' \ | |
4f90d2ae | 143 | --exclude '__pycache__' \ |
c1714454 | 144 | --exclude '.pytest_cache' \ |
814eed0e | 145 | --exclude '.git' \ |
beaa1a44 | 146 | --exclude '__pyinstaller' \ |
814eed0e | 147 | -- \ |
804ca01c | 148 | README.md supportedsites.md Changelog.md LICENSE \ |
149 | CONTRIBUTING.md Collaborators.md CONTRIBUTORS AUTHORS \ | |
775cde82 | 150 | Makefile yt-dlp.1 README.txt completions .gitignore \ |
151 | setup.cfg yt-dlp yt_dlp pyproject.toml devscripts test | |
da7f321e | 152 | |
868d2f60 | 153 | AUTHORS: |
154 | git shortlog -s -n HEAD | cut -f2 | sort > AUTHORS |