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