Makefile 6.1 KB

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