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