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